From e4f8d71b6e8d9613a98c1f3a676a939c9d196f2b Mon Sep 17 00:00:00 2001 From: xuqm Date: Thu, 27 Mar 2025 19:11:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(hospital):=20=E6=B7=BB=E5=8A=A0=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=BA=91=E8=87=AA=E5=AE=9A=E4=B9=89=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在发送文本消息时添加云自定义数据,包含医生和患者信息 - 更新 HosImManager 类,增加 sendTextMessage 和 addCloudCustomData 方法 - 修改 HosChatView 中发送消息的逻辑,传入患者信息 - 优化 ImManage 中的 IM状态变更日志 - 在 ToolsHelper 中添加 stringToArrayBuffer 方法,用于字符串和 ArrayBuffer 的转换 --- src/main/ets/utils/ToolsHelper.ets | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/ets/utils/ToolsHelper.ets b/src/main/ets/utils/ToolsHelper.ets index 20600ba..b7a8e53 100644 --- a/src/main/ets/utils/ToolsHelper.ets +++ b/src/main/ets/utils/ToolsHelper.ets @@ -1,6 +1,6 @@ import promptAction from '@ohos.promptAction'; import { BusinessError, deviceInfo } from '@kit.BasicServicesKit'; -import { HashMap, util } from '@kit.ArkTS'; +import { buffer, HashMap, util } from '@kit.ArkTS'; import { DeviceInfo } from '../bean/DeviceInfo'; import { common } from '@kit.AbilityKit'; import { md5_hex } from '../util/md5'; @@ -433,6 +433,11 @@ export class ToolsHelper { return decoder.decodeToString(new Uint8Array(arrayBuffer)) } + static stringToArrayBuffer(str: string): ArrayBuffer { + let buf = buffer.from(str, 'utf-8'); // 使用 UTF-8 编码 + return buf.buffer; + } + private static setTimeOutMap: Map = new Map() private static uniqueIdMap = new WeakMap();