lc895296059@163.com 4 lat temu
rodzic
commit
ade14a0794

+ 13 - 7
src/main/java/com/yc/education/controller/UsersController.java

@@ -95,6 +95,7 @@ public class UsersController {
         AjaxMessage<Object> ajax = new AjaxMessage<>();
         Integer sendCoeds = (int) ((Math.random() * 9 + 1) * 100000);
         String sendCoed = String.valueOf(sendCoeds);
+        System.out.println("*** >>> 验证码:"+sendCoed );
         Map<String, String> map = new HashMap<>();
         if (type == 0) {
             map.put("SMSPhone", phone);
@@ -188,18 +189,22 @@ public class UsersController {
     @RequestMapping("register.html")
     public AjaxMessage register(String phone, HttpServletRequest request) {
         AjaxMessage ajaxMessage = new AjaxMessage();
-        String openId = (String) request.getSession().getAttribute("openId");
-        Object recommendid = request.getSession().getAttribute("recommendid");
-        JSONObject weixinuser = (JSONObject) request.getSession().getAttribute("weixinuser");
+        ajaxMessage.setIs(true);
+        System.out.println("** >>> 准备登陆 " );
         Users usersByPhone = usersService.getUsersByPhone(phone);
+        System.out.println("*** usersByPhone >> "+usersByPhone);
+        Object recommendid = request.getSession().getAttribute("recommendid");
+        System.out.println("*** recommendid >> "+ recommendid);
         Users users = null;
-        int save = 0;
+        int save = 1;
         if (usersByPhone != null) {
-            usersByPhone.setOpenid(openId);
-            usersService.setCharsetToUtf8mb4();
-            save = usersService.updateNotNull(usersByPhone);
             request.getSession().setAttribute("users", usersByPhone);
         } else {
+
+            String openId = (String) request.getSession().getAttribute("openId");
+
+            JSONObject weixinuser = (JSONObject) request.getSession().getAttribute("weixinuser");
+
             users = new Users();
             users.setAddtime(new Date());
             Object nickname = weixinuser.get("nickname");
@@ -287,6 +292,7 @@ public class UsersController {
         } else {
             ajaxMessage.setIs(true);
         }
+        System.out.println("**** end "+ajaxMessage );
         return ajaxMessage;
     }
 

+ 5 - 3
src/main/java/com/yc/education/controller/admin/IndexAdminController.java

@@ -88,7 +88,7 @@ public class IndexAdminController {
     @RequestMapping("adminproxy.html")
     public ModelAndView adminproxy(@RequestParam(required = false, defaultValue = "0") int page,
                                    @RequestParam(required = false, defaultValue = "10") int rows,
-                                   int type) {
+                                   @RequestParam(required = false, defaultValue = "1") int type) {
         ModelAndView modelAndView = new ModelAndView();
         List<Procuration> procurations = procurationService.PROCURATION_LIST(page, rows, type);
         modelAndView.addObject("pageInfo", new PageInfo<>(procurations));
@@ -109,8 +109,10 @@ public class IndexAdminController {
         ModelAndView modelAndView = new ModelAndView();
         List<Sign> signList = signService.SIGN_LIST(page, rows);
         for (Sign sign : signList) {
-            Users users = usersService.selectByKey(sign.getUserid());
-            sign.setUsername(users.getName());
+            if(sign.getUserid() != null){
+                Users users = usersService.selectByKey(sign.getUserid());
+                sign.setUsername(users.getName());
+            }
         }
         modelAndView.addObject("pageInfo", new PageInfo<>(signList));
         return modelAndView;

+ 0 - 40
src/main/java/com/yc/education/util/CreateKey.java

@@ -1,40 +0,0 @@
-package com.yc.education.util;
-
-
-import cn.com.do1.dqdp.creater.ComponentCreater;
-
-public class CreateKey {
-/*    public static void main(String[] arguments) throws Exception {
-
-        String mac = "08-D4-0C-0D-9E-81";
-        System.out.println("MAC ......... " + mac);
-        String content = "99999|20221228";
-        System.out.println("加密前:" + content);
-        byte[] encryptResult = AESEncryptUtil.encrypt(content.getBytes(), mac);
-        String encryptResultStr = parseByte2HexStr(encryptResult);
-        System.out.println("加密后:" + encryptResultStr);
-// 解密
-        byte[] decryptFrom = parseHexStr2Byte(encryptResultStr);
-        byte[] decryptResult = AESEncryptUtil.decrypt(decryptFrom, mac);
-        System.out.println("解密后:" + new String(decryptResult));
-    }*/
-
-//    static ComponentCreater createrTester = new ComponentCreater("E:\\daoyicode\\2017年西南财经大学会计学院企业号项目\\trunk\\wxqyh2.3.1\\wxqyh-subproject\\src\\main\\java", "teacher.lecture", "default");
-
-    public static void main(String[] arguments) throws Exception {
-
-        ComponentCreater createrTester = new ComponentCreater("/Users/apple/Desktop/java/", "cadre", "default");
-        /*  createrTester.addTable(new String[]{"wxqyh_jhjyj_3.0.2","tb_zs_performance_config"});*/
-        createrTester.addTable(new String[]{"wxqyh_jhjyj_3.0.2", "tb_zs_cadre_operation_log"});
-        try {
-            createrTester.buildPO();  //生成PO实体类
-            //createrTester.buildRensources();
-            //createrTester.buildJavaCode(); //生成其他
-        } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
-
-}

+ 7 - 3
src/main/java/com/yc/education/util/MachineIp.java

@@ -1,5 +1,6 @@
 package com.yc.education.util;
 
+import java.io.IOException;
 import java.net.Inet4Address;
 import java.net.InetAddress;
 import java.net.InterfaceAddress;
@@ -39,8 +40,11 @@ public class MachineIp {
         return ip;
     }
 
-    public static void main(String[] args) {
-    	System.err.println(localIp());
-	}
+    public static void main(String[] args) throws IOException {
+    	/*System.err.println(localIp());*/
+        SM4 sm4 = new SM4( );
+        String decode = sm4.decode("pVUnxpFL39NMFFupXDwBdA==", "W5#");
+        System.out.println(decode );
+    }
 
 }

+ 22 - 37
src/main/resources/log4j.properties

@@ -1,43 +1,28 @@
-#
-# The MIT License (MIT)
-#
-# Copyright (c) 2014 abel533@gmail.com
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-log4j.rootLogger=debug,stdout,logfile
-
-
+log4j.rootLogger=DEBUG, stdout
+log4j.logger.java.sql=debug,stdout 
 log4j.logger.com.github.pagehelper=DEBUG
 log4j.logger.org.apache.ibatis=DEBUG
-
-log4j.logger.com.github.pagehelper.mapper = TRACE
-
+log4j.logger.com.github.pagehelper.mapper=TRACE
 ### Console output...
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.Encoding=UTF-8
+log4j.appender.stdout.Target=System.err
 log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
-
-log4j.logger.com.ibatis=DEBUG
-log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
-log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
-log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
-log4j.logger.Java.sql.Connection=DEBUG
-log4j.logger.java.sql.Statement=DEBUG
-log4j.logger.java.sql.PreparedStatement=DEBUG
+###### File Logger ###############
+#开发时,使用DEBUG,发布时最好修改成INFO,如果未设置级别,则使用
+#父日志记录器的,设置了就使用logger的,不管父日志怎样设置
+log4j.logger.com.yc=INFO,FILELOGER
+#开发时设为true,表示需要屏幕输出,发布时这里最好设置为false,表示不继承父日志记录器的Appender
+log4j.additivity.com.yc=true
+log4j.appender.FILELOGER=org.apache.log4j.RollingFileAppender
+#设置日志输出编码方式为UTF-8,如果不指定,会以当前运行操作系统的编码方式记录,这样在有的Linux上会出面乱码
+log4j.appender.FILELOGER.Encoding=UTF-8
+#${LOGS_PATH}为JVM环境变量,我们可以在运行里给JVM加上该参数 -DLOGS_PATH=e:/tmp/log
+log4j.appender.FILELOGER.File=${catalina.home}/logs/jiemit.log
+log4j.appender.FILELOGER.MaxFileSize=1024KB
+log4j.appender.FILELOGER.MaxBackupIndex=10
+#文件采用追加方式
+log4j.appender.FILELOGER.Append=true
+log4j.appender.FILELOGER.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILELOGER.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] [%p] [%l] - [%m]%n

+ 7 - 7
src/main/webapp/WEB-INF/jsp/admin/adminproxy.jsp

@@ -42,7 +42,7 @@
         <%--			</span>--%>
         <a class="btn btn-danger radius" href="javascript:;" id="delete"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
 
-        <span class="r">共有数据:<strong>${pageInfo.total }</strong> 条</span>
+        <span class="r">共有数据:<strong>${pageInfo.total }</strong> ss条</span>
     </div>
     <div class="mt-20">
         <table class="table table-border table-bordered table-bg table-hover table-sort">
@@ -117,21 +117,21 @@
         <section>
             <div class="bd points-goods-list">
                 <ul class="pages">
-                    <li><a href="adminproxy.html?page=1&rows=${pageInfo.pageSize}">首页</a></li>
+                    <li><a href="adminproxy.html?page=1&rows=${pageInfo.pageSize}&type=${type}">首页</a></li>
                     <li class="prev"><a
-                            href="adminproxy.html?page=${pageInfo.prePage}&rows=${pageInfo.pageSize}">上一页</a></li>
+                            href="adminproxy.html?page=${pageInfo.prePage}&rows=${pageInfo.pageSize}&type=${type}">上一页</a></li>
                     <c:forEach items="${pageInfo.navigatepageNums}" var="nav">
                         <c:if test="${nav == pageInfo.pageNum}">
-                            <li><a href="adminproxy.html?page=${nav}&rows=${pageInfo.pageSize}"
+                            <li><a href="adminproxy.html?page=${nav}&rows=${pageInfo.pageSize}&type=${type}"
                                    class="active">${nav}</a></li>
                         </c:if>
                         <c:if test="${nav != pageInfo.pageNum}">
-                            <li><a href="adminproxy.html?page=${nav}&rows=${pageInfo.pageSize}">${nav}</a></li>
+                            <li><a href="adminproxy.html?page=${nav}&rows=${pageInfo.pageSize}&type=${type}">${nav}</a></li>
                         </c:if>
                     </c:forEach>
                     <li class="next"><a
-                            href="adminproxy.html?page=${pageInfo.nextPage}&rows=${pageInfo.pageSize}">下一页</a></li>
-                    <li><a href="adminproxy.html?page=${pageInfo.pages }&rows=${pageInfo.pageSize}">末页</a></li>
+                            href="adminproxy.html?page=${pageInfo.nextPage}&rows=${pageInfo.pageSize}&type=${type}">下一页</a></li>
+                    <li><a href="adminproxy.html?page=${pageInfo.pages }&rows=${pageInfo.pageSize}&type=${type}">末页</a></li>
                 </ul>
             </div>
         </section>

+ 7 - 1
src/main/webapp/WEB-INF/jsp/apply_proxy.jsp

@@ -119,14 +119,18 @@
      * @returns {boolean}
      */
     function sendsmg() {
+        $(".get_codes").removeAttr("onclick");
         var phone = $("#phone").val();
         if (phone == null || phone == '') {
             layer.msg("请输入手机号码");
             return false;
         } else {
             $.post("sendsms.html", {"phone": phone}, function (data) {
+                if(!data.is){
+                    layer.msg("该手机号已被限流,限流规则:一条/分钟,5条/小时,10条/天!", {icon: 0, time: 5000});
+                }
+            },"json");
 
-            });
             interval = setInterval(function () {
                 if (seconds > 0) {
                     seconds--;
@@ -134,11 +138,13 @@
                     $(".get_codes").attr("disabled", true)
                 } else {
                     clearInterval(interval)
+                    $(".get_codes").attr("onclick","sendsmg()");
                     $(".get_codes").text('重新获取');
                     $(".get_codes").attr("disabled", false)
                     seconds = 60;
                 }
             }, 1000)
+
         }
     }
 

+ 0 - 2
src/main/webapp/WEB-INF/jsp/login.jsp

@@ -119,10 +119,8 @@
                 layer.msg("验证码错误,请您核对验证码");
             } else {
                 $.post("register.html", {"phone": phone}, function (datas) {
-                    if (!datas.is) {
                         layer.msg("登录成功");
                         window.location.href = "my.html";
-                    }
                 })
             }
         })