This commit is contained in:
lvyuankang 2024-08-22 15:24:15 +08:00
parent 2fb04cbc52
commit bd62ff705d
5 changed files with 15 additions and 8 deletions

View File

@ -49,6 +49,8 @@ export async function deleteAllFIleLog(path){
let filenames = fs.listFileSync(path, options); let filenames = fs.listFileSync(path, options);
console.info("listFile succeed",JSON.stringify(filenames)); console.info("listFile succeed",JSON.stringify(filenames));
for (let i = 0; i < filenames.length; i++) { for (let i = 0; i < filenames.length; i++) {
console.info("listFile succeed",JSON.stringify(filenames[i]));
if(isSevenDaysAgo(filenames[i])){ if(isSevenDaysAgo(filenames[i])){
fs.rmdir(path+filenames[i], (err) => { fs.rmdir(path+filenames[i], (err) => {
if (err) { if (err) {
@ -65,10 +67,11 @@ export async function deleteAllFIleLog(path){
function isSevenDaysAgo(date) { function isSevenDaysAgo(date) {
const today = new Date(); // 当前日期 const today = new Date(); // 当前日期
const target = new Date(date); // 需要判断的日期 const target = new Date(date); // 需要判断的日期
console.info("listFile succeed1",JSON.stringify(target));
const diff = today.getTime() - target.getTime(); // 计算两个日期之间的毫秒数差异 const diff = today.getTime() - target.getTime(); // 计算两个日期之间的毫秒数差异
const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数 const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数
console.info("listFile succeed2",JSON.stringify(diffDays));
// 如果差异天数正好是7则原日期是当前日期的前七天 // 如果差异天数正好是7则原日期是当前日期的前七天
return diffDays > 7; return diffDays > 7;
} }

View File

@ -303,9 +303,9 @@ export default class UdpClientByCenter {
if (strachArr[0] != '#DN_GD') { if (strachArr[0] != '#DN_GD') {
return return
} }
console.log(`${TAG} udp222 on message array buffer:${str}`);
strachArr[28] = globalThis.chuankoMsg || strachArr[28] strachArr[28] = globalThis.chuankoMsg || strachArr[28]
console.log(`${TAG} udp222 on message array buffer:${str}`);
// this.stashFn(str) // this.stashFn(str)
const newArr = JSON.parse(JSON.stringify(strachArr)) const newArr = JSON.parse(JSON.stringify(strachArr))
@ -316,6 +316,7 @@ export default class UdpClientByCenter {
if(strachArr[83]!='4'){ if(strachArr[83]!='4'){
this.chafenFlag++ this.chafenFlag++
if(this.chafenFlag>=15&&!globalThis.dialogOpen){ if(this.chafenFlag>=15&&!globalThis.dialogOpen){
getUDP(globalThis.context,true)
globalThis.title='差分状态异常' globalThis.title='差分状态异常'
globalThis.type='3' globalThis.type='3'
AppStorage.SetOrCreate('errorMsg', 1); AppStorage.SetOrCreate('errorMsg', 1);

View File

@ -97,7 +97,7 @@ export const CandidateData: Array<User> = [
{ {
sfzmhm: '3423231995014700005', sfzmhm: '3423231995014700005',
xm: '测试学员5', xm: '测试学员5',
lsh: '0000000000004', lsh: '0000000000005',
ksy1: '考试员2', ksy1: '考试员2',
id: '002', id: '002',
kszp: '', kszp: '',
@ -120,7 +120,7 @@ export const CandidateData: Array<User> = [
{ {
sfzmhm: '342323199501470016', sfzmhm: '342323199501470016',
xm: '测试学员6', xm: '测试学员6',
lsh: '0000000000005', lsh: '0000000000006',
ksy1: '考试员1', ksy1: '考试员1',
id: '001', id: '001',
kszp: '', kszp: '',
@ -212,7 +212,7 @@ export const CandidateData: Array<User> = [
{ {
sfzmhm: '34232319950147000010', sfzmhm: '34232319950147000010',
xm: '测试学员10', xm: '测试学员10',
lsh: '002', lsh: '0000000000009',
ksy1: '考试员2', ksy1: '考试员2',
id: '0000000000010', id: '0000000000010',
kszp: '', kszp: '',

View File

@ -12,6 +12,7 @@ import { GlobalConfig } from '../config';
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口'] @State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口']
// @State textList2: string[] = [] // @State textList2: string[] = []
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960

View File

@ -132,6 +132,7 @@ struct UserInfo {
// this.openDeviceByIDCard() // this.openDeviceByIDCard()
const routerParam = router.getParams() || { type: 0 }; const routerParam = router.getParams() || { type: 0 };
console.log('routerParam', JSON.stringify(routerParam)) console.log('routerParam', JSON.stringify(routerParam))
if (!globalThis.singlePlay) { if (!globalThis.singlePlay) {
// @ts-ignore // @ts-ignore
if (routerParam.type != 1) { if (routerParam.type != 1) {
@ -147,8 +148,8 @@ struct UserInfo {
this.getCurrentStudent(res.sfzmhm) this.getCurrentStudent(res.sfzmhm)
} }
}) })
}
} else if (user && (user.kssycs == '0' || user.kssycs == '')) { else if (user && (user.kssycs == '0' || user.kssycs == '')) {
console.log('datadatadatadata') console.log('datadatadatadata')
this.list = this.list.filter(res => { this.list = this.list.filter(res => {
return res.sfzmhm != user.sfzmhm return res.sfzmhm != user.sfzmhm
@ -226,7 +227,7 @@ struct UserInfo {
this.stopDeviceById() this.stopDeviceById()
// globalThis.statue=4 // globalThis.statue=4
router.pushUrl({ router.pushUrl({
url: examSubject == 3 ? 'pages/c' : 'pages/Judge', url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
params: { params: {
sczb: Number(this.isBoardPrePareSetPopupOpen), sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf, kfdm: this.sczbkf,
@ -460,6 +461,7 @@ struct UserInfo {
return return
} }
await upDateTableByArray('USER', []) await upDateTableByArray('USER', [])
await upDateTableByArray('USERLIST', [])
this.type = '2' this.type = '2'
this.errorDialog.open() this.errorDialog.open()
this.updateTimeLimit = true this.updateTimeLimit = true