1.更新黑名单上传逻辑问题

2.增加字段
This commit is contained in:
appqy 2022-11-16 00:28:31 +08:00
parent f35d165e53
commit 03f0df3a59
5 changed files with 24 additions and 6 deletions

View File

@ -4,6 +4,7 @@ return [
'Id' => 'ID',
'Sn' => '设备序列号',
'Name' => '设备名称',
'Dev_type' => '设备类型',
'Lock' => '锁定',
'V' => '固件版本',
'Localid' => 'localid',

View File

@ -4,6 +4,7 @@ return [
'Id' => 'ID',
'Sn' => '设备序列号',
'Name' => '设备名称',
'Dev_type' => '设备类型',
'Lock' => '锁定',
'V' => '固件版本',
'Localid' => 'localid',

View File

@ -17,24 +17,38 @@ class Info extends Api
{
//日志收集
$body = file_get_contents('php://input');
if(!empty($body)){
$body = json_decode($body, true);
if(empty($body['sn'])){
$this->error('error', '');
}
$post = [
"mac" => $body['mac'] ?? "",
"localid" => $body['localid'] ?? "",
"name" => $body['name'] ?? "",
"v" => $body['v'] ?? "",
"dev_type" => $body['dev_type'] ?? "",
"v" => $body['fw'] ?? "",
"ip" => $this->request->ip(),
"sn" => $body['sn'] ?? "",
"lock" => intval($body['lock']),
"createtime" => time(),
];
"createtime" => time()
];
$black_log = new \app\admin\model\Blacklog();
$black_log->save($post);
$black_only_log = new \app\admin\model\Blackollog();
try {
$black_only_log->save($post);
} catch (\Exception $e) {}
if($post['lock'] == 0){
//解除锁定,列表中删除
$black_only_log->where('sn', '=', $post['sn'])->delete();
}else{
//写入列表
try {
$post['updateTime'] = time();
$black_only_log->save($post);
} catch (\Exception $e) {}
}
}
$this->success('success', '');

View File

@ -29,6 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sn', title: __('Sn'), operate: 'LIKE'},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'lock', title: __('Lock'), operate: 'LIKE', formatter: Controller.api.formatter.lock},
{field: 'dev_type', title: __('Dev_type'), operate: 'LIKE'},
{field: 'v', title: __('V'), operate: 'LIKE'},
{field: 'localid', title: __('Localid'), operate: 'LIKE'},
{field: 'mac', title: __('Mac'), operate: 'LIKE'},

View File

@ -31,6 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sn', title: __('Sn'), operate: 'LIKE'},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'lock', title: __('Lock'), operate: 'LIKE', formatter: Controller.api.formatter.lock},
{field: 'dev_type', title: __('Dev_type'), operate: 'LIKE'},
{field: 'v', title: __('V'), operate: 'LIKE'},
{field: 'localid', title: __('Localid'), operate: 'LIKE'},
{field: 'mac', title: __('Mac'), operate: 'LIKE'},