host配置修改 #33
| @ -51,12 +51,13 @@ export async function initCenterCache(params,url){ | ||||
|     }) | ||||
| } | ||||
| //参数下发读表接口
 | ||||
| export async function initCenterCacheByKSPT(params){ | ||||
| export async function initCenterCacheByKSPT(params,url){ | ||||
|     return await request({ | ||||
|         url:'/der2/services/para/initCenterCache.ws', | ||||
|         data:params, | ||||
|         method:'post', | ||||
|         xml:false, | ||||
|         host:url | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| @ -77,6 +78,7 @@ export async function initialization(params){ | ||||
|         url:'/der2/services/exam/initialization.ws', | ||||
|         data:`<?xml version="1.0" encoding="UTF-8" ?><initializationReq><body><carId>${params.carId}</carId><examinationRoomId>${params.examinationRoomId}</examinationRoomId><shellVersion>${params.shellVersion}</shellVersion><judgeVersion>${params.judgeVersion}</judgeVersion><videoVersion>${params.videoVersion}</videoVersion><carInfo></carInfo><map_Road></map_Road><map_Road_Lane></map_Road_Lane><map_SubItem></map_SubItem><t_CarParmSet></t_CarParmSet><map_ItemClass></map_ItemClass><map_Point></map_Point><map_Point_Item></map_Point_Item><CDSBINFO></CDSBINFO><MARKRULESET></MARKRULESET></body></initializationReq>`, | ||||
|         method:'post', | ||||
|         host:params.host, | ||||
|         xml:true, | ||||
|     }) | ||||
| } | ||||
|  | ||||
| @ -148,7 +148,7 @@ export async function getDataBaseTable(params,reqParam) { | ||||
|               "typeRsp": "0" // 赋默认值0,无需改变
 | ||||
|             } | ||||
|           } | ||||
|           let res: any = await initCenterCache(str) | ||||
|           let res: any = await initCenterCache(str,reqParam.centerHost) | ||||
|           if( res.body[params.tableName].length==0){ | ||||
|             resolve(); | ||||
|             return | ||||
| @ -248,7 +248,7 @@ export async function getMySystemSetTable(params,reqParam) { | ||||
|         "typeRsp": "0" // 赋默认值0,无需改变
 | ||||
|       } | ||||
|     } | ||||
|     initCenterCacheByKSPT(str).then((res)=>{ | ||||
|     initCenterCacheByKSPT(str,reqParam.url).then((res)=>{ | ||||
|       if( res.body[params.tableName].length==0){ | ||||
|         resolve(); | ||||
|         return | ||||
| @ -357,9 +357,10 @@ export async function upDataZhongxinginitialization(param){ | ||||
|       "examinationRoomId": param.examinationRoomId, //考试平台kdid
 | ||||
|       videoVersion:'1.0', | ||||
|       judgeVersion:param.judgeVersion, | ||||
|       shellVersion:  param.shellVersion | ||||
|       shellVersion:  param.shellVersion, | ||||
|       host:param.host | ||||
|     } | ||||
|     console.log('daihai2') | ||||
|     console.log('daihai2',JSON.stringify(str)) | ||||
| 
 | ||||
|     initialization(str).then(async (res)=>{ | ||||
|       console.log('daihai3',JSON.stringify(res)) | ||||
|  | ||||
| @ -19,7 +19,7 @@ export async function getUDP() { | ||||
|             globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort) | ||||
|             globalThis.udpClient.sendMsg('111', null) | ||||
|             globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` | ||||
|             globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) | ||||
|             // globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
 | ||||
|           }, 1000) | ||||
|         }) | ||||
|       } | ||||
| @ -43,7 +43,7 @@ export async function getUDP() { | ||||
|       //   globalThis.udpClient.closeUdp(async ()=>{ })
 | ||||
|       // }
 | ||||
|       globalThis.udpClient = {} | ||||
|       globalThis.udpClient.onMessage_1 = () => {} | ||||
|       // globalThis.udpClient.onMessage_1 = () => {}
 | ||||
|       globalThis.host = '' | ||||
|     } | ||||
|   }) | ||||
| @ -66,10 +66,9 @@ export async function getUDP2() { | ||||
|         // 未绑定
 | ||||
|         console.log(` getUDP2  has no  udclent and  bind `); | ||||
|         const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort) | ||||
| 
 | ||||
|         udpClient2.bindUdp() | ||||
|         udpClient2.onError_Callback() | ||||
|         udpClient2.onMessage_2((val) => { | ||||
|         await udpClient2.bindUdp() | ||||
|         await udpClient2.onError_Callback() | ||||
|         await udpClient2.onMessage_2((val) => { | ||||
|           if (val.id == '32') { | ||||
|             globalThis.signNum = val.body[1] | ||||
| 
 | ||||
| @ -92,8 +91,6 @@ export async function getUDP2() { | ||||
|       } | ||||
|     } else { | ||||
|       globalThis.udpClient2 = {} | ||||
|       globalThis.udpClient2.onMessage_2 = () => { | ||||
|       } | ||||
|       globalThis.udpClient2.setMsgCallBack = () => { | ||||
|       } | ||||
|     } | ||||
| @ -130,8 +127,8 @@ export async function setJudgeUdp() { | ||||
|   if (config && config[0] && config[0].udplocalIp) { | ||||
|     const {udplocalIp} = config[0]; | ||||
|     const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort) | ||||
|     udpClientbyCenter.bindUdp() | ||||
|     udpClientbyCenter.onMessage_1((val) => { | ||||
|     await udpClientbyCenter.bindUdp() | ||||
|     await udpClientbyCenter.onMessage_1((val) => { | ||||
|       console.log('valval', val) | ||||
|     }) | ||||
|     // globalThis.judgeUdpClient = udpClientbyCenter;
 | ||||
|  | ||||
| @ -242,18 +242,14 @@ export default class UdpClientByCenter { | ||||
| 
 | ||||
|   closeUdp(callback?) { | ||||
|     console.log('UdpClientByCenter  enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort); | ||||
|     this.udp.on('close', () => { | ||||
|       console.log('UdpClientByCenter  onClose ip:' + this.localIp + ' port:' + this.localIpPort); | ||||
|       this.isWorking = false | ||||
|       if (callback != null) { | ||||
|         callback() | ||||
|       } | ||||
|     } | ||||
|     ) | ||||
|     this.udp.close(err => { | ||||
|       if (err) { | ||||
|         console.log('UdpClientByCenter  closeUdp  failed ip:' + this.localIp + ' port:' + this.localIpPort + ' err:' + JSON.stringify(err)); | ||||
|       } else { | ||||
|         this.isWorking = false | ||||
|         if (callback != null) { | ||||
|           callback() | ||||
|         } | ||||
|         console.log('UdpClientByCenter  closeUdp  succeed ip:' + this.localIp + ' port:' + this.localIpPort); | ||||
|       } | ||||
|     }) | ||||
| @ -261,7 +257,7 @@ export default class UdpClientByCenter { | ||||
| 
 | ||||
|   //plc
 | ||||
|   onMessage_1(callback?) { | ||||
|     this.udp.on('message', value => { | ||||
|     this.udp&&this.udp.on('message', value => { | ||||
|       console.log(TAG, 'udponmessage') | ||||
|       // 收到的是ArrayBuffer 需要进行转换解析
 | ||||
|       this.plcUdpError = false | ||||
|  | ||||
| @ -35,7 +35,7 @@ export default async function request(req: any) { | ||||
|     paramsStr = paramsStr.toString(); | ||||
|     paramsStr = paramsStr.substring(0, paramsStr.length-1) | ||||
|     try { | ||||
|         let baseUrl=host?host:(globalThis.host||GlobalConfig.host) | ||||
|         let baseUrl=host?host:globalThis.host | ||||
| 
 | ||||
|         // let baseUrl=host?config.csptHost:config.host'
 | ||||
|         console.info('surenjun',baseUrl) | ||||
|  | ||||
| @ -42,7 +42,6 @@ export default class EntryAbility extends UIAbility { | ||||
|             spzd3:false, | ||||
|             spzd4:false, | ||||
|         } | ||||
|         globalThis.singlePlay=false //单机模式
 | ||||
|         globalThis.signNum=0//心跳指令编号
 | ||||
|         globalThis.lsh='0000000000000'//学员流水号
 | ||||
|         globalThis.ratio= 1700 / 960 //适配比例
 | ||||
|  | ||||
| @ -15,6 +15,7 @@ import { getliushuiNum, setliushuiNum } from '../common/service/indexService'; | ||||
| import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; | ||||
| import worker, { MessageEvents } from '@ohos.worker'; | ||||
| import promptAction from '@ohos.promptAction' | ||||
| import { voiceService } from '../common/service/voiceService'; | ||||
| 
 | ||||
| @Entry | ||||
| @Component | ||||
| @ -33,6 +34,7 @@ struct Index { | ||||
|   fileHelper = null; | ||||
|   private fileUtil: FileUtil | ||||
|   private interval = null; | ||||
|   private vocObj = null; | ||||
|   private workerInstance = null; | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
| 
 | ||||
| @ -213,6 +215,8 @@ struct Index { | ||||
|     globalThis.ratio = 1700 / 960 | ||||
|     this.angle = 0 | ||||
|     this.loading = false | ||||
|     this.vocObj = new voiceService(async (status, val, next) => { | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   async testXMLToJSONInWorker() { | ||||
| @ -224,7 +228,9 @@ struct Index { | ||||
|       shellVersion: globalThis.version, | ||||
|       paraKdid: globalThis.timeInfo?.paraKdid, | ||||
|       mode: globalThis.timeInfo?.mode, | ||||
|       context: this.context | ||||
|       context: this.context, | ||||
|       host:globalThis.host, | ||||
|       centerHost:globalThis.timeInfo.url | ||||
|     } | ||||
|     workerInstance.postMessage(param); | ||||
|     workerInstance.onmessage = (e: MessageEvents): void => { | ||||
| @ -287,6 +293,10 @@ struct Index { | ||||
|     // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) | ||||
| 
 | ||||
|     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { | ||||
|       this.vocObj.playAudio({ | ||||
|         type: 1, | ||||
|         name: 'welcome.wav' | ||||
|       }) | ||||
|       globalThis.singlePlay = false | ||||
|     } | ||||
|     this.isSingle = globalThis.singlePlay | ||||
|  | ||||
| @ -555,6 +555,7 @@ struct Index { | ||||
|   } | ||||
| 
 | ||||
|   aboutToAppear() { | ||||
|     this.ratio=globalThis.ratio | ||||
|     this.openFlag = true | ||||
|     const fileUtil = new FileUtil(this.context) | ||||
|     this.fileUtil = fileUtil | ||||
|  | ||||
| @ -308,6 +308,7 @@ export default struct SignDisplayCom { | ||||
| 
 | ||||
| 
 | ||||
|     if (showBack) { | ||||
|       this.ratio=1.4 | ||||
|       globalThis.udpClient.onMessage_1((msg) => { | ||||
|         console.log('msgmsg', msg) | ||||
|         if (msg) { | ||||
|  | ||||
| @ -1,3 +1,5 @@ | ||||
| 
 | ||||
| 
 | ||||
| { | ||||
|   "module": { | ||||
|     "name": "entry", | ||||
| @ -36,6 +38,7 @@ | ||||
|     ], | ||||
|     "requestPermissions":[ | ||||
|       {"name": "ohos.permission.CONNECTIVITY_INTERNAL"}, | ||||
|       {"name": "ohos.permission.SET_TIME"}, | ||||
|       { | ||||
|         "name": "ohos.permission.INTERNET" | ||||
|       }, | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								entry/src/main/resources/rawfile/welcome.wav
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								entry/src/main/resources/rawfile/welcome.wav
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user