|
@@ -40,9 +40,7 @@ import org.springblade.core.log.annotation.ApiLog;
|
|
|
import org.springblade.core.redis.cache.BladeRedis;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
-import org.springblade.core.sms.model.SmsCode;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
-import org.springblade.core.tool.support.Kv;
|
|
|
import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.modules.api.request.MerchantRegisterRequest;
|
|
|
import org.springblade.modules.auth.enums.UserEnum;
|
|
@@ -56,7 +54,6 @@ import org.springblade.modules.platform.entity.UserScores;
|
|
|
import org.springblade.modules.platform.service.IUserRecomService;
|
|
|
import org.springblade.modules.platform.service.IUserScoresService;
|
|
|
import org.springblade.modules.platform.service.UserAppService;
|
|
|
-import org.springblade.modules.resource.builder.sms.SmsBuilder;
|
|
|
import org.springblade.modules.system.entity.User;
|
|
|
import org.springblade.modules.system.entity.UserApp;
|
|
|
import org.springblade.modules.system.entity.UserInfo;
|
|
@@ -68,13 +65,11 @@ import org.springblade.modules.system.vo.UserMerchantVO;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
|
|
|
import static org.springblade.modules.resource.utils.SmsUtil.VALIDATE_FAIL;
|
|
|
-import static org.springblade.modules.resource.utils.SmsUtil.VALIDATE_SUCCESS;
|
|
|
|
|
|
/**
|
|
|
* 控制器
|
|
@@ -275,6 +270,13 @@ public class LoginController extends BladeController {
|
|
|
if (StringUtil.isEmpty(captchaCode) ||StringUtil.isEmpty(captchaId)){
|
|
|
return R.fail("请输入手机验证码!");
|
|
|
}
|
|
|
+
|
|
|
+ User user = userService.getByAccount(username);
|
|
|
+
|
|
|
+ if (Objects.isNull(user)){
|
|
|
+ return R.fail("请先注册!");
|
|
|
+ }
|
|
|
+
|
|
|
String tenantId = WebUtil.getRequest().getHeader(TokenUtil.TENANT_HEADER_KEY);
|
|
|
String grantType = "phone";
|
|
|
String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), UserEnum.APP.getName());
|
|
@@ -287,6 +289,15 @@ public class LoginController extends BladeController {
|
|
|
.set("userType", userType);
|
|
|
ITokenGranter granter = TokenGranterBuilder.getGranter(grantType);
|
|
|
UserInfo userInfo = granter.grant(tokenParameter);
|
|
|
+ if (UserEnum.MERCHANT.getName().equals(userType)) {
|
|
|
+ UserMerchantVO vo = iUserMerchantService.getByUserId(user.getId());
|
|
|
+ if (AuditStatusEnum.WAIT.getValue().equals(vo.getAuditStatus())) {
|
|
|
+ return R.fail("账号审核中");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotNull(user.getLogOut()) && user.getLogOut() == 1){
|
|
|
+ return R.fail("用户已注销无法正常使用,如需使用请联系管理员");
|
|
|
+ }
|
|
|
return R.data(TokenUtil.createAuthInfo(userInfo));
|
|
|
}
|
|
|
|