Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eMall_api
Project
Project
Details
Activity
Releases
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
杨硕
eMall_api
Commits
c6ed804d
Commit
c6ed804d
authored
Jul 28, 2023
by
gaoyingwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 订阅消息发送
parent
7fb73698
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
2 deletions
+16
-2
application-dev.properties
...l-admin-api/src/main/resources/application-dev.properties
+1
-0
application-prod.properties
...-admin-api/src/main/resources/application-prod.properties
+1
-0
WeixinService.java
.../main/java/com/emall/flash/service/api/WeixinService.java
+12
-2
application-dev.properties
...-mobile-api/src/main/resources/application-dev.properties
+1
-0
application-prod.properties
...mobile-api/src/main/resources/application-prod.properties
+1
-0
No files found.
emall-admin-api/src/main/resources/application-dev.properties
View file @
c6ed804d
...
@@ -41,6 +41,7 @@ spring.cache.redis.cache-null-values=true
...
@@ -41,6 +41,7 @@ spring.cache.redis.cache-null-values=true
# 发送小程序订阅信息url
# 发送小程序订阅信息url
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.miniprogramState
=
developer
wx.app-id
=
wx16cfb2d12e4ab57c
wx.app-id
=
wx16cfb2d12e4ab57c
wx.app-secret
=
37556072ad536b8d9d6cf5fb638fec88
wx.app-secret
=
37556072ad536b8d9d6cf5fb638fec88
...
...
emall-admin-api/src/main/resources/application-prod.properties
View file @
c6ed804d
...
@@ -41,6 +41,7 @@ spring.cache.redis.cache-null-values=true
...
@@ -41,6 +41,7 @@ spring.cache.redis.cache-null-values=true
# 发送小程序订阅信息url
# 发送小程序订阅信息url
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.miniprogramState
=
developer
wx.app-id
=
wx16cfb2d12e4ab57c
wx.app-id
=
wx16cfb2d12e4ab57c
wx.app-secret
=
37556072ad536b8d9d6cf5fb638fec88
wx.app-secret
=
37556072ad536b8d9d6cf5fb638fec88
...
...
emall-core/src/main/java/com/emall/flash/service/api/WeixinService.java
View file @
c6ed804d
...
@@ -18,6 +18,7 @@ import okhttp3.OkHttpClient;
...
@@ -18,6 +18,7 @@ import okhttp3.OkHttpClient;
import
okhttp3.Request
;
import
okhttp3.Request
;
import
okhttp3.RequestBody
;
import
okhttp3.RequestBody
;
import
okhttp3.Response
;
import
okhttp3.Response
;
import
org.apache.commons.lang3.StringUtils
;
import
org.nutz.http.Header
;
import
org.nutz.http.Header
;
import
org.nutz.http.Http
;
import
org.nutz.http.Http
;
import
org.nutz.json.Json
;
import
org.nutz.json.Json
;
...
@@ -49,6 +50,8 @@ public class WeixinService {
...
@@ -49,6 +50,8 @@ public class WeixinService {
private
Logger
logger
=
LoggerFactory
.
getLogger
(
WeixinService
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
WeixinService
.
class
);
@Value
(
"${wechat.sendMessageUrl}"
)
@Value
(
"${wechat.sendMessageUrl}"
)
private
String
sendMessageUrl
;
private
String
sendMessageUrl
;
@Value
(
"${wechat.miniprogramState}"
)
private
String
miniprogramState
;
public
void
updateWeixinToken
()
{
public
void
updateWeixinToken
()
{
HttpUtil
.
trustEveryone
();
HttpUtil
.
trustEveryone
();
...
@@ -293,6 +296,12 @@ public class WeixinService {
...
@@ -293,6 +296,12 @@ public class WeixinService {
else
else
result
=
"审核不通过"
;
result
=
"审核不通过"
;
String
finalResult
=
result
;
String
finalResult
=
result
;
String
remarks
=
""
;
if
(
StringUtils
.
isNotBlank
(
receipt
.
getRemarks
()))
{
remarks
=
receipt
.
getRemarks
();
}
else
remarks
=
"审核通过"
;
String
finalRemarks
=
remarks
;
messageContent
.
put
(
"phrase2"
,
new
HashMap
<
String
,
Object
>()
{{
messageContent
.
put
(
"phrase2"
,
new
HashMap
<
String
,
Object
>()
{{
put
(
"value"
,
finalResult
);
put
(
"value"
,
finalResult
);
}});
}});
...
@@ -300,7 +309,7 @@ public class WeixinService {
...
@@ -300,7 +309,7 @@ public class WeixinService {
put
(
"value"
,
date
);
put
(
"value"
,
date
);
}});
}});
messageContent
.
put
(
"thing3"
,
new
HashMap
<
String
,
Object
>()
{{
messageContent
.
put
(
"thing3"
,
new
HashMap
<
String
,
Object
>()
{{
put
(
"value"
,
receipt
.
getRemarks
()
);
put
(
"value"
,
finalRemarks
);
}});
}});
JSONObject
messageContentJson
=
new
JSONObject
(
messageContent
);
JSONObject
messageContentJson
=
new
JSONObject
(
messageContent
);
//构造订阅消息
//构造订阅消息
...
@@ -311,7 +320,8 @@ public class WeixinService {
...
@@ -311,7 +320,8 @@ public class WeixinService {
body
.
put
(
"template_id"
,
"Z1GyWI2Q9m6VZna-AeIGvvKCQzhxHWBbBVe8UY49fbA"
);
//填写你的模板ID
body
.
put
(
"template_id"
,
"Z1GyWI2Q9m6VZna-AeIGvvKCQzhxHWBbBVe8UY49fbA"
);
//填写你的模板ID
body
.
put
(
"data"
,
messageContentJson
);
body
.
put
(
"data"
,
messageContentJson
);
body
.
put
(
"lang"
,
"zh_CN"
);
body
.
put
(
"lang"
,
"zh_CN"
);
// body.put("miniprogram_state", "formal");
body
.
put
(
"page"
,
"my/myIntegral/receiptRecord/index"
);
body
.
put
(
"miniprogram_state"
,
miniprogramState
);
//跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
org
.
nutz
.
http
.
Response
response
=
Http
.
post3
(
url
,
Json
.
toJson
(
body
),
Header
.
create
(
params
),
3000
);
org
.
nutz
.
http
.
Response
response
=
Http
.
post3
(
url
,
Json
.
toJson
(
body
),
Header
.
create
(
params
),
3000
);
if
(
response
.
isOK
())
{
if
(
response
.
isOK
())
{
...
...
emall-mobile-api/src/main/resources/application-dev.properties
View file @
c6ed804d
...
@@ -43,3 +43,4 @@ spring.cache.redis.cache-null-values=true
...
@@ -43,3 +43,4 @@ spring.cache.redis.cache-null-values=true
# 发送小程序订阅信息url
# 发送小程序订阅信息url
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.miniprogramState
=
developer
emall-mobile-api/src/main/resources/application-prod.properties
View file @
c6ed804d
...
@@ -43,3 +43,4 @@ spring.cache.redis.cache-null-values=true
...
@@ -43,3 +43,4 @@ spring.cache.redis.cache-null-values=true
# 发送小程序订阅信息url
# 发送小程序订阅信息url
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.sendMessageUrl
=
https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=
wechat.miniprogramState
=
developer
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