【类 型】:feat 添加日志接口

【原  因】:
【过  程】:
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-10-12 16:16:51 +08:00
parent 468b89263b
commit 7f2788f8d8

View File

@ -187,4 +187,22 @@ class PublicController extends Controller
echo "Could not connect to MQTT broker: " . $e->getMessage();
}
}
/**
* @abstract 写入日志
*/
public function addLog()
{
if ($this->tokenShop_id) {
$data['shop_id'] = $this->tokenShop_id;
$data['log'] = $_REQUEST['log'];
$data['time'] = time();
if (D('log')->add($data)) {
echo json_encode(array('status' => 1, 'msg' => '添加成功'));
} else {
echo json_encode(array('status' => 0, 'msg' => '添加失败'));
}
} else {
echo json_encode(array('status' => 0, 'msg' => '登录异常'));
}
}
}