| | |
| | | |
| | | 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.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; |
| | |
| | | |
| | | @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 |
| | |
| | | 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) { |
| | |
| | | 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(); |
| | |
| | | |
| | | } |
| | | |
| | | @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) { |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |