feat: 接单列表接口

This commit is contained in:
gcd 2025-03-31 12:02:38 +08:00
parent a8d2980e23
commit 0f0e5a467d
4 changed files with 12 additions and 9 deletions

View File

@ -14,8 +14,8 @@ class OrderDispatch extends Model
];
// public function orderInfo()
// {
// return $this->belongsTo('User','uid');
// }
public function orderInfo()
{
return $this->belongsTo(Order::class,'order_id', 'id');
}
}

View File

@ -8,11 +8,14 @@ class OrderDispatchService extends BaseService
{
public function dispatchList(int $workerId, int $pageSize)
{
$model = $this->getOrderDispatchModel()
return $this->getOrderDispatchModel()
->with(['orderInfo' => function ($query) {
$query->field('id,order_no,item_id,item_title,receive_type,address,lng,lat,plan_time,online_amount,discount_amount');
}])
->where('status', OrderDispatch::STATUS_TOGET)
->where('worker_id', $workerId)
->field(['id', 'order_id', 'status', 'remark', 'plan_time', 'create_time'])
->field(['id', 'order_id', 'status', 'remark', 'create_time'])
->order('id desc')
->paginate($pageSize);
return $model;
}
}

View File

@ -6,5 +6,5 @@ use app\common\controller\WorkerApi;
class Order extends WorkerApi
{
protected $noNeedLogin = ['*'];
protected $noNeedLogin = [];
}

View File

@ -43,7 +43,7 @@ class Worker extends WorkerApi
public function guestLogin()
{
$this->workerLogin(1);
$this->workerLogin(9);
$this->success('登录成功', $this->user);
}