add:手机短信验证码
This commit is contained in:
parent
221902f161
commit
64e9304966
2 changed files with 13 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ import com.sqx.modules.app.utils.UserConstantInterface;
|
|||
import com.sqx.modules.app.utils.WxPhone;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.sys.service.SysCaptchaService;
|
||||
import com.sqx.modules.utils.HttpClientUtil;
|
||||
import com.sqx.modules.utils.MD5Util;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -24,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
import weixin.popular.api.SnsAPI;
|
||||
import weixin.popular.bean.sns.SnsToken;
|
||||
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -43,6 +46,9 @@ public class AppLoginController {
|
|||
@Autowired
|
||||
private CommonInfoService commonInfoService;
|
||||
|
||||
@Autowired
|
||||
SysCaptchaService sysCaptchaService;
|
||||
|
||||
|
||||
@ApiOperation("微信小程序登陆")
|
||||
@RequestMapping(value = "/wxLogin", method = RequestMethod.GET)
|
||||
|
|
@ -119,9 +125,13 @@ public class AppLoginController {
|
|||
}
|
||||
|
||||
@ApiOperation("用户端发送验证码")
|
||||
@RequestMapping(value = "/sendMsg/{phone}/{state}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/sendMsg/{phone}/{state}/{captchaval}/{uuid}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result sendMsg(@PathVariable String phone, @PathVariable String state) {
|
||||
public Result sendMsg(@PathVariable String phone, @PathVariable String state,@PathVariable String captchaval,@PathVariable String uuid) {
|
||||
boolean captcha = sysCaptchaService.validate(uuid, captchaval);
|
||||
if(!captcha){
|
||||
return Result.error("验证码不正确");
|
||||
}
|
||||
return userService.sendMsg(phone, state);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class SysCaptchaServiceImpl extends ServiceImpl<SysCaptchaDao, SysCaptcha
|
|||
captchaEntity.setCode(code);
|
||||
//5分钟后过期
|
||||
captchaEntity.setExpireTime(DateUtils.addDateMinutes(new Date(), 5));
|
||||
this.save(captchaEntity);
|
||||
this.saveOrUpdate(captchaEntity,new QueryWrapper<SysCaptchaEntity>().eq("uuid",uuid));
|
||||
|
||||
return producer.createImage(code);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue