1
This commit is contained in:
@@ -97,6 +97,18 @@ class MqttDispatcher {
|
||||
});
|
||||
}
|
||||
|
||||
// 检查授权状态(对于需要授权的操作)
|
||||
const authorizationService = require('../../services/authorization_service');
|
||||
const authCheck = await authorizationService.checkAuthorization(deviceCode, 'sn_code');
|
||||
if (!authCheck.is_authorized) {
|
||||
console.log(`[MQTT分发器] 设备 ${deviceCode} 授权检查失败: ${authCheck.message}`);
|
||||
return this.sendMqttResponse(mqttClient, uuid, {
|
||||
code: 403,
|
||||
message: authCheck.message,
|
||||
data: null
|
||||
});
|
||||
}
|
||||
|
||||
// 获取对应的处理器
|
||||
const handler = this.actionHandlers.get(action);
|
||||
if (!handler) {
|
||||
|
||||
Reference in New Issue
Block a user