Your Name 3 years ago
parent
commit
c38d40d3d2

+ 9
- 2
src/main/java/com/yunzhi/marketing/common/WorkWxUtils.java View File

47
             params.put("limit", 10);
47
             params.put("limit", 10);
48
             JSONObject result = post("/cgi-bin/living/get_user_all_livingid", params);
48
             JSONObject result = post("/cgi-bin/living/get_user_all_livingid", params);
49
             JSONArray lst = result.getJSONArray("livingid_list");
49
             JSONArray lst = result.getJSONArray("livingid_list");
50
-            return lst.size() > 0 ? (String) lst.get(0) : null;
50
+            String livingId = lst.size() > 0 ? (String) lst.get(0) : null;
51
+
52
+//            if (!StringUtils.isEmpty(livingId)) {
53
+//                JSONObject res = post("/cgi-bin/living/get_living_info?livingid="+StringUtils.urlEncode(livingId), null);
54
+//                System.out.println(res);
55
+//            }
56
+
57
+            return livingId;
51
         } catch (WxErrorException e) {
58
         } catch (WxErrorException e) {
52
             if (90601 == e.getError().getErrorCode()) {
59
             if (90601 == e.getError().getErrorCode()) {
53
                 throw new Exception("直播房间不存在");
60
                 throw new Exception("直播房间不存在");
92
 
99
 
93
     private JSONObject post(String url, JSONObject data) throws WxErrorException {
100
     private JSONObject post(String url, JSONObject data) throws WxErrorException {
94
         String uri = wxCpService.getWxCpConfigStorage().getApiUrl(url);
101
         String uri = wxCpService.getWxCpConfigStorage().getApiUrl(url);
95
-        String response = wxCpService.post(uri, data.toJSONString());
102
+        String response = wxCpService.post(uri, null != data  ? data.toJSONString() : null);
96
         return JSONObject.parseObject(response);
103
         return JSONObject.parseObject(response);
97
     }
104
     }
98
 }
105
 }

+ 2
- 2
src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java View File

306
     }
306
     }
307
 
307
 
308
     @GetMapping("/wx/taLiveActivity/work/livingCode")
308
     @GetMapping("/wx/taLiveActivity/work/livingCode")
309
-    public ResponseBean getWorkLivingCode(@RequestParam String livingid,
309
+    public ResponseBean getWorkLivingCode(@RequestParam("user") String user,
310
                                           HttpServletRequest request) {
310
                                           HttpServletRequest request) {
311
         String openid = getOpenId(request);
311
         String openid = getOpenId(request);
312
         try {
312
         try {
313
-            String id = workWxUtils.getLivingId(livingid);
313
+            String id = workWxUtils.getLivingId(user);
314
             String livingCode = workWxUtils.getLivingCode(id, openid);
314
             String livingCode = workWxUtils.getLivingCode(id, openid);
315
             return ResponseBean.success(livingCode);
315
             return ResponseBean.success(livingCode);
316
         } catch (Exception e) {
316
         } catch (Exception e) {