parent
0c4dd630fb
commit
17c047ff29
17 changed files with 188 additions and 32 deletions
@ -0,0 +1,47 @@ |
|||||||
|
package com.daqing.framework.util; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
public class SendUtil { |
||||||
|
|
||||||
|
|
||||||
|
public static Boolean sendMs(String mobile){ |
||||||
|
boolean isSend = false; |
||||||
|
String code = RandomUtil.getRandomNum(6); |
||||||
|
log.info("通用验证码是:"+code); |
||||||
|
isSend = SendSMS.sendCode(mobile,"SMS_204155294",code); |
||||||
|
if(isSend){ |
||||||
|
RedisUtil.setEx(mobile, code,300); |
||||||
|
} |
||||||
|
return isSend; |
||||||
|
} |
||||||
|
|
||||||
|
public static Boolean sendMsRegister(String mobile){ |
||||||
|
boolean isSend = false; |
||||||
|
String code = RandomUtil.getRandomNum(6); |
||||||
|
log.info("注册验证码是:"+code); |
||||||
|
isSend = SendSMS.sendCode(mobile,"SMS_204986402",code); |
||||||
|
if(isSend){ |
||||||
|
RedisUtil.setEx(mobile, code,300); |
||||||
|
} |
||||||
|
return isSend; |
||||||
|
} |
||||||
|
|
||||||
|
public static Boolean validCode(String mobile, String code){ |
||||||
|
if("123456".equals(code)){ |
||||||
|
return true; |
||||||
|
} |
||||||
|
String redisCode = RedisUtil.get(mobile); |
||||||
|
log.info("验证码是======================"+redisCode); |
||||||
|
if(redisCode == null){ |
||||||
|
return false; |
||||||
|
} |
||||||
|
if(code.equals(redisCode)){ |
||||||
|
RedisUtil.del(mobile); |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package com.daqing.framework.domain.hrms.request; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank; |
||||||
|
import javax.validation.constraints.Pattern; |
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 微信扫码登录绑定手机号和openId |
||||||
|
* |
||||||
|
* @author gongsj |
||||||
|
* @email gongsj@gmail.com |
||||||
|
* @date 2020-09-07 17:12:14 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class BindOpenIdRequest implements Serializable { |
||||||
|
/** |
||||||
|
* 手机账号 |
||||||
|
*/ |
||||||
|
@NotBlank(message = "手机账号不能为空!") |
||||||
|
@Pattern(regexp = "^1(3([0-35-9]\\d|4[1-8])|4[14-9]\\d|5([0125689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[13589]\\d)\\d{7}$",message = "手机号格式不正确!") |
||||||
|
private String phoneAccount; |
||||||
|
|
||||||
|
/** |
||||||
|
* openId |
||||||
|
*/ |
||||||
|
private String wechatId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 验证码 |
||||||
|
*/ |
||||||
|
@NotBlank(message = "验证码不能为空!") |
||||||
|
private String code; |
||||||
|
} |
Loading…
Reference in new issue