Compare commits
2 Commits
39b7a362c2
...
38b7a8f3ad
| Author | SHA1 | Date |
|---|---|---|
|
|
38b7a8f3ad | |
|
|
7020853604 |
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* @param playUserReq 用户资料
|
||||
*/
|
||||
void updatePasswordByCode(PlayUserReq playUserReq) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,24 @@ public class PlayletUserAppServiceImpl implements PlayletUserAppService {
|
|||
public void updatePlayletUser(PlayletUser 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class WxServiceImpl implements WxService {
|
|||
|
||||
@Override
|
||||
public String getOpenidByCode(String code) {
|
||||
String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid="+ wxConfig.getAppId() + "&secret=" + wxConfig.getSecret() + "&code=" + code + "&grant_type=authorization_code";
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid="+ wxConfig.getAppId() + "&secret=" + wxConfig.getSecret() + "&js_code=" + code + "&grant_type=authorization_code";
|
||||
log.info("调用微信获取openId,入参url:{}", url);
|
||||
String result = HttpUtils.sendGet(url);
|
||||
log.info("调用微信获取openId,响应内容:{}", result);
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ swagger:
|
|||
|
||||
#小程序配置
|
||||
wx:
|
||||
appId: 'wx60fa92c432e05ed1'
|
||||
secret: '8ff8ab065446e2ad552e88a37780d8fe'
|
||||
appId: 'wx0e233b84fa447fb4'
|
||||
secret: '9d8a99595d25cfc852f3644dafd06e98'
|
||||
|
||||
#阿里云OSS配置
|
||||
aliyun:
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class BaseEntity implements Serializable
|
|||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params;
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
|
|
|
|||
Loading…
Reference in New Issue