From f68b3571fc5c07f32bcb82b616ffedb3bdcd48ec Mon Sep 17 00:00:00 2001 From: gcd Date: Sun, 20 Apr 2025 23:47:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B8=88=E5=82=85=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/services/OrderDispatchService.php | 22 +++++++++++++++++-- .../worker/controller/OrderDispatch.php | 16 ++++++++++++++ application/worker/validate/OrderDispatch.php | 2 ++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index f6d3973..1924969 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -205,6 +205,7 @@ class OrderDispatchService extends BaseService 'order_id', 'status', 'remark', + 'worker_remark', 'create_time', 'total', 'online_total', @@ -306,7 +307,7 @@ class OrderDispatchService extends BaseService ->where('worker_id', $workerId) ->find(); if (!$res) { - $this->apiError('订单不存在'); + $this->apiError('工单不存在'); } return $res; @@ -315,7 +316,7 @@ class OrderDispatchService extends BaseService /** * @param int $workerId 师傅id * @param array $params 请求参数 - * @return void + * @return bool */ public function completeService(int $workerId, array $params) { @@ -358,6 +359,23 @@ class OrderDispatchService extends BaseService $this->apiError('操作失败', $e); } + return true; + } + + /** + * 保存师傅备注 + * @param int $workerId 师傅id + * @param int $orderDispatchId 订单派单id + * @param string $workerRemark 备注信息 + * @return true + */ + public function saveWorkerRemark(int $workerId, int $orderDispatchId, string $workerRemark) + { + $orderDispatch = $this->getOrderDispatchInfo($workerId, $orderDispatchId); + $orderDispatch->worker_remark = $workerRemark; + $orderDispatch->save(); + + return true; } } diff --git a/application/worker/controller/OrderDispatch.php b/application/worker/controller/OrderDispatch.php index 13af53c..6f07222 100644 --- a/application/worker/controller/OrderDispatch.php +++ b/application/worker/controller/OrderDispatch.php @@ -124,6 +124,22 @@ class OrderDispatch extends WorkerApi $res = $this->getOrderDispatchService()->completeService($this->user['id'], $params); $this->success('操作成功', $res); } + + /** + * 保存师傅备注 + * @return void + */ + public function saveWorkerRemark() + { + $params = $this->request->request(); + $validate = $this->validate($params, \app\worker\validate\OrderDispatch::class . '.saveWorkerRemark'); + if ($validate !== true) { + $this->error($validate); + } + + $res = $this->getOrderDispatchService()->saveWorkerRemark($this->user['id'], $params['order_dispatch_id'], $params['worker_remark']); + $this->success('操作成功', $res); + } } diff --git a/application/worker/validate/OrderDispatch.php b/application/worker/validate/OrderDispatch.php index c4b6ced..0e01e33 100644 --- a/application/worker/validate/OrderDispatch.php +++ b/application/worker/validate/OrderDispatch.php @@ -19,6 +19,7 @@ class OrderDispatch extends Validate 'payment_image|收款图片' => 'require|max:255', 'offline_total_type|尾款收款方' => 'in:0,1,2', 'reject_reason|拒接原因' => 'max:100', + 'worker_remark|备注信息' => 'max:500', ]; protected $message = [ @@ -32,5 +33,6 @@ class OrderDispatch extends Validate 'appointmentTime' => ['order_dispatch_id', 'plan_time'], 'arrivedOnSite' => ['order_dispatch_id', 'images'], 'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type'], + 'saveWorkerRemark' => ['order_dispatch_id', 'worker_remark'], ]; }