短信接口
来源:互联网 发布:同城团购用什么软件 编辑:程序博客网 时间:2024/05/23 19:16
@Log4j
public Result<Map<String, Integer>>getValidateCode(StringdeviceId, Stringtype, Stringmobile) {
Result<Map<String, Integer>>result =new Result<>();
longincr = MemcacheUtil.incr(memcachedClient,mobile + "_mc_count");
System.out.println("验证次数"+incr);
if (incr >= 20) {
//一天中发送验证码过多
result.setResultCode("2");
result.setResultMessage("验证次数过多");
returnresult.setError();
}
//生成6位验证码
String code = (int) ((Math.random() * 9 + 1) * 100000) +"";
System.out.println("验证码"+code+"手机号"+mobile);
//存入缓存中
MemcacheUtil.replace(memcachedClient,mobile +"_mc",code);
System.out.println("缓存中"+MemcacheUtil.get(memcachedClient,mobile+"_mc")+"手机号"+mobile);
//发送验证码
String content = "您的验证码为" +code + ",验证码将在5分钟后失效,届时请重新获取";
String data = "username=123&password=123&gateway=0&extendCode=00&mobile=" +mobile +"&content=" +content;
String url = "http://116.**.**.***:8080/CMS/smssrv/Send.html";
String callback = GetValidateCode.sendPost(url,data);
JSONObject callback_json = JSONObject.fromObject(callback);
String data_ = callback_json.getString("result");
if ("0".equals(data_)) {
//验证码发送成功进行缓存保存验证码
result.setResultCode("0");
returnresult.setSusses();
} else {
//验证码发送失败
result.setResultCode("1");
returnresult.setError();
}
}
- 短信接口
- 短信接口
- 短信接口
- 短信接口
- 短信接口
- 短信接口
- 短信接口
- 新浪短信接口新浪短信接口
- 短信接口哪家好 凌凯短信接口
- 又写短信接口
- 短信接口平台
- 短信接口平台
- 贝贝短信开发接口
- 星幻短信接口
- 短信支付接口
- 实时调用短信接口
- 调用接口发短信
- php短信接口源码
- PagerAdapter基本概况
- 1.UIAlertController
- Mac OS X中MacPorts安装和使用
- 金蝶结账的时候出现压缩账套失败 KIC_Compress.KD
- 架构漫谈(六):软件架构到底是要解决什么问题?
- 短信接口
- jsp九大内置对象、四种作用域、跳转方式
- 轻量响应式 CSS 框架
- java多线程学习
- 基于FL2440开发板的U-boot移植记录
- spring自带的定时任务功能,基于注解和xml配置
- NIO框架(4)---聊天室
- 杭电5687-字典树模板
- git开源库——布局——流式布局