From bd62ff705d21a19ff55730cdb74886dbfc7d2664 Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Thu, 22 Aug 2024 15:24:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E6=AE=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/service/indexService.ts | 5 ++++- entry/src/main/ets/common/utils/UdpClientByCenter.ts | 3 ++- entry/src/main/ets/mock/CandidateData.ts | 6 +++--- entry/src/main/ets/pages/TerminalInfos.ets | 1 + entry/src/main/ets/pages/UserInfo.ets | 8 +++++--- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 810cf0d4..d8f8d648 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -49,6 +49,8 @@ export async function deleteAllFIleLog(path){ let filenames = fs.listFileSync(path, options); console.info("listFile succeed",JSON.stringify(filenames)); for (let i = 0; i < filenames.length; i++) { + console.info("listFile succeed",JSON.stringify(filenames[i])); + if(isSevenDaysAgo(filenames[i])){ fs.rmdir(path+filenames[i], (err) => { if (err) { @@ -65,10 +67,11 @@ export async function deleteAllFIleLog(path){ function isSevenDaysAgo(date) { const today = new Date(); // 当前日期 const target = new Date(date); // 需要判断的日期 + console.info("listFile succeed1",JSON.stringify(target)); const diff = today.getTime() - target.getTime(); // 计算两个日期之间的毫秒数差异 const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数 - + console.info("listFile succeed2",JSON.stringify(diffDays)); // 如果差异天数正好是7,则原日期是当前日期的前七天 return diffDays > 7; } diff --git a/entry/src/main/ets/common/utils/UdpClientByCenter.ts b/entry/src/main/ets/common/utils/UdpClientByCenter.ts index 8b337fb8..e5c2f4ea 100644 --- a/entry/src/main/ets/common/utils/UdpClientByCenter.ts +++ b/entry/src/main/ets/common/utils/UdpClientByCenter.ts @@ -303,9 +303,9 @@ export default class UdpClientByCenter { if (strachArr[0] != '#DN_GD') { return } - console.log(`${TAG} udp222 on message array buffer:${str}`); strachArr[28] = globalThis.chuankoMsg || strachArr[28] + console.log(`${TAG} udp222 on message array buffer:${str}`); // this.stashFn(str) const newArr = JSON.parse(JSON.stringify(strachArr)) @@ -316,6 +316,7 @@ export default class UdpClientByCenter { if(strachArr[83]!='4'){ this.chafenFlag++ if(this.chafenFlag>=15&&!globalThis.dialogOpen){ + getUDP(globalThis.context,true) globalThis.title='差分状态异常' globalThis.type='3' AppStorage.SetOrCreate('errorMsg', 1); diff --git a/entry/src/main/ets/mock/CandidateData.ts b/entry/src/main/ets/mock/CandidateData.ts index a188a7db..307f8040 100644 --- a/entry/src/main/ets/mock/CandidateData.ts +++ b/entry/src/main/ets/mock/CandidateData.ts @@ -97,7 +97,7 @@ export const CandidateData: Array = [ { sfzmhm: '3423231995014700005', xm: '测试学员5', - lsh: '0000000000004', + lsh: '0000000000005', ksy1: '考试员2', id: '002', kszp: '', @@ -120,7 +120,7 @@ export const CandidateData: Array = [ { sfzmhm: '342323199501470016', xm: '测试学员6', - lsh: '0000000000005', + lsh: '0000000000006', ksy1: '考试员1', id: '001', kszp: '', @@ -212,7 +212,7 @@ export const CandidateData: Array = [ { sfzmhm: '34232319950147000010', xm: '测试学员10', - lsh: '002', + lsh: '0000000000009', ksy1: '考试员2', id: '0000000000010', kszp: '', diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index 81feded8..e6cd6fd3 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -12,6 +12,7 @@ import { GlobalConfig } from '../config'; @Entry @Component struct Index { + @State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口'] // @State textList2: string[] = [] @State ratio: number = 1700 / 960 diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index de17658a..1f7096e6 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -132,6 +132,7 @@ struct UserInfo { // this.openDeviceByIDCard() const routerParam = router.getParams() || { type: 0 }; console.log('routerParam', JSON.stringify(routerParam)) + if (!globalThis.singlePlay) { // @ts-ignore if (routerParam.type != 1) { @@ -147,8 +148,8 @@ struct UserInfo { this.getCurrentStudent(res.sfzmhm) } }) - - } else if (user && (user.kssycs == '0' || user.kssycs == '')) { + } + else if (user && (user.kssycs == '0' || user.kssycs == '')) { console.log('datadatadatadata') this.list = this.list.filter(res => { return res.sfzmhm != user.sfzmhm @@ -226,7 +227,7 @@ struct UserInfo { this.stopDeviceById() // globalThis.statue=4 router.pushUrl({ - url: examSubject == 3 ? 'pages/c' : 'pages/Judge', + url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', params: { sczb: Number(this.isBoardPrePareSetPopupOpen), kfdm: this.sczbkf, @@ -460,6 +461,7 @@ struct UserInfo { return } await upDateTableByArray('USER', []) + await upDateTableByArray('USERLIST', []) this.type = '2' this.errorDialog.open() this.updateTimeLimit = true