chore: reorder import
This commit is contained in:
66
src/apis/requests/device/storage/ndm-nvr.ts
Normal file
66
src/apis/requests/device/storage/ndm-nvr.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmNvrPageQuery, PageResult, NdmNvrResultVO, NdmNvrUpdateVO, NdmNvrVO, ClientChannel, NdmRecordCheck } from '@/apis/models';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user