Commit d63790c3 authored by muhong's avatar muhong

修改 邀请码

parent 9d0111a2
......@@ -12,6 +12,7 @@ import com.wwdz.ch.core.util.RegexUtil;
import com.wwdz.ch.core.util.UUID;
import com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder;
import com.wwdz.ch.db.dao.UserDao;
import com.wwdz.ch.db.domain.Switch;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.wx.constant.CacheCodeConstants;
import com.wwdz.ch.wx.constant.LoginTypeEnum;
......@@ -23,6 +24,7 @@ import com.wwdz.ch.wx.manager.TikTokLoginManager;
import com.wwdz.ch.wx.manager.UserTokenManager;
import com.wwdz.ch.wx.manager.WxLoginManager;
import com.wwdz.ch.wx.service.InviteRecordService;
import com.wwdz.ch.wx.service.SwitchService;
import com.wwdz.ch.wx.service.UserService;
import com.wwdz.ch.wx.util.IpUtil;
import com.wwdz.ch.wx.util.RedisUtil;
......@@ -73,6 +75,8 @@ public class UserServiceImpl implements UserService {
@Autowired
private InviteRecordService inviteRecordService;
@Autowired
private SwitchService switchService;
@Override
......@@ -128,7 +132,12 @@ public class UserServiceImpl implements UserService {
}
// 获取登录结果
Map<String, Object> result = getLoginResult(dto.getMobile(), request);
Switch switchh = switchService.findOnly();
boolean isOpen = Objects.nonNull(switchh) && switchh.getState() == 1;
result.put("isInvited", inviteRecordService.isExisted(dto.getMobile()).getData());
if (!isOpen) {
result.put("isInvited", true);
}
logger.info("【请求结束】手机号登录,响应结果:{}", JSONObject.toJSONString(result));
// 清除验证码缓存
redisUtil.del(key);
......@@ -183,7 +192,12 @@ public class UserServiceImpl implements UserService {
}
// 获取登录结果
Map<String, Object> result = getLoginResult(mobile, request);
Switch switchh = switchService.findOnly();
boolean isOpen = Objects.nonNull(switchh) && switchh.getState() == 1;
result.put("isInvited", inviteRecordService.isExisted(mobile).getData());
if (!isOpen) {
result.put("isInvited", true);
}
logger.info("【请求结束】快捷登录成功,响应结果:{}", JSONObject.toJSONString(result));
return Result.success(result);
} catch (Exception e) {
......
......@@ -43,10 +43,7 @@ public class LoginInterceptor implements HandlerInterceptor {
logger.info("进入拦截器");
String token = request.getHeader("Authorization");
Switch switchh = switchService.findOnly();
boolean isOpen = false;
if (Objects.nonNull(switchh) && switchh.getState() == 1) {
isOpen = true;
}
boolean isOpen = Objects.nonNull(switchh) && switchh.getState() == 1;
String url = request.getRequestURI();
if (!isOpen) {
if (Arrays.asList(excludeUrl).contains(url)) {
......@@ -66,7 +63,7 @@ public class LoginInterceptor implements HandlerInterceptor {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().write(JSON.toJSONString(map));
} else {
Integer loginType = 1;
int loginType = 1;
if (StringUtils.isBlank(token)) {
loginType = 2;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment