记得上下班打卡 | git大法好,push需谨慎

Commit bd40360e authored by anjiabin's avatar anjiabin

Merge remote-tracking branch 'origin/dev' into test

parents a6d97095 c318f074
......@@ -71,8 +71,8 @@ liquidnet:
client:
admin:
phpPayUrl: http://testdragon.zhengzai.tv
phpMallUrl: https://testmall.zhengzai.tv
platformUrl: https://testplatform.zhengzai.tv
phpMallUrl: https://testmall.zhengzai.tv
platformUrl: https://testplatform.zhengzai.tv
shunfeng:
url: "https://butler-dev-ms.sf-express.com"
sk: 21e9a70f677a2bf29dfa2b3bead4f018
......
......@@ -123,6 +123,18 @@ public class PayController {
return ResponseDto.success(respDto);
}
@GetMapping("/thirdCheckOrder")
@ApiOperation("三方订单查询")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "code", value = "", example = "PAY202107131522368438531155")
})
@ResponseBody
public ResponseDto<DragonPayOrderQueryRespDto> thirdCheckOrder(@RequestParam(value = "code") @NotNull(message = "支付编号不能为空!") String code){
DragonPayOrderQueryRespDto respDto = dragonOrdersService.checkOrderStatusByCode(code);
return ResponseDto.success(respDto);
}
@GetMapping("/manulNotify")
@ApiOperation("手动通知商户")
@ApiResponse(code = 200, message = "接口返回对象参数")
......
......@@ -182,3 +182,30 @@ CREATE TABLE `sweet_manual_shop`
DEFAULT CHARSET = utf8
COLLATE = utf8_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT '电子宣传手册商铺表';
-- 正在现场服务号关注事件储存用户信息表
drop TABLE if exists `sweet_wechat_user`;
CREATE TABLE `sweet_wechat_user`
(
`mid` bigint unsigned NOT NULL AUTO_INCREMENT,
`user_id` varchar(200) NOT NULL DEFAULT '' COMMENT 'user_id',
`openId` varchar(200) NOT NULL DEFAULT '' COMMENT 'openId',
`unionId` varchar(200) NOT NULL DEFAULT '' COMMENT 'unionId',
`nickname` varchar(200) NOT NULL DEFAULT '' COMMENT '昵称',
`sexDesc` varchar(200) NOT NULL DEFAULT '' COMMENT '性别',
`sex` tinyint NOT NULL DEFAULT 0 COMMENT '性别 男1',
`headImgUrl` varchar(200) NOT NULL DEFAULT '' COMMENT '头像',
`language` varchar(200) NOT NULL DEFAULT '' COMMENT 'zh_CN',
`country` varchar(200) NOT NULL DEFAULT '' COMMENT '国家',
`province` varchar(200) NOT NULL DEFAULT '' COMMENT '省',
`city` varchar(200) NOT NULL DEFAULT '' COMMENT '市',
`subscribeTime` datetime NULL DEFAULT null COMMENT '关注时间',
`subscribeScene` varchar(200) NOT NULL DEFAULT '' COMMENT 'ADD_SCENE_SEARCH 关注方式',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`),
KEY `sweet_wechat_user_user_id` (`user_id`)
) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT '正在现场服务号关注事件储存用户信息表';
......@@ -20,6 +20,9 @@ public class SweetWechatActionCallbackController {
@Autowired
private SweetWechatCallbackServiceImpl sweetWechatCallbackService;
@Autowired
private WechatSignUtils wechatSignUtils;
@GetMapping("record")
@ApiOperation("get")
public void record(
......@@ -30,7 +33,7 @@ public class SweetWechatActionCallbackController {
@RequestParam() String echostr
) {
try {
if (WechatSignUtils.checkSignature(signature, timestamp, nonce)) {
if (wechatSignUtils.checkSignature(signature, timestamp, nonce)) {
log.info("验签通过");
PrintWriter out = response.getWriter();
out.print(echostr);
......@@ -46,7 +49,8 @@ public class SweetWechatActionCallbackController {
@PostMapping("record")
@ApiOperation("post")
public String record(
@RequestBody String requestBody,
// @RequestBody String requestBody,
@RequestParam String requestBody,
@RequestParam("signature") String signature,
@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce,
......@@ -57,7 +61,7 @@ public class SweetWechatActionCallbackController {
log.info("\n接收微信请求:[openid=[{}], [signature=[{}], encType=[{}], msgSignature=[{}],"
+ " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
if (!WechatSignUtils.checkSignature(signature, timestamp, nonce)) {
if (!wechatSignUtils.checkSignature(signature, timestamp, nonce)) {
log.info("验签未通过,非法请求,可能属于伪造的请求!");
return "";
}
......
......@@ -35,6 +35,7 @@ public class SubscribeHandler implements WxMpMessageHandler {
}
log.info("根据 openId:[{}]获取到的微信用户信息:[{}]", wxMessage.getFromUser(), wxMpUser.toString());
return null;
}
}
......@@ -70,10 +70,10 @@ public class SweetWechatCallbackServiceImpl {
.end();
// 取消关注事件
router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT)
/*router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT)
.event(WxConsts.EventType.UNSUBSCRIBE)
.handler(unsubscribeHandler)
.end();
.end();*/
return router;
}
......@@ -82,7 +82,7 @@ public class SweetWechatCallbackServiceImpl {
WxMpConfigStorage wxMpConfig = wxMpConfig(appid, secret, token, aeskey);
WxMpService wxMpService = wxMpService(wxMpConfig);
String out = null;
if (encType == null) {
if (encType == null || encType.isEmpty()) {
// 明文传输的消息
WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(requestBody);
log.info("\n消息内容为:\n[{}] ", inMessage.toString());
......
package com.liquidnet.service.sweet.utils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
......@@ -14,11 +15,12 @@ import java.util.Arrays;
* @author jiangxiulong
* @since 2021-07-29 3:19 下午
*/
@Component
public class WechatSignUtils {
// 与接口配置信息中的 Token 要一致
@Value("${liquidnet.wechat.zhengzai.service.token}")
private static String token;
private String token;
/**
* 验证签名
......@@ -28,7 +30,7 @@ public class WechatSignUtils {
* @param nonce
* @return
*/
public static boolean checkSignature(String signature, String timestamp, String nonce) {
public boolean checkSignature(String signature, String timestamp, String nonce) {
String[] arr = new String[]{token, timestamp, nonce};
// 将 token、timestamp、nonce 三个参数进行字典序排序
Arrays.sort(arr);
......@@ -59,7 +61,7 @@ public class WechatSignUtils {
* @param byteArray
* @return
*/
private static String byteToStr(byte[] byteArray) {
private String byteToStr(byte[] byteArray) {
String strDigest = "";
for (int i = 0; i < byteArray.length; i++) {
strDigest += byteToHexStr(byteArray[i]);
......@@ -73,7 +75,7 @@ public class WechatSignUtils {
* @param mByte
* @return
*/
private static String byteToHexStr(byte mByte) {
private String byteToHexStr(byte mByte) {
char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char[] tempArr = new char[2];
tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment