فهرست منبع

95:红德堂APP调试

app微信登录处理
Long 1 روز پیش
والد
کامیت
ae4058ab37

+ 15 - 0
fs-service/src/main/java/com/fs/core/config/WxOpenProperties.java

@@ -0,0 +1,15 @@
+package com.fs.core.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Data
+@Configuration
+@ConfigurationProperties("wx.open")
+public class WxOpenProperties {
+
+    private String appId = "wx703c4bd07bbd1695";
+
+    private String secret = "034f5cc8d9b5151f9d25da9628541e35";
+}

+ 3 - 0
fs-service/src/main/resources/application-config-druid-hdt.yml

@@ -45,6 +45,9 @@ wx:
       - appId: wx7670b3b1b1cfcd47 # 第一个公众号的appid  //公众号名称:成都九州在线互联网医院
         secret: c6e5726c7039092a907c3242c8d3e406 # 公众号的appsecret
         token: PPKOdAlCoMO # 接口配置里的Token值抖音免领及代运营        aesKey: Eswa6VjwtVcw03qZy6Wllgrv5aytIA1SZPEU0kU2 # 接口配置里的EncodingAESKey值
+  open:
+    appId: wx0943a6f6d040ca3a
+    secret: 602e2a9ea639b6cd18eb80e715c4b22e
 aifabu:  #爱链接
   appKey: 7b471be905ab17ef358c610d117601d008
 

+ 5 - 5
fs-user-app/src/main/java/com/fs/app/controller/AppLoginController.java

@@ -9,6 +9,7 @@ import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.sign.Md5Utils;
+import com.fs.core.config.WxOpenProperties;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserNewTask;
@@ -51,9 +52,8 @@ public class AppLoginController extends AppBaseController{
     private FsUserMapper userMapper;
     @Autowired
     private IFsUserNewTaskService userNewTaskService;
-
-    private static final String APP_ID = "wx703c4bd07bbd1695";
-    private static final String APP_SECRET = "034f5cc8d9b5151f9d25da9628541e35";
+    @Autowired
+    private WxOpenProperties openProperties;
 
     @Autowired
     private RedisCache redisCache;
@@ -150,7 +150,7 @@ public class AppLoginController extends AppBaseController{
                 return R.error("code不存在");
             }
             logger.info("zyp app微信登录,param:{}", param);
-            Map result = WxUtil.getAccessToken(param.getCode(),APP_ID,APP_SECRET);
+            Map result = WxUtil.getAccessToken(param.getCode(), openProperties.getAppId(), openProperties.getSecret());
             String accessToken = result.get("access_token").toString();
             String unionid = result.get("unionid").toString();
 
@@ -237,7 +237,7 @@ public class AppLoginController extends AppBaseController{
     public R bindWeChat(@Validated @RequestBody FsUserEditUnionidParam param) {
         try {
             logger.info("zyp app绑定微信,param:{}", param);
-            Map result = WxUtil.getAccessToken(param.getCode(),APP_ID,APP_SECRET);
+            Map result = WxUtil.getAccessToken(param.getCode(), openProperties.getAppId(), openProperties.getSecret());
             String accessToken = result.get("access_token").toString();
             String unionid = result.get("unionid").toString();
             String openid = result.get("openid").toString();