瀏覽代碼

sms message send

daqian 4 年之前
父節點
當前提交
823baacd3b
共有 2 個文件被更改,包括 13 次插入14 次删除
  1. 11 12
      src/main/java/com/jfinal/club/reg/RegController.java
  2. 2 2
      src/main/java/com/jfinal/club/util/HttpSender.java

+ 11 - 12
src/main/java/com/jfinal/club/reg/RegController.java

@@ -17,16 +17,14 @@ package com.jfinal.club.reg;
 import com.alibaba.fastjson.JSONObject;
 import com.jfinal.aop.Before;
 import com.jfinal.aop.Inject;
+import com.jfinal.club.common.kit.IpKit;
 import com.jfinal.club.util.HttpSender;
 import com.jfinal.core.Controller;
-import com.jfinal.club.common.kit.IpKit;
 import com.jfinal.kit.Ret;
 import com.jfinal.kit.StrKit;
-import org.apache.commons.lang3.StringUtils;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.regex.Pattern;
 
 /**
@@ -125,18 +123,19 @@ public class RegController extends Controller {
         Integer sendCoeds = (int) ((Math.random() * 9 + 1) * 100000);
         String sendCoed = String.valueOf(sendCoeds);
 
-        String urls = "http://api.uoleem.com.cn/sms/uoleemApi";// 应用地址
+//uoleem平台
+/*        String urls = "http://api.uoleem.com.cn/sms/uoleemApi";// 应用地址
         String username = "shjieguan";// 账号
         String pwd = "Shjieguan";// 密码
         String mobile = phone;// 手机号码,多个号码使用","分割
         String content = "你的验证码为:" + sendCoed + ",该验证码5分钟内有效,请勿泄漏于他人。";
-        String returnString = HttpSender.batchSend(urls, username, pwd, mobile, content);
+        String returnString = HttpSender.batchSend(urls, username, pwd, mobile, content);*/
 
-//        String paramstring = "{\"code\":\"" + sendCoed + "\"}";
-//        String templatecode = "SMS_123672940";
-//        title = "获取密码";
-//        String str = "你的验证码为:" + sendCoed + ",该验证码5分钟内有效,请勿泄漏于他人。\n";
-//        boolean fag = HttpSender.sendSms("接米网络", templatecode, phone, paramstring);
+//阿里平台
+        String paramstring = "{\"code\":\"" + sendCoed + "\"}";
+        String templatecode = "SMS_180054910";
+        String str = "你的验证码为:" + sendCoed + ",该验证码5分钟内有效,请勿泄漏于他人。\n";
+        boolean fag = HttpSender.sendSms("铁嘴网", templatecode, phone, paramstring);
         return sendCoed;
     }
 

+ 2 - 2
src/main/java/com/jfinal/club/util/HttpSender.java

@@ -73,8 +73,8 @@ public class HttpSender {
     static final String domain = "dysmsapi.aliyuncs.com";
 
     // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
-    static final String accessKeyId = "nI7j7sUzmnm3HIGn";
-    static final String accessKeySecret = "1ATZnBIGvT6iWN6IIqryAvnUhE23LP";
+    static final String accessKeyId = "LTAI4Fj9zH8KFRVmRA9YrqDr";
+    static final String accessKeySecret = "w9aH1yJyvlUoQJ71hVKMY6Rr7jW7xU";
 
 
     //发送短信方法