From 6b44359d8a1095db6f326341e8bdbfc0be7b7cf0 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 22 八月 2021 17:10:20 +0800
Subject: [PATCH] 优化代码

---
 service-front/src/main/java/com/java110/front/smo/wechatGateway/impl/WechatGatewaySMOImpl.java |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/service-front/src/main/java/com/java110/front/smo/wechatGateway/impl/WechatGatewaySMOImpl.java b/service-front/src/main/java/com/java110/front/smo/wechatGateway/impl/WechatGatewaySMOImpl.java
old mode 100644
new mode 100755
index d03f30b..f55f1cf
--- a/service-front/src/main/java/com/java110/front/smo/wechatGateway/impl/WechatGatewaySMOImpl.java
+++ b/service-front/src/main/java/com/java110/front/smo/wechatGateway/impl/WechatGatewaySMOImpl.java
@@ -48,8 +48,7 @@
     private WechatAuthProperties wechatAuthProperties;
 
     @Override
-    public ResponseEntity<String>
-    gateway(IPageData pd) throws Exception {
+    public ResponseEntity<String> gateway(IPageData pd, String wId) throws Exception {
 
         JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
         Assert.hasKeyAndValue(paramIn, "fromUserName", "璇锋眰鎶ユ枃涓湭鍖呭惈fromUserName");
@@ -67,7 +66,26 @@
         //鍒ゆ柇鐢ㄦ埛鏄惁缁戝畾涓氫富
         boolean bindFlag = judgeBindOwner(pd, fromUserName);
         if (!bindFlag) {
-            responseStr = WechatFactory.formatText(toUserName, fromUserName, WechatConstant.NO_BIND_OWNER_RESPONSE_MESSAGE);
+
+            String noBindOwnerResponseMessage = MappingCache.getRemark(WechatConstant.WECHAT_DOMAIN, WechatConstant.NO_BIND_OWNER);
+
+            if (StringUtil.isEmpty(noBindOwnerResponseMessage)) {
+
+                noBindOwnerResponseMessage = WechatConstant.NO_BIND_OWNER_RESPONSE_MESSAGE;
+            }
+            if (!noBindOwnerResponseMessage.contains("wAppId=")) {
+                if (noBindOwnerResponseMessage.indexOf("W_APP_ID") > 0) {
+                    noBindOwnerResponseMessage = noBindOwnerResponseMessage.replace("W_APP_ID", "wAppId=" + WechatFactory.getAppId(wId));
+                } else {
+                    if (noBindOwnerResponseMessage.indexOf("?") > -1) {
+                        noBindOwnerResponseMessage += ("&wAppId=" + WechatFactory.getAppId(wId));
+                    } else {
+                        noBindOwnerResponseMessage += ("?wAppId=" + WechatFactory.getAppId(wId));
+                    }
+                }
+            }
+
+            responseStr = WechatFactory.formatText(toUserName, fromUserName, noBindOwnerResponseMessage);
             return new ResponseEntity<String>(responseStr, HttpStatus.OK);
         }
 

--
Gitblit v1.8.0