lc895296059@163.com před 4 roky
rodič
revize
ed97208121

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 3
src/main/java/com/jfinal/club/login/user.ftl


+ 18 - 14
src/main/java/com/jfinal/club/reg/RegController.java

@@ -16,6 +16,7 @@ package com.jfinal.club.reg;
 
 import com.alibaba.fastjson.JSONObject;
 import com.jfinal.aop.Before;
+import com.jfinal.aop.Clear;
 import com.jfinal.aop.Inject;
 import com.jfinal.club.common.kit.IpKit;
 import com.jfinal.club.util.HttpSender;
@@ -25,6 +26,7 @@ import com.jfinal.kit.StrKit;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 import java.util.regex.Pattern;
 
 /**
@@ -88,26 +90,22 @@ public class RegController extends Controller {
      * @Date 2020/3/16
      * @Param []
      **/
+    @Clear
     public void sendMessage() throws Exception {
-        JSONObject object = new JSONObject();
         String phone = getPara("phone");
         String reg = "^[1](([3|5|8][\\d])|([4][4,5,6,7,8,9])|([6][2,5,6,7])|([7][^9])|([9][1,8,9]))[\\d]{8}$";// 验证手机号
         if (!StrKit.isBlank(phone)) {
             boolean matches = Pattern.compile(reg).matcher(phone).matches();
             if (matches) {
-                String s = sendSMS(phone);
-                object.put("is", true);
-//                object.put("code", s);
-                renderJson(object);
-                Map<String, String> map = new HashMap<>();
-                map.put("SMSPhone", phone);
-                map.put("SMSCode", s);
-                setSessionAttr(phone, map);
+                String msg = sendSMS(phone);
+                if(Objects.equals("OK",msg)){
+                    renderJson(Ret.ok("msg","短信发送成功"));
+                }else{
+                    renderJson(Ret.fail("msg",msg));
+                }
             }
         } else {
-            object.put("is", false);
-//            object.put("code", 0);
-            renderJson(object);
+            renderJson(Ret.fail("msg","手机号码错误!"));
         }
     }
 
@@ -135,8 +133,14 @@ public class RegController extends Controller {
         String paramstring = "{\"code\":\"" + sendCoed + "\"}";
         String templatecode = "SMS_180054910";
         String str = "你的验证码为:" + sendCoed + ",该验证码5分钟内有效,请勿泄漏于他人。\n";
-        boolean fag = HttpSender.sendSms("铁嘴网", templatecode, phone, paramstring);
-        return sendCoed;
+        String msg = HttpSender.sendSms("铁嘴网", templatecode, phone, paramstring);
+        if(Objects.equals("OK",msg)){
+            Map<String, String> map = new HashMap<>();
+            map.put("SMSPhone", phone);
+            map.put("SMSCode", sendCoed);
+            setSessionAttr(phone, map);
+        }
+        return msg;
     }
 
 

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

@@ -78,7 +78,7 @@ public class HttpSender {
 
 
     //发送短信方法
-    public static boolean sendSms(String signname, String templatecode, String phone, String paramstring) throws ClientException {
+    public static String sendSms(String signname, String templatecode, String phone, String paramstring) throws ClientException {
         //可自助调整超时时间
         System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
         System.setProperty("sun.net.client.defaultReadTimeout", "10000");
@@ -110,9 +110,9 @@ public class HttpSender {
         SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
         System.err.println(sendSmsResponse.getCode());
         if ("OK".equals(sendSmsResponse.getCode())) {
-            return true;
+            return "OK";
         } else {
-            return false;
+            return sendSmsResponse.getMessage();
         }
     }
 

+ 0 - 1
src/main/webapp/_view/_admin/account/index.html

@@ -139,7 +139,6 @@
      */
     $("input[name ='locks']").click(function () {
         var id = $(this).attr("data-id");
-        console.log(id)
         if (this.checked) {
             $.post("/admin/account/lock_t", {"id": id, "p": '#(usersPage.pageNumber)'}, function (data) {
                 if (data.state == 'ok') {

+ 13 - 5
src/main/webapp/_view/login/forget_password.html

@@ -113,7 +113,7 @@
 <script type="text/javascript" src="/assets/jquery_form/jquery.form.min.js"></script>
 <script type="text/javascript" src="/assets/layer/layer/layer.js"></script>
 <script src="/assets/js/jfinal-admin-common.js"></script>
-<script src="/nvrnetwork/assets/js/jfinal-admin.js"></script>
+<script src="/assets/js/jfinal-admin.js"></script>
 <script type="text/javascript">
 
     $(document).ready(function () {
@@ -141,8 +141,6 @@
     });
 
 
-
-
     var bbte = 60;
 
     function daojishi() {
@@ -152,6 +150,7 @@
                 $("#logleyzs").val("重新获取");
                 $("#logleyzs").attr("disabled", false);
                 clearInterval(itenout);
+                $("#logleyzs").attr("onclick","sendMessage()");
                 return;
             }
             if (bbte > 0) {
@@ -165,11 +164,19 @@
 
     function sendMessage() {
         var phone = $("#phone").val();
+        var reg = /^0?1[3|4|5|8|7][0-9]\d{8}$/;
+        if(!reg.test(phone)){
+            layer.msg("手机号码输入有误!");
+            $("#phone").focus()
+            return false
+        }
+
+        $("#logleyzs").removeAttr("onclick");
         $.post("/reg/sendMessage", {"phone": phone}, function (data) {
-            if (data.is) {
+            if (data.state == "ok") {
                 daojishi();
             } else {
-                layer.msg("手机号码有误", {
+                layer.msg(data.msg, {
                         shift: 6
                         , shade: 0.3
                         , time: 0
@@ -177,6 +184,7 @@
                         , closeBtn: 1
                         , shadeClose: false
                     }, function () {
+                        $("#logleyzs").attr("onclick","sendMessage()");
                     }
                 );
             }

+ 12 - 2
src/main/webapp/_view/reg/register.html

@@ -143,6 +143,7 @@
                 $("#logleyzs").val("重新获取");
                 $("#logleyzs").attr("disabled", false);
                 clearInterval(itenout);
+                $("#logleyzs").attr("onclick","sendMessage()");
                 return;
             }
             if (bbte > 0) {
@@ -156,11 +157,19 @@
 
     function sendMessage() {
         var phone = $("#phone").val();
+        var reg = /^0?1[3|4|5|8|7][0-9]\d{8}$/;
+        if(!reg.test(phone)){
+            layer.msg("手机号码输入有误!");
+            $("#phone").focus()
+            return false
+        }
+
+        $("#logleyzs").removeAttr("onclick");
         $.post("/reg/sendMessage", {"phone": phone}, function (data) {
-            if (data.is) {
+            if (data.state == "ok") {
                 daojishi();
             } else {
-                layer.msg("手机号码有误", {
+                layer.msg(data.msg, {
                         shift: 6
                         , shade: 0.3
                         , time: 0
@@ -169,6 +178,7 @@
                         , shadeClose: false
                     }, function () {
                         updateRegCaptcha();
+                        $("#logleyzs").attr("onclick","sendMessage()");
                     }
                 );
             }

src/main/webapp/upload/temp/e5521034783593e04f4fb8028516d8f9.jpg → target/jfinal-club-release/jfinal-club/webapp/upload/img/feedback/0/0_20200331103932.jpg


src/main/webapp/upload/temp/u=3459187728,3433791377&fm=26&gp=0.jpg → target/jfinal-club-release/jfinal-club/webapp/upload/img/temp/u=3459187728,3433791377&fm=26&gp=01.jpg