Commit c00baca9 by Sixong.Zhu

id to string

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