From c4adcf28a5ed9e7d5a14629a3917d89054f7fd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=9F=E5=B7=9D=E4=B8=9C?= Date: Thu, 8 May 2025 18:06:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/services/OrderDispatchService.php | 15 +++++++++++++++ application/worker/controller/OrderDispatch.php | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index 6a140bf..13f5286 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -264,6 +264,21 @@ class OrderDispatchService extends BaseService return true; } + public function updatePlanTime(int $workerId, int $orderDispatchId, string $planTime) + { + $orderDispatch = $this->getOrderDispatchInfo($workerId, $orderDispatchId); + $orderDispatch->plan_time = $planTime; + $orderDispatch->save(); + + $orderDispatchChangeParams = [ + 'dispatch' => $orderDispatch, + 'remark' => `师傅已修改上门时间,旧的时间:${$orderDispatch->plan_time},新的时间:${$planTime}` + ]; + Hook::listen('order_dispatch_change', $orderDispatchChangeParams); + + return true; + } + /** * 完成上门 * @param int $workerId 师傅id diff --git a/application/worker/controller/OrderDispatch.php b/application/worker/controller/OrderDispatch.php index 6f07222..e9218c1 100644 --- a/application/worker/controller/OrderDispatch.php +++ b/application/worker/controller/OrderDispatch.php @@ -93,6 +93,22 @@ class OrderDispatch extends WorkerApi $this->success('操作成功', $res); } + /** + * 修改上门时间 + * @return void + */ + public function updatePlanTime() + { + $params = $this->request->request(); + $validate = $this->validate($params, \app\worker\validate\OrderDispatch::class . '.appointmentTime'); + if ($validate !== true) { + $this->error($validate); + } + + $res = $this->getOrderDispatchService()->updatePlanTime($this->user['id'], $params['order_dispatch_id'], $params['plan_time']); + $this->success('操作成功', $res); + } + /** * 提交上门信息 * @return void