From 0f0e5a467da58487ccb7f7ea3369de06c21c2cea Mon Sep 17 00:00:00 2001 From: gcd Date: Mon, 31 Mar 2025 12:02:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/model/OrderDispatch.php | 8 ++++---- application/services/OrderDispatchService.php | 9 ++++++--- application/worker/controller/Order.php | 2 +- application/worker/controller/Worker.php | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) 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); }