忘记密码
This commit is contained in:
parent
7020853604
commit
38b7a8f3ad
|
|
@ -66,4 +66,16 @@ public class PlayletUserAppController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping(value = "/updatePasswordByCode")
|
||||||
|
@ApiOperation(value = "验证码修改密码", httpMethod = "POST")
|
||||||
|
public Result<String> updatePasswordByCode(@RequestBody PlayUserReq playUserReq){
|
||||||
|
try {
|
||||||
|
playletUserAppService.updatePasswordByCode(playUserReq);
|
||||||
|
return Result.success();
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,9 @@ public interface PlayletUserAppService {
|
||||||
*/
|
*/
|
||||||
void updatePlayletUser(PlayletUser playletUser);
|
void updatePlayletUser(PlayletUser playletUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param playUserReq 用户资料
|
||||||
|
*/
|
||||||
|
void updatePasswordByCode(PlayUserReq playUserReq) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,24 @@ public class PlayletUserAppServiceImpl implements PlayletUserAppService {
|
||||||
public void updatePlayletUser(PlayletUser playletUser) {
|
public void updatePlayletUser(PlayletUser playletUser) {
|
||||||
iPlayletUserService.updateById(playletUser);
|
iPlayletUserService.updateById(playletUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updatePasswordByCode(PlayUserReq playUserReq) throws Exception{
|
||||||
|
String alreadyCode = stringRedisTemplate.opsForValue().get(RedisConstants.SMS_CODE_PREFIX + playUserReq.getPhone());
|
||||||
|
if(StringUtils.isEmpty(alreadyCode)){
|
||||||
|
throw new Exception("验证码已过期!");
|
||||||
|
}
|
||||||
|
if(!alreadyCode.equals(playUserReq.getCode())){
|
||||||
|
throw new Exception("短信验证码错误!");
|
||||||
|
}
|
||||||
|
PlayletUser user = iPlayletUserService.lambdaQuery()
|
||||||
|
.eq(PlayletUser::getPhone, playUserReq.getPhone()).one();
|
||||||
|
if(user == null){
|
||||||
|
throw new Exception("用户尚未注册!");
|
||||||
|
}else {
|
||||||
|
user.setPassword(playUserReq.getPassword());
|
||||||
|
iPlayletUserService.updateById(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public class BaseEntity implements Serializable
|
||||||
|
|
||||||
/** 请求参数 */
|
/** 请求参数 */
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
@TableField(exist = false)
|
||||||
private Map<String, Object> params;
|
private Map<String, Object> params;
|
||||||
|
|
||||||
public Map<String, Object> getParams()
|
public Map<String, Object> getParams()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue