add 断开链接通知

This commit is contained in:
chenbo 2023-12-13 16:26:52 +08:00
parent 7659cea767
commit 20e2e3c159
1 changed files with 13 additions and 1 deletions

View File

@ -1,13 +1,14 @@
<?php
namespace app\api\controller;
use app\common\model\device\MonitorThreshold;
use app\common\model\LandCollection;
use Exception;
use think\facade\Log;
class DataCollectController extends BaseApiController
{
public array $notNeedLogin = ['collect'];
public array $notNeedLogin = ['collect', 'disabled'];
// 种植数据采集
public function collect()
{
@ -46,10 +47,21 @@ class DataCollectController extends BaseApiController
];
LandCollection::create($data);
// 报警监测
$monitorThreshold = MonitorThreshold::find()->toArray();
return $this->success('接收成功', ['user_name'=>$parmas['username'], 'topic'=>$parmas['topic']]);
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
public function disabled()
{
$parmas = $this->request->post();
Log::info(json_encode($parmas));
}
}