调整配置文件。优化代码格式。

This commit is contained in:
zhouxy108 2023-02-01 09:46:57 +08:00
parent 6d7517f778
commit 151a33cad4
4 changed files with 10 additions and 10 deletions

View File

@ -62,8 +62,3 @@ plusone:
# 异常拦截机制是否拦截所有异常
exception:
handle-all-exception: false
# 日志配置
logging:
level:
root: debug

View File

@ -9,3 +9,8 @@ plusone:
code: Plusone
template:
code: 【Plusone】验证码%s10分钟内有效请勿泄露。
# 日志配置
logging:
level:
root: info
'[xyz.zhouxy.plusone]': debug

View File

@ -34,7 +34,7 @@ import xyz.zhouxy.plusone.validator.InvalidInputException;
@Service
public class AccountContextService {
private final static StpLogic adminAuthLogic = AuthLogic.adminAuthLogic;
private static final StpLogic adminAuthLogic = AuthLogic.adminAuthLogic;
@Resource
private AccountQueries accountQueries;
@ -95,7 +95,7 @@ public class AccountContextService {
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
default -> throw InvalidInputException.unsupportedPrincipalTypeException("输入邮箱地址或手机号");
};
Assert.notNull(account, () -> AccountLoginException.accountNotExistException());
Assert.notNull(account, AccountLoginException::accountNotExistException);
mailAndSmsVerifyService.checkOtp(principal, command.getOtp());
}

View File

@ -49,9 +49,9 @@ public class AdminLoginService {
case EMAIL -> accountRepository.findByEmail(Email.of(principal));
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
};
Assert.notNull(account, () -> AccountLoginException.accountNotExistException());
Assert.notNull(account, AccountLoginException::accountNotExistException);
var isPasswordCorrect = account.checkPassword(command.getPassword());
Assert.isTrue(isPasswordCorrect, () -> AccountLoginException.passwordErrorException());
Assert.isTrue(isPasswordCorrect, AccountLoginException::passwordErrorException);
adminAuthLogic.login(account.getId().orElseThrow(), command.isRememberMe());
var accountDetails = accountQueries.queryAccountDetails(account.getId().orElseThrow());
@ -66,7 +66,7 @@ public class AdminLoginService {
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
default -> throw InvalidInputException.unsupportedPrincipalTypeException("输入邮箱地址或手机号");
};
Assert.notNull(account, () -> AccountLoginException.accountNotExistException());
Assert.notNull(account, AccountLoginException::accountNotExistException);
mailAndSmsVerifyService.checkOtp(principal, command.getOtp());