chore: update response check status

This commit is contained in:
2026-01-13 16:31:28 +07:00
parent 48691e79f2
commit 48db190c3f
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export default abstract class CommandService {
const topicData = `${body.merchantName}/${body.floorName}_${unitNumber}-${body.deviceName}-${body.roomName}-${body.deviceType}-${body.commandType}-${body.towerNumber}` const topicData = `${body.merchantName}/${body.floorName}_${unitNumber}-${body.deviceName}-${body.roomName}-${body.deviceType}-${body.commandType}-${body.towerNumber}`
const cmd = dataMapping.find((device) => device.deviceName == body.deviceName) const cmd = dataMapping.find((device) => device.deviceName == body.deviceName)
const request = await sendCommandToThirdParty(topicData, `${cmd?.command}${body.payload.action}`) const request = await sendCommandToThirdParty(topicData, `${cmd?.command}${body.payload.action}`)
if (request.status !== 200) { if (request.status !== 200 || request.data.status == 400) {
return { return {
status: 'error' as const, status: 'error' as const,
message: request.status == 404 ? 'Device not found' : 'Command failed' as const, message: request.status == 404 ? 'Device not found' : 'Command failed' as const,
+1 -1
View File
@@ -45,7 +45,7 @@ export default abstract class QueryService {
deviceType: request.data.data.devType, deviceType: request.data.data.devType,
code: request.data.data.code, code: request.data.data.code,
towerNumber: request.data.data.tower, towerNumber: request.data.data.tower,
payload: request.data.data.payload, payload: request.data.data.payload?.split('=')[1],
}, },
} }
} }