diff --git a/admin/src/api/air_monitor.ts b/admin/src/api/air_monitor.ts deleted file mode 100644 index 0d95eb0a..00000000 --- a/admin/src/api/air_monitor.ts +++ /dev/null @@ -1,26 +0,0 @@ -import request from '@/utils/request' - -// 空气监测列表 -export function apiAirMonitorLists(params: any) { - return request.get({ url: '/device.air_monitor/lists', params }) -} - -// 添加空气监测 -export function apiAirMonitorAdd(params: any) { - return request.post({ url: '/device.air_monitor/add', params }) -} - -// 编辑空气监测 -export function apiAirMonitorEdit(params: any) { - return request.post({ url: '/device.air_monitor/edit', params }) -} - -// 删除空气监测 -export function apiAirMonitorDelete(params: any) { - return request.post({ url: '/device.air_monitor/delete', params }) -} - -// 空气监测详情 -export function apiAirMonitorDetail(params: any) { - return request.get({ url: '/device.air_monitor/detail', params }) -} \ No newline at end of file diff --git a/admin/src/api/soil_monitor.ts b/admin/src/api/soil_monitor.ts deleted file mode 100644 index 4a584e20..00000000 --- a/admin/src/api/soil_monitor.ts +++ /dev/null @@ -1,26 +0,0 @@ -import request from '@/utils/request' - -// 土壤监测列表 -export function apiSoilMonitorLists(params: any) { - return request.get({ url: '/device.soil_monitor/lists', params }) -} - -// 添加土壤监测 -export function apiSoilMonitorAdd(params: any) { - return request.post({ url: '/device.soil_monitor/add', params }) -} - -// 编辑土壤监测 -export function apiSoilMonitorEdit(params: any) { - return request.post({ url: '/device.soil_monitor/edit', params }) -} - -// 删除土壤监测 -export function apiSoilMonitorDelete(params: any) { - return request.post({ url: '/device.soil_monitor/delete', params }) -} - -// 土壤监测详情 -export function apiSoilMonitorDetail(params: any) { - return request.get({ url: '/device.soil_monitor/detail', params }) -} \ No newline at end of file diff --git a/admin/src/views/air_monitor/edit.vue b/admin/src/views/air_monitor/edit.vue deleted file mode 100644 index eafc060d..00000000 --- a/admin/src/views/air_monitor/edit.vue +++ /dev/null @@ -1,181 +0,0 @@ - - - diff --git a/admin/src/views/air_monitor/index.vue b/admin/src/views/air_monitor/index.vue deleted file mode 100644 index 08e4a497..00000000 --- a/admin/src/views/air_monitor/index.vue +++ /dev/null @@ -1,189 +0,0 @@ - - - - diff --git a/admin/src/views/soil_monitor/edit.vue b/admin/src/views/soil_monitor/edit.vue deleted file mode 100644 index 682abdca..00000000 --- a/admin/src/views/soil_monitor/edit.vue +++ /dev/null @@ -1,173 +0,0 @@ - - - diff --git a/admin/src/views/soil_monitor/index.vue b/admin/src/views/soil_monitor/index.vue deleted file mode 100644 index fbc5224f..00000000 --- a/admin/src/views/soil_monitor/index.vue +++ /dev/null @@ -1,191 +0,0 @@ - - - - - diff --git a/app/adminapi/controller/device/AirMonitorController.php b/app/adminapi/controller/device/AirMonitorController.php deleted file mode 100644 index 46e4f7d2..00000000 --- a/app/adminapi/controller/device/AirMonitorController.php +++ /dev/null @@ -1,108 +0,0 @@ -dataLists(new AirMonitorLists()); - } - - - /** - * @notes 添加 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function add() - { - $params = (new AirMonitorValidate())->post()->goCheck('add'); - $result = AirMonitorLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(AirMonitorLogic::getError()); - } - - - /** - * @notes 编辑 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function edit() - { - $params = (new AirMonitorValidate())->post()->goCheck('edit'); - $result = AirMonitorLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(AirMonitorLogic::getError()); - } - - - /** - * @notes 删除 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function delete() - { - $params = (new AirMonitorValidate())->post()->goCheck('delete'); - AirMonitorLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取详情 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function detail() - { - $params = (new AirMonitorValidate())->goCheck('detail'); - $result = AirMonitorLogic::detail($params); - return $this->data($result); - } - - -} \ No newline at end of file diff --git a/app/adminapi/controller/device/SoilMonitorController.php b/app/adminapi/controller/device/SoilMonitorController.php deleted file mode 100644 index 67ef5dc1..00000000 --- a/app/adminapi/controller/device/SoilMonitorController.php +++ /dev/null @@ -1,108 +0,0 @@ -dataLists(new SoilMonitorLists()); - } - - - /** - * @notes 添加 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function add() - { - $params = (new SoilMonitorValidate())->post()->goCheck('add'); - $result = SoilMonitorLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(SoilMonitorLogic::getError()); - } - - - /** - * @notes 编辑 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function edit() - { - $params = (new SoilMonitorValidate())->post()->goCheck('edit'); - $result = SoilMonitorLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(SoilMonitorLogic::getError()); - } - - - /** - * @notes 删除 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function delete() - { - $params = (new SoilMonitorValidate())->post()->goCheck('delete'); - SoilMonitorLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取详情 - * @return \think\response\Json - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function detail() - { - $params = (new SoilMonitorValidate())->goCheck('detail'); - $result = SoilMonitorLogic::detail($params); - return $this->data($result); - } - - -} \ No newline at end of file diff --git a/app/adminapi/lists/device/AirMonitorLists.php b/app/adminapi/lists/device/AirMonitorLists.php deleted file mode 100644 index 12923c99..00000000 --- a/app/adminapi/lists/device/AirMonitorLists.php +++ /dev/null @@ -1,92 +0,0 @@ -params['device_id'])) { - $allowSearch[] = 'device_id'; - } - return array_intersect(array_keys($this->params), $allowSearch); - } - - public function userSearch(): array - { - $userWhere['user_id'] = 0; - // 超级管理员数据 - if ($this->adminInfo['root'] && !$this->adminInfo['user_id']) { - unset($userWhere['user_id']); - } - // 普通用户数据 - if (!$this->adminInfo['root'] && $this->adminInfo['user_id']) { - $userWhere['user_id'] = $this->adminInfo['user_id']; - } - return $userWhere; - } - - /** - * @notes 获取列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function lists(): array - { - return AirMonitor::withSearch($this->setSearch(), $this->params)->where($this->userSearch())->with('device') - ->field(['id', 'device_id', 'wind_direction', 'wind_speed', 'temperature', 'moisture', 'co2_content', 'pressure', 'rainfall', 'light_intensity', 'create_time']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取数量 - * @return int - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function count(): int - { - return AirMonitor::withSearch($this->setSearch(), $this->params)->where($this->userSearch())->count(); - } - -} \ No newline at end of file diff --git a/app/adminapi/lists/device/SoilMonitorLists.php b/app/adminapi/lists/device/SoilMonitorLists.php deleted file mode 100644 index 8dc958e8..00000000 --- a/app/adminapi/lists/device/SoilMonitorLists.php +++ /dev/null @@ -1,92 +0,0 @@ -params['device_id'])) { - $allowSearch[] = 'device_id'; - } - return array_intersect(array_keys($this->params), $allowSearch); - } - - public function userSearch(): array - { - $userWhere['user_id'] = 0; - // 超级管理员数据 - if ($this->adminInfo['root'] && !$this->adminInfo['user_id']) { - unset($userWhere['user_id']); - } - // 普通用户数据 - if (!$this->adminInfo['root'] && $this->adminInfo['user_id']) { - $userWhere['user_id'] = $this->adminInfo['user_id']; - } - return $userWhere; - } - - /** - * @notes 获取列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function lists(): array - { - return SoilMonitor::withSearch($this->setSearch(), $this->params)->where($this->userSearch())->with('device') - ->field(['id', 'device_id', 'temperature', 'moisture', 'conductivity', 'ph', 'n_content', 'p_content', 'k_content', 'create_time']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取数量 - * @return int - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function count(): int - { - return SoilMonitor::withSearch($this->setSearch(), $this->params)->where($this->userSearch())->count(); - } - -} \ No newline at end of file diff --git a/app/adminapi/logic/device/AirMonitorLogic.php b/app/adminapi/logic/device/AirMonitorLogic.php deleted file mode 100644 index 33ffccc1..00000000 --- a/app/adminapi/logic/device/AirMonitorLogic.php +++ /dev/null @@ -1,122 +0,0 @@ - $params['device_id'], - 'wind_direction' => $params['wind_direction'], - 'wind_speed' => $params['wind_speed'], - 'temperature' => $params['temperature'], - 'moisture' => $params['moisture'], - 'co2_content' => $params['co2_content'], - 'pressure' => $params['pressure'], - 'rainfall' => $params['rainfall'], - 'light_intensity' => $params['light_intensity'], - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 编辑 - * @param array $params - * @return bool - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - AirMonitor::where('id', $params['id'])->update([ - 'device_id' => $params['device_id'], - 'wind_direction' => $params['wind_direction'], - 'wind_speed' => $params['wind_speed'], - 'temperature' => $params['temperature'], - 'moisture' => $params['moisture'], - 'co2_content' => $params['co2_content'], - 'pressure' => $params['pressure'], - 'rainfall' => $params['rainfall'], - 'light_intensity' => $params['light_intensity'], - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除 - * @param array $params - * @return bool - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public static function delete(array $params): bool - { - return AirMonitor::destroy($params['id']); - } - - - /** - * @notes 获取详情 - * @param $params - * @return array - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public static function detail($params): array - { - return AirMonitor::findOrEmpty($params['id'])->toArray(); - } -} \ No newline at end of file diff --git a/app/adminapi/logic/device/SoilMonitorLogic.php b/app/adminapi/logic/device/SoilMonitorLogic.php deleted file mode 100644 index 390cedc9..00000000 --- a/app/adminapi/logic/device/SoilMonitorLogic.php +++ /dev/null @@ -1,120 +0,0 @@ - $params['device_id'], - 'temperature' => $params['temperature'], - 'moisture' => $params['moisture'], - 'conductivity' => $params['conductivity'], - 'ph' => $params['ph'], - 'n_content' => $params['n_content'], - 'p_content' => $params['p_content'], - 'k_content' => $params['k_content'], - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 编辑 - * @param array $params - * @return bool - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public static function edit(array $params): bool - { - Db::startTrans(); - try { - SoilMonitor::where('id', $params['id'])->update([ - 'device_id' => $params['device_id'], - 'temperature' => $params['temperature'], - 'moisture' => $params['moisture'], - 'conductivity' => $params['conductivity'], - 'ph' => $params['ph'], - 'n_content' => $params['n_content'], - 'p_content' => $params['p_content'], - 'k_content' => $params['k_content'], - ]); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - self::setError($e->getMessage()); - return false; - } - } - - - /** - * @notes 删除 - * @param array $params - * @return bool - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public static function delete(array $params): bool - { - return SoilMonitor::destroy($params['id']); - } - - - /** - * @notes 获取详情 - * @param $params - * @return array - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public static function detail($params): array - { - return SoilMonitor::findOrEmpty($params['id'])->toArray(); - } -} \ No newline at end of file diff --git a/app/adminapi/validate/device/AirMonitorValidate.php b/app/adminapi/validate/device/AirMonitorValidate.php deleted file mode 100644 index 8dd32468..00000000 --- a/app/adminapi/validate/device/AirMonitorValidate.php +++ /dev/null @@ -1,112 +0,0 @@ - 'require', - 'device_id' => 'require', - 'wind_direction' => 'require', - 'wind_speed' => 'require', - 'temperature' => 'require', - 'moisture' => 'require', - 'co2_content' => 'require', - 'pressure' => 'require', - 'rainfall' => 'require', - 'light_intensity' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'device_id' => '设备ID', - 'wind_direction' => '风向', - 'wind_speed' => '风速', - 'temperature' => '空气温度', - 'moisture' => '空气湿度', - 'co2_content' => '二氧化碳含量', - 'pressure' => '大气压强', - 'rainfall' => '降雨量', - 'light_intensity' => '光照强度', - ]; - - - /** - * @notes 添加场景 - * @return AirMonitorValidate - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function sceneAdd() - { - return $this->only(['device_id','wind_direction','wind_speed','temperature','moisture','co2_content','pressure','rainfall','light_intensity']); - } - - - /** - * @notes 编辑场景 - * @return AirMonitorValidate - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function sceneEdit() - { - return $this->only(['id','device_id','wind_direction','wind_speed','temperature','moisture','co2_content','pressure','rainfall','light_intensity']); - } - - - /** - * @notes 删除场景 - * @return AirMonitorValidate - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return AirMonitorValidate - * @author likeadmin - * @date 2023/11/24 16:49 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/adminapi/validate/device/SoilMonitorValidate.php b/app/adminapi/validate/device/SoilMonitorValidate.php deleted file mode 100644 index 58b3e4ae..00000000 --- a/app/adminapi/validate/device/SoilMonitorValidate.php +++ /dev/null @@ -1,110 +0,0 @@ - 'require', - 'device_id' => 'require', - 'temperature' => 'require', - 'moisture' => 'require', - 'conductivity' => 'require', - 'ph' => 'require', - 'n_content' => 'require', - 'p_content' => 'require', - 'k_content' => 'require', - ]; - - - /** - * 参数描述 - * @var string[] - */ - protected $field = [ - 'id' => 'id', - 'device_id' => '设备ID', - 'temperature' => '土壤温度', - 'moisture' => '土壤湿度', - 'conductivity' => '电导率', - 'ph' => '土壤酸碱度', - 'n_content' => '氮含量', - 'p_content' => '磷含量', - 'k_content' => '钾含量', - ]; - - - /** - * @notes 添加场景 - * @return SoilMonitorValidate - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function sceneAdd() - { - return $this->only(['device_id','temperature','moisture','conductivity','ph','n_content','p_content','k_content']); - } - - - /** - * @notes 编辑场景 - * @return SoilMonitorValidate - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function sceneEdit() - { - return $this->only(['id','device_id','temperature','moisture','conductivity','ph','n_content','p_content','k_content']); - } - - - /** - * @notes 删除场景 - * @return SoilMonitorValidate - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function sceneDelete() - { - return $this->only(['id']); - } - - - /** - * @notes 详情场景 - * @return SoilMonitorValidate - * @author likeadmin - * @date 2023/11/24 17:02 - */ - public function sceneDetail() - { - return $this->only(['id']); - } - -} \ No newline at end of file diff --git a/app/common/model/device/AirMonitor.php b/app/common/model/device/AirMonitor.php deleted file mode 100644 index af546476..00000000 --- a/app/common/model/device/AirMonitor.php +++ /dev/null @@ -1,77 +0,0 @@ -hasOne(\app\common\model\device\Device::class, 'id', 'device_id'); - } - - /** - * @notes 搜索器-注册时间 - * @param $query - * @param $value - * @param $data - * @author 段誉 - * @date 2022/9/22 16:13 - */ - public function searchStartTimeAttr($query, $value, $data) - { - if ($value) { - $query->where('create_time', '>=', strtotime($value)); - } - } - - /** - * @notes 搜索器-注册时间 - * @param $query - * @param $value - * @param $data - * @author 段誉 - * @date 2022/9/22 16:13 - */ - public function searchEndTimeAttr($query, $value, $data) - { - if ($value) { - $query->where('create_time', '<=', strtotime($value)); - } - } - - - -} \ No newline at end of file diff --git a/app/common/model/device/SoilMonitor.php b/app/common/model/device/SoilMonitor.php deleted file mode 100644 index 4789dbc9..00000000 --- a/app/common/model/device/SoilMonitor.php +++ /dev/null @@ -1,76 +0,0 @@ -hasOne(\app\common\model\device\Device::class, 'id', 'device_id'); - } - - /** - * @notes 搜索器-注册时间 - * @param $query - * @param $value - * @param $data - * @author 段誉 - * @date 2022/9/22 16:13 - */ - public function searchStartTimeAttr($query, $value, $data) - { - if ($value) { - $query->where('create_time', '>=', strtotime($value)); - } - } - - /** - * @notes 搜索器-注册时间 - * @param $query - * @param $value - * @param $data - * @author 段誉 - * @date 2022/9/22 16:13 - */ - public function searchEndTimeAttr($query, $value, $data) - { - if ($value) { - $query->where('create_time', '<=', strtotime($value)); - } - } - - -} \ No newline at end of file diff --git a/app/common/model/monitor/AirMonitor.php b/app/common/model/monitor/AirMonitor.php deleted file mode 100644 index b4cefc8e..00000000 --- a/app/common/model/monitor/AirMonitor.php +++ /dev/null @@ -1,10 +0,0 @@ -