第四修改
parent
8178dc9cae
commit
afe4128893
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/bwie-api/bwie-user-api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-api/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
||||
|
|
|
@ -48,13 +48,11 @@ public class AuthServicelmpl implements AuthService{
|
|||
public Result login(UserRequest userRequest) {
|
||||
//判断姓名是否为空
|
||||
Optional<String> optional = Optional.ofNullable(userRequest.getUsername());
|
||||
|
||||
String defaultName = optional.orElse("张三");
|
||||
//判断
|
||||
if (!optional.isPresent()){
|
||||
//为null定义一个默认值
|
||||
String defaultName = optional.orElse("张三");
|
||||
userRequest.setUsername(defaultName);
|
||||
}
|
||||
String orDefault = optionalUtils.getOrDefault(optional, defaultName);
|
||||
//为null 返回默认值
|
||||
userRequest.setUsername(orDefault);
|
||||
User user = remoteUserService.findName(userRequest.getUsername()).getData();
|
||||
if (null==user){
|
||||
return Result.error("用户名不存在!!!!!!!");
|
||||
|
@ -75,11 +73,10 @@ public class AuthServicelmpl implements AuthService{
|
|||
public Result sendCode(String tel) {
|
||||
//判断手机号是否为空
|
||||
Optional<String> optional = Optional.ofNullable(tel);
|
||||
if (!optional.isPresent()){
|
||||
//默认值
|
||||
String defaultPhone = optional.orElse("18098734205");
|
||||
tel = defaultPhone;
|
||||
}
|
||||
//默认值
|
||||
String defaultPhone = optional.orElse("18098734205");
|
||||
String defaultTel = optionalUtils.getOrDefault(optional, defaultPhone);
|
||||
tel = defaultTel;
|
||||
//格式验证
|
||||
if (!tel.matches("^1[3-9]\\d{9}$")){
|
||||
return Result.error("手机号格式有误");
|
||||
|
@ -105,11 +102,12 @@ public class AuthServicelmpl implements AuthService{
|
|||
public Result TelLogin(TelLogin telLogin) {
|
||||
//判断手机号是否为空
|
||||
Optional<String> optional = Optional.ofNullable(telLogin.getTel());
|
||||
if (!optional.isPresent()){
|
||||
//默认值
|
||||
String defaultPhone = optional.orElse("18098734205");
|
||||
telLogin.setTel(defaultPhone);
|
||||
}
|
||||
//默认值
|
||||
String defaultPhone = optional.orElse("18098734205");
|
||||
|
||||
String orDefault = optionalUtils.getOrDefault(optional, defaultPhone);
|
||||
|
||||
telLogin.setTel(orDefault);
|
||||
//格式验证
|
||||
if (!telLogin.getTel().matches("^1[3-9]\\d{9}$")){
|
||||
return Result.error("手机号格式有误");
|
||||
|
|
Loading…
Reference in New Issue