init
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ruoyi.cai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.SmsVerify;
|
||||
import com.ruoyi.cai.enums.CodeEnum;
|
||||
|
||||
/**
|
||||
* 短信验证码Service接口
|
||||
@@ -11,5 +12,5 @@ import com.ruoyi.cai.domain.SmsVerify;
|
||||
*/
|
||||
public interface SmsVerifyService extends IService<SmsVerify> {
|
||||
|
||||
void put(String mobile);
|
||||
void put(CodeEnum codeEnum, String mobile);
|
||||
}
|
||||
|
||||
@@ -34,4 +34,6 @@ public interface UserService extends IService<User> {
|
||||
boolean agreeProtocol(Long userId);
|
||||
|
||||
void checkFinishStatus(Long userId);
|
||||
|
||||
void resetPassword(String mobile, String password);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@ public class SmsVerifyServiceImpl extends ServiceImpl<SmsVerifyMapper,SmsVerify>
|
||||
private CodeManager codeManager;
|
||||
|
||||
@Override
|
||||
public void put(String mobile){
|
||||
String code = codeManager.put(CodeEnum.REGISTER, mobile);
|
||||
public void put(CodeEnum codeEnum,String mobile){
|
||||
String code = codeManager.put(codeEnum, mobile);
|
||||
SmsVerify smsVerify = new SmsVerify();
|
||||
smsVerify.setType(codeEnum.name());
|
||||
smsVerify.setType(codeEnum.getName());
|
||||
smsVerify.setReceivePhone(mobile);
|
||||
smsVerify.setVerifyCode(code);
|
||||
smsVerify.setSendInterface("阿里云");
|
||||
|
||||
@@ -141,4 +141,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
.set(User::getFinishStatus,1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPassword(String mobile, String password) {
|
||||
if(StringUtils.isEmpty(mobile) || StringUtils.isEmpty(password)){
|
||||
throw new ServiceException("参数异常");
|
||||
}
|
||||
this.update(Wrappers.lambdaUpdate(User.class)
|
||||
.eq(User::getMobile,mobile)
|
||||
.set(User::getPassword,BCrypt.hashpw(password)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user