TanJingyu 1 سال پیش
والد
کامیت
e4cb518f17

+ 9 - 0
src/main/java/com/cybertogether/wx/notice/infrastructure/Downstream.java

@@ -12,6 +12,15 @@ import java.util.List;
 @ConfigurationProperties(prefix = "downstream")
 public class Downstream {
     private List<String> urls;
+    private List<String> msgUrls;
+
+    public List<String> getMsgUrls() {
+        return msgUrls;
+    }
+
+    public void setMsgUrls(List<String> msgUrls) {
+        this.msgUrls = msgUrls;
+    }
 
     public List<String> getUrls() {
         return urls;

+ 12 - 1
src/main/java/com/cybertogether/wx/notice/web/WxPushReceptionController.java

@@ -56,7 +56,18 @@ public class WxPushReceptionController {
                                     @RequestParam(name = "msg_signature", required = false) String msgSignature,
                                     @RequestBody String encryptedXmlBodyText,
                                     @PathVariable String appId) {
-        LOGGER.info("微信通知转发服务-收到微信消息与事件通知-{}", encryptedXmlBodyText);
+        LOGGER.info("微信通知转发服务-收到微信消息与事件通知");
+
+        String urlParams = String.format("?timestamp=%s&nonce=%s&msg_signature=%s", timestamp, nonce, msgSignature);
+
+        for (String url : downstream.getMsgUrls()) {
+            try {
+                HttpClientUtils.postData(url + appId + urlParams, encryptedXmlBodyText);
+            }catch (Exception e) {
+                // ignore
+            }
+        }
+
         return "success";
     }
 }

+ 2 - 0
src/main/resources/application.yml

@@ -25,3 +25,5 @@ downstream:
   urls:
     - https://pandora-testapi.denet.me/pandora/wx/pushReception/authorization
     - https://pandora-api.denet.me/pandora/wx/pushReception/authorization
+  msgUrls:
+    - https://pandora-testapi.denet.me/pandora/wx/pushReception/msgEvent/