You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.7 KiB
70 lines
1.7 KiB
1 year ago
|
<?php
|
||
|
|
||
|
namespace app\api\model\Server;
|
||
|
|
||
|
|
||
|
use app\api\service\User as UserService;
|
||
|
use app\common\model\server\Order;
|
||
|
use cores\exception\BaseException;
|
||
|
use think\db\exception\DbException;
|
||
|
use think\Paginator;
|
||
|
|
||
|
class ServerOrder extends Order
|
||
|
{
|
||
|
/**
|
||
|
* 隐藏字段
|
||
|
* @var array
|
||
|
*/
|
||
|
protected $hidden = [
|
||
|
'store_id',
|
||
|
'create_time',
|
||
|
'update_time',
|
||
|
'trade_id',
|
||
|
'server_image_id',
|
||
|
'is_delete',
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* @notes:用户服务订单列表
|
||
|
* @param $where
|
||
|
* @param int $listRows
|
||
|
* @return Paginator
|
||
|
* @throws BaseException
|
||
|
* @throws DbException
|
||
|
* @author: wanghousheng
|
||
|
*/
|
||
|
public function userOrders($where, int $listRows = 15): Paginator
|
||
|
{
|
||
|
// 当前用户ID
|
||
|
$userId = UserService::getCurrentLoginUserId();
|
||
|
// 查询列表数据
|
||
|
return $this->with(['image', 'dealer'])
|
||
|
->where($where)
|
||
|
->where('user_id', '=', $userId)
|
||
|
->where('is_delete', '=', 0)
|
||
|
->order(['create_time' => 'desc'])
|
||
|
->paginate($listRows);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @notes:分销员订单列表
|
||
|
* @param $where
|
||
|
* @param int $listRows
|
||
|
* @return Paginator
|
||
|
* @throws BaseException
|
||
|
* @throws DbException
|
||
|
* @author: wanghousheng
|
||
|
*/
|
||
|
public function dealerOrders($where, int $listRows = 15): Paginator
|
||
|
{
|
||
|
// 当前用户ID
|
||
|
$userId = UserService::getCurrentLoginUserId();
|
||
|
// 查询列表数据
|
||
|
return $this->with(['image', 'user'])
|
||
|
->where($where)
|
||
|
->where('dealer_id', '=', $userId)
|
||
|
->where('is_delete', '=', 0)
|
||
|
->order(['create_time' => 'desc'])
|
||
|
->paginate($listRows);
|
||
|
}
|
||
|
}
|