Commit 20e30833 by Sixong.Zhu

update

parent 4ea0d9d8
......@@ -16,6 +16,7 @@ import { GeneralOrderDirection } from "../model/order-product";
class OrderService {
public readonly generalOrder = "general_order_info";
public readonly generalOrderPaymentModel = "general_order_payment_info";
public readonly generalOrderDefaultDetailName = 'userOrderDetail';
private readonly commentModel = "uniplat_model_remark@general_order";
private readonly fileModel = "general_order_payment_file_info";
......
......@@ -862,7 +862,7 @@ export default {
await getChatModelInfo(
wantedChatRoom.model_name,
wantedChatRoom.obj_id,
Chat.isBackend() ? wantedChatRoom.detail_name : ''
wantedChatRoom.detail_name
)
.then((info) => {
commit(
......@@ -966,7 +966,7 @@ export default {
await getChatModelInfo(
firstChat.model_name,
firstChat.obj_id,
Chat.isBackend() ? firstChat.detail_name : ''
firstChat.detail_name
);
await dispatch(
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION,
......
import Chat from "../xim";
import { orderService } from '../service/order';
export type ChatInfo = {
[eid: string]: any;
......@@ -18,14 +19,28 @@ export interface ChatModelInfoData {
data: any;
}
const model2DetailNameMapping = new Map<string, string>();
function buildCache() {
if (!model2DetailNameMapping.size) {
// 用户端默认不使用chat内置的detailName(这个专属于服务端),所以这里加一层内置转换
if (!Chat.isBackend()) {
model2DetailNameMapping.set(orderService.generalOrder, orderService.generalOrderDefaultDetailName);
}
}
}
export async function getChatModelInfo(
modelName: string,
id: string | number,
detailname?: string,
forceReload = false
) {
buildCache();
const key = `${modelName}-${id}`;
const detail = detailname ? model2DetailNameMapping.get(modelName) || detailname : detailname;
if (loadingKeys.has(key)) {
return new Promise<ChatModelInfoData>((resolve) =>
waitingAction.push({ key, resolve })
......@@ -53,7 +68,7 @@ export async function getChatModelInfo(
loadingKeys.add(key);
const info = await Chat.getSdk()
.model(modelName)
.detail(id + "", detailname)
.detail(id + "", detail)
.query();
const data = info;
chatInfo[key] = data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment