initial commit
This commit is contained in:
8
src/apis/requests/device/index.ts
Normal file
8
src/apis/requests/device/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from './ndm-camera';
|
||||
export * from './ndm-decoder';
|
||||
export * from './ndm-keyboard';
|
||||
export * from './ndm-media-server';
|
||||
export * from './ndm-nvr';
|
||||
export * from './ndm-security-box';
|
||||
export * from './ndm-switch';
|
||||
export * from './ndm-video-server';
|
||||
24
src/apis/requests/device/ndm-camera.ts
Normal file
24
src/apis/requests/device/ndm-camera.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmCameraPageQuery, NdmCameraResultVO, NdmCameraUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmCameraPage = async (stationCode: string, pageQuery: PageParams<NdmCameraPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmCameraResultVO>>(`${prefix}/api/ndm/ndmCamera/page`, pageQuery);
|
||||
const [err, ndmCameraData] = resp;
|
||||
if (err || !ndmCameraData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmCameraData;
|
||||
};
|
||||
|
||||
export const putNdmCamera = async (stationCode: string, updateVO: NdmCameraUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmCameraResultVO>(`${prefix}/api/ndm/ndmCamera`, updateVO);
|
||||
const [err, ndmCamera] = resp;
|
||||
if (err || !ndmCamera) {
|
||||
throw err;
|
||||
}
|
||||
return ndmCamera;
|
||||
};
|
||||
24
src/apis/requests/device/ndm-decoder.ts
Normal file
24
src/apis/requests/device/ndm-decoder.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmDecoderPageQuery, NdmDecoderResultVO, NdmDecoderUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmDecoderPage = async (stationCode: string, pageQuery: PageParams<NdmDecoderPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmDecoderResultVO>>(`${prefix}/api/ndm/ndmDecoder/page`, pageQuery);
|
||||
const [err, ndmDecoderData] = resp;
|
||||
if (err || !ndmDecoderData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmDecoderData;
|
||||
};
|
||||
|
||||
export const putNdmDecoder = async (stationCode: string, updateVO: NdmDecoderUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmDecoderResultVO>(`${prefix}/api/ndm/ndmDecoder`, updateVO);
|
||||
const [err, ndmDecoder] = resp;
|
||||
if (err || !ndmDecoder) {
|
||||
throw err;
|
||||
}
|
||||
return ndmDecoder;
|
||||
};
|
||||
24
src/apis/requests/device/ndm-keyboard.ts
Normal file
24
src/apis/requests/device/ndm-keyboard.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmKeyboardPageQuery, NdmKeyboardResultVO, NdmKeyboardUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmKeyboardPage = async (stationCode: string, pageQuery: PageParams<NdmKeyboardPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmKeyboardResultVO>>(`${prefix}/api/ndm/ndmKeyboard/page`, pageQuery);
|
||||
const [err, ndmKeyboardData] = resp;
|
||||
if (err || !ndmKeyboardData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmKeyboardData;
|
||||
};
|
||||
|
||||
export const putNdmKeyboard = async (stationCode: string, updateVO: NdmKeyboardUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmKeyboardResultVO>(`${prefix}/api/ndm/ndmKeyboard`, updateVO);
|
||||
const [err, ndmKeyboard] = resp;
|
||||
if (err || !ndmKeyboard) {
|
||||
throw err;
|
||||
}
|
||||
return ndmKeyboard;
|
||||
};
|
||||
24
src/apis/requests/device/ndm-media-server.ts
Normal file
24
src/apis/requests/device/ndm-media-server.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmMediaServerPageQuery, NdmMediaServerResultVO, NdmMediaServerUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmMediaServerPage = async (stationCode: string, pageQuery: PageParams<NdmMediaServerPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmMediaServerResultVO>>(`${prefix}/api/ndm/ndmMediaServer/page`, pageQuery);
|
||||
const [err, ndmMediaServerData] = resp;
|
||||
if (err || !ndmMediaServerData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmMediaServerData;
|
||||
};
|
||||
|
||||
export const putNdmMediaServer = async (stationCode: string, updateVO: NdmMediaServerUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmMediaServerResultVO>(`${prefix}/api/ndm/ndmMediaServer`, updateVO);
|
||||
const [err, ndmMediaServer] = resp;
|
||||
if (err || !ndmMediaServer) {
|
||||
throw err;
|
||||
}
|
||||
return ndmMediaServer;
|
||||
};
|
||||
10
src/apis/requests/device/ndm-monitor.ts
Normal file
10
src/apis/requests/device/ndm-monitor.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const resetMonitorSchedule = async (stationCode: string) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.get<void>(`${prefix}/api/ndm/ndmConstant/anyTenant/resetMonitorSchedule`);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
69
src/apis/requests/device/ndm-nvr.ts
Normal file
69
src/apis/requests/device/ndm-nvr.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { ClientChannel, NdmNvrPageQuery, NdmNvrResultVO, NdmNvrUpdateVO, NdmNvrVO, NdmRecordCheck } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmNvrPage = async (stationCode: string, pageQuery: PageParams<NdmNvrPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmNvrResultVO>>(`${prefix}/api/ndm/ndmNvr/page`, pageQuery);
|
||||
const [err, ndmNvrData] = resp;
|
||||
if (err || !ndmNvrData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmNvrData;
|
||||
};
|
||||
|
||||
export const putNdmNvr = async (stationCode: string, updateVO: NdmNvrUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmNvrResultVO>(`${prefix}/api/ndm/ndmNvr`, updateVO);
|
||||
const [err, ndmNvr] = resp;
|
||||
if (err || !ndmNvr) {
|
||||
throw err;
|
||||
}
|
||||
return ndmNvr;
|
||||
};
|
||||
|
||||
export const getChannelList = async (stationCode: string, ndmNvr: NdmNvrVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<ClientChannel[]>(`${prefix}/api/ndm/ndmRecordCheck/getChannelList`, {
|
||||
code: ndmNvr.gbCode,
|
||||
time: '',
|
||||
});
|
||||
const [err, channelList] = resp;
|
||||
if (err || !channelList) {
|
||||
throw err;
|
||||
}
|
||||
return channelList;
|
||||
};
|
||||
|
||||
export const getRecordCheckByParentId = async (stationCode: string, ndmNvr: NdmNvrVO, lastDays: number, gbCodeList: string[] = []) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endDateTime = dayjs();
|
||||
const startDateTime = endDateTime.subtract(lastDays, 'day');
|
||||
const resp = await ndmClient.post<NdmRecordCheck[]>(`${prefix}/api/ndm/ndmRecordCheck/getRecordCheckByParentId`, {
|
||||
start: startDateTime.format('YYYY-MM-DD'),
|
||||
end: endDateTime.format('YYYY-MM-DD'),
|
||||
parentId: ndmNvr.gbCode,
|
||||
gbCodeList,
|
||||
});
|
||||
const [err, recordCheckList] = resp;
|
||||
if (err || !recordCheckList) {
|
||||
throw err;
|
||||
}
|
||||
return recordCheckList;
|
||||
};
|
||||
|
||||
export const reloadRecordCheckByGbId = async (stationCode: string, channel: ClientChannel, dayOffset: number) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<boolean>(`${prefix}/api/ndm/ndmRecordCheck/reloadRecordCheckByGbId`, {
|
||||
...channel,
|
||||
dayOffset,
|
||||
});
|
||||
const [err, result] = resp;
|
||||
if (err || !result) {
|
||||
throw err;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
39
src/apis/requests/device/ndm-security-box.ts
Normal file
39
src/apis/requests/device/ndm-security-box.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmSecurityBoxPageQuery, NdmSecurityBoxResultVO, NdmSecurityBoxUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmSecurityBoxPage = async (stationCode: string, pageQuery: PageParams<NdmSecurityBoxPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmSecurityBoxResultVO>>(`${prefix}/api/ndm/ndmSecurityBox/page`, pageQuery);
|
||||
const [err, ndmSecurityBoxData] = resp;
|
||||
if (err || !ndmSecurityBoxData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSecurityBoxData;
|
||||
};
|
||||
|
||||
export const putNdmSecurityBox = async (stationCode: string, updateVO: NdmSecurityBoxUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmSecurityBoxResultVO>(`${prefix}/api/ndm/ndmSecurityBox`, updateVO);
|
||||
const [err, ndmSecurityBox] = resp;
|
||||
if (err || !ndmSecurityBox) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSecurityBox;
|
||||
};
|
||||
|
||||
export const turnStatus = async (stationCode: string, ipAddress: string, circuitIndex: number, status: number) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<boolean>(`${prefix}/api/ndm/ndmSecurityBox/turnStatus`, {
|
||||
community: 'public',
|
||||
ipAddress,
|
||||
circuit: `${circuitIndex}`,
|
||||
status,
|
||||
});
|
||||
const [err, result] = resp;
|
||||
if (err || !result) {
|
||||
throw err;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
24
src/apis/requests/device/ndm-switch.ts
Normal file
24
src/apis/requests/device/ndm-switch.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmSwitchPageQuery, NdmSwitchResultVO, NdmSwitchUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmSwitchPage = async (stationCode: string, pageQuery: PageParams<NdmSwitchPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmSwitchResultVO>>(`${prefix}/api/ndm/ndmSwitch/page`, pageQuery);
|
||||
const [err, ndmSwitchData] = resp;
|
||||
if (err || !ndmSwitchData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSwitchData;
|
||||
};
|
||||
|
||||
export const putNdmSwitch = async (stationCode: string, updateVO: NdmSwitchUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmSwitchResultVO>(`${prefix}/api/ndm/ndmSwitch`, updateVO);
|
||||
const [err, ndmSwitch] = resp;
|
||||
if (err || !ndmSwitch) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSwitch;
|
||||
};
|
||||
24
src/apis/requests/device/ndm-video-server.ts
Normal file
24
src/apis/requests/device/ndm-video-server.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { NdmVideoServerPageQuery, NdmVideoServerResultVO, NdmVideoServerUpdateVO } from '@/apis/models/device';
|
||||
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmVideoServerPage = async (stationCode: string, pageQuery: PageParams<NdmVideoServerPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmVideoServerResultVO>>(`${prefix}/api/ndm/ndmVideoServer/page`, pageQuery);
|
||||
const [err, ndmVideoServerData] = resp;
|
||||
if (err || !ndmVideoServerData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmVideoServerData;
|
||||
};
|
||||
|
||||
export const putNdmVideoServer = async (stationCode: string, updateVO: NdmVideoServerUpdateVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmVideoServerResultVO>(`${prefix}/api/ndm/ndmVideoServer`, updateVO);
|
||||
const [err, ndmVideoServer] = resp;
|
||||
if (err || !ndmVideoServer) {
|
||||
throw err;
|
||||
}
|
||||
return ndmVideoServer;
|
||||
};
|
||||
Reference in New Issue
Block a user