|
|
@@ -16,11 +16,13 @@ import org.springblade.gateway.shop_gateway.entity.dto.AppAccountDto;
|
|
|
import org.springblade.ldt.account.entity.Account;
|
|
|
import org.springblade.ldt.account.service.IAccountService;
|
|
|
import org.springblade.modules.resource.utils.SmsUtil;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
@@ -37,7 +39,7 @@ public class AppAccountController {
|
|
|
@PostMapping("login")
|
|
|
@ApiOperation(value = "商户商场登录")
|
|
|
@SneakyThrows
|
|
|
- public R login(@RequestBody Account account) throws ServiceException {
|
|
|
+ public R login(@RequestBody @Valid Account account) throws ServiceException {
|
|
|
|
|
|
Account user = accountService.getOne(new QueryWrapper<Account>().lambda().eq(Account::getPhone, account.getPhone()));
|
|
|
Assert.notNull(user,() ->{throw new ServiceException(ResCode.USER_NOT_FOUNT);});
|
|
|
@@ -50,7 +52,7 @@ public class AppAccountController {
|
|
|
@PostMapping("register")
|
|
|
@ApiOperation(value = "注册账号")
|
|
|
@SneakyThrows
|
|
|
- public R register(@RequestBody AppAccountDto appAccountDto) {
|
|
|
+ public R register(@RequestBody @Valid AppAccountDto appAccountDto) {
|
|
|
|
|
|
Assert.isTrue(SmsUtil.validateMessage(null,appAccountDto.getSmsId(),appAccountDto.getValue(),appAccountDto.getPhone()),()->{
|
|
|
throw new ServiceException(ResCode.VALIDATE_FAIL);
|
|
|
@@ -61,7 +63,6 @@ public class AppAccountController {
|
|
|
Assert.isTrue(accountService.saveOrUpdate(account),()->{
|
|
|
throw new ServiceException(ResCode.SHOP_REGISTER_ERROR);
|
|
|
});
|
|
|
-
|
|
|
return R.data(account);
|
|
|
|
|
|
}
|