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