<?php
/**
 * Created by PhpStorm.
 * User: pc
 * Date: 2021/11/24
 * Time: 13:44
 */

namespace app\api\model;
use think\Model;
use think\exception\HttpResponseException;
use think\Request;
use think\Response;
class RechargeModel extends Model{



    // 表名
    protected $name = 'recharge_order';

    public static function orderlist($where,$page,$pageSize){
        return self::alias('ro')
            ->join('user u','u.id = ro.user_id','left')
            ->join('payment_logs pl','pl.order_id = ro.id','left')
            ->where($where)
            ->page($page)
            ->limit($pageSize)
            ->order('ro.id desc')
            ->field('ro.*,u.username,u.username,u.nickname,u.avatar,pl.order_sn,pl.pay_way,pl.status as pl_status')
            ->select();
    }

    public static function orderdetail($where){
        return self::alias('ro')
            ->join('user u','u.id = ro.user_id','left')
            ->join('payment_logs pl','pl.order_id = ro.id','left')
            ->where($where)
            ->field('ro.*,u.username,u.username,u.nickname,u.avatar,pl.order_sn,pl.pay_way,pl.status as pl_status')
            ->find();
    }


}