yuliang 5 years ago
parent
commit
b3cc0df6c7

+ 30 - 1
whepi-ui/ok.html

@@ -1 +1,30 @@
-ok23
+<!DOCTYPE html>
+<html>
+<head>
+    <title>测试</title>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <script src="${s3('/jquery/1.11.0/jquery.min.js')}"></script>
+</head>
+<body>
+<button style="height: 70px; width: 150px" onclick="click();"> 测试 </button>
+</body>
+<script>
+  (function ($) {
+
+  })(jQuery);
+
+  function click() {
+    debugger;
+    $.ajax({
+      url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa3991865de920847&redirect_uri=http://yuliang.ng.yvanui.com/userOpen/loginTest&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect',
+      get: "get",
+      success: function (data) {
+        alert(data);
+        console.log(data);
+
+      },
+    });
+  }
+</script>

+ 36 - 0
whepi-ui/templates/ok.html

@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>测试</title>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <script src="${s3('/jquery/1.11.0/jquery.min.js')}"></script>
+</head>
+<body>
+<div>
+    <input type="button" style="height: 70px; width: 150px " onclick="clickwwwww();" value="测试"/>
+</div>
+</body>
+</html>
+<script>
+  function clickwwwww() {
+    debugger;
+    $.ajax({
+      url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa3991865de920847&redirect_uri=http://yuliang.ng.yvanui.com/userOpen/loginTest&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect',
+      get: "get",
+      success: function (data) {
+        alert(data);
+        console.log(data);
+
+      },
+    });
+  }
+  (function ($) {
+
+
+
+
+  })(jQuery);
+</script>

+ 25 - 0
whepi-web/src/main/java/com/bofeng/controller/EpiAdminController.java

@@ -8,6 +8,7 @@ import com.bofeng.entity.UserOpen;
 import com.bofeng.entity.UserRole;
 import com.bofeng.service.EpiAdminService;
 import com.bofeng.service.EpiTemplateMessageService;
+import com.bofeng.service.MsReportService;
 import com.bofeng.service.TemplateMessageService;
 import com.yvan.ModelOps;
 import com.yvan.mvc.Pd;
@@ -35,6 +36,9 @@ public class EpiAdminController {
     @Autowired
     private UserOpenMapper userOpenMapper;
 
+    @Autowired
+    private MsReportService msReportService;
+
     @ApiOperation("升级业委会角色")
     @PostMapping("/whepi/epi/admin/addRole")
     public ModelOps adminAddRole(@Pd(name = "we", desc = "手机号码") String we){
@@ -73,4 +77,25 @@ public class EpiAdminController {
 
         System.out.println("==============执行定时任务完毕================");
     }
+
+    @Scheduled(cron = "0 0 0 * * ?") //每天0点执行一次
+    public void scheduledReportByFixedDelay() {
+        System.out.println("==============执行定时任务开始================");
+        msReportService.getNowByYesterdayDate();
+//        Long start = 0L, count = 100L;
+//        while (true) {
+//            List<UserOpen> userOpens = userOpenMapper.getOpenUser(start, count);
+//            int re = 0;
+//            for (UserOpen userOpen : userOpens) {
+//                re += epiTemplateMessageService.systemSendRemindMessage(userOpen.getUserId(), userOpen.getOpenId());
+//            }
+//            System.out.println("==============执行定时任务"+re+"================");
+//            start += count;
+//            if (userOpens == null || userOpens.size()<count) {
+//                break;
+//            }
+//        }
+
+        System.out.println("==============执行定时任务完毕================");
+    }
 }

+ 15 - 15
whepi-web/src/main/java/com/bofeng/wx/WxController.java

@@ -123,24 +123,24 @@ public class WxController {
 //        );
 
         val btn1 = new WxMenuButton();
-        btn1.setName("健康日报");
+        btn1.setName("家园互助");
         btn1.setType(WxConsts.MenuButtonType.VIEW);
         btn1.setUrl(
                 wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
                                 "/user/home.html",
                         WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
         );
-        val btn2 = new WxMenuButton();
-        btn2.setName("商品团购");
-        btn2.setType(WxConsts.MenuButtonType.VIEW);
-        btn2.setUrl(
-                wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
-                                "/tuangou/home.html",
-                        WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
-        );
+//        val btn2 = new WxMenuButton();
+//        btn2.setName("商品团购");
+//        btn2.setType(WxConsts.MenuButtonType.VIEW);
+//        btn2.setUrl(
+//                wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
+//                                "/tuangou/home.html",
+//                        WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
+//        );
 
-        val btn3 = new WxMenuButton();
-        btn3.setName("我的");
+//        val btn3 = new WxMenuButton();
+//        btn3.setName("我的");
 
         val btnDesc = new WxMenuButton();
         btnDesc.setName("平台简介");
@@ -159,8 +159,8 @@ public class WxController {
                                 "/home/homeHelp.html",
                         WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
         );
-        btn3.getSubButtons().add(btnDesc);
-        btn3.getSubButtons().add(btnHelp);
+//        btn3.getSubButtons().add(btnDesc);
+//        btn3.getSubButtons().add(btnHelp);
 
 //        val btn2 = new WxMenuButton();
 //        btn2.setName("业委会");
@@ -223,8 +223,8 @@ public class WxController {
 //        btn3.getSubButtons().add(btn33);
 
         menu.getButtons().add(btn1);
-        menu.getButtons().add(btn2);
-        menu.getButtons().add(btn3);
+        menu.getButtons().add(btnDesc);
+        menu.getButtons().add(btnHelp);
 //        menu.getButtons().add(btn2);
 //        menu.getButtons().add(btn3);
         wxService.getMenuService().menuCreate(menu);

+ 19 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -5,6 +5,7 @@ import com.bofeng.entity.*;
 import com.bofeng.excel.ExcelUtils;
 import com.bofeng.service.*;
 import com.fasterxml.jackson.core.JsonProcessingException;
+import com.yvan.ModelOps;
 import com.yvan.platform.JsonWapper;
 import com.yvan.platform.YvanUtil;
 import com.yvan.springmvc.ResultModel;
@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.View;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -240,4 +242,21 @@ public class UserOpenController {
     public ModelAndView homeHelp(ModelMap model) {
         return new ModelAndView("/home/homeHelp.ftl", model);
     }
+
+    @GetMapping("/home/testOk.html")
+    public ModelAndView testOk(ModelMap model, HttpServletResponse response) {
+        response.setHeader("Access-Control-Allow-Credentials","true");
+        response.setHeader("Access-Control-Allow-Origin","*");
+        response.setHeader("Access-Control-Allow-Methods","GET,POST,OPTIONS,DELETE");
+        response.setHeader("Access-Control-Max-Age","3600");
+        response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
+
+        return new ModelAndView("/ok.html", model);
+    }
+
+    @GetMapping("/home/chulishuju")
+    public ModelOps chulishuju() {
+        msReportService.getNowByYesterdayDate();
+        return ModelOps.newSuccess();
+    }
 }