|
|
@@ -1,5 +1,8 @@
|
|
|
package com.ydtech.modules.admin.controller;
|
|
|
|
|
|
+import cn.hutool.core.codec.Base64;
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
+import cn.hutool.crypto.symmetric.AES;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.model.vo.WechatBindVo;
|
|
|
@@ -7,8 +10,12 @@ import com.ydtech.modules.admin.model.vo.WechatLoginVo;
|
|
|
import com.ydtech.modules.admin.model.vo.WechatVo;
|
|
|
import com.ydtech.modules.admin.service.WechatService;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
+import com.ydtech.modules.order.utils.AESUtilsWithDataBase;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.NoArgsConstructor;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
@@ -19,7 +26,11 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStreamReader;
|
|
|
+import java.nio.charset.Charset;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
@Api(tags = "微信业务")
|
|
|
@Slf4j
|
|
|
@@ -53,25 +64,32 @@ public class WechatController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @GetMapping(path = "/customer/callback")
|
|
|
- @ApiOperation(value = "客服回调")
|
|
|
- public HttpResult<String> customerCallback(HttpServletRequest request) throws IOException {
|
|
|
- log.info(request.getMethod());
|
|
|
- log.info(request.getHeader("Accept"));
|
|
|
- Map<String, String[]> parameterMap = request.getParameterMap();
|
|
|
+ @Data
|
|
|
+ @AllArgsConstructor
|
|
|
+ @NoArgsConstructor
|
|
|
+ public static class Test {
|
|
|
+
|
|
|
+ private String msgSignature;
|
|
|
+
|
|
|
+ private String timestamp;
|
|
|
+
|
|
|
+ private String nonce;
|
|
|
+
|
|
|
+ private String echostr;
|
|
|
|
|
|
- log.info();
|
|
|
- log.info(convertStreamToString(request.getInputStream()));
|
|
|
- return HttpResult.ok(convertStreamToString(request.getInputStream()));
|
|
|
}
|
|
|
|
|
|
- public String convertStreamToString(ServletInputStream inputStream) throws IOException {
|
|
|
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
- String line;
|
|
|
- while ((line = reader.readLine()) != null) {
|
|
|
- stringBuilder.append(line + "\n");
|
|
|
- }
|
|
|
- return stringBuilder.toString();
|
|
|
+ @GetMapping(path = "/customer/callback")
|
|
|
+ @ApiOperation(value = "客服回调")
|
|
|
+ public HttpResult<String> customerCallback(@RequestParam(value = "msg_signature") String msgSignature,
|
|
|
+ @RequestParam(value = "timestamp") String timestamp,
|
|
|
+ @RequestParam(value = "nonce") String nonce,
|
|
|
+ @RequestParam(value = "echostr") String echoStr) {
|
|
|
+ System.out.println(msgSignature + " " + timestamp + " " + nonce + " " + echoStr);
|
|
|
+// HBme3ASL
|
|
|
+// kv1XrZqTDUup27rVatFG3s04DSw2qEAvxg7k9euEROq
|
|
|
+// f1bfbc5dad67cee5ff28b97ee030188c443e12d7 1732671302 1732293939 GOqO+iXVYx2FBoD0uzjwkNcTBEyvOeKKfLkShKrgvQ0GWmAM3cVB4NxXf4KB5w3IDO37yIb8M+9pfSD/xzlwNQ==
|
|
|
+ return HttpResult.ok();
|
|
|
}
|
|
|
+
|
|
|
}
|