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
20e30833
authored
Dec 28, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
4ea0d9d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
service/order.ts
store/index.ts
utils/chat-info.ts
service/order.ts
View file @
20e30833
...
...
@@ -16,6 +16,7 @@ import { GeneralOrderDirection } from "../model/order-product";
class
OrderService
{
public
readonly
generalOrder
=
"general_order_info"
;
public
readonly
generalOrderPaymentModel
=
"general_order_payment_info"
;
public
readonly
generalOrderDefaultDetailName
=
'userOrderDetail'
;
private
readonly
commentModel
=
"uniplat_model_remark@general_order"
;
private
readonly
fileModel
=
"general_order_payment_file_info"
;
...
...
store/index.ts
View file @
20e30833
...
...
@@ -862,7 +862,7 @@ export default {
await
getChatModelInfo
(
wantedChatRoom
.
model_name
,
wantedChatRoom
.
obj_id
,
Chat
.
isBackend
()
?
wantedChatRoom
.
detail_name
:
''
wantedChatRoom
.
detail_name
)
.
then
((
info
)
=>
{
commit
(
...
...
@@ -966,7 +966,7 @@ export default {
await
getChatModelInfo
(
firstChat
.
model_name
,
firstChat
.
obj_id
,
Chat
.
isBackend
()
?
firstChat
.
detail_name
:
''
firstChat
.
detail_name
);
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
...
...
utils/chat-info.ts
View file @
20e30833
import
Chat
from
"../xim"
;
import
{
orderService
}
from
'../service/order'
;
export
type
ChatInfo
=
{
[
eid
:
string
]:
any
;
...
...
@@ -18,14 +19,28 @@ export interface ChatModelInfoData {
data
:
any
;
}
const
model2DetailNameMapping
=
new
Map
<
string
,
string
>
();
function
buildCache
()
{
if
(
!
model2DetailNameMapping
.
size
)
{
// 用户端默认不使用chat内置的detailName(这个专属于服务端),所以这里加一层内置转换
if
(
!
Chat
.
isBackend
())
{
model2DetailNameMapping
.
set
(
orderService
.
generalOrder
,
orderService
.
generalOrderDefaultDetailName
);
}
}
}
export
async
function
getChatModelInfo
(
modelName
:
string
,
id
:
string
|
number
,
detailname
?:
string
,
forceReload
=
false
)
{
buildCache
();
const
key
=
`
${
modelName
}
-
${
id
}
`
;
const
detail
=
detailname
?
model2DetailNameMapping
.
get
(
modelName
)
||
detailname
:
detailname
;
if
(
loadingKeys
.
has
(
key
))
{
return
new
Promise
<
ChatModelInfoData
>
((
resolve
)
=>
waitingAction
.
push
({
key
,
resolve
})
...
...
@@ -53,7 +68,7 @@ export async function getChatModelInfo(
loadingKeys
.
add
(
key
);
const
info
=
await
Chat
.
getSdk
()
.
model
(
modelName
)
.
detail
(
id
+
""
,
detail
name
)
.
detail
(
id
+
""
,
detail
)
.
query
();
const
data
=
info
;
chatInfo
[
key
]
=
data
;
...
...
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