diff --git a/application/common/model/OrderDispatch.php b/application/common/model/OrderDispatch.php index 9d50ef7..362f9eb 100644 --- a/application/common/model/OrderDispatch.php +++ b/application/common/model/OrderDispatch.php @@ -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'); + } } diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index 41e99ed..009e93d 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -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; } } diff --git a/application/worker/controller/Order.php b/application/worker/controller/Order.php index 121d85d..3976d33 100644 --- a/application/worker/controller/Order.php +++ b/application/worker/controller/Order.php @@ -6,5 +6,5 @@ use app\common\controller\WorkerApi; class Order extends WorkerApi { - protected $noNeedLogin = ['*']; + protected $noNeedLogin = []; } diff --git a/application/worker/controller/Worker.php b/application/worker/controller/Worker.php index b6fd77f..2ec18dd 100644 --- a/application/worker/controller/Worker.php +++ b/application/worker/controller/Worker.php @@ -43,7 +43,7 @@ class Worker extends WorkerApi public function guestLogin() { - $this->workerLogin(1); + $this->workerLogin(9); $this->success('登录成功', $this->user); }