feat: 师傅备注

This commit is contained in:
gcd 2025-04-20 23:47:00 +08:00
parent 1d0a4d54c0
commit f68b3571fc
3 changed files with 38 additions and 2 deletions

View File

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

View File

@ -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);
}
}

View File

@ -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'],
];
}