Jelajahi Sumber

update:还原app微信登录,采用配置app的appId

ct 3 hari lalu
induk
melakukan
73a1cfc686

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

@@ -15,8 +15,6 @@ import com.fs.common.exception.ServiceException;
 import com.fs.common.service.ISmsService;
 import com.fs.common.utils.sign.Md5Utils;
 import com.fs.core.config.WxOpenProperties;
-import com.fs.course.domain.FsCoursePlaySourceConfig;
-import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserNewTask;
@@ -72,9 +70,6 @@ public class AppLoginController extends AppBaseController{
 
     @Autowired
     private ISmsService smsService;
-    @Autowired
-    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
-
     @ApiOperation("注册app用户")
     @PostMapping("/register")
     @RepeatSubmit
@@ -243,28 +238,8 @@ public class AppLoginController extends AppBaseController{
                 return R.error("code不存在");
             }
 
-            String appId = param.getAppId();
-            String appSecret = "";
-            if (StringUtils.isBlank(appId)) {
-                List<FsCoursePlaySourceConfig> list = fsCoursePlaySourceConfigService.list(new QueryWrapper<FsCoursePlaySourceConfig>().eq("name", "app").eq("is_del", 0));
-                if(!list.isEmpty()){
-                    FsCoursePlaySourceConfig fsCoursePlaySourceConfig = list.get(0);
-                    appId = fsCoursePlaySourceConfig.getAppid();
-                    appSecret =  fsCoursePlaySourceConfig.getSecret();
-                }
-            } else {
-                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.getOne(new QueryWrapper<FsCoursePlaySourceConfig>().eq("appid", appId).eq("is_del", 0));
-                if(fsCoursePlaySourceConfig != null){
-                    appId = fsCoursePlaySourceConfig.getAppid();
-                    appSecret =  fsCoursePlaySourceConfig.getSecret();
-                }
-            }
-            if (StringUtils.isBlank(appId) || StringUtils.isBlank(appSecret)) {
-                appId = openProperties.getAppId();
-                appSecret = openProperties.getSecret();
-            }
-            logger.info("zyp app微信登录,param:{},输出appid,{},secret:{}", param, appId, appSecret);
-            Map result = WxUtil.getAccessToken(param.getCode(),appId,appSecret);
+            logger.info("zyp app微信登录,param:{},输出appid,{},secret:{}", param, openProperties.getAppId(), openProperties.getSecret());
+            Map result = WxUtil.getAccessToken(param.getCode(), openProperties.getAppId(), openProperties.getSecret());
             String accessToken = result.get("access_token").toString();
             String unionid = result.get("unionid").toString();
 
@@ -290,7 +265,7 @@ public class AppLoginController extends AppBaseController{
                 }
                 user.setUnionId(unionid);
                 // 新用户 - 添加 appId
-                user.setAppId(appId);
+                user.setAppId(openProperties.getAppId());
                 user.setCreateTime(new Date());
                 user.setStatus(1);
                 if (StringUtils.isNotEmpty(param.getJpushId())) {
@@ -302,7 +277,7 @@ public class AppLoginController extends AppBaseController{
                 return R.ok(map);
             } else {
                 // 老用户 - 检查并添加appId(不重复添加)
-                String updatedAppId = addAppIdIfNotExists(user.getAppId(), appId);
+                String updatedAppId = addAppIdIfNotExists(user.getAppId(), openProperties.getAppId());
                 if (!updatedAppId.equals(user.getAppId())) {
                     FsUser userMap = new FsUser();
                     userMap.setUserId(user.getUserId());