|
@@ -26,6 +26,7 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import org.springblade.common.aspect.IPLimit;
|
|
import org.springblade.common.cache.ParamCache;
|
|
import org.springblade.common.cache.ParamCache;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.enums.AuditStatusEnum;
|
|
import org.springblade.common.enums.AuditStatusEnum;
|
|
@@ -271,12 +272,6 @@ public class LoginController extends BladeController {
|
|
return R.fail("请输入手机验证码!");
|
|
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 tenantId = WebUtil.getRequest().getHeader(TokenUtil.TENANT_HEADER_KEY);
|
|
String grantType = "phone";
|
|
String grantType = "phone";
|
|
String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), UserEnum.APP.getName());
|
|
String userType = Func.toStr(WebUtil.getRequest().getHeader(TokenUtil.USER_TYPE_HEADER_KEY), UserEnum.APP.getName());
|
|
@@ -290,12 +285,12 @@ public class LoginController extends BladeController {
|
|
ITokenGranter granter = TokenGranterBuilder.getGranter(grantType);
|
|
ITokenGranter granter = TokenGranterBuilder.getGranter(grantType);
|
|
UserInfo userInfo = granter.grant(tokenParameter);
|
|
UserInfo userInfo = granter.grant(tokenParameter);
|
|
if (UserEnum.MERCHANT.getName().equals(userType)) {
|
|
if (UserEnum.MERCHANT.getName().equals(userType)) {
|
|
- UserMerchantVO vo = iUserMerchantService.getByUserId(user.getId());
|
|
|
|
|
|
+ UserMerchantVO vo = iUserMerchantService.getByUserId(userInfo.getUser().getId());
|
|
if (AuditStatusEnum.WAIT.getValue().equals(vo.getAuditStatus())) {
|
|
if (AuditStatusEnum.WAIT.getValue().equals(vo.getAuditStatus())) {
|
|
return R.fail("账号审核中");
|
|
return R.fail("账号审核中");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotNull(user.getLogOut()) && user.getLogOut() == 1){
|
|
|
|
|
|
+ if(ObjectUtil.isNotNull(userInfo.getUser().getLogOut()) && userInfo.getUser().getLogOut() == 1){
|
|
return R.fail("用户已注销无法正常使用,如需使用请联系管理员");
|
|
return R.fail("用户已注销无法正常使用,如需使用请联系管理员");
|
|
}
|
|
}
|
|
return R.data(TokenUtil.createAuthInfo(userInfo));
|
|
return R.data(TokenUtil.createAuthInfo(userInfo));
|
|
@@ -353,6 +348,7 @@ public class LoginController extends BladeController {
|
|
@ApiOperationSupport(order = 6)
|
|
@ApiOperationSupport(order = 6)
|
|
@ApiOperation(value = "商家注册", notes = "商家注册")
|
|
@ApiOperation(value = "商家注册", notes = "商家注册")
|
|
@Transactional
|
|
@Transactional
|
|
|
|
+ @IPLimit(count = 1, time = 1)
|
|
public R<Void> merchantRegister(@Valid @RequestBody MerchantRegisterRequest request) {
|
|
public R<Void> merchantRegister(@Valid @RequestBody MerchantRegisterRequest request) {
|
|
if (!PhoneUtil.isPhone(request.getPhone())){
|
|
if (!PhoneUtil.isPhone(request.getPhone())){
|
|
return R.fail("请输入正确的手机号!");
|
|
return R.fail("请输入正确的手机号!");
|