From 264b5dea5b74c4b5ba54a90caba7e709858a037e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 25 八月 2022 17:58:27 +0800
Subject: [PATCH] 增加rabbitmq

---
 src/main/java/com/yeshi/buwan/controller/parser/OtherParser.java |   91 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 65 insertions(+), 26 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/controller/parser/OtherParser.java b/src/main/java/com/yeshi/buwan/controller/parser/OtherParser.java
index 132df49..ba0363e 100644
--- a/src/main/java/com/yeshi/buwan/controller/parser/OtherParser.java
+++ b/src/main/java/com/yeshi/buwan/controller/parser/OtherParser.java
@@ -2,15 +2,24 @@
 
 import com.google.gson.Gson;
 import com.yeshi.buwan.domain.*;
+import com.yeshi.buwan.domain.jump.JumpDetail;
+import com.yeshi.buwan.domain.jump.JumpTypeEnum;
 import com.yeshi.buwan.domain.recommend.AdRecommendRight;
+import com.yeshi.buwan.domain.system.DetailSystem;
+import com.yeshi.buwan.domain.system.SystemInfo;
+import com.yeshi.buwan.videos.funtv.FunTVNewApi;
 import com.yeshi.buwan.service.imp.*;
 import com.yeshi.buwan.service.imp.recommend.AdRecommendRightService;
+import com.yeshi.buwan.service.inter.jump.JumpDetailService;
 import com.yeshi.buwan.util.*;
 import com.yeshi.buwan.util.annotation.RequireUid;
+import com.yeshi.buwan.util.log.VideoLogFactory;
 import com.yeshi.buwan.util.zhibo.MeiNvZhiBoUtil;
 import com.yeshi.buwan.vo.AcceptData;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Controller;
 
 import javax.annotation.Resource;
@@ -20,6 +29,7 @@
 
 @Controller
 public class OtherParser {
+    private final Logger playLogger = LoggerFactory.getLogger("videoPlay");
     private String[] sdks = {"4.0.1", "4.0.2", "4.1.0", "4.2.2", "4.2.4", "4.4.2", "4.4.4", "5.0.1", "5.1.0"};
     private String[] fbl = {"720x1280", "480x800", "480x854", "640x960", "1080x1920"};
     @Resource
@@ -36,6 +46,10 @@
     private MeiNvZhiBoUtil meiNvZhiBoUtil;
     @Resource
     private AdRecommendRightService adRecommendRightService;
+    @Resource
+    private JumpDetailService jumpDetailService;
+    @Resource
+    private RedisManager redisManager;
 
     @RequireUid
     public void advice(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
@@ -101,25 +115,40 @@
         List<HomeNotice> list = homeNoticeService.getHomeNoticeList(detailSystem.getId());
         String content = "";
         String url = "";
+        HomeNotice notice = null;
         if (list != null && list.size() > 0) {
             int position = (int) ((list.size() + 1) * Math.random());
             if (position == 0)
                 position = 1;
             if (position > list.size())
                 position = list.size();
-            HomeNotice notice = list.get(position - 1);
+            notice = list.get(position - 1);
             long now = System.currentTimeMillis();
             if (TimeUtil.convertAllTimeToTemp(notice.getStarttime()) < now
                     && now < TimeUtil.convertAllTimeToTemp(notice.getEndtime())) {// 鍦ㄦ樉绀烘椂闂村唴
-                content = notice.getContent();
-                url = notice.getUrl();
+
+            } else {
+                notice = null;
             }
         }
+
+        JumpDetail jumpDetail = null;
+
+        if (notice != null && acceptData.getVersion() >= 98 && "android".equalsIgnoreCase(acceptData.getPlatform())) {
+            content = notice.getContent();
+            url = notice.getUrl().split("\\?")[1].replace("url=", "").trim();
+            jumpDetail = jumpDetailService.selectByTypeCache(JumpTypeEnum.baichuan);
+        }
+
+        JSONObject params = new JSONObject();
+        params.put("url", url);
 
         JSONObject object = new JSONObject();
         object.put("Content", content);// content
         object.put("Url", url);// url
         object.put("ShowAd", "0");// 骞垮憡鏄剧ず
+        object.put("Params", params);// 璺宠浆鍙傛暟
+        object.put("jumpDetail", new Gson().toJson(jumpDetail));
 
         out.print(JsonUtil.loadTrueJson(object.toString()));
         out.flush();
@@ -212,19 +241,6 @@
 
     }
 
-    @RequireUid
-    public void kkInstall(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
-        KKInstall kk = new KKInstall();
-        kk.setCreatetime(System.currentTimeMillis() + "");
-        kk.setUser(new UserInfo(acceptData.getUid()));
-        kk.setPackageName(acceptData.getPackageName());
-
-        LogUtil.i("鐢ㄦ埛" + acceptData.getUid() + "瀹夎KK鎻掍欢");
-        out.print(JsonUtil.loadTrueJson(""));
-        out.flush();
-        out.close();
-        return;
-    }
 
     public void adRecommendRight(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
 
@@ -237,16 +253,39 @@
         out.close();
     }
 
-    public void addContact(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
-        String contact = request.getParameter("Contact");
-        if (!StringUtil.isNullOrEmpty(contact)) {
-            String da = StringUtil.getFromBase64(contact);
-            JSONArray array = JSONArray.fromObject(da);
-            for (int i = 0; i < array.size(); i++) {
-                JSONObject obj = array.optJSONObject(i);
-                otherService.addContact(obj.optString("Name"), obj.optString("Mobile"));
-            }
-        }
+
+    public void playStatistic(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
+        String videoId = request.getParameter("VideoId");
+        String resourceId = request.getParameter("ResourceId");
+        playLogger.info(VideoLogFactory.createStatisticLog("", Integer.parseInt(resourceId), videoId));
+
+        out.print(JsonUtil.loadTrueJson(""));
         return;
     }
+
+
+    /**
+     * 鑾峰彇椋庤鎺堟潈鐮�
+     *
+     * @param acceptData
+     * @param request
+     * @param out
+     */
+    public void getFuntvAuthCode(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
+        String authCode = null;
+//        try {
+//            authCode = redisManager.getCommonString("funtv_authcode");
+//        } catch (Exception e) {
+//        }
+//
+//        if (!StringUtil.isNullOrEmpty(authCode)) {
+//            out.print(JsonUtil.loadTrueJson(authCode));
+//        } else {
+            authCode = FunTVNewApi.getAuthCode();
+//            if (!StringUtil.isNullOrEmpty(authCode)) {
+//                redisManager.cacheCommonString("funtv_authcode", authCode, 60 * 5);//缂撳瓨5鍒嗛挓
+//            }
+            out.print(JsonUtil.loadTrueJson(authCode));
+        }
+//    }
 }

--
Gitblit v1.8.0