| | |
| | | |
| | | 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.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.zhibo.MeiNvZhiBoUtil; |
| | |
| | | private MeiNvZhiBoUtil meiNvZhiBoUtil; |
| | | @Resource |
| | | private AdRecommendRightService adRecommendRightService; |
| | | @Resource |
| | | private JumpDetailService jumpDetailService; |
| | | |
| | | @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(); |