Commit c00baca9 by Sixong.Zhu

id to string

parent 6307c231
Showing with 76 additions and 52 deletions
......@@ -156,7 +156,7 @@ export default {
state,
id: ChatStore.STATE_CHAT_CURRENT_CHAT_ID
) {
state[ChatStore.STATE_CHAT_CURRENT_CHAT_ID] = Number(id);
state[ChatStore.STATE_CHAT_CURRENT_CHAT_ID] = id;
},
[ChatStore.MUTATION_CLEAR_CURRENT_CHAT_VERSION](state) {
state[ChatStore.STATE_CHAT_CURRENT_CHAT_VERSION] = null;
......@@ -488,7 +488,7 @@ export default {
const chat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
const data = await Chat.getSdk()
.model(chat.model_name)
.chat(Number(chat.obj_id), orgId())
.chat(chat.obj_id, orgId())
.sendMsg(params.msgType, params.msg);
await dispatch(ChatStore.ACTION_GET_FRESH_MESSAGE);
return data;
......@@ -528,7 +528,7 @@ export default {
.model(params.modelName)
.chat(params.selectedListId, orgId())
.createChat();
const chatId = Number(imChatId);
const chatId = +imChatId;
await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
commit(ChatStore.MUTATION_SHOW_CHAT, !params.showByPage);
await dispatch(
......@@ -545,7 +545,7 @@ export default {
.model(params.modelName)
.chat(params.selectedListId, orgId())
.createChat(true);
const chatId = Number(imChatId);
const chatId = +imChatId;
await commit(ChatStore.MUTATION_SHOW_CHAT, true);
await dispatch(
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION,
......@@ -746,49 +746,61 @@ export default {
},
async [ChatStore.ACTION_CHAT_START_RECEPTION]({ getters, dispatch }) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.startChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
async [ChatStore.ACTION_CHAT_FINISH_RECEPTION]({ getters, dispatch }) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.finishChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
async [ChatStore.ACTION_CHAT_USER_EXIT]({ getters, dispatch }) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.userExitChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
async [ChatStore.ACTION_CHAT_CS_EXIT]({ getters, dispatch }) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.csExitChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
......@@ -797,13 +809,16 @@ export default {
uids: Parameters<ChatStore.ACTION_CHAT_ADD_MEMBERS>[0]
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.addMember(uids.map((id) => Number(id)))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
......@@ -812,13 +827,16 @@ export default {
uids: Parameters<ChatStore.ACTION_CHAT_REMOVE_MEMBER>[0]
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.removeMember(uids.map((id) => Number(id)))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
......@@ -827,13 +845,16 @@ export default {
uids: Parameters<ChatStore.ACTION_CHAT_ADD_CS>[0]
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.addCs(uids.map((id) => Number(id)))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
......@@ -842,13 +863,16 @@ export default {
uids: Parameters<ChatStore.ACTION_CHAT_REMOVE_CS>[0]
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat;
if (model_name == null) return;
if (obj_id == null) return;
if (
!currentChat ||
!currentChat.model_name ||
!currentChat.obj_id
) {
return Promise.reject();
}
return await Chat.getSdk()
.model(model_name)
.chat(obj_id, orgId())
.model(currentChat.model_name)
.chat(currentChat.obj_id, orgId())
.removeCs(uids.map((id) => Number(id)))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
},
......
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