### T24XA921 可视柜台终端轻量化_日志上传优化
#### 改了什么
- 解决日志乱码问题
  - 原因：乱码示例-------比如全空字符 0xcd 0xcd 0xcd 0xcd,中文两个0xcd 0xcd 则合并为一个屯，如果一个0xcd则会跟后面的\组成一个新的字，导致json不合法，引发上传失败。
  - 解决方案：一个包有最多12条日志，如果上传失败，则拆分成单条，再送一次。如果单条上送失败，可以确定为乱码，则用base64加密ResultMsg字段后上传。
  - 即使最后失败了，也不存数据库，直接删除。
  - 有优化告警部分的日志记录，只有乱码的数据，discard_forRTI1002才会累加。Warn: {checkUrlActive::GetSendLogInfo, TS_Suc:2992, TU_Suc:20, BS_Suc:0, BU_Suc:1, beidou_Suc:32, TS_Err:2571, TU_Err:0, BS_Err:0, BU_Err:0, beidou_Err:0, discard_forFull:0, discard_forRTI1002:443, curNum:1266}(sc=0xF02, uc=0x10F00204)
- 解决最后实体最后一部分日志未能上传问题。
  - 原因：实体有一个线程一直发日志给spshell，只要spshell收到和存到数据库，则不存在丢失的可能。
  - 该线程在无日志的情况下，大约100ms触发一次。因为实体crash时，日志会产生好几条，并立刻关闭实体，导致没法送到spshell。
  - 解决方案：
    - （1）在实体crash时，不关闭实体，而是先发送全部日志后，再关闭实体。
    - （2）由线程定时触发，改成信号触发方式，只要有新日志，就能触发日志发送。

#### 建议的关注的测试范围
- 日志乱码部分是否加密上传成功，可通过可视柜台运维系统查看
- 实体crash时最后的日志是否上传，可以kill实体。观察本地日志和日志平台上是否一致。
- 观察内存和cpu占用情况，不会明显提升。（主要为spshell，内存不会长时间增长不下落， cpu部分除启动时，一般不超过5%）

#### 个人使用的辅助测试的工具
- 集中配置项Chromium	WebMask_RVC.Stand2S	main|ad|with_min|with_debugmode|with_magic|with_media|with_LinkLog|with_specialTest
- 会每100ms生成一条日志， 会生成n个0xcd的日志，会间隔的产生乱码数据。相当于200ms产生一条脏数据。
- 默认可视日志如下(因未去重，可能会看到多条一致的，后续可视柜台运维系统会处理这个问题)
- {"CmptId":"LR04.02","CmptName":"RVCTerminalPlus","LogFile":"SI","EvenTime":"2025-01-03 16:32:25.677","CostTime":0,"VtmUuid":"03e52bde68a74f1c8b0371694bd4df2b","Version":"1.0","DateTime":"2025-01-03 16:32:25.677","ResultCode":"SUC0000","LogCode":"","API":"dirty_logs","TipMsg":"","BussID":"","SourceType":"","ResultMsg":"1792屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯","TraceID":"","Item":"1","EntityName":"mod_chromium","LifeID":196,"TimeSn":2053,"ServName":"7555980277","TerminalNo":"7555980277","SN":"7.5.1.1","ClientIP":"172.31.224.1"}

### T25BL501 可视柜台web扩展增强_ws安全交互实现
#### 改了什么
- （1）计划js层websocket连接，使用加密websocket连接，并包含对应标签，以跟原业务区别。
- （2）计划js层接口，拟全部采用新的交互数据接口，预估会影响到Request、RequestAck、Event、Info类型的数据
  - 使用{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}包装参数字段
- （3）对于js层接口，返回值规范为errorCode+errorMsg, errorCode对应为终端的rtaCode，errorMsg对应格式为"[RTAxxxx] 描述话术"

#### 如何检查交互结果
- 对于（1），在上传日志中有体现和关联，具体会影响以下类型的日志，"ws_build"  "ws_beginSession"  "ws_close"  "ws_info"  "ws_register"  "ws_request"  "ws_setvar"  "ws_getvar"  "ws_broadcast"  "vtm_endsession"  "vtm_requestAck"  "vtm_event"  "vtm_sessionAck"  "ws_logEvent"  "ws_logWarn"  "entity_onlog"  "entity_begin"  "entity_openPage"  "entity_stageChange"  "entity_status" 
  - 例如， {"78173721_logType":"ws_build","detail":{**"isSecurity":"ws_sm2"**,**"url":"ws://127.0.0.1:9003/?name=safe_client"**},"hdl":150712200,**"name":"safe_client"**,"threadId":26656,"timestamp":"2025-01-23 11:32:23.276"}
- 针对（2），返回给业务层时会有体现，例如：
  - {"messageType":4,"sessionID":1121827250,"transID":1,"isEnd":1,"errorCode":0,"errorMsg":"","{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}":"{\"result\":98,\"additionalMsg\":\"\"}"}
  - 非安全连接返回时，result、additionalMsg在第一层和第二层都会出现
  - 安全连接返回时，reuslt、additionalMsg只在第二层出现
- 针对（3），返回给业务层时会有体现，例如：
  - 非安全连接返回时，有errorCode、userCode、vtmCode、errorMsg，其中errorCode为数值
  - 安全连接返回时，有errorCode、errorMsg，其中errorCode为字符串

#### 选用的request、requestAck、event接口
- request、info、event的默认参数为"transID", "sessionID", "methodID", "signature", "timeout" ,"messageType","class","entity","methodID"，实体参数不应于上面参数重复
  - 可选择的接口PinPad::GetInputJS
  ```
  <twoway name="GetInputJS" overlap="true" jsflag="true" method_id="4">
			<req>
				<!-- 调用超时时间 -->
				<param name="timeout" type="int" />
				<!-- 账号（卡号） -->
				<param name="account" type="string" />
			</req>
			<res>
				<!--获取的密文 -->
				<param name="data" type="string" />
				<!--终端号 -->
				<param name="deviceno" type="string" />
				<!--密钥序号 -->
				<param name="keyseq" type="string" />
				<!--密钥校验码 -->
				<param name="checkcode" type="string" />
			</res>			
		</twoway>
  ```
- requestAck默认参数有"messageType", "sessionID", "transID", "isEnd", "errorCode", "errorMsg"，实体参数不应与上面参数重复
  - 选择的接口InteractiveControl::StartRemoteRecord
  - 
  ```
  <twoway name="StartRemoteRecord" overlap="true">
			<req>
				<param name="VideoName" type="wstring"/>
			</req>
			<res>
				<param name="ErrorCode" type="uint"/>
				<param name="ErrorMsg" type="wstring"/>
			</res>
		</twoway>
  ```


### 测试方法说明
（1）目前硬件模拟器中并不好模拟GPIO的脏数据，还是选用chromium中集中配置参数的方式验证，可设置
- 集中配置项Chromium	WebMask_RVC.Stand2S	main|ad|with_min|with_debugmode|with_magic|with_media|with_specialTest，即可200ms产生一条脏数据
（2）关于生成大量的交互日志，可使用硬件模拟器产生，任意当前可用接口，连续调用就行。
（3）硬件模拟器暂不支持加密，王洁说后续他开发支持。当前测试版本我会提供测试工具验证，预估今天下午提供