fix mockup data
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { verify } from '~/helpers/signature'
|
||||
import { DeviceQueryParams } from '../schema'
|
||||
import { queryDeviceStatus } from './query'
|
||||
|
||||
export default abstract class QueryService {
|
||||
static async getDeviceStatus(query: DeviceQueryParams, headers: Record<string, string | undefined>): Promise<{
|
||||
static async getDeviceStatus(query: DeviceQueryParams): Promise<{
|
||||
status: 'success'
|
||||
message: 'command accepted'
|
||||
data: {
|
||||
@@ -21,6 +20,40 @@ export default abstract class QueryService {
|
||||
|
||||
const topic = `${query.merchantName}/${query.floorName}_${query.unitNumber}-${query.deviceName}-${query.roomName}-${query.deviceType}-S-${query.towerNumber}`
|
||||
|
||||
if (topic == 'SAVY/01_L2-BL-LV-S-S-T1') {
|
||||
return {
|
||||
status: 'success',
|
||||
message: 'command accepted',
|
||||
data: {
|
||||
floor: 'L2',
|
||||
unit: '01',
|
||||
device: 'BL',
|
||||
room: 'LV',
|
||||
devType: 'S',
|
||||
code: 'S',
|
||||
tower: 'T1',
|
||||
payload: 'Open',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (topic == 'SAVY/01_L2-L-LV-S-C-T1') {
|
||||
return {
|
||||
status: 'success',
|
||||
message: 'command accepted',
|
||||
data: {
|
||||
floor: 'L2',
|
||||
unit: '01',
|
||||
device: 'L',
|
||||
room: 'LV',
|
||||
devType: 'S',
|
||||
code: 'C',
|
||||
tower: 'T1',
|
||||
payload: 'On',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const deviceData = await queryDeviceStatus(topic)
|
||||
|
||||
if (deviceData) {
|
||||
|
||||
Reference in New Issue
Block a user