This commit is contained in:
2025-03-18 22:02:39 +08:00
parent 71ec622afb
commit 3d3fc88d15

View File

@ -36,18 +36,24 @@ class Record extends Auth
public function end()
{
$record_id = $this->request->post('record_id');
$record = InspectionRecord::mk()->where('id', $record_id)->find();
$result = $this->_vali([
'record_id.require' => '记录ID不能为空',
'record_id.integer' => '记录ID必须是整数',
'error.require' => '巡检结果不能为空',
'error.in:0,1' => '巡检结果范围异常',
'content.require' => '记录内容不能为空',
'imgs.require' => '记录图片不能为空'
]);
$record = InspectionRecord::mk()->where('id', $result['record_id'])->find();
if (empty($record)) {
$this->error('记录不存在');
}
$lat = $this->request->post('lat');
$lng = $this->request->post('lng');
$imgs = $this->request->post('imgs');
$content = $this->request->post('content');
$record->status = 1;
$record->imgs = $imgs;
$record->content = $content;
$record->imgs = $result['imgs'];
$record->error = $result['error'];
$record->content = $result['content'];
$record->points()->save([
'staff_id' => $this->staff->id,
'lat' => $lat,