孙永军 %!s(int64=2) %!d(string=hai) anos
pai
achega
e10141dfd4

+ 15 - 6
src/main/java/com/sxtvs/open/api/clue/controller/WxClueController.java

@@ -3,10 +3,9 @@ package com.sxtvs.open.api.clue.controller;
 import com.sxtvs.open.core.sls.AliyunLogger;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 
@@ -17,11 +16,21 @@ public class WxClueController {
     @Resource
     private AliyunLogger logger;
 
-    @RequestMapping("wx_create")
-    public void wxCreate(@RequestBody(required = false) String wxXml, @RequestParam("echostr") String nonce, HttpServletResponse response) throws IOException {
+    @GetMapping(value = "wx_create")
+    public void wxCreate(@RequestParam("echostr") String echostr,
+                         @RequestParam("timestamp") String timestamp,
+                         @RequestParam("signature ") String signature ,
+                         @RequestParam("nonce ") String nonce ,
+                         HttpServletResponse response) throws IOException {
+        response.getWriter().write(echostr);
+
+    }
+
+    @PostMapping(value = "wx_create", produces = MediaType.APPLICATION_XML_VALUE)
+    public void wxCreate(@RequestBody(required = false) Object wxXml,
+                         HttpServletResponse response) throws IOException {
 
         logger.info("wx xml", wxXml);
-        response.getWriter().write(nonce);
 
     }
 }