refactor(hospital): 重构消息相关代码

- 修改 ApiConfig 文件,添加分号
- 重命名 ConversationBean 中的属性,首字母大写
- 移除 HosConversationVIew 中的 onLoadMore 方法
- 新增 MessageHelper工具类,用于解析和处理消息
- 优化 HttpHelper 中的 response 处理逻辑
- 在 ToolsHelper 中添加 toString 方法,用于处理 ArrayBuffer
这个提交包含在:
徐勤民 2025-03-10 16:42:44 +08:00
父节点 376d9a5fd0
当前提交 920d33e8a4
共有 2 个文件被更改,包括 11 次插入2 次删除

查看文件

@ -272,7 +272,12 @@ export class HttpHelper {
this.httpHandlerList.length) this.httpHandlerList.length)
} }
if (data.responseCode === 200) { if (data.responseCode === 200) {
resolve((typeof data.result === 'string' ? JSON.parse(data.result) : data.result) as T)
if (typeof data.result === 'string') {
resolve(JSON.parse(data.result) as T)
}else{
resolve(data.result as T)
}
} else { } else {
const err: Error = new Error() const err: Error = new Error()
err.name = data.responseCode.toString() err.name = data.responseCode.toString()

查看文件

@ -1,6 +1,6 @@
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; import { BusinessError, deviceInfo } from '@kit.BasicServicesKit';
import { HashMap } from '@kit.ArkTS'; import { buffer, HashMap } from '@kit.ArkTS';
import { DeviceInfo } from '../bean/DeviceInfo'; import { DeviceInfo } from '../bean/DeviceInfo';
import { common } from '@kit.AbilityKit'; import { common } from '@kit.AbilityKit';
import { md5_hex } from '../util/md5'; import { md5_hex } from '../util/md5';
@ -389,6 +389,10 @@ export class ToolsHelper {
} }
static toString(arrayBuffer: ArrayBuffer) {
return buffer.from(arrayBuffer).toString('base64')
}
private static setTimeOutMap: Map<string, ThrottleInterface> = new Map() private static setTimeOutMap: Map<string, ThrottleInterface> = new Map()
private static uniqueIdMap = new WeakMap<Function, string>(); private static uniqueIdMap = new WeakMap<Function, string>();