feat:更新
This commit is contained in:
		
							parent
							
								
									c7dd0aa000
								
							
						
					
					
						commit
						17ef3ce4be
					
				| @ -42,6 +42,7 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | |||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|   const {xtlb,jkxlh,jkid,drvexam} = params; |   const {xtlb,jkxlh,jkid,drvexam} = params; | ||||||
|  | 
 | ||||||
|   //新监管调用
 |   //新监管调用
 | ||||||
|   if (globalThis.isJGNew) { |   if (globalThis.isJGNew) { | ||||||
|     return await writeObjectOutNew(params,filePath) |     return await writeObjectOutNew(params,filePath) | ||||||
| @ -51,8 +52,9 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | |||||||
|   const drvexamArrs = Reflect.ownKeys(drvexam) |   const drvexamArrs = Reflect.ownKeys(drvexam) | ||||||
|     .filter(dKey => drvexam[dKey] != undefined) |     .filter(dKey => drvexam[dKey] != undefined) | ||||||
|     .map((key: string) => ( |     .map((key: string) => ( | ||||||
|     `<${key}>${drvexam[key]}</${key}>`)); |       `<${key}>${drvexam[key]}</${key}>`)); | ||||||
| 
 | 
 | ||||||
|  |   console.log('surenjun filePath=>',filePath); | ||||||
|   if(filePath){ |   if(filePath){ | ||||||
|     const fileUtil = new FileUtil(globalThis.context); |     const fileUtil = new FileUtil(globalThis.context); | ||||||
|     await fileUtil.initFolder(filePath); |     await fileUtil.initFolder(filePath); | ||||||
| @ -61,7 +63,6 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | |||||||
|     }) +`\n`); |     }) +`\n`); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   console.info('surenjun','调用旧监管') |  | ||||||
|   //对象转换成xml
 |   //对象转换成xml
 | ||||||
|   const temp = await request({ |   const temp = await request({ | ||||||
|     host: globalThis.JGHOST, |     host: globalThis.JGHOST, | ||||||
| @ -92,12 +93,18 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | |||||||
|                </SOAP-ENV:Envelope>`, |                </SOAP-ENV:Envelope>`, | ||||||
|     method: 'post', |     method: 'post', | ||||||
|     xml: true |     xml: true | ||||||
|   }) |   },) | ||||||
|   if(filePath){ |   if(filePath){ | ||||||
|     const fileUtil = new FileUtil(globalThis.context); |     const fileUtil = new FileUtil(globalThis.context); | ||||||
|     await fileUtil.initFolder(filePath); |     await fileUtil.initFolder(filePath); | ||||||
|     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`); |     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`); | ||||||
|   } |   } | ||||||
|  |   // const {code} = temp;
 | ||||||
|  |   // if(code == '2300007' || code == '2300028'){
 | ||||||
|  |   //   return await writeObjectOut(params,filePath)
 | ||||||
|  |   // }else{
 | ||||||
|  |   //   return temp
 | ||||||
|  |   // }
 | ||||||
|   return temp |   return temp | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,9 +4,6 @@ let baseHost = globalThis.host; | |||||||
| import FileUtil from '../common/utils/File'; | import FileUtil from '../common/utils/File'; | ||||||
| import FileLog from '../pages/judgeSDK/utils/fileLog'; | import FileLog from '../pages/judgeSDK/utils/fileLog'; | ||||||
| 
 | 
 | ||||||
| //新监管接口
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| //监管接口序列号映射
 | //监管接口序列号映射
 | ||||||
| const gjxlhObj = { | const gjxlhObj = { | ||||||
|   '17C51': '02-21-000009', |   '17C51': '02-21-000009', | ||||||
| @ -21,6 +18,7 @@ interface WR{ | |||||||
|   message?:string |   message?:string | ||||||
|   code:number |   code:number | ||||||
| } | } | ||||||
|  | 
 | ||||||
| export default async function writeObjectOutNew(data,filePath): Promise<WR> { | export default async function writeObjectOutNew(data,filePath): Promise<WR> { | ||||||
|   const fileUtil = new FileUtil(globalThis.context); |   const fileUtil = new FileUtil(globalThis.context); | ||||||
|   const {jkid , drvexam} = data; |   const {jkid , drvexam} = data; | ||||||
| @ -28,12 +26,17 @@ export default async function writeObjectOutNew(data,filePath): Promise<WR> { | |||||||
|   const params = await getParams(jkid, drvexam); |   const params = await getParams(jkid, drvexam); | ||||||
|   const {wglb,jkxlh,glbm,jgbh,sjbs} = basic; |   const {wglb,jkxlh,glbm,jgbh,sjbs} = basic; | ||||||
| 
 | 
 | ||||||
|   console.info('surenjun filePath=>',filePath) |   if(filePath){ | ||||||
|   fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ |     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ | ||||||
|     wglb,jkxlh,glbm,jgbh,sjbs, |       wglb,jkxlh,glbm,jgbh,sjbs, | ||||||
|     data:params.data, |       data:params.data, | ||||||
|     file:{...params.file,param:[]}, |       file:{...params.file,param:[]}, | ||||||
|   })); |     })); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // let connectTimeout = sjbs === '02-21-000014' ?60000:1
 | ||||||
|  | 
 | ||||||
|  |   console.info('surenjun','调用旧监管') | ||||||
| 
 | 
 | ||||||
|   const temp = await request({ |   const temp = await request({ | ||||||
|     host: globalThis.JGHOST, |     host: globalThis.JGHOST, | ||||||
| @ -66,7 +69,13 @@ export default async function writeObjectOutNew(data,filePath): Promise<WR> { | |||||||
|     await fileUtil.initFolder(filePath); |     await fileUtil.initFolder(filePath); | ||||||
|     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`); |     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`); | ||||||
|   } |   } | ||||||
|   return temp |   const {code} = temp; | ||||||
|  |   if(code == '2300007' || code == '2300028'){ | ||||||
|  |     return await writeObjectOutNew(params,filePath) | ||||||
|  |   }else{ | ||||||
|  |     return temp | ||||||
|  |   } | ||||||
|  | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getParams(jkid, drvexam) { | export async function getParams(jkid, drvexam) { | ||||||
|  | |||||||
| @ -10,8 +10,6 @@ const config = { | |||||||
|     host:GlobalConfig.host, |     host:GlobalConfig.host, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * @author: Renjun Su |  * @author: Renjun Su | ||||||
|  * @date: 2023/2/20 |  * @date: 2023/2/20 | ||||||
| @ -22,6 +20,7 @@ const config = { | |||||||
|  * @param {params} get请求的数据 |  * @param {params} get请求的数据 | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
|  | // let httpRequest = http.createHttp();
 | ||||||
| 
 | 
 | ||||||
| export default async function request(req: any) { | export default async function request(req: any) { | ||||||
|     const {url,params = {},data = {},xml,method = 'get',host,isNewCenter = false} = req; |     const {url,params = {},data = {},xml,method = 'get',host,isNewCenter = false} = req; | ||||||
| @ -32,7 +31,6 @@ export default async function request(req: any) { | |||||||
|             'Content-Type': xml ? 'text/xml' : 'application/json' |             'Content-Type': xml ? 'text/xml' : 'application/json' | ||||||
|         }, |         }, | ||||||
|         extraData: xml ? data : JSON.stringify(data), |         extraData: xml ? data : JSON.stringify(data), | ||||||
|         connectTimeout:120000, |  | ||||||
|     } |     } | ||||||
|     //params转url拼接参数
 |     //params转url拼接参数
 | ||||||
|     let paramsStr  = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || ''; |     let paramsStr  = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || ''; | ||||||
| @ -41,9 +39,8 @@ export default async function request(req: any) { | |||||||
|     try { |     try { | ||||||
|         let baseUrl=host?host:globalThis.host |         let baseUrl=host?host:globalThis.host | ||||||
|         // let baseUrl=host?config.csptHost:config.host'
 |         // let baseUrl=host?config.csptHost:config.host'
 | ||||||
|         console.log('optionsoptions',JSON.stringify(data).length) |  | ||||||
|         console.log('响应头地址' + baseUrl,url) |         console.log('响应头地址' + baseUrl,url) | ||||||
|         const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options); |         const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, {...options}); | ||||||
|         // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
 |         // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
 | ||||||
|         // writeLog({
 |         // writeLog({
 | ||||||
|         //     time:dateFormat(new Date()),
 |         //     time:dateFormat(new Date()),
 | ||||||
| @ -65,6 +62,7 @@ export default async function request(req: any) { | |||||||
|             const msgXml = res.Envelope.Body.writeObjectOutResponse.return; |             const msgXml = res.Envelope.Body.writeObjectOutResponse.return; | ||||||
|             //Envelope.Body.writeObjectOutResponse.return
 |             //Envelope.Body.writeObjectOutResponse.return
 | ||||||
|             const dd = handleCenterCode(msgXml,isNewCenter); |             const dd = handleCenterCode(msgXml,isNewCenter); | ||||||
|  |             httpRequest.destroy(); | ||||||
|             return dd |             return dd | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @ -85,32 +83,35 @@ export default async function request(req: any) { | |||||||
|         } |         } | ||||||
|         console.info('jiangsong:res in request' + url + JSON.stringify(resObj)) |         console.info('jiangsong:res in request' + url + JSON.stringify(resObj)) | ||||||
|         if(resObj.resultCode === '0') { |         if(resObj.resultCode === '0') { | ||||||
|  |             httpRequest.destroy(); | ||||||
|             return res |             return res | ||||||
|         }else { |         }else { | ||||||
|             prompt.showToast({ |             prompt.showToast({ | ||||||
|                 message: decodeURIComponent(resObj.resultMessage), |                 message: decodeURIComponent(resObj.resultMessage), | ||||||
|                 duration: 3000 |                 duration: 3000 | ||||||
|             }); |             }); | ||||||
|  |             httpRequest.destroy(); | ||||||
|             return res |             return res | ||||||
|         } |         } | ||||||
|     } catch (e) { |     } catch (e) { | ||||||
|         console.info('test-error' + url  + ' error:resp: '+ JSON.stringify(e)) |         console.info('test-error' + url  + ' error:resp: '+ JSON.stringify(e)) | ||||||
|         if(!e||!(e?.message)){ |         if(!e||!(e?.message)){ | ||||||
|             return false |             return {code:-1} | ||||||
|         } |         } | ||||||
|         const code = e?.code; |         const code = e?.code; | ||||||
|         prompt.showToast({ |         prompt.showToast({ | ||||||
|             message: e?.message, |             message: e?.message, | ||||||
|             duration: 5000 |             duration: 5000 | ||||||
|         }); |         }); | ||||||
|  |         httpRequest.destroy(); | ||||||
|         switch (code){ |         switch (code){ | ||||||
|         //断网
 |         //断网
 | ||||||
|             case 2300007: return 2300007 |             case 2300007: return 2300007 | ||||||
|  |         // 超时
 | ||||||
|             case 2300028: return 2300028 |             case 2300028: return 2300028 | ||||||
|             default: |             default: | ||||||
|         } |         } | ||||||
|         httpRequest.destroy(); |         return {code:e.code} | ||||||
|         return false |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @ -120,6 +121,8 @@ async function writeLog(param){ | |||||||
|     fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(param)+`\n`) |     fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(param)+`\n`) | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| //xml格式转JSON
 | //xml格式转JSON
 | ||||||
| function xmlToJson(result,url) { | function xmlToJson(result,url) { | ||||||
|     console.log("xmlToJson begin",url); |     console.log("xmlToJson begin",url); | ||||||
|  | |||||||
| @ -41,8 +41,6 @@ struct Index { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |  | ||||||
|     }); |  | ||||||
|     globalThis.windowClass.setWindowSystemBarEnable([]) |     globalThis.windowClass.setWindowSystemBarEnable([]) | ||||||
|     const time = await getCurrentTime() |     const time = await getCurrentTime() | ||||||
| 
 | 
 | ||||||
| @ -761,10 +759,10 @@ struct Index { | |||||||
|                             .height(118 * 0.95) |                             .height(118 * 0.95) | ||||||
|                             .margin({ bottom: 8 }) |                             .margin({ bottom: 8 }) | ||||||
|                             .onClick(() => { |                             .onClick(() => { | ||||||
|                               this.vocObj.playAudio({ |                               // this.vocObj.playAudio({ | ||||||
|                                 type: 1, |                               //   type: 1, | ||||||
|                                 name: 'button_media.wav' |                               //   name: 'button_media.wav' | ||||||
|                               }) |                               // }) | ||||||
|                               this.setManualProjectFn(index) |                               this.setManualProjectFn(index) | ||||||
|                             }) |                             }) | ||||||
|                           }) |                           }) | ||||||
| @ -797,10 +795,10 @@ struct Index { | |||||||
|             .alignItems(VerticalAlign.Center) |             .alignItems(VerticalAlign.Center) | ||||||
|             .border({ width: 5, color: '#4D4136', radius: 30 }) |             .border({ width: 5, color: '#4D4136', radius: 30 }) | ||||||
|             .onClick(() => { |             .onClick(() => { | ||||||
|               this.vocObj.playAudio({ |               // this.vocObj.playAudio({ | ||||||
|                 type: 1, |               //   type: 1, | ||||||
|                 name: 'button_media.wav' |               //   name: 'button_media.wav' | ||||||
|               }) |               // }) | ||||||
|               this.signDisplayComVisible = true |               this.signDisplayComVisible = true | ||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
| @ -836,10 +834,10 @@ struct Index { | |||||||
|               .backgroundImageSize({ width: '100%', height: '100%' }) |               .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|               .margin({ bottom: 10 }) |               .margin({ bottom: 10 }) | ||||||
|               .onClick(() => { |               .onClick(() => { | ||||||
|                 this.vocObj.playAudio({ |                 // this.vocObj.playAudio({ | ||||||
|                   type: 1, |                 //   type: 1, | ||||||
|                   name: 'button_media.wav' |                 //   name: 'button_media.wav' | ||||||
|                 }) |                 // }) | ||||||
|                 this.isDeductedPopShow = true |                 this.isDeductedPopShow = true | ||||||
|               }) |               }) | ||||||
|             } |             } | ||||||
| @ -869,10 +867,10 @@ struct Index { | |||||||
|             .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) |             .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) | ||||||
|             .backgroundImageSize({ width: '100%', height: '100%' }) |             .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|             .onClick(() => { |             .onClick(() => { | ||||||
|               this.vocObj.playAudio({ |               // this.vocObj.playAudio({ | ||||||
|                 type: 1, |               //   type: 1, | ||||||
|                 name: 'button_media.wav' |               //   name: 'button_media.wav' | ||||||
|               }) |               // }) | ||||||
|               if (this.judgeConfigObj['353'] == '0') { |               if (this.judgeConfigObj['353'] == '0') { | ||||||
|                 this.endPopupVisible = true |                 this.endPopupVisible = true | ||||||
|               } else { |               } else { | ||||||
| @ -936,10 +934,10 @@ struct Index { | |||||||
|           .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) |           .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) | ||||||
|           .backgroundImageSize({ width: '33.33%', height: '33.33%' }) |           .backgroundImageSize({ width: '33.33%', height: '33.33%' }) | ||||||
|           .onClick(() => { |           .onClick(() => { | ||||||
|             this.vocObj.playAudio({ |             // this.vocObj.playAudio({ | ||||||
|               type: 1, |             //   type: 1, | ||||||
|               name: 'button_media.wav' |             //   name: 'button_media.wav' | ||||||
|             }) |             // }) | ||||||
|             this.signDisplayComVisible = false |             this.signDisplayComVisible = false | ||||||
|           }) |           }) | ||||||
|         }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') |         }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') | ||||||
|  | |||||||
| @ -730,19 +730,21 @@ struct UserInfo { | |||||||
|     this.currentUser.id = '1' |     this.currentUser.id = '1' | ||||||
|     const avPlayer = this.avPlayer; |     const avPlayer = this.avPlayer; | ||||||
|     this.isLoadingPopupVisible = true |     this.isLoadingPopupVisible = true | ||||||
|  | 
 | ||||||
|     avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { |     avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { | ||||||
|       console.info('surenjun','播放结束开始考试接口调用') |       console.info('surenjun','播放结束开始考试接口调用') | ||||||
|       const {code,keystr,message} = await this.beginExam(); |       const {code,keystr,message} = await this.beginExam() || {}; | ||||||
|       console.info('surenjun','开始考试接口调用结束') |       console.info('surenjun','开始考试接口调用结束') | ||||||
|  |       // console.info('surenjun',code +'') | ||||||
|       //@ts-ignore TODO code转换 |       //@ts-ignore TODO code转换 | ||||||
|       if (code != 1) { |       if (code != 1) { | ||||||
|  |         avPlayer.playAudio(['voice/监管审核未通过.mp3']); | ||||||
|  |         this.isLoadingPopupVisible = false | ||||||
|  |         this.isExamStart = false | ||||||
|         promptAction.showToast({ |         promptAction.showToast({ | ||||||
|           message, |           message, | ||||||
|           duration: 4000 |           duration: 4000 | ||||||
|         }) |         }) | ||||||
|         avPlayer.playAudio(['voice/监管审核未通过.mp3']); |  | ||||||
|         this.isLoadingPopupVisible = false |  | ||||||
|         this.isExamStart = false |  | ||||||
|         return |         return | ||||||
|       } |       } | ||||||
|       this.currentUser.id = '0' |       this.currentUser.id = '0' | ||||||
|  | |||||||
| @ -200,7 +200,7 @@ export default class Judge { | |||||||
|       handleUdp(msg) |       handleUdp(msg) | ||||||
|       const udpIndex = globalThis.udpIndex; |       const udpIndex = globalThis.udpIndex; | ||||||
|       if (udpIndex % 5 === 0) { |       if (udpIndex % 5 === 0) { | ||||||
|         handDistance(); |         // handDistance();
 | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
| @ -1044,7 +1044,7 @@ export default class Judge { | |||||||
|         dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index+1},${Math.floor(d /100)}`).join(';'), |         dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index+1},${Math.floor(d /100)}`).join(';'), | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     const {code,keystr,message} = await writeObjectOut(data,filePath); |     const {code,keystr,message} = await writeObjectOut(data,filePath)  ; | ||||||
|     promptWxCode('17C56', code) |     promptWxCode('17C56', code) | ||||||
| 
 | 
 | ||||||
|     if(code != 1){ |     if(code != 1){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user