Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
a1747e89
Commit
a1747e89
authored
May 21, 2019
by
田超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
ecc78325
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
14 deletions
+33
-14
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+33
-14
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
a1747e89
...
@@ -159,19 +159,22 @@ public class SendWeixinRequestTools {
...
@@ -159,19 +159,22 @@ public class SendWeixinRequestTools {
@ParamLog
(
"推送消息"
)
@ParamLog
(
"推送消息"
)
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
)
{
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
)
{
String
nickNameStr
=
getNickNameStr
(
weixinGroupId
);
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
sendMessageDTO
.
getContent
());
sendTextMessageVO
.
setContent
(
nickNameStr
+
" "
+
sendMessageDTO
.
getContent
());
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
sendAtMessage
(
nickNameStr
,
robotId
,
weixinGroupId
);
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setGroupId
(
weixinGroupId
);
sendPicMessageVO
.
setGroupId
(
weixinGroupId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
sendMessageDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
sendMessageDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
sendAtMessage
(
nickNameStr
,
robotId
,
weixinGroupId
);
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
robotId
);
sendArticleMessageVO
.
setAltId
(
robotId
);
sendArticleMessageVO
.
setDescription
(
sendMessageDTO
.
getDescription
());
sendArticleMessageVO
.
setDescription
(
sendMessageDTO
.
getDescription
());
...
@@ -183,6 +186,16 @@ public class SendWeixinRequestTools {
...
@@ -183,6 +186,16 @@ public class SendWeixinRequestTools {
}
}
}
}
private
static
void
sendAtMessage
(
String
nickNameStr
,
String
robotId
,
String
weixinGroupId
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
private
static
String
addLinkParam
(
String
url
,
Long
groupQrcodeId
,
Long
classifyId
,
Long
bookGroupId
)
{
private
static
String
addLinkParam
(
String
url
,
Long
groupQrcodeId
,
Long
classifyId
,
Long
bookGroupId
)
{
if
(
StringUtil
.
isEmpty
(
url
))
{
if
(
StringUtil
.
isEmpty
(
url
))
{
return
url
;
return
url
;
...
@@ -282,7 +295,23 @@ public class SendWeixinRequestTools {
...
@@ -282,7 +295,23 @@ public class SendWeixinRequestTools {
}
}
public
static
void
sendDefaultMessage
(
String
groupName
,
String
robotId
,
String
weixinGroupId
)
{
public
static
void
sendDefaultMessage
(
String
groupName
,
String
robotId
,
String
weixinGroupId
)
{
String
content
=
""
;
String
content
=
getNickNameStr
(
weixinGroupId
);
if
(
StringUtil
.
isEmpty
(
groupName
))
{
content
+=
",欢迎加入本群,凭以下关键词领取任务或资源:"
;
}
else
{
content
+=
",欢迎加入"
+
groupName
+
"!凭以下关键词领取任务或资源:"
;
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
private
static
String
getNickNameStr
(
String
weixinGroupId
){
String
nameStr
=
""
;
Map
<
String
,
Integer
>
nickNames
=
JedisClusterUtils
.
getJson
(
"BOOK:WEIXINGROUP:GUIDEUSER"
+
weixinGroupId
,
Map
.
class
);
Map
<
String
,
Integer
>
nickNames
=
JedisClusterUtils
.
getJson
(
"BOOK:WEIXINGROUP:GUIDEUSER"
+
weixinGroupId
,
Map
.
class
);
int
i
=
0
;
int
i
=
0
;
List
<
String
>
names
=
new
ArrayList
<>();
List
<
String
>
names
=
new
ArrayList
<>();
...
@@ -302,19 +331,9 @@ public class SendWeixinRequestTools {
...
@@ -302,19 +331,9 @@ public class SendWeixinRequestTools {
}
}
for
(
String
nickName
:
names
)
{
for
(
String
nickName
:
names
)
{
nickNames
.
remove
(
nickName
);
nickNames
.
remove
(
nickName
);
content
=
content
+
"@"
+
nickName
+
"
"
;
nameStr
=
nameStr
+
"@"
+
nickName
+
"
"
;
}
}
JedisClusterUtils
.
setJson
(
"BOOK:WEIXINGROUP:GUIDEUSER"
+
weixinGroupId
,
nickNames
);
JedisClusterUtils
.
setJson
(
"BOOK:WEIXINGROUP:GUIDEUSER"
+
weixinGroupId
,
nickNames
);
return
nameStr
;
if
(
StringUtil
.
isEmpty
(
groupName
))
{
content
+=
",欢迎加入本群,凭以下关键词领取任务或资源:"
;
}
else
{
content
+=
",欢迎加入"
+
groupName
+
"!凭以下关键词领取任务或资源:"
;
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
}
}
}
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