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
ccd1ce05
authored
Oct 14, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update data contact
parent
2dd1a102
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
73 deletions
components/chat-list-model.vue
components/controller/chat-list.ts
components/workflow.vue
database/index.ts
model/index.ts
store/index.ts
xim/models/chat.ts
components/chat-list-model.vue
View file @
ccd1ce05
...
...
@@ -212,11 +212,8 @@ export default class ModelChatList extends Vue {
return
{
id
:
it
.
id
.
value
,
chat_id
:
it
.
ImChatId
.
value
,
business_data
:
{
model_name
:
it
.
ModelName
.
value
,
obj_id
:
it
.
ObjId
.
value
,
detail_name
:
""
,
},
last_msg_sender
:
it
.
LastSpeakUid
.
value
,
last_msg_content
:
it
.
LastMsgContent
.
value
,
last_msg_ts
:
it
.
LastMsgTime
.
value
,
...
...
@@ -294,8 +291,8 @@ export default class ModelChatList extends Vue {
private
async
goToChatRoom
(
data
:
ChatType
)
{
await
this
.
_createChat
({
modelName
:
data
.
business_data
.
model_name
,
selectedListId
:
data
.
business_data
.
obj_id
,
modelName
:
data
.
model_name
,
selectedListId
:
data
.
obj_id
,
uids
:
[],
showByPage
:
true
,
});
...
...
@@ -344,10 +341,9 @@ export default class ModelChatList extends Vue {
const
length
=
chats
.
length
;
let
count
=
0
;
chats
.
forEach
((
chat
)
=>
{
const
{
model_name
,
obj_id
}
=
chat
.
business_data
;
this
.
sdk
.
model
(
model_name
)
.
chat
(
+
obj_id
,
this
.
global
.
org
.
id
.
toString
())
.
model
(
chat
.
model_name
)
.
chat
(
+
chat
.
obj_id
,
this
.
global
.
org
.
id
.
toString
())
.
startChat
()
.
finally
(()
=>
{
count
++
;
...
...
components/controller/chat-list.ts
View file @
ccd1ce05
...
...
@@ -63,7 +63,8 @@ export default class ChatList extends Vue {
id
:
data
.
last_msg_sender
,
name
:
userInfo
.
row
.
first_name
.
display
as
string
,
});
});
})
.
catch
(()
=>
{});
}
}
if
(
data
.
last_msg_content
===
""
)
{
...
...
components/workflow.vue
View file @
ccd1ce05
...
...
@@ -76,16 +76,12 @@ export default class WorkFlow extends Vue {
private
readonly
startProcessIns
!
:
startProcessDialog
;
@
Prop
({
type
:
String
,
required
:
true
,
})
private
readonly
model_name
!
:
string
;
@
Prop
({
type
:
String
,
required
:
true
,
})
private
readonly
id
!
:
string
;
@
Prop
({
required
:
true
})
private
readonly
id
!
:
string
|
number
;
@
Prop
({
type
:
String
,
...
...
database/index.ts
View file @
ccd1ce05
...
...
@@ -8,14 +8,18 @@ class ChatCacheDatabaseController {
private
readonly
messageDatabases
=
new
Map
<
string
,
IDBDatabase
>
();
private
uid
=
""
;
private
readonly
version
=
1
;
private
readonly
listVersion
=
1
;
private
readonly
msgVersion
=
1
;
private
readonly
chatListKey
=
"chat-list"
;
private
readonly
chatMessageKey
=
"chat-message"
;
public
setup
(
uid
:
string
)
{
return
new
Promise
<
void
>
((
resolve
)
=>
{
if
(
uid
&&
indexedDB
)
{
const
r
=
indexedDB
.
open
((
this
.
uid
=
uid
),
this
.
version
);
const
r
=
indexedDB
.
open
(
"u-"
+
(
this
.
uid
=
uid
),
this
.
listVersion
);
// eslint-disable-next-line @typescript-eslint/no-this-alias
const
that
=
this
;
const
setupDb
=
()
=>
{
...
...
@@ -56,7 +60,7 @@ class ChatCacheDatabaseController {
if
(
!
t
)
{
return
new
Promise
<
void
>
((
resolve
)
=>
{
if
(
this
.
uid
&&
indexedDB
)
{
const
r
=
indexedDB
.
open
(
k
,
this
.
v
ersion
);
const
r
=
indexedDB
.
open
(
k
,
this
.
msgV
ersion
);
// eslint-disable-next-line @typescript-eslint/no-this-alias
const
that
=
this
;
const
setupDb
=
()
=>
{
...
...
model/index.ts
View file @
ccd1ce05
...
...
@@ -160,22 +160,19 @@ export interface BaseChatItem {
last_msg_ts
:
number
;
members_updated
:
number
;
user_updated
:
number
;
model_name
:
string
;
obj_id
:
string
;
}
export
interface
RawChatItem
extends
BaseChatItem
{
ext
:
string
;
business_data
:
string
;
last_msg_content
:
string
;
business_data
?:
string
;
}
export
interface
TransferedChatItem
extends
BaseChatItem
{
chat_id
:
number
;
ext
:
string
;
business_data
:
{
detail_name
:
string
;
model_name
:
string
;
obj_id
:
string
;
};
last_msg_content
:
{
text
?:
string
};
}
...
...
store/index.ts
View file @
ccd1ce05
...
...
@@ -75,18 +75,15 @@ async function preCacheImgs(msgs: any[]) {
}
function
buildChatItem
(
chat
:
RawChatItem
)
{
let
business_data
;
if
(
chat
.
business_data
)
{
business_data
=
JSON
.
parse
(
chat
.
business_data
);
}
if
(
business_data
?.
model_name
==
null
)
{
business_data
=
null
;
if
(
!
chat
.
model_name
&&
chat
.
business_data
)
{
const
b
=
JSON
.
parse
(
chat
.
business_data
)
as
{
model_name
:
string
;
obj_id
:
string
;
};
chat
.
model_name
=
b
.
model_name
;
b
.
obj_id
&&
(
chat
.
obj_id
=
b
.
obj_id
);
}
return
{
...
chat
,
chat_id
:
chat
.
id
,
business_data
,
}
as
ChatType
;
return
{
...
chat
,
chat_id
:
chat
.
id
}
as
ChatType
;
}
const
filterActiveChats
=
(
items
:
RawChatItem
[])
=>
{
...
...
@@ -485,13 +482,11 @@ export default {
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
];
if
(
uniplatId
==
null
)
return
;
try
{
const
{
business_data
}
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
data
=
await
sdk
()
.
model
(
business_data
.
model_name
)
.
chat
(
Number
(
business_data
.
obj_id
),
orgId
())
.
model
(
chat
.
model_name
)
.
chat
(
Number
(
chat
.
obj_id
),
orgId
())
.
sendMsg
(
params
.
msgType
,
params
.
msg
);
await
dispatch
(
ChatStore
.
ACTION_GET_FRESH_MESSAGE
);
return
data
;
}
catch
(
error
)
{
...
...
@@ -616,29 +611,15 @@ export default {
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]?.
list
??
[];
let
wantedChatRoom
=
chatList
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
if
(
wantedChatRoom
==
null
||
wantedChatRoom
.
business_data
==
null
)
{
if
(
!
wantedChatRoom
)
{
const
data
=
await
xim
.
fetchChat
(
chatId
);
if
(
!
data
)
{
return
;
}
const
chat
=
data
.
args
[
0
];
let
business_data
;
if
(
chat
.
business_data
)
{
business_data
=
JSON
.
parse
(
chat
.
business_data
);
}
if
(
business_data
?.
model_name
==
null
)
{
business_data
=
null
;
}
if
(
!
business_data
)
{
return
;
}
wantedChatRoom
=
{
...
chat
,
chat_id
:
chat
.
id
,
business_data
,
}
as
ChatType
;
commit
(
ChatStore
.
MUTATION_SAVE_SINGLE_CHAT
,
wantedChatRoom
);
}
else
{
...
...
@@ -654,9 +635,8 @@ export default {
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_ID
,
chatId
);
await
getChatModelInfo
(
wantedChatRoom
.
business_data
.
model_name
,
wantedChatRoom
.
business_data
.
obj_id
,
wantedChatRoom
.
business_data
.
detail_name
wantedChatRoom
.
model_name
,
wantedChatRoom
.
obj_id
)
.
then
((
info
)
=>
{
commit
(
...
...
@@ -753,10 +733,7 @@ export default {
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
const
firstChat
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]?.
list
[
0
];
if
(
firstChat
==
null
)
return
;
await
getChatModelInfo
(
firstChat
.
business_data
.
model_name
,
firstChat
.
business_data
.
obj_id
);
await
getChatModelInfo
(
firstChat
.
model_name
,
firstChat
.
obj_id
);
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
firstChat
.
chat_id
...
...
@@ -765,7 +742,7 @@ 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
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
().
model
(
model_name
).
chat
(
obj_id
,
orgId
()).
startChat
();
...
...
@@ -775,7 +752,7 @@ export default {
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
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
().
model
(
model_name
).
chat
(
obj_id
,
orgId
()).
finishChat
();
...
...
@@ -785,7 +762,7 @@ export default {
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
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
().
model
(
model_name
).
chat
(
obj_id
,
orgId
()).
userExitChat
();
...
...
@@ -795,7 +772,7 @@ export default {
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
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
().
model
(
model_name
).
chat
(
obj_id
,
orgId
()).
csExitChat
();
...
...
@@ -808,7 +785,7 @@ export default {
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
if
(
currentChat
==
null
)
return
;
const
{
model_name
,
obj_id
}
=
currentChat
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
()
...
...
@@ -824,7 +801,7 @@ export default {
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
if
(
currentChat
==
null
)
return
;
const
{
model_name
,
obj_id
}
=
currentChat
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
()
...
...
@@ -840,7 +817,7 @@ export default {
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
if
(
currentChat
==
null
)
return
;
const
{
model_name
,
obj_id
}
=
currentChat
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
()
...
...
@@ -856,7 +833,7 @@ export default {
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
if
(
currentChat
==
null
)
return
;
const
{
model_name
,
obj_id
}
=
currentChat
.
business_data
;
const
{
model_name
,
obj_id
}
=
currentChat
;
if
(
model_name
==
null
)
return
;
if
(
obj_id
==
null
)
return
;
await
sdk
()
...
...
xim/models/chat.ts
View file @
ccd1ce05
...
...
@@ -23,11 +23,8 @@ export interface Chat {
last_msg_sender
:
string
;
last_msg_content
:
string
;
last_msg_type
:
string
;
business_data
:
{
model_name
:
string
;
obj_id
:
string
;
detail_name
:
string
;
};
is_finish
:
boolean
;
is_deleted
:
boolean
;
is_remove
:
boolean
;
...
...
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