feat: 【后端API】新增更新进度接口
This commit is contained in:
parent
f8fc5589a1
commit
dbfc1cc145
|
|
@ -245,6 +245,9 @@ class OrderDispatchService extends BaseService
|
||||||
'image',
|
'image',
|
||||||
'finish_time',
|
'finish_time',
|
||||||
'offline_total_type',
|
'offline_total_type',
|
||||||
|
'is_finish_today',
|
||||||
|
'estimated_finish_time',
|
||||||
|
'work_progress',
|
||||||
];
|
];
|
||||||
$res = $this->getOrderDispatchModel()
|
$res = $this->getOrderDispatchModel()
|
||||||
->with(['orderInfo' => function ($query) use ($orderFields) {
|
->with(['orderInfo' => function ($query) use ($orderFields) {
|
||||||
|
|
@ -431,6 +434,21 @@ class OrderDispatchService extends BaseService
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateProgress(int $workerId, array $params)
|
||||||
|
{
|
||||||
|
$orderDispatch = $this->getOrderDispatchInfo($workerId, $params['order_dispatch_id']);
|
||||||
|
$orderDispatch->is_finish_today = $params['is_finish_today'];
|
||||||
|
$orderDispatch->estimated_finish_time = $params['estimated_finish_time'];
|
||||||
|
|
||||||
|
if ($params['is_finish_today'] == 0) {
|
||||||
|
$orderDispatch->work_progress = $params['work_progress'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$orderDispatch->save();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,22 @@ class OrderDispatch extends WorkerApi
|
||||||
$this->success('操作成功', $res);
|
$this->success('操作成功', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新施工进度
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updateProgress()
|
||||||
|
{
|
||||||
|
$params = $this->request->request();
|
||||||
|
$validate = $this->validate($params, \app\worker\validate\OrderDispatch::class . '.updateProgress');
|
||||||
|
if ($validate !== true) {
|
||||||
|
$this->error($validate);
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $this->getOrderDispatchService()->updateProgress($this->user['id'], $params);
|
||||||
|
$this->success('操作成功', $res);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改上门时间
|
* 修改上门时间
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ class OrderDispatch extends Validate
|
||||||
|
|
||||||
'reject_reason|拒接原因' => 'max:100',
|
'reject_reason|拒接原因' => 'max:100',
|
||||||
'worker_remark|备注信息' => 'max:500',
|
'worker_remark|备注信息' => 'max:500',
|
||||||
|
|
||||||
|
'is_finish_today|今日完成' => 'require|in:0,1',
|
||||||
|
'estimated_finish_time|完成时间' => 'require|date',
|
||||||
|
'work_progress|当前施工进度' => 'max:200',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $message = [
|
protected $message = [
|
||||||
|
|
@ -37,5 +41,6 @@ class OrderDispatch extends Validate
|
||||||
'arrivedOnSite' => ['order_dispatch_id', 'images'],
|
'arrivedOnSite' => ['order_dispatch_id', 'images'],
|
||||||
'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type'],
|
'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type'],
|
||||||
'saveWorkerRemark' => ['order_dispatch_id', 'worker_remark'],
|
'saveWorkerRemark' => ['order_dispatch_id', 'worker_remark'],
|
||||||
|
'updateProgress' => ['order_dispatch_id', 'is_finish_today', 'estimated_finish_time', 'work_progress'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user