Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
56db439e
Commit
56db439e
authored
Jun 07, 2022
by
Shadow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发消息给客服不受限制
parent
52bd0556
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
11 deletions
+40
-11
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
+40
-11
No files found.
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
View file @
56db439e
...
...
@@ -13,6 +13,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
...
...
@@ -365,16 +366,54 @@ public class NormalChatAction {
private
boolean
friend
(
String
reqId
,
ImClient
imClientSender
,
Long
conversationId
,
List
<
ImConversationMembers
>
membersList
,
Channel
channel
)
{
String
meClientId
=
imClientSender
.
getClientId
();
String
heClientId
;
Long
heFkClientId
;
if
(
membersList
.
get
(
0
).
getClientId
()
!=
null
&&
membersList
.
get
(
0
).
getClientId
().
equals
(
meClientId
))
{
heClientId
=
membersList
.
get
(
1
).
getClientId
();
heFkClientId
=
membersList
.
get
(
1
).
getFkClientId
();
}
else
{
heClientId
=
membersList
.
get
(
0
).
getClientId
();
heFkClientId
=
membersList
.
get
(
0
).
getFkClientId
();
}
ImClient
imClientReceiver
=
imClientService
.
getCacheImClient
(
heFkClientId
);
ImFriend
my
=
friendService
.
getByKey
(
meClientId
,
heClientId
);
ImFriend
friend
=
friendService
.
getByKey
(
heClientId
,
meClientId
);
// 获取拓展参数
String
senderAttributesStr
=
imClientSender
.
getAttributes
();
String
receiverAttributesStr
=
imClientReceiver
.
getAttributes
();
JSONObject
senderAttributes
=
new
JSONObject
();
JSONObject
receiverAttributes
=
new
JSONObject
();
if
(
StringUtils
.
isNotBlank
(
senderAttributesStr
))
{
try
{
senderAttributes
=
JSONObject
.
parseObject
(
senderAttributesStr
);
}
catch
(
Exception
e
)
{
// do nothing is ok
}
}
if
(
StringUtils
.
isNotBlank
(
receiverAttributesStr
))
{
try
{
receiverAttributes
=
JSONObject
.
parseObject
(
receiverAttributesStr
);
}
catch
(
Exception
e
)
{
// do nothing is ok
}
}
// 判断是否其中一方是客服
boolean
senderIsServiceMan
=
Optional
.
ofNullable
(
senderAttributes
.
getBoolean
(
"isServiceMan"
)).
orElse
(
Boolean
.
FALSE
);
boolean
receiverIsServiceMan
=
Optional
.
ofNullable
(
receiverAttributes
.
getBoolean
(
"isServiceMan"
)).
orElse
(
Boolean
.
FALSE
);
if
(
senderIsServiceMan
||
receiverIsServiceMan
)
{
// 无需继续判断
return
true
;
}
// 判定是陌生人的几种情况,没有好友申请 or 好友申请未通过 or 我/朋友拒绝了请求 or 我/朋友删除了好友关系
Boolean
isStranger
=
(
my
==
null
||
friend
==
null
)
...
...
@@ -386,17 +425,7 @@ public class NormalChatAction {
if
(
isStranger
)
{
// 陌生人限制
String
attributes
=
imClientSender
.
getAttributes
();
boolean
isVip
=
false
;
if
(
StringUtils
.
isNotEmpty
(
attributes
))
{
// 小虎豆独有功能
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
attributes
);
isVip
=
jsonObject
.
getBoolean
(
"isVip"
);
}
catch
(
Exception
e
)
{
// 没有配置 认为不是vip
}
}
boolean
isVip
=
Optional
.
ofNullable
(
senderAttributes
.
getBoolean
(
"isVip"
)).
orElse
(
Boolean
.
FALSE
);
int
sendCount
=
imMessageService
.
count
(
Wrappers
.<
ImMessage
>
lambdaQuery
().
eq
(
ImMessage:
:
getFkConversationId
,
conversationId
).
eq
(
ImMessage:
:
getSender
,
imClientSender
.
getId
()).
between
(
ImMessage:
:
getCreateTime
,
getStartTime
(),
getEndTime
()));
...
...
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