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
d1c3f11e
authored
Dec 17, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
fc3973b2
613baad6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
27 deletions
store/index.ts
store/model.ts
utils/chat-info.ts
xim/xim.ts
store/index.ts
View file @
d1c3f11e
...
...
@@ -32,7 +32,7 @@ function uniqueMessages(
messages
:
NonNullable
<
ChatStore
.
STATE_CHAT_MSG_HISTORY
>
)
{
const
arr
=
[...
messages
];
return
unique
(
arr
,
function
(
item
,
all
)
{
return
unique
(
arr
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
id
===
item
.
id
);
});
}
...
...
@@ -362,7 +362,7 @@ export default {
state
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]
=
[...
current
];
}
},
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
const
setTimeoutId
:
{
[
key
:
string
]:
number
}
=
{};
return
(
state
:
ChatStoreState
,
...
...
@@ -469,7 +469,7 @@ export default {
.
sort
();
const
last
=
ts
[
ts
.
length
-
1
];
const
execute
=
()
=>
new
Promise
<
ChatType
[]
>
((
resolve
)
=>
{
new
Promise
<
ChatType
[]
>
((
resolve
,
reject
)
=>
{
Chat
.
onReady
(()
=>
{
xim
.
fetchChatListAfter
(
last
)
!
.
then
((
r
)
=>
{
const
list
=
filterActiveChats
(
...
...
@@ -483,7 +483,7 @@ export default {
);
}
resolve
(
buildUnreadMessage
(
cache
));
});
})
.
catch
(
reject
)
;
});
}).
finally
(()
=>
(
loadingChatList
=
false
));
...
...
@@ -491,7 +491,7 @@ export default {
}
const
execute
=
()
=>
new
Promise
<
ChatType
[]
>
((
resolve
)
=>
{
new
Promise
<
ChatType
[]
>
((
resolve
,
reject
)
=>
{
Chat
.
onReady
(()
=>
{
xim
.
fetchChatList
().
then
((
data
)
=>
{
if
(
!
data
)
{
...
...
@@ -506,7 +506,7 @@ export default {
dbController
.
saveChatList
(
items
);
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
items
);
resolve
(
buildUnreadMessage
(
items
));
});
})
.
catch
(
reject
)
;
});
}).
finally
(()
=>
(
loadingChatList
=
false
));
...
...
@@ -542,7 +542,7 @@ export default {
{
dispatch
},
p
:
{
chat
:
number
;
unread
:
number
}
)
{
dbController
return
dbController
.
updateChat4UnreadCount
(
p
.
chat
,
p
.
unread
)
.
then
(()
=>
dispatch
(
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
)
...
...
@@ -922,7 +922,7 @@ export default {
}
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
unique
(
newChatMembers
,
function
(
item
,
all
)
{
unique
(
newChatMembers
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
eid
===
item
.
eid
);
})
);
...
...
@@ -1179,8 +1179,8 @@ export default {
p
.
read_count
=
option
.
all
?
p
.
total_read_count
:
option
.
readed
?
option
.
readed
:
p
.
read_count
+
1
;
?
option
.
readed
:
p
.
read_count
+
1
;
}
}
}
else
{
...
...
@@ -1189,8 +1189,8 @@ export default {
p
.
read_count
=
option
.
all
?
p
.
total_read_count
:
option
.
readed
?
option
.
readed
:
p
.
read_count
+
1
;
?
option
.
readed
:
p
.
read_count
+
1
;
}
}
}
...
...
store/model.ts
View file @
d1c3f11e
...
...
@@ -387,7 +387,7 @@ export namespace ChatStore {
export
type
ACTION_UPDATE_CHAT_UNREAD_MESSAGE_COUNT
=
(
p
:
{
chat
:
number
;
unread
:
number
;
})
=>
void
;
})
=>
Promise
<
void
>
;
}
export
interface
ChatStoreState
{
...
...
utils/chat-info.ts
View file @
d1c3f11e
...
...
@@ -16,12 +16,16 @@ export async function getChatModelInfo(
)
{
const
key
=
`
${
modelName
}
-
${
id
}
`
if
(
chatInfo
[
key
]
&&
!
forceReload
)
{
return
Promise
.
resolve
({
uniplatId
:
chatInfo
[
key
].
row
.
UniplatChatId
.
value
,
chat_id
:
+
chatInfo
[
key
].
row
.
UniplatImChatId
.
value
,
uniplat_version
:
0
,
data
:
chatInfo
[
key
],
});
const
d
=
chatInfo
[
key
];
if
(
d
.
row
&&
d
.
row
.
UniplatChatId
)
{
return
Promise
.
resolve
({
uniplatId
:
d
.
row
.
UniplatChatId
.
value
,
chat_id
:
+
d
.
row
.
UniplatImChatId
.
value
,
uniplat_version
:
0
,
data
:
d
,
});
}
return
Promise
.
resolve
({
uniplatId
:
0
,
chat_id
:
0
,
uniplat_version
:
0
,
data
:
d
});
}
const
info
=
await
Chat
.
getSdk
()
.
model
(
modelName
)
...
...
@@ -29,10 +33,13 @@ export async function getChatModelInfo(
.
query
();
const
data
=
info
;
chatInfo
[
key
]
=
data
;
return
{
uniplatId
:
info
.
row
.
UniplatChatId
.
value
,
chat_id
:
Number
(
info
.
row
.
UniplatImChatId
.
value
),
uniplat_version
:
0
,
data
,
};
if
(
info
.
row
&&
info
.
row
.
UniplatChatId
)
{
return
{
uniplatId
:
info
.
row
.
UniplatChatId
.
value
,
chat_id
:
Number
(
info
.
row
.
UniplatImChatId
.
value
),
uniplat_version
:
0
,
data
,
};
}
return
{
uniplatId
:
0
,
chat_id
:
0
,
uniplat_version
:
0
,
data
,
};
}
xim/xim.ts
View file @
d1c3f11e
...
...
@@ -285,7 +285,6 @@ export class Xim {
kind
:
string
,
listener
:
ChatNotifyListener
):
this
;
public
on
(
event
:
"chat_notify"
,
listener
:
ChatNotifyListener
):
this
;
public
on
(
event
:
"status"
,
listener
:
StatusChangeListener
):
this
;
public
on
(...
args
:
any
[]):
this
{
...
...
@@ -306,7 +305,6 @@ export class Xim {
kind
:
string
,
listener
:
ChatNotifyListener
):
this
;
public
off
(
event
:
"chat_notify"
,
listener
:
ChatNotifyListener
):
this
;
public
off
(
event
:
"status"
,
listener
:
StatusChangeListener
):
this
;
public
off
(...
args
:
any
[]):
this
{
...
...
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