Browse Source

[update] message:1.小程序登录后存入账号id到sa-token

kelei 6 tháng trước cách đây
mục cha
commit
ee38a3b8e8

+ 1 - 1
admin/src/main/java/com/flyer/foster/service/impl/AppUserServiceImpl.java

@@ -52,7 +52,6 @@ public class AppUserServiceImpl extends ServiceImpl<IAppUserMapper, AppUser> imp
         String openid = code2Session.getOpenid();
         // 查找用户信息,存在更新,不存在新增
         AppUser appUser = iAppUserService.lambdaQuery().eq(AppUser::getOpenId, openid).one();
-        StpAppUtil.login(openid, LoginDevice.APP);
         if (appUser == null) {
             // 存入用户信息
             appUser = new AppUser();
@@ -67,6 +66,7 @@ public class AppUserServiceImpl extends ServiceImpl<IAppUserMapper, AppUser> imp
             appUser.setGardenId(dto.getGardenId());
             this.save(appUser);
         }
+        StpAppUtil.login(appUser.getId(), LoginDevice.APP);
         AppUserRespDTO respDTO = new AppUserRespDTO();
         BeanUtil.copyProperties(appUser, respDTO);
         respDTO.setToken(StpAppUtil.getTokenValue());