From 3d3fc88d15a6bffedf14d97e7052be403fa8338a Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 18 Mar 2025 22:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/api/auth/Record.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugs/think-plugs-inspection/src/controller/api/auth/Record.php b/plugs/think-plugs-inspection/src/controller/api/auth/Record.php index 3997c2a..d8a2374 100644 --- a/plugs/think-plugs-inspection/src/controller/api/auth/Record.php +++ b/plugs/think-plugs-inspection/src/controller/api/auth/Record.php @@ -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,