huwhois 4 years ago
parent
commit
46fb202f03

+ 3 - 1
src/main/java/io/renren/modules/app/controller/AppLoginController.java

@ -8,6 +8,7 @@
8 8
9 9
package io.renren.modules.app.controller;
10 10
11
import io.renren.common.utils.MyUtils;
11 12
import io.renren.common.utils.R;
12 13
import io.renren.common.validator.Assert;
13 14
import io.renren.common.validator.ValidatorUtils;
@ -51,7 +52,8 @@ public class AppLoginController {
51 52
        smsCodeService.validate(form.getUuid(), form.getCode(), form.getPhone());
52 53
53 54
        //用户登录
54
        UserEntity user =  userService.queryByPhone(form.getPhone());
55
        String symbol = MyUtils.md5(form.getTurename() + form.getPhone());
56
        UserEntity user =  userService.queryBySymbol(symbol);
55 57
        Assert.isNull(user, "手机号错误");
56 58
        long userId = user.getUserId();
57 59

+ 2 - 1
src/main/java/io/renren/modules/app/form/LoginForm.java

@ -22,13 +22,14 @@ public class LoginForm {
22 22
    // @ApiModelProperty(value = "手机号")
23 23
    // @NotBlank(message="手机号不能为空")
24 24
    // private String mobile;
25
26 25
    // @ApiModelProperty(value = "密码")
27 26
    // @NotBlank(message="密码不能为空")
28 27
    // private String password;
29 28
30 29
    @NotBlank(message="手机号不能为空")
31 30
    private String phone;
31
    @NotBlank(message="姓名不能为空")
32
    private String turename;
32 33
    @NotBlank(message="短信验证码不能为空")
33 34
    private String code;
34 35
    private String uuid;

+ 2 - 0
src/main/java/io/renren/modules/app/service/UserService.java

@ -22,6 +22,8 @@ public interface UserService extends IService<UserEntity> {
22 22
23 23
	UserEntity queryByPhone(String phone);
24 24
25
	UserEntity queryBySymbol(String symbol);
26
25 27
	/**
26 28
	 * 用户登录
27 29
	 * @param form    登录表单

+ 2 - 2
src/main/java/io/renren/modules/app/service/impl/SmsCodeServiceImpl.java

@ -48,7 +48,7 @@ public class SmsCodeServiceImpl extends ServiceImpl<SmsCodeDao, SmsCodeEntity> i
48 48
    public void validate(String uuid, String code, String phone)  throws RRException{
49 49
        SmsCodeEntity smsCodeEntity = this.getOne(new QueryWrapper<SmsCodeEntity>().eq("uuid", uuid));
50 50
        if (smsCodeEntity == null) {
51
            throw new RRException("验证码不正确");
51
            throw new RRException("验证码不正确1");
52 52
        }
53 53
54 54
        if (smsCodeEntity.getCode().equalsIgnoreCase(code) && smsCodeEntity.getPhone().equalsIgnoreCase(phone)
@ -56,7 +56,7 @@ public class SmsCodeServiceImpl extends ServiceImpl<SmsCodeDao, SmsCodeEntity> i
56 56
            // 删除验证码
57 57
            this.removeById(uuid);
58 58
        } else {
59
            throw new RRException("验证码不正确");
59
            throw new RRException("验证码不正确2");
60 60
        }
61 61
    }
62 62
}

+ 5 - 0
src/main/java/io/renren/modules/app/service/impl/UserServiceImpl.java

@ -29,6 +29,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
29 29
		return baseMapper.selectOne(new QueryWrapper<UserEntity>().eq("phone", phone));
30 30
	}
31 31
32
	@Override
33
	public UserEntity queryBySymbol(String symbol) {
34
		return this.getOne(new QueryWrapper<UserEntity>().eq("symbol", symbol));
35
	}
36
32 37
	// @Override
33 38
	// public long login(LoginForm form) {
34 39
	// 	UserEntity user = queryByPhone(form.getMobile());