feat: 优化

This commit is contained in:
苟川东 2025-05-08 18:06:13 +08:00
parent 087315f2cf
commit c4adcf28a5
2 changed files with 31 additions and 0 deletions

View File

@ -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

View File

@ -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