Browse Source

Merge remote-tracking branch 'origin/master'

peiguo 5 năm trước cách đây
mục cha
commit
6577784329

+ 86 - 0
admin-ui/app/whepi/ceshi.js

@@ -0,0 +1,86 @@
+define(function (require) {
+  return function (context) {
+
+    var $form, $form1;
+
+    //检查查询
+    function queryGrid1() {
+      var obj = $form.formGet();
+      if (obj.we == "") {
+        $.yvan.msg('请选择电话号码');
+        return false;
+      }
+      return true;
+    }
+
+    //检查查询
+    function queryGrid2() {
+      var obj = $form1.formGet();
+      if (obj.uptownId == "") {
+        $.yvan.msg('请选择小区');
+        return false;
+      }
+      if (obj.date == "") {
+        $.yvan.msg('请选择导出时间');
+        return false;
+      }
+      return true;
+    }
+
+    return {
+      center: {
+        border: false,
+        title: '数据处理',
+        items: [
+          {
+            onRender: function () {
+              $form = $(this);
+            },
+            xtype: 'formgroup',
+            title: '',
+            items: [
+              [
+                {
+                  xtype: 'textbox',
+                  label: '电话号码',
+                  name: 'we',
+                  prompt: '请输入要添加的电话号码',
+                  labelWidth: 'auto',
+                  id: 'we',
+                },
+              ]
+            ]
+          },
+          {
+            xtype: 'group',
+            title: '具体操作',
+            items: [
+              [{xtype: 'offset'},
+                {
+                  xtype: 'button', text: '授权测试', class: 'button-blue', onClick: function () {
+                    if (!queryGrid1()) {
+                      return;
+                    }
+                    var a = $form.formGet()
+
+                    $.yvan.ajax({
+                      method: 'post',
+                      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',
+                      data: $form.formGet(),
+                      success: function (data) {
+                        $.yvan.msg('操作成功');
+                        return;
+                      }
+                    });
+
+
+                  }
+                },
+              ],
+            ]
+          }
+        ]
+      },
+    };
+  };
+});

+ 22 - 3
whepi-ui/templates/yeweihui/tuangouHome.ftl

@@ -1,7 +1,24 @@
-<#assign title="我的团购"/>
+<#assign title="管理员"/>
 <#include "/home/frag.head.ftl" />
 
-<#include "/yeweihui/tuangou.ftl" />
+<div class="weui-tab">
+    <input id="userId" type="text" hidden="hidden" value=${user_id!}/>
+    <input id="uptownId" type="text" hidden="hidden" value=${uptown_id!}/>
+    <input id="uptownName" type="text" hidden="hidden" value=${uptown_name!}/>
+
+    <div class="weui-tab__bd">
+        <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
+            <#include "/yeweihui/tuangou.ftl" />
+        </div>
+    </div>
+    <div class="weui-tabbar">
+        <a id="tab1a" href="#tab1" class="weui-tabbar__item weui-bar__item--on">
+            <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
+            <p class="weui-tabbar__label">团购</p>
+        </a>
+    </div>
+</div>
+
 
 </body>
 
@@ -21,6 +38,8 @@
             });
 
         });
-    })(jQuery);
 
+        tuangou_init();
+
+    })(jQuery);
 </script>

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

@@ -8,10 +8,15 @@ import com.bofeng.entity.UserRole;
 import com.bofeng.service.HomeService;
 import com.bofeng.service.WxUserOpenService;
 import com.yvan.Model;
+import com.yvan.ModelOps;
 import com.yvan.platform.JsonWapper;
 import com.yvan.platform.StringUtils;
+import com.yvan.springmvc.HttpParameterParser;
+import com.yvan.springmvc.HttpUtils;
 import io.swagger.annotations.ApiOperation;
+import lombok.val;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -30,6 +35,26 @@ public class WxUserOpenController {
     @Autowired
     private WxUserOpenService wxUserOpenService;
 
+    @GetMapping("/userOpen/loginTest")
+    public Model<UserOpen> loginTest() {
+        val parser = HttpParameterParser.newInstance(HttpUtils.currentRequest());
+        String openId = parser.getString("openId");
+        String code = parser.getString("code");
+        if (StringUtils.isNullOrEmpty(code)) {
+            return Model.newFail("code为空");
+        }
+        UserOpen userOpen = homeService.getUserOpenByCode(code);
+        if (userOpen == null) {
+            return Model.newFail("微信登录失败");
+        }
+        //成功返回用户Id
+        try {
+            return Model.newSuccess(userOpen);
+        } catch (Exception e) {
+            return Model.newFail(e.getMessage());
+        }
+    }
+
     @ApiOperation("用户注册页面点登录")
     @PostMapping("/userOpen/login")
     public Model<UserOpen> login(JsonWapper jsonWapper) {

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

@@ -64,10 +64,10 @@ public class UserOpenController {
                              @RequestParam(value = "userType", required = false, defaultValue = "0") Integer userType) throws JsonProcessingException {
         List<UserRole> list = new ArrayList<>();
         if (userId == 0) {
-            UserOpen userOpen = homeService.getUserOpen();
-            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
-//            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
-//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+//            UserOpen userOpen = homeService.getUserOpen();
+//            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
+            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
             userId = userOpen.getUserId();
             model.put("user", userOpen);
             model.put("user_id", "\"" + userOpen.getUserId() + "\"");

+ 1 - 1
whepi-web/src/main/resources/application.yml

@@ -43,7 +43,7 @@ endpoints:
 #  whitelabel.enabled: false
 
 spring:
-  profiles.active: guojing
+  profiles.active: lll
 
   application:
     name: bofeng-web