圖片刪除
This commit is contained in:
		
							parent
							
								
									997cd3dc88
								
							
						
					
					
						commit
						8e276824e8
					
				| @ -65,27 +65,25 @@ export async function deleteAllFIleLog(path){ | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| export async function delHilgo(){ | export async function delHilog(){ | ||||||
|  |   console.log('kkkkmmm1') | ||||||
|  | 
 | ||||||
|   const fileUtil = new FileUtil(globalThis.context) |   const fileUtil = new FileUtil(globalThis.context) | ||||||
|   const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/hilogTime.txt'); |   const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/hilogTime.txt'); | ||||||
|  |   const folderPath = await fileUtil.initFolder(`/config`); | ||||||
|  |   console.log('kkkkmmm2',data) | ||||||
|   if(data === '' || data === undefined){ |   if(data === '' || data === undefined){ | ||||||
|     const folderPath = await fileUtil.initFolder(`/config`); |     const date=dateFormat(new Date()).split(' ')[0] | ||||||
|     fileUtil.addFile(`${folderPath}/hilogTime.txt`, JSON.stringify(1)) |     console.log('mm'.date) | ||||||
|  |     fileUtil.addFile(`${folderPath}/hilogTime.txt`, date) | ||||||
|   }else{ |   }else{ | ||||||
|     if(Number(data)<7){ |     console.log('kkkkmmm2',data) | ||||||
|       let num=Number(data)+1 |     console.log('datadata',data,isSevenDaysAgo(data)) | ||||||
|       fileUtil.addFile(`${folderPath}/hilogTime.txt`, JSON.stringify(num)) |     if(isSevenDaysAgo(data)){ | ||||||
|     }else{ |       const date=dateFormat(new Date()).split(' ')[0] | ||||||
|       let num=Number(data)+1 |       fileUtil.addFile(`${folderPath}/hilogTime.txt`, date) | ||||||
|       fileUtil.addFile(`${folderPath}/hilogTime.txt`, JSON.stringify(1)) |  | ||||||
|       fs.rmdir('/data/log/hilog', (err) => { |  | ||||||
|         if (err) { |  | ||||||
|           console.error("rmdir failed with error message: " + err.message + ", error code: " + err.code); |  | ||||||
|         } else { |  | ||||||
|           console.info("rmdir succeed"); |  | ||||||
|         } |  | ||||||
|       }); |  | ||||||
|       deleteAllFileByPiC('jt',1) |       deleteAllFileByPiC('jt',1) | ||||||
|  |       // fileUtil.addFile(`${folderPath}/hilogTime.txt`, JSON.stringify(num))
 | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -93,10 +91,9 @@ 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)); |   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)); |   console.info("listFile succeed2",(diffDays)); | ||||||
|   // 如果差异天数正好是7,则原日期是当前日期的前七天
 |   // 如果差异天数正好是7,则原日期是当前日期的前七天
 | ||||||
|   return diffDays > 7; |   return diffDays > 7; | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ import { getUDP, getUDP2 } from '../common/utils/GlobalUdp'; | |||||||
| import { initJudgeUdp } from '../common/utils/UdpJudge'; | import { initJudgeUdp } from '../common/utils/UdpJudge'; | ||||||
| import { judgeConfig } from './judgeSDK/utils/judgeConfig'; | import { judgeConfig } from './judgeSDK/utils/judgeConfig'; | ||||||
| import { getTCP } from '../common/utils/GlobalTcp'; | import { getTCP } from '../common/utils/GlobalTcp'; | ||||||
| import { getliushuiNum, setliushuiNum, takePhotoFn, deleteAllFIleLog } from '../common/service/indexService'; | import { getliushuiNum, setliushuiNum, takePhotoFn, delHilog } from '../common/service/indexService'; | ||||||
| import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; | import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; | ||||||
| import worker, { MessageEvents } from '@ohos.worker'; | import worker, { MessageEvents } from '@ohos.worker'; | ||||||
| import promptAction from '@ohos.promptAction' | import promptAction from '@ohos.promptAction' | ||||||
| @ -19,6 +19,7 @@ import { voiceService } from '../common/service/voiceService'; | |||||||
| import errorMsgDialog from './compontents/errorMsgDialog' | import errorMsgDialog from './compontents/errorMsgDialog' | ||||||
| import { getSyncData } from '../common/service/initable'; | import { getSyncData } from '../common/service/initable'; | ||||||
| import GetDistance from '../common/utils/GetDistance' | import GetDistance from '../common/utils/GetDistance' | ||||||
|  | import UIAbility from '@ohos.app.ability.UIAbility'; | ||||||
| 
 | 
 | ||||||
| // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||||
| 
 | 
 | ||||||
| @ -369,19 +370,23 @@ struct Index { | |||||||
|   async onPageShow() { |   async onPageShow() { | ||||||
|     console.log('ttttt', 1111) |     console.log('ttttt', 1111) | ||||||
|     this.userAuth(); |     this.userAuth(); | ||||||
|  |     let resourceManager = this.context.resourceManager; | ||||||
| 
 | 
 | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |     this.vocObj = new voiceService(async (status, val, next) => { | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     console.log('globalThis.singlePlay', globalThis.singlePlay) |     console.log('globalThis.singlePlay', globalThis.singlePlay) | ||||||
|     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { |     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { | ||||||
|       console.log('tttttttt') |       this.context.resourceManager.getRawFileContent("welcome.wav").then(value => { | ||||||
|       setTimeout(()=>{ |  | ||||||
|         this.vocObj.playAudio({ |         this.vocObj.playAudio({ | ||||||
|           type: 1, |           type: 1, | ||||||
|           name: 'welcome.wav' |           name: 'welcome.wav' | ||||||
|         }) |         }) | ||||||
|       },500) |         // let rawFile = value; | ||||||
|  |       }).catch(error => { | ||||||
|  |         console.log("getRawFileContent promise error is " + error); | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|       globalThis.singlePlay = false |       globalThis.singlePlay = false | ||||||
|     } |     } | ||||||
|     this.isSingle = globalThis.singlePlay |     this.isSingle = globalThis.singlePlay | ||||||
| @ -425,6 +430,8 @@ struct Index { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async initParams() { |   async initParams() { | ||||||
|  |     console.log('kkkkmmm') | ||||||
|  |     delHilog() | ||||||
|     // deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/') |     // deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/') | ||||||
|     //设置plc udp 同步requesthost |     //设置plc udp 同步requesthost | ||||||
|     await getUDP(this.context, false) |     await getUDP(this.context, false) | ||||||
| @ -451,16 +458,6 @@ struct Index { | |||||||
|       if (this.num >= 3) { |       if (this.num >= 3) { | ||||||
|         this.heartMsg() |         this.heartMsg() | ||||||
|       } |       } | ||||||
|       // const data=AppStorage.Get('errorMsg'); |  | ||||||
|       // console.log('1123',data,globalThis.type,globalThis.dialogOpen) |  | ||||||
|       // if(data==1){ |  | ||||||
|       //   if(globalThis.type=='3'&&!globalThis.dialogOpen){ |  | ||||||
|       //     globalThis.dialogOpen=true |  | ||||||
|       //     this.errorDialog.open() |  | ||||||
|       //   }else if(globalThis.type=='1'){ |  | ||||||
|       //     this.errorDialog.open() |  | ||||||
|       //   } |  | ||||||
|       // } |  | ||||||
|     }, 1000) |     }, 1000) | ||||||
|     //下载模型 |     //下载模型 | ||||||
|     // await this.getModel() |     // await this.getModel() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user