Parcourir la source

短信发送慢

2510966293@qq.com il y a 5 ans
Parent
commit
ad1e8c93d1

+ 19 - 4
src/main/java/com/yc/education/controller/WxLoginController.java

@@ -11,10 +11,7 @@ import net.sf.json.JSONObject;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -507,4 +504,22 @@ public class WxLoginController extends BaseController {
     }*/
 
 
+    @RequestMapping("sendsms.html")
+    @ResponseBody
+    public AjaxMessage<Object> sendSMS(HttpServletRequest request,HttpSession session,
+                                       @RequestParam(required = false, defaultValue = "") String phone) throws Exception {
+
+        Integer sendCoeds = (int) ((Math.random() * 9 + 1) * 100000);
+
+
+        String url = "http://www.uoleem.com.cn/api/";// 应用地址
+
+        String username = "shjieguan";// 账号
+        String pwd = "Shjieguan";// 密码
+        String mobile = phone;// 手机号码,多个号码使用","分割
+        String content = "【附近养车】校验码:" + sendCoeds+"" + ",您正在通过短信验证码登录,请尽快操作!";//短信内容
+        HttpSender.batchSend(url, username, pwd, mobile, content);
+        return new AjaxMessage<>(true, "", sendCoeds+"");
+    }
+
 }