From 1d4d5403b5e3d9f09727e014350fee4981d217f4 Mon Sep 17 00:00:00 2001 From: weiz Date: Sat, 25 Nov 2023 17:35:05 +0800 Subject: [PATCH] delete no-use file --- app/api/controller/DeviceController.php | 52 ------------------------- app/common/model/land/LandDevice.php | 34 ---------------- 2 files changed, 86 deletions(-) delete mode 100644 app/api/controller/DeviceController.php delete mode 100644 app/common/model/land/LandDevice.php diff --git a/app/api/controller/DeviceController.php b/app/api/controller/DeviceController.php deleted file mode 100644 index eb2f6f1f..00000000 --- a/app/api/controller/DeviceController.php +++ /dev/null @@ -1,52 +0,0 @@ -request->post(['land_id','device_code']); - if(empty($params['land_id']) || empty($params['device_code'])) { - return $this->fail('缺少必要参数'); - } - $land = Land::where('id',$params['land_id'])->findOrEmpty(); - if($land->isEmpty()){ - return $this->fail('土地信息错误'); - } - $device = Device::where('code',$params['device_code'])->findOrEmpty(); - if($device->isEmpty()){ - return $this->fail('设备不存在'); - } - if($device['is_bind'] == 2){ - return $this->fail('当前设备已被绑定'); - } - $landDevice = LandDevice::where('land_id',$land['id'])->where('device_type',$device['type'])->findOrEmpty(); - if(!$landDevice->isEmpty()){ - $msg = $device['type'] == 1 ? '土壤监测设备' : ($device['type'] == 2 ? '环境监测设备' : '视频监控设备'); - return $this->fail('该土地已绑定'.$msg); - } - Db::transaction(function()use($land,$device) { - Device::where('id',$device['id'])->update([ - 'is_bind' => 2, - 'user_id' => $land['user_id'], - 'update_time' => time() - ]); - LandDevice::create([ - 'land_id' => $land['id'], - 'device_id' => $device['id'], - 'device_type' => $device['type'], - 'create_time' => time(), - 'update_time' => time() - ]); - }); - return $this->success('设备绑定成功'); - } - } \ No newline at end of file diff --git a/app/common/model/land/LandDevice.php b/app/common/model/land/LandDevice.php deleted file mode 100644 index fecebb44..00000000 --- a/app/common/model/land/LandDevice.php +++ /dev/null @@ -1,34 +0,0 @@ -