Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e7cdb23f
authored
Nov 05, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update for detail name
parent
a33fdcc0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
model/index.ts
store/index.ts
xim/models/chat.ts
model/index.ts
View file @
e7cdb23f
...
...
@@ -100,7 +100,7 @@ export const enum MessageType {
Withdraw
=
"withdraw"
,
MyPurchasePlan
=
"my_purchase_plan"
,
MyWelfare
=
"my_welfare"
,
QuestionAnswer
=
"question_answer"
QuestionAnswer
=
"question_answer"
,
}
export
const
enum
MessageHandled
{
...
...
@@ -137,6 +137,7 @@ export type MessageRequestResult = readonly Message[];
export
interface
BaseChatItemBusinessData
{
model_name
:
string
;
obj_id
:
string
;
detail_name
?:
string
;
}
export
interface
BaseChatItem
extends
BaseChatItemBusinessData
{
...
...
store/index.ts
View file @
e7cdb23f
...
...
@@ -83,10 +83,17 @@ async function preCacheImgs(msgs?: any[]) {
}
function
buildChatItem
(
chat
:
RawChatItem
)
{
if
(
!
chat
.
model_name
&&
chat
.
business_data
)
{
if
(
chat
.
business_data
)
{
const
b
=
JSON
.
parse
(
chat
.
business_data
)
as
BaseChatItemBusinessData
;
chat
.
model_name
=
b
.
model_name
;
b
.
obj_id
&&
(
chat
.
obj_id
=
b
.
obj_id
);
if
(
!
chat
.
model_name
)
{
chat
.
model_name
=
b
.
model_name
;
b
.
obj_id
&&
(
chat
.
obj_id
=
b
.
obj_id
);
}
b
.
detail_name
&&
!
chat
.
detail_name
&&
(
chat
.
detail_name
=
b
.
detail_name
);
}
return
{
...
chat
,
chat_id
:
chat
.
id
}
as
ChatType
;
}
...
...
@@ -386,6 +393,25 @@ export default {
async
[
ChatStore
.
ACTION_GET_MY_CHAT_LIST
]({
commit
,
state
})
{
let
cache
=
await
dbController
.
getChatList
();
for
(
const
item
of
cache
)
{
if
(
item
.
business_data
&&
!
item
.
detail_name
)
{
const
d
=
JSON
.
parse
(
item
.
business_data
)
as
BaseChatItemBusinessData
;
if
(
d
)
{
if
(
d
.
detail_name
)
{
item
.
detail_name
=
d
.
detail_name
;
}
if
(
!
item
.
obj_id
&&
d
.
obj_id
)
{
item
.
obj_id
=
d
.
obj_id
;
}
if
(
!
item
.
model_name
&&
d
.
model_name
)
{
item
.
model_name
=
d
.
model_name
;
}
}
}
}
const
buildUnreadMessage
=
(
items
:
ChatType
[])
=>
{
let
sum
=
0
;
items
.
forEach
((
i
)
=>
(
sum
+=
i
.
unread_msg_count
));
...
...
@@ -923,7 +949,10 @@ export default {
return
await
Chat
.
getSdk
()
.
model
(
currentChat
.
model_name
)
.
chat
(
currentChat
.
obj_id
,
orgId
())
.
addMember
(
uids
.
map
((
id
)
=>
+
id
),
-
30
)
.
addMember
(
uids
.
map
((
id
)
=>
+
id
),
-
30
)
.
finally
(()
=>
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
));
},
async
[
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
](
...
...
xim/models/chat.ts
View file @
e7cdb23f
...
...
@@ -47,6 +47,8 @@ export interface Chat {
chat_id
:
number
;
catalog
:
string
;
biz_type_id
:
number
;
business_data
?:
string
;
detail_name
?:
string
;
}
export
interface
Message
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment