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
d5af68b7
authored
Jul 15, 2021
by
panjiangyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
token接入
parent
f5dd8918
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
19 deletions
model/index.ts
xim/index.ts
xim/xim.ts
model/index.ts
View file @
d5af68b7
...
@@ -31,14 +31,6 @@ export type TokenStringGetter = () => Promise<string>
...
@@ -31,14 +31,6 @@ export type TokenStringGetter = () => Promise<string>
export
interface
ChatOption
{
export
interface
ChatOption
{
/**
/**
* 企业token [商户端使用,用户端和移动端不需要]
*/
enterpriseTokenString
?:
TokenStringGetter
;
/**
* 个人token
*/
userTokenString
:
TokenStringGetter
;
/**
* 长链接chat sdk地址
* 长链接chat sdk地址
*/
*/
webSocketUri
:
string
;
webSocketUri
:
string
;
...
@@ -46,8 +38,6 @@ export interface ChatOption {
...
@@ -46,8 +38,6 @@ export interface ChatOption {
sdk
:
()
=>
UniplatSdk
;
sdk
:
()
=>
UniplatSdk
;
orgId
:
()
=>
string
|
number
;
orgId
:
()
=>
string
|
number
;
logger
?:
ChatServiceLogger
;
}
}
export
interface
ChatServiceLogger
{
export
interface
ChatServiceLogger
{
...
...
xim/index.ts
View file @
d5af68b7
...
@@ -21,9 +21,7 @@ class Chat {
...
@@ -21,9 +21,7 @@ class Chat {
if
(
!
option
)
{
if
(
!
option
)
{
throw
new
Error
(
`You must specify a chat option for chat service`
);
throw
new
Error
(
`You must specify a chat option for chat service`
);
}
}
// if (!option.userTokenString) {
// throw new Error(`You must specify a user token for chat service`)
// }
if
(
!
option
.
webSocketUri
)
{
if
(
!
option
.
webSocketUri
)
{
throw
new
Error
(
throw
new
Error
(
`You must specify a web socket address for chat service`
`You must specify a web socket address for chat service`
...
@@ -32,12 +30,8 @@ class Chat {
...
@@ -32,12 +30,8 @@ class Chat {
this
.
_sdk
=
option
.
sdk
;
this
.
_sdk
=
option
.
sdk
;
this
.
_orgId
=
option
.
orgId
;
this
.
_orgId
=
option
.
orgId
;
// if (option.enterpriseTokenString) {
this
.
token
=
async
()
=>
option
.
sdk
().
global
.
jwtToken
;
// this.token = option.enterpriseTokenString
// } else {
this
.
token
=
option
.
userTokenString
;
tokenManager
.
save
(
this
.
token
);
tokenManager
.
save
(
this
.
token
);
// }
EmojiService
.
raiseOnReady
(
this
.
token
);
EmojiService
.
raiseOnReady
(
this
.
token
);
return
this
.
initChatSdk
(
option
.
webSocketUri
);
return
this
.
initChatSdk
(
option
.
webSocketUri
);
...
...
xim/xim.ts
View file @
d5af68b7
...
@@ -146,7 +146,7 @@ export class Xim {
...
@@ -146,7 +146,7 @@ export class Xim {
):
Promise
<
Message
[]
>
{
):
Promise
<
Message
[]
>
{
this
.
checkConnected
();
this
.
checkConnected
();
if
(
this
.
client
==
null
)
{
if
(
this
.
client
==
null
)
{
throw
new
Error
(
"client shouldn't undefined"
)
throw
new
Error
(
"client shouldn't undefined"
)
;
};
};
const
res
=
await
this
.
client
.
fetchChatMsgs
(
chatType
,
chatId
,
{
const
res
=
await
this
.
client
.
fetchChatMsgs
(
chatType
,
chatId
,
{
lid
,
lid
,
...
...
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