1 文件已重命名
35个文件已修改
34个文件已添加
| | |
| | | <org.springframework-version>4.3.0.RELEASE</org.springframework-version> |
| | | <spring.mongodb.version>1.10.10.RELEASE</spring.mongodb.version> |
| | | <solrj.version>4.10.4</solrj.version> |
| | | <logback.version>1.2.3</logback.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | |
| | | <artifactId>javax-servlet-api</artifactId> |
| | | <version>3.1.0</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/lib/javax.servlet-api-3.1.0.jar</systemPath> |
| | | <systemPath>${basedir}/libs/javax.servlet-api-3.1.0.jar</systemPath> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>showapi</groupId> |
| | | <artifactId>showapi_sdk_java</artifactId> |
| | | <version>1.0.0</version> |
| | | </dependency> |
| | | |
| | | |
| | |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.xuxueli</groupId> |
| | | <artifactId>xxl-job-core</artifactId> |
| | | <version>2.1.2</version> |
| | | </dependency> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/ch.ethz.ganymed/ganymed-ssh2 --> |
| | | <dependency> |
| | | <groupId>ch.ethz.ganymed</groupId> |
| | | <artifactId>ganymed-ssh2</artifactId> |
| | | <version>build210</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--日志框架 --> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-classic</artifactId> |
| | | <version>${logback.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-core</artifactId> |
| | | <version>${logback.version}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | <skip>true</skip> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-install-plugin</artifactId> |
| | | <version>2.5.2</version> |
| | | <executions> |
| | | <execution> |
| | | <id>install-show-api</id> |
| | | <phase>clean</phase> |
| | | <configuration> |
| | | <file>${basedir}/libs/showapi_sdk_java.jar</file> |
| | | <repositoryLayout>default</repositoryLayout> |
| | | <groupId>showapi</groupId> |
| | | <artifactId>showapi_sdk_java</artifactId> |
| | | <version>1.0.0</version> |
| | | <packaging>jar</packaging> |
| | | <generatePom>true</generatePom> |
| | | </configuration> |
| | | <goals> |
| | | <goal>install-file</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | |
| | | </plugins> |
| | | |
| | | <resources> |
| | |
| | | @Component |
| | | public class AcFunUtil { |
| | | |
| | | public final static int RESOURCE_ID = 21; |
| | | public final static String RESOURCE_NAME = "AcFun"; |
| | | |
| | | @Resource |
| | | private AcTypeEqVideoTypeService acTypeEqVideoTypeService; |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.controller.admin.api; |
| | | |
| | | import com.yeshi.buwan.domain.DetailSystem; |
| | | import com.yeshi.buwan.job.AdJob; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | | import java.util.Arrays; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/ad") |
| | | public class AdController { |
| | | @Resource |
| | | private AdJob adJob; |
| | | |
| | | @RequestMapping("getOnLiningVersion") |
| | | public void getOnLiningVersion(PrintWriter out) { |
| | | int versionCode = adJob.getOnliningVersionCode(getDefaultDetailSystem()); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("versionCode", versionCode); |
| | | out.print(JsonUtil.loadTrueAdmin(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "setOnLiningVersion", method = RequestMethod.POST) |
| | | public void setOnLiningVersion(int versionCode, PrintWriter out) { |
| | | adJob.setOnliningVersionCode(versionCode, getDefaultDetailSystem()); |
| | | out.print(JsonUtil.loadTrueAdmin("")); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "setChannelOnLine", method = RequestMethod.POST) |
| | | public void setChannelOnLine(String channel, PrintWriter out) { |
| | | String[] channels = new String[]{ |
| | | "vivo", "oppo", "huawei", "xiaomi", "qq", "meizu", "baidu", "360", "wandoujia" |
| | | }; |
| | | |
| | | if (!Arrays.asList(channels).contains(channel)) { |
| | | out.print(JsonUtil.loadFalseAdmin("渠道不存在")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | int versionCode = adJob.getOnliningVersionCode(getDefaultDetailSystem()); |
| | | adJob.showAd(channel, getDefaultDetailSystem(), versionCode + 1); |
| | | out.print(JsonUtil.loadTrueAdmin("")); |
| | | } |
| | | |
| | | private DetailSystem getDefaultDetailSystem() { |
| | | return new DetailSystem(44 + ""); |
| | | } |
| | | } |
| | |
| | | classParser.getHotStarDetail(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getVideoClass")) { |
| | | classParser.getVideoClass(acceptData, request, out); |
| | | }else if (method.equalsIgnoreCase("getHomeClass")) { |
| | | classParser.getHomeClass(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getNewClass")) { |
| | | classParser.getNewClass(acceptData, request, out); // 分类 |
| | | } else if (method.equalsIgnoreCase("getFirstChildTypeNew")) { |
New file |
| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.yeshi.buwan.controller.parser.*; |
| | | import com.yeshi.buwan.service.imp.UserService; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.Utils; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | @Controller |
| | | @RequestMapping("/api") |
| | | public class ApiControllerV3 { |
| | | @Resource |
| | | private AdParser adParser; |
| | | @Resource |
| | | private ClassParser classParser; |
| | | @Resource |
| | | private CommentParser commentParser; |
| | | @Resource |
| | | private HomeParser homeParser; |
| | | |
| | | @Resource |
| | | private UserParser userParser; |
| | | |
| | | @Resource |
| | | private OtherParser otherParser; |
| | | |
| | | @Resource |
| | | private AttentionParser attentionParser; |
| | | |
| | | @Resource |
| | | private NewsParser newsParser; |
| | | |
| | | @Resource |
| | | private FoundParser foundParser; |
| | | |
| | | @Resource |
| | | private ZhiBoParser zhiBoParser; |
| | | |
| | | @Resource |
| | | private ShopParser shopParser; |
| | | |
| | | @Resource |
| | | private ConfigParser configParser; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @RequestMapping(value = "/ad/{method}", method = RequestMethod.POST) |
| | | public void ad(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if ("getMineAdList".equalsIgnoreCase(method)) { |
| | | adParser.getMineAdList(acceptData, request, out); |
| | | } else if ("reportAd".equalsIgnoreCase(method)) { |
| | | adParser.reportAd(acceptData, request, out); |
| | | } else if ("reportCommonAd".equalsIgnoreCase(method)) { |
| | | adParser.reportCommonAd(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/class/{method}", method = RequestMethod.POST) |
| | | public void clazz(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) { |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | return; |
| | | } |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | |
| | | if (method.equalsIgnoreCase("getClass")) { |
| | | classParser.getClass(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotStars")) { |
| | | classParser.getHotStars(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotStarsVideo")) { |
| | | classParser.getHotStarsVideo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getVideoList")) { |
| | | classParser.getVideoList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getFirstChildType")) { |
| | | classParser.getFirstChildType(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotType")) { |
| | | classParser.getHotType(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getSpecialList")) { |
| | | classParser.getSpecialList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getSpecialDetail")) { |
| | | classParser.getSpecialDetail(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotStarDetail")) { |
| | | classParser.getHotStarDetail(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getVideoClass")) { |
| | | classParser.getVideoClass(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getNewClass")) { |
| | | classParser.getNewClass(acceptData, request, out); // 分类 |
| | | } else if (method.equalsIgnoreCase("getFirstChildTypeNew")) { |
| | | classParser.getFirstChildTypeNew(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getRecommendCategoryVideoBanner")) { |
| | | classParser.getRecommendCategoryVideoBanner(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getRecommendCategoryVideoList")) { |
| | | classParser.getRecommendCategoryVideoList(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/comment/{method}", method = RequestMethod.POST) |
| | | public void comment(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("getReadState")) { |
| | | commentParser.getReadState(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getVideoCommentList")) { |
| | | commentParser.getVideoCommentList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getMyCommentReply")) { |
| | | commentParser.getMyCommentReply(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("replayComment")) { |
| | | commentParser.replayComment(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("comment")) { |
| | | commentParser.comment(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("userLogin")) { |
| | | commentParser.login(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("wxLogin")) { |
| | | String code = request.getParameter("Code"); |
| | | commentParser.wxLogin(acceptData, code, request, out); |
| | | } |
| | | |
| | | |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/recommend/{method}", method = RequestMethod.POST) // |
| | | public void home(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | System.out.println("---------"); |
| | | System.out.println("IP:" + IPUtil.getRemotIP(request)); |
| | | System.out.println("---------"); |
| | | |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) { |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | return; |
| | | } |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | |
| | | switch (method) { |
| | | case "getHomeAd": |
| | | homeParser.getHomeAd(acceptData, request, out); |
| | | break; |
| | | case "getHomeType": |
| | | homeParser.getHomeType(acceptData, request, out); |
| | | break; |
| | | case "getVideoDetail": |
| | | homeParser.getVideoDetail(acceptData, request, out); |
| | | break; |
| | | case "isCollect": |
| | | homeParser.isCollected(acceptData, request, out); |
| | | break; |
| | | case "getAdList": |
| | | homeParser.getAdList(acceptData, request, out); |
| | | break; |
| | | case "getNewVideoDetail": |
| | | homeParser.getNewVideoDetail(acceptData, request, out); |
| | | break; |
| | | case "getPlayUrl": |
| | | homeParser.getPlayUrl(acceptData, request, out); |
| | | break; |
| | | case "getMoreVideo": |
| | | homeParser.getMoreVideo(acceptData, request, out); |
| | | break; |
| | | case "isPraise": |
| | | homeParser.isPraise(acceptData, request, out); |
| | | break; |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/other/{method}", method = RequestMethod.POST) |
| | | public void other(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("advice")) { |
| | | otherParser.advice(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getWxAd")) { |
| | | otherParser.getWxAd(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("wxClickAction")) { |
| | | otherParser.wxClickAction(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getNotice")) { |
| | | otherParser.getNotice(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getRealUrl")) { |
| | | otherParser.getRealUrl(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("kkinstall")) { |
| | | otherParser.kkInstall(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getIntersection")) { |
| | | otherParser.getIntersection(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("test")) { |
| | | otherParser.test(request, out); |
| | | } else if (method.equalsIgnoreCase("getMeiNvZhiBo")) { |
| | | otherParser.getMeiNvZhiBo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getYearList")) { |
| | | otherParser.getYearList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("addContact")) { |
| | | otherParser.addContact(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("adRecommendRight")) { |
| | | otherParser.adRecommendRight(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/test/{method}", method = RequestMethod.GET) |
| | | public void test(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | String uid = request.getParameter("Uid"); |
| | | if (!method.equalsIgnoreCase("getUid")) { |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | } |
| | | userParser.getUid(acceptData, request, out); |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/user/{method}") |
| | | public void user(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, String callback, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (!method.equalsIgnoreCase("getUid")) { |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | } |
| | | if (method.equalsIgnoreCase("getUid")) {// 获取用户编号 |
| | | userParser.getUid(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("suggestSearch")) {// 建议搜索返回关键字 |
| | | userParser.suggestSearch(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("search")) {// 搜索 |
| | | userParser.search(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("searchNew")) {// 搜索 |
| | | userParser.searchNew(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotSearch")) {// 获取热门搜索 |
| | | userParser.getHotSearch(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("guessLike")) {// 猜你喜欢 |
| | | userParser.guessLike(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getUserInfo")) {// 获取用户信息 |
| | | userParser.getUserInfo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getCollectedVideo")) {// 获取收藏的视频 |
| | | userParser.getCollectedVideo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getScoreCollect")) {// 收藏软件送积分 |
| | | userParser.getScoreCollect(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getUserBanner")) {// 获取滑动图片 |
| | | userParser.getUserBanner(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("updateUserInfo")) {// 获取滑动图片 |
| | | userParser.updateUserInfo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getIPInfo")) { |
| | | userParser.getIPInfo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getRelativeVideos")) { |
| | | userParser.getRelativeVideos(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getPeopleSeeVideos")) { |
| | | userParser.getPeopleSeeVideos(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("sendVerifyCode")) { |
| | | userParser.sendVerifyCode(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("register")) { |
| | | userParser.register(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("login")) { |
| | | userParser.login(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("updateLoginUserInfo")) { |
| | | userParser.updateLoginUserInfo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getLoginUserInfo")) { |
| | | userParser.getLoginUserInfo(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("setPwd")) { |
| | | userParser.setPwd(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("unRegister")) {//注销 |
| | | userParser.unRegister(acceptData, request, out); |
| | | } |
| | | |
| | | out.close(); |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/attention/{method}", method = RequestMethod.POST) |
| | | public void attention(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("addAttention")) {// 获取用户编号 |
| | | attentionParser.addAttention(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("cancelAttention")) { |
| | | attentionParser.cancelAttention(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getAttentionList")) { |
| | | attentionParser.getAttentionList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getAttentionUpdateList")) { |
| | | attentionParser.getAttentionUpdateList(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/news/{method}", method = RequestMethod.POST) |
| | | public void news(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("getNewsTypeList")) {// 获取用户编号 |
| | | newsParser.getNewsTypeList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getNewsList")) { |
| | | newsParser.getNewsList(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | // 发现页面接口 |
| | | @RequestMapping(value = "/found/{method}", method = RequestMethod.POST) |
| | | public void found(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("getSpecialMainList")) {// 获取用户编号 |
| | | foundParser.getSpecialMainList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotStarMainList")) {// 明星合集 |
| | | foundParser.getHotStarMainList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getNewsMainList")) { |
| | | foundParser.getNewsMainList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getAppHui")) { |
| | | foundParser.getAppHui(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("guessLike")) { |
| | | foundParser.guessLike(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | // 直播类接口 |
| | | @RequestMapping(value = "/zhibo/{method}", method = RequestMethod.POST) |
| | | public void zhibo(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, HttpServletResponse response, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | // |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("getNewList")) {// 获取用户编号 |
| | | zhiBoParser.getNewList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getTop")) { |
| | | zhiBoParser.getTop(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("addStatistics")) { |
| | | zhiBoParser.addStatistics(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getHotLive")) { |
| | | zhiBoParser.getHotLive(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getAllLiveType")) { |
| | | zhiBoParser.getAllLiveType(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getLiveList")) { |
| | | zhiBoParser.getLiveList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getLiveListByType")) { |
| | | zhiBoParser.getLiveListByType(acceptData, request, out); |
| | | } |
| | | out.close(); |
| | | } |
| | | |
| | | // 直播类接口 |
| | | @RequestMapping(value = "/shop/{method}", method = RequestMethod.POST) |
| | | public void shop(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | String uid = request.getParameter("Uid"); |
| | | if (StringUtil.isNullOrEmpty(uid)) |
| | | uid = userService.getUid(request.getParameter("Device"), 1 + "", "", "", "", ""); |
| | | if (method.equalsIgnoreCase("addCollect")) {// 获取用户编号 |
| | | shopParser.addCollect(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("addComment")) { |
| | | shopParser.addComment(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("cancelCollect")) { |
| | | shopParser.cancelCollect(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getCommentList")) { |
| | | shopParser.getCommentList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getGoodsItemDetail")) { |
| | | shopParser.getGoodsItemDetail(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getGoodsItemList")) { |
| | | shopParser.getGoodsItemList(acceptData, request, out); |
| | | } else if (method.equalsIgnoreCase("getCollectList")) { |
| | | shopParser.getCollectList(acceptData, request, out); |
| | | } |
| | | |
| | | out.close(); |
| | | } |
| | | |
| | | // 配置类接口 |
| | | @RequestMapping(value = "/config/{method}", method = RequestMethod.POST) |
| | | public void config(AcceptData acceptData, @PathVariable String method, HttpServletRequest request, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(method)) |
| | | return; |
| | | |
| | | if (!Utils.signIsRight(request)) |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | |
| | | if (method.equalsIgnoreCase("getConfig")) {// 获取用户编号 |
| | | configParser.getConfig(acceptData, request, out); |
| | | } |
| | | |
| | | out.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import com.yeshi.buwan.service.imp.ConfigService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Controller |
| | | public class BaiduParser { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(BaiduParser.class); |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.util.ad.CommonAdUtil; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.HomeClassVO; |
| | | import com.yeshi.buwan.vo.video.VideoListResultVO; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | |
| | | } |
| | | } |
| | | |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53) { |
| | | SuperVideoType sty = new SuperVideoType(); |
| | | sty.setCreatetime(0 + ""); |
| | | sty.setPicture(""); |
| | | VideoType vt = new VideoType(22222); |
| | | vt.setName("头条"); |
| | | vt.setCategoryType("http://wap.baizhan.net/09"); |
| | | vt.setIcon("http://img.zcool.cn/community/01e299592fd75ba8012193a365723f.png@1280w_1l_2o_100sh.png"); |
| | | sty.setType(vt); |
| | | boolean isC = false; |
| | | for (SuperVideoType svt : list) { |
| | | if (svt.getType().getId() == vt.getId()) { |
| | | isC = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!isC) |
| | | list.add(sty); |
| | | } |
| | | // if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53) { |
| | | // SuperVideoType sty = new SuperVideoType(); |
| | | // sty.setCreatetime(0 + ""); |
| | | // sty.setPicture(""); |
| | | // VideoType vt = new VideoType(22222); |
| | | // vt.setName("头条"); |
| | | // vt.setCategoryType("http://wap.baizhan.net/09"); |
| | | // vt.setIcon("http://img.zcool.cn/community/01e299592fd75ba8012193a365723f.png@1280w_1l_2o_100sh.png"); |
| | | // sty.setType(vt); |
| | | // boolean isC = false; |
| | | // for (SuperVideoType svt : list) { |
| | | // if (svt.getType().getId() == vt.getId()) { |
| | | // isC = true; |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // if (!isC) |
| | | // list.add(sty); |
| | | // } |
| | | |
| | | List<VideoType> typeList = new ArrayList<VideoType>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | |
| | | // } |
| | | // } |
| | | |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53) { |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53 && !"qq".equalsIgnoreCase(acceptData.getChannel())) { |
| | | SuperVideoType sty = new SuperVideoType(); |
| | | sty.setCreatetime(0 + ""); |
| | | sty.setPicture(""); |
| | | VideoType vt = new VideoType(22222); |
| | | vt.setName("头条"); |
| | | vt.setName("美女直播"); |
| | | vt.setShow("1"); |
| | | vt.setCategoryType("http://wap.baizhan.net/09"); |
| | | vt.setIcon("http://img.zcool.cn/community/01e299592fd75ba8012193a365723f.png@1280w_1l_2o_100sh.png"); |
| | | vt.setCategoryType("http://m.v.6.cn/event/porkvideo?src=9n8wc5medm&nologo=1&t=2"); |
| | | vt.setIcon("https://hbimg.huabanimg.com/12834704bb4aa39342c2fb51e0c644181b13997b70eb-CqlE1I_fw658/format/webp"); |
| | | sty.setType(vt); |
| | | boolean isC = false; |
| | | for (SuperVideoType svt : list) { |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取首页导航分类 |
| | | * |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void getHomeClass(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | UserInfo user = userService.getUserInfo(acceptData.getUid()); |
| | | if (Utils.isTest(request, user, detailSystem.getId())) |
| | | detailSystem = systemService.getDetailSystemById(40 + ""); |
| | | |
| | | List<SuperVideoType> list = classService.getSuperVideoTypeTitleList(detailSystem.getId()); |
| | | |
| | | List<HomeClassVO> typelist = new ArrayList<>(); |
| | | for (SuperVideoType sv : list) { |
| | | VideoType type = sv.getType(); |
| | | HomeClassVO vo = new HomeClassVO(); |
| | | |
| | | if ("0".equalsIgnoreCase(type.getShow())) |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_RECOMMEND); |
| | | else |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_CLASS); |
| | | vo.setId(type.getId()); |
| | | vo.setName(type.getName()); |
| | | vo.setShowTitle(type.getShowTitle()); |
| | | vo.setType(type.getType()); |
| | | vo.setCategoryType(type.getCategoryType()); |
| | | |
| | | typelist.add(vo); |
| | | } |
| | | |
| | | HomeClassVO vo = new HomeClassVO(); |
| | | |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_NOVEL); |
| | | vo.setName("小说"); |
| | | typelist.add(3, vo); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString()); |
| | | JSONArray array = new JSONArray(); |
| | | for (int j = 0; j < typelist.size(); j++) |
| | | array.add(StringUtil.outPutResultJson(typelist.get(j))); |
| | | object.put("data", array); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | |
| | | } |
| | | |
| | | |
| | | public void getHotStars(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | String page = request.getParameter("Page"); |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.yeshi.buwan.domain.DetailSystem; |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.util.IPUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | |
| | | @Controller |
| | | public class ConfigParser { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(ConfigParser.class); |
| | | @Resource |
| | | private ConfigService configService; |
| | | @Resource |
| | | private SystemService systemService; |
| | | |
| | | private String getAdShowType(String key, String channel, int version, Map<String, String> map) { |
| | | public String getAdShowType(String key, String channel, int version, Map<String, String> map) { |
| | | String splash = map.get(key); |
| | | JSONObject jsonObject = JSONObject.fromObject(splash); |
| | | ADConfig splashAD = null; |
| | |
| | | String province = json.optString(acceptData.getChannel().toLowerCase()); |
| | | if (!StringUtil.isNullOrEmpty(splash) && !StringUtil.isNullOrEmpty(province)) { |
| | | String pro = IPUtil.getIPProvince(ip); |
| | | LogHelper.print("城市屏蔽:" + ip + ":" + pro); |
| | | if (pro != null && pro.contains(province)) {//屏蔽IP |
| | | splash = ""; |
| | | LogHelper.print("城市屏蔽:" + pro); |
| | | } |
| | | } |
| | | } |
| | |
| | | ad.put("videoPlayPre", getAdShowType("ad_play_video_pre", acceptData.getChannel(), acceptData.getVersion(), map)); |
| | | //APP退出 |
| | | ad.put("exitApp", getAdShowType("ad_exit_app", acceptData.getChannel(), acceptData.getVersion(), map)); |
| | | //全屏广告控制 |
| | | ad.put("videoDetailFullVideo", getAdShowType("ad_video_detail_full_video", acceptData.getChannel(), acceptData.getVersion(), map)); |
| | | |
| | | data.put("ad", ad); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | public List<HomeVideo> getZhiBoVideoList() throws Exception { |
| | | List<HomeVideo> list = new ArrayList<HomeVideo>(); |
| | | String result = get("http://www.kktv1.com/CDN/output/M/3/I/10002002/P/start-0_offset-6_platform-2/json.js"); |
| | |
| | | private BanQuanService banQuanService; |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private SolrAlbumDataManager solrDataManager; |
| | | @Resource |
| | | private ConfigParser configParser; |
| | | |
| | | public void getUid(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | |
| | | object.put("Uid", uid); |
| | | object.put("Portrait", userInfo.getPortrait()); |
| | | object.put("Nickname", userInfo.getNickname()); |
| | | object.put("TopIcon", map.get("top_icon")); |
| | | |
| | | object.put("ZiXun", map.get("zixun_url")); |
| | | if (acceptData.getPlatform().equalsIgnoreCase("ios") && !"中国".equalsIgnoreCase(userInfo.getCountry()))// 正在审核的版本 |
| | | object.put("CommentUrl", ""); |
| | |
| | | object.put("WXShareIcon", map.get("wx_share_icon")); |
| | | object.put("WXShareUrl", map.get("wx_share_url")); |
| | | object.put("WXShareContent", map.get("wx_share_content")); |
| | | |
| | | if ("qq".equalsIgnoreCase(acceptData.getChannel())) { |
| | | object.put("TopIcon", ""); |
| | | object.put("TuiGuang", ""); |
| | | } else { |
| | | object.put("TuiGuang", map.get("taobao_tuiguang")); |
| | | object.put("TopIcon", map.get("top_icon")); |
| | | } |
| | | object.put("SOHU_partner", detailSystem.getSohuPartner()); |
| | | object.put("SOHU_key", detailSystem.getSohuKey()); |
| | | |
| | |
| | | fullVideoVersion = json.optInt(acceptData.getChannel().toLowerCase(), 0); |
| | | } |
| | | |
| | | if (acceptData.getVersion() >= fullVideoVersion) {// 是否屏蔽详情页全屏广告 |
| | | |
| | | String type = configParser.getAdShowType("ad_video_detail_full_video", acceptData.getChannel(), acceptData.getVersion(), map); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(type)) {// 是否屏蔽详情页全屏广告 |
| | | JSONObject adType = JSONObject.fromObject(map.get("ad_type")); |
| | | adType.put("videoDetailSplashAd", true); |
| | | object.put("adType", adType.toString()); |
| | | } else { |
| | | JSONObject adType = JSONObject.fromObject(map.get("ad_type")); |
| | | adType.put("videoDetailSplashAd", false); |
| | | object.put("adType", adType.toString()); |
| | |
| | | } |
| | | |
| | | if (!verifyCode.equalsIgnoreCase(request.getSession().getAttribute(email) + "")) { |
| | | out.print(JsonUtil.loadTrueJson("验证码错误")); |
| | | out.print(JsonUtil.loadFalseJson("验证码错误")); |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | public Config selectByKey(String key, Long systemId, int maxVersion) { |
| | | List list = sqlList(" SELECT a.* FROM (SELECT * FROM `wk_video_config` vc WHERE vc,`key`=? and vc.`systemId`=? AND vc.`minVersion`<=? ORDER BY vc.`minVersion` DESC) a GROUP BY a.`systemId`,a.`key`", key, systemId, maxVersion); |
| | | List list = sqlListWithEntity("SELECT a.* FROM (SELECT * FROM `wk_video_config` vc where vc.`key`=? and vc.`systemId`=? AND vc.`minVersion`<=? ORDER BY vc.`minVersion` DESC) a GROUP BY a.`systemId`,a.`key`", Config.class, key, systemId, maxVersion); |
| | | if (list != null && list.size() > 0) |
| | | return (Config) list.get(0); |
| | | return null; |
| | |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | |
| | | return list("from VideoInfo vi where vi.name=?", start, count, new Serializable[]{name}); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据主键批量查询 |
| | | * |
| | | * @param videoIds |
| | | * @return |
| | | */ |
| | | public List<VideoInfo> listByVideoIds(List<String> videoIds) { |
| | | String hql = "from VideoInfo vi where "; |
| | | List<String> ors = new ArrayList<>(); |
| | | for (String vi : videoIds) { |
| | | ors.add(" vi.id=? "); |
| | | } |
| | | hql += StringUtil.concat(ors, "or"); |
| | | String[] videos = new String[videoIds.size()]; |
| | | videoIds.toArray(videos); |
| | | return list(hql, videos); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.juhe.funtv; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class FunTVAlbum2Dao extends MongodbBaseDao<FunTVAlbum2> { |
| | | |
| | | /** |
| | | * 根据ChannelId查询 |
| | | * |
| | | * @param channelId 1-电影 2-电视剧 3-动漫 4-综艺 5-少儿 |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | public List<FunTVAlbum2> listByChannelId(int channelId, int start, int count) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("channelId").is(channelId + "")); |
| | | query.skip(start); |
| | | query.limit(count); |
| | | return findList(query); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.juhe.funtv; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Repository |
| | | public class FunTVShortVideo2Dao extends MongodbBaseDao<FunTVShortVideo2> { |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.juhe.funtv; |
| | | |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class FunTVVideo2Dao extends MongodbBaseDao<FunTVVideo2> { |
| | | |
| | | /** |
| | | * 通过媒体ID查询视频 |
| | | * |
| | | * @param mediaId |
| | | * @return |
| | | */ |
| | | public List<FunTVVideo2> listByMediaId(String mediaId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("mediaId").is(mediaId)); |
| | | // List<Sort.Order> orders = new ArrayList<>(); |
| | | // orders.add(new Sort.Order(Sort.Direction.ASC, "num")); |
| | | // query.with(new Sort(orders)); |
| | | return findList(query); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.juhe.funtv; |
| | | |
| | | import com.yeshi.buwan.dao.base.BaseDao; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.funtv.entity.VideoFunTV2; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | |
| | | @Repository |
| | | public class VideoFunTV2Dao extends MongodbBaseDao<VideoFunTV2> { |
| | | |
| | | |
| | | /** |
| | | * 根据MediaId查询 |
| | | * |
| | | * @param mediaId |
| | | * @return |
| | | */ |
| | | public VideoFunTV2 selectByMediaId(String mediaId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("mediaId").is(mediaId)); |
| | | return findOne(query); |
| | | } |
| | | |
| | | /** |
| | | * 按videoId查询 |
| | | * |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | | public VideoFunTV2 selectByVideoId(String videoId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("videoId").is(Long.parseLong(videoId))); |
| | | return findOne(query); |
| | | } |
| | | |
| | | } |
| | |
| | | return findList(query); |
| | | } |
| | | |
| | | public List<IqiyiAlbum2> listByChannelId(int channelId, long albumId, int start, int count) { |
| | | public List<IqiyiAlbum2> listByChannelId(int channelId, Long albumId, Integer contentType, int start, int count) { |
| | | Query query = new Query(); |
| | | Criteria criteria = Criteria.where("channelId").is(channelId).andOperator(Criteria.where("featureAlbumId").is(albumId)); |
| | | query.addCriteria(criteria); |
| | | List<Criteria> andCriteria = new ArrayList<>(); |
| | | Criteria criteria = Criteria.where("channelId").is(channelId); |
| | | andCriteria.add(criteria); |
| | | if (albumId != null) { |
| | | andCriteria.add(Criteria.where("featureAlbumId").is(albumId)); |
| | | } |
| | | if (contentType != null) { |
| | | andCriteria.add(Criteria.where("contentType").is(contentType)); |
| | | } |
| | | Criteria[] wheres = new Criteria[andCriteria.size()]; |
| | | andCriteria.toArray(wheres); |
| | | query.addCriteria(new Criteria().andOperator(wheres)); |
| | | query.skip(start); |
| | | query.limit(count); |
| | | return findList(query); |
| | |
| | | return findList(query); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拉取所有数据 |
| | | * |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | public List<AlbumVideoMap> listAll(int start, int count) { |
| | | Query query = new Query(); |
| | | query.skip(start); |
| | | query.limit(count); |
| | | return findList(query); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算所有 |
| | | * |
| | | * @return |
| | | */ |
| | | public long countAll() { |
| | | Query query = new Query(); |
| | | return count(query); |
| | | } |
| | | |
| | | |
| | | public AlbumVideoMap selectByVideoId(String videoId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("videoId").is(videoId)); |
| | | return findOne(query); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dto.mq; |
| | | |
| | | public class FunTVAlbum2MQMsg { |
| | | private String handler; |
| | | private String id; |
| | | |
| | | public String getHandler() { |
| | | return handler; |
| | | } |
| | | |
| | | public void setHandler(String handler) { |
| | | this.handler = handler; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.funtv; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.funtv.vo.*; |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.vo.video.funtv.Funtv2ResultVO; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | public class FunTVNewApi { |
| | | private static final String CP = "fk84vly"; |
| | | private static final String SECRET_KEY = "eD*r3dZNQ%7"; |
| | | |
| | | private static String accessToken; |
| | | private static long accessTokenInvalidTime; |
| | | |
| | | private static String httpGet(String url) { |
| | | if (url != null) { |
| | | try { |
| | | return new String(HttpUtil.defaultGet(url).getBytes("ISO-8859-1"), "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static String getAccessToken() { |
| | | long time = System.currentTimeMillis() / 1000; |
| | | String result = httpGet(String.format("http://papi.funshion.com/api/accesstoken?cp=%s&ctime=%s&sign=%s", CP, time, StringUtil.Md5(CP + time + SECRET_KEY))); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | if (json.optInt("code") == 0) |
| | | return json.optString("access_token"); |
| | | else |
| | | return null; |
| | | } |
| | | |
| | | private static String baseRequest(String url, Map<String, String> params) throws Exception { |
| | | long now = System.currentTimeMillis(); |
| | | if (accessTokenInvalidTime <= now || StringUtil.isNullOrEmpty(accessToken)) { |
| | | String token = getAccessToken(); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | throw new Exception("access_token获取失败"); |
| | | } |
| | | accessToken = token; |
| | | accessTokenInvalidTime = now + 1000 * 60 * 90L; |
| | | } |
| | | |
| | | Map<String, String> allParams = new HashMap<>(); |
| | | allParams.put("cp", CP); |
| | | allParams.put("access_token", accessToken); |
| | | for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | allParams.put(key, params.get(key)); |
| | | } |
| | | |
| | | List<String> paramsList = new ArrayList<>(); |
| | | for (Iterator<String> its = allParams.keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | String value = allParams.get(key); |
| | | paramsList.add(key + "=" + URLEncoder.encode(value, "UTF-8")); |
| | | } |
| | | |
| | | String paramStr = org.yeshi.utils.StringUtil.concat(paramsList, "&"); |
| | | url += "?" + paramStr; |
| | | return httpGet(url); |
| | | } |
| | | |
| | | /** |
| | | * @param page |
| | | * @param pageSize |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @param channelId 频道ID 1-电影 2-电视剧 3-动漫 4-综艺 5-少儿 |
| | | * @param status 0表示不可用媒体,1表示可用媒体,2表示全部媒体 |
| | | * @return |
| | | */ |
| | | public static Funtv2ResultVO getAlbums(int page, int pageSize, Long startTime, Long endTime, Integer channelId, Integer status) { |
| | | String url = "http://papi.funshion.com/cp/syncmv"; |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("mtype", "media"); |
| | | if (startTime == null) |
| | | params.put("start", "0"); |
| | | else |
| | | params.put("start", TimeUtil.getGernalTime(startTime, "yyyyMMddHHmm")); |
| | | if (endTime == null) |
| | | params.put("end", "0"); |
| | | else |
| | | params.put("end", TimeUtil.getGernalTime(endTime, "yyyyMMddHHmm")); |
| | | |
| | | if (channelId != null) |
| | | params.put("channel", channelId + ""); |
| | | |
| | | if (status != null) |
| | | params.put("status", status + ""); |
| | | |
| | | params.put("page_size", pageSize + ""); |
| | | params.put("page_no", page + ""); |
| | | |
| | | try { |
| | | String result = baseRequest(url, params); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | if (json.optInt("code") == 0) { |
| | | JSONArray array = json.optJSONArray("datas"); |
| | | List<FunTVAlbum2> album2List = new Gson().fromJson(array.toString(), new TypeToken<List<FunTVAlbum2>>() { |
| | | }.getType()); |
| | | for (FunTVAlbum2 album2 : album2List) |
| | | if (album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | video2.setMediaId(album2.getId()); |
| | | int totalCount = json.optInt("total"); |
| | | return new Funtv2ResultVO(totalCount, album2List); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static FunTVAlbum2 getAlbumsDetail(String aid) { |
| | | String url = "http://papi.funshion.com/cp/syncmv"; |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("mtype", "media"); |
| | | params.put("id", aid); |
| | | try { |
| | | String result = baseRequest(url, params); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | if (json.optInt("code") == 0) { |
| | | JSONArray array = json.optJSONArray("datas"); |
| | | List<FunTVAlbum2> album2List = new Gson().fromJson(array.toString(), new TypeToken<List<FunTVAlbum2>>() { |
| | | }.getType()); |
| | | for (FunTVAlbum2 album2 : album2List) |
| | | if (album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | video2.setMediaId(album2.getId()); |
| | | if (album2List != null && album2List.size() > 0) |
| | | return album2List.get(0); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static Funtv2ResultVO getVideos(int page, int pageSize, Long startTime, Long endTime, Integer channelId, Integer status) { |
| | | String url = "http://papi.funshion.com/cp/syncmv"; |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("mtype", "video"); |
| | | if (startTime == null) |
| | | params.put("start", "0"); |
| | | else |
| | | params.put("start", TimeUtil.getGernalTime(startTime, "yyyyMMddHHmm")); |
| | | if (endTime == null) |
| | | params.put("end", "0"); |
| | | else |
| | | params.put("end", TimeUtil.getGernalTime(endTime, "yyyyMMddHHmm")); |
| | | |
| | | if (channelId != null) |
| | | params.put("channel", channelId + ""); |
| | | |
| | | if (status != null) |
| | | params.put("status", status + ""); |
| | | |
| | | params.put("page_size", pageSize + ""); |
| | | params.put("page_no", page + ""); |
| | | |
| | | try { |
| | | String result = baseRequest(url, params); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | if (json.optInt("code") == 0) { |
| | | JSONArray array = json.optJSONArray("datas"); |
| | | List<FunTVShortVideo2> videoList = new Gson().fromJson(array.toString(), new TypeToken<List<FunTVShortVideo2>>() { |
| | | }.getType()); |
| | | int totalCount = json.optInt("total"); |
| | | return new Funtv2ResultVO(totalCount, videoList); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static FunTVShortVideo2 getVideoDetail(String vid) { |
| | | String url = "http://papi.funshion.com/cp/syncmv"; |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("mtype", "video"); |
| | | params.put("id", vid); |
| | | |
| | | try { |
| | | String result = baseRequest(url, params); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | if (json.optInt("code") == 0) { |
| | | JSONArray array = json.optJSONArray("datas"); |
| | | List<FunTVShortVideo2> videoList = new Gson().fromJson(array.toString(), new TypeToken<List<FunTVShortVideo2>>() { |
| | | }.getType()); |
| | | if (videoList != null && videoList.size() > 0) |
| | | return videoList.get(0); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private CategoryVideoDao categoryVideoDao; |
| | | |
| | | |
| | | |
| | | public final static int RESOURCE_ID = 19; |
| | | public final static String RESOURCE_NAME = "风行"; |
| | | |
| | | public static VideoDetailInfo convertFunTVVideoToVideoDetail(FunTVVideo pv, FunTVAlbum p) { |
| | | VideoDetailInfo vinfo = new VideoDetailInfo(); |
| | | vinfo.setExtraId(pv.getVid() + ""); |
New file |
| | |
| | | package com.yeshi.buwan.funtv; |
| | | |
| | | import com.yeshi.buwan.dao.CategoryVideoDao; |
| | | import com.yeshi.buwan.domain.CategoryVideo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.funtv.entity.*; |
| | | import com.yeshi.buwan.funtv.vo.*; |
| | | import com.yeshi.buwan.funtv.vo.base.FunTVBaseAlbum; |
| | | import com.yeshi.buwan.funtv.vo.base.FunTVBaseVideo; |
| | | import com.yeshi.buwan.service.imp.juhe.FunTVService; |
| | | import com.yeshi.buwan.util.JuheVideoUtil; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class FunTVUtil2 { |
| | | |
| | | public final static int PLAY_NONE = 0;// 不能播放 |
| | | public final static int PLAY_HTML = 1;// 跳转移动端网页播放 |
| | | public final static int PLAY_SDK = 3;// 内嵌SDK播放 |
| | | |
| | | public final static int RESOURCE_ID = 24; |
| | | public final static String RESOURCE_NAME = "风行."; |
| | | |
| | | @Resource |
| | | private FunTVService funTVService; |
| | | |
| | | @Resource |
| | | private CategoryVideoDao categoryVideoDao; |
| | | |
| | | |
| | | public static VideoDetailInfo convertFunTVVideoToVideoDetail(FunTVVideo2 pv, FunTVAlbum2 p) { |
| | | VideoDetailInfo vinfo = new VideoDetailInfo(); |
| | | vinfo.setExtraId(pv.getId()); |
| | | vinfo.setName(pv.getName()); |
| | | if ("综艺".equalsIgnoreCase(p.getChannel())) |
| | | vinfo.setTag(pv.getName()); |
| | | else if ("电影".equalsIgnoreCase(p.getChannel())) |
| | | vinfo.setTag(p.getName()); |
| | | else |
| | | vinfo.setTag(pv.getNum()); |
| | | vinfo.setType("funtv"); |
| | | vinfo.setId(Long.parseLong(pv.getId())); |
| | | return vinfo; |
| | | } |
| | | |
| | | /** |
| | | * @param p |
| | | * @return |
| | | */ |
| | | public static VideoInfo convertFunTVAlbumToVideoInfo(FunTVAlbum2 p) { |
| | | long timeStamp = TimeUtil.convertGernalTime(p.getRelease(), "yyyy年MM月dd日"); |
| | | Calendar ca = Calendar.getInstance(); |
| | | ca.setTimeInMillis(timeStamp); |
| | | int year = ca.get(Calendar.YEAR); |
| | | int month = ca.get(Calendar.MONTH) + 1; |
| | | int day = ca.get(Calendar.DAY_OF_MONTH); |
| | | String director = p.getDirector(); |
| | | String mainActor = p.getActor(); |
| | | |
| | | String score = p.getScore(); |
| | | |
| | | String tag = ""; |
| | | VideoType videoType = new VideoType(getFunTVAlbumType(p)); |
| | | |
| | | if (p.getChannel().contains("电影")) { |
| | | tag = "评分:" + score; |
| | | } else if (p.getChannel().contains("电视剧") || p.getChannel().contains("动漫")) { |
| | | tag = p.getUpdate(); |
| | | } else if (p.getChannel().contains("综艺")) { |
| | | tag = p.getUpdate(); |
| | | } |
| | | |
| | | Comparator<FunTVVideo2> cm = new Comparator<FunTVVideo2>() { |
| | | public int compare(FunTVVideo2 o1, FunTVVideo2 o2) { |
| | | int t2 = Integer.parseInt(o2.getNum()); |
| | | int t1 = Integer.parseInt(o1.getNum()); |
| | | return (t2 - t1);// 倒序排列 |
| | | } |
| | | }; |
| | | Collections.sort(p.getEpisodes(), cm); |
| | | |
| | | String latestHpicture = p.getEpisodes().get(0).getStill(); |
| | | |
| | | long updateTime = System.currentTimeMillis(); |
| | | |
| | | VideoInfo vi = new VideoInfo(); |
| | | vi.setVideoType(videoType); |
| | | vi.setArea(p.getArea()); |
| | | vi.setBaseurl(""); |
| | | vi.setCanSave(false); |
| | | vi.setCommentCount(0); |
| | | vi.setContentType(1); |
| | | vi.setCreatetime(System.currentTimeMillis()); |
| | | vi.setDay(day + ""); |
| | | vi.setDirector(director); |
| | | vi.setFocus(""); |
| | | vi.setHpicture(p.getStill()); |
| | | vi.setIntroduction(p.getDescription()); |
| | | vi.setLatestHpicture(latestHpicture); |
| | | vi.setLatestVpicture(""); |
| | | vi.setMainActor(mainActor); |
| | | vi.setMonth(month + ""); |
| | | vi.setName(p.getName()); |
| | | vi.setNowNumber(0 + ""); |
| | | vi.setOrderby("0"); |
| | | vi.setPicture(p.getPoster()); |
| | | vi.setScore(score); |
| | | vi.setShare("0"); |
| | | vi.setShow(1 + ""); |
| | | vi.setTag(tag); |
| | | vi.setVpicture(p.getPoster()); |
| | | vi.setWatchCount(0 + ""); |
| | | vi.setYear(year + ""); |
| | | vi.setUpdatetime(updateTime + ""); |
| | | vi.setVideocount(p.getEpisodes() != null ? p.getEpisodes().size() : 1); |
| | | return vi; |
| | | } |
| | | |
| | | /** |
| | | * 短视频转为正片 |
| | | * |
| | | * @param p |
| | | * @return |
| | | */ |
| | | public static VideoInfo convertVideoToVideoInfo(FunTVShortVideo2 p) { |
| | | String time = p.getRelease(); |
| | | Calendar ca = Calendar.getInstance(); |
| | | ca.setTimeInMillis(TimeUtil.convertGernalTime(time, "yyyy-MM-dd HH:mm:ss")); |
| | | int year = ca.get(Calendar.YEAR); |
| | | int month = ca.get(Calendar.MONTH) + 1; |
| | | int day = ca.get(Calendar.DAY_OF_MONTH); |
| | | String score = "9.0"; |
| | | String tag = ""; |
| | | if (StringUtil.isNullOrEmpty(p.getDuration())) { |
| | | tag = p.getDuration(); |
| | | } |
| | | |
| | | long updateTime = ca.getTimeInMillis(); |
| | | VideoInfo vi = new VideoInfo(); |
| | | vi.setArea(""); |
| | | vi.setBaseurl(p.getFunH5Url()); |
| | | vi.setCanSave(false); |
| | | vi.setCommentCount(0); |
| | | vi.setCreatetime(System.currentTimeMillis()); |
| | | vi.setDay(day + ""); |
| | | vi.setDirector(""); |
| | | vi.setFocus(""); |
| | | vi.setHpicture(p.getStill()); |
| | | vi.setIntroduction(""); |
| | | vi.setLatestHpicture(""); |
| | | vi.setLatestVpicture(""); |
| | | vi.setMainActor(""); |
| | | vi.setMonth(month + ""); |
| | | vi.setName(p.getName()); |
| | | vi.setNowNumber(0 + ""); |
| | | vi.setOrderby("0"); |
| | | vi.setPicture(p.getStill()); |
| | | vi.setScore(score); |
| | | vi.setShare("0"); |
| | | vi.setShow(1 + ""); |
| | | vi.setTag(tag); |
| | | vi.setVpicture(""); |
| | | vi.setWatchCount(0 + ""); |
| | | vi.setYear(year + ""); |
| | | vi.setUpdatetime(updateTime + ""); |
| | | vi.setVideocount(1); |
| | | vi.setContentType(2); |
| | | return vi; |
| | | } |
| | | |
| | | public static int getFunTVAlbumType(FunTVAlbum2 p) { |
| | | if (p.getChannel().contains("电影")) { |
| | | return 151; |
| | | } else if (p.getChannel().contains("电视剧")) { |
| | | return 150; |
| | | } else if (p.getChannel().contains("综艺")) { |
| | | return 152; |
| | | } else if (p.getChannel().contains("动漫")) { |
| | | return 153; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | private void addFunTVVideo(FunTVVideo funTVVideo) { |
| | | final String name = funTVVideo.getTitle(); |
| | | if (!(Boolean) categoryVideoDao.excute(new HibernateCallback<Boolean>() { |
| | | public Boolean doInHibernate(Session session) throws HibernateException { |
| | | return JuheVideoUtil.isNeedAdd(session, name); |
| | | } |
| | | })) |
| | | return; |
| | | |
| | | // 加入videoInfo |
| | | try { |
| | | funTVService.saveVideo(funTVVideo);// 存入数据库 |
| | | //todo 拉取数据的时候不处理 |
| | | // funTVVideo.setId(funTVService.getFunTVVideoByVid(funTVVideo.getVid()).getId()); |
| | | // funTVService.addVideoToVideoInfo(funTVVideo); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | public void saveFunTVAlbum(FunTVAlbum pm) { |
| | | final String name = pm.getTitle(); |
| | | if (!(Boolean) categoryVideoDao.excute(new HibernateCallback<Boolean>() { |
| | | public Boolean doInHibernate(Session session) throws HibernateException { |
| | | return JuheVideoUtil.isNeedAdd(session, name); |
| | | } |
| | | })) |
| | | return; |
| | | |
| | | FunTVVideo pv = funTVService.getLatestFunTVVideo(pm.getAid() + ""); |
| | | Comparator<FunTVVideo> cp = new Comparator<FunTVVideo>() { |
| | | public int compare(FunTVVideo o1, FunTVVideo o2) { |
| | | long t1 = o1.getNum(); |
| | | long t2 = o2.getNum(); |
| | | return (int) (t1 - t2); |
| | | } |
| | | }; |
| | | |
| | | Collections.sort(pm.getVideoList(), cp); |
| | | List<FunTVVideo> vlist = new ArrayList<FunTVVideo>(); |
| | | |
| | | boolean isUpdate = false; |
| | | if (pm.getVideoList().size() > 0 && pv != null) |
| | | isUpdate = pm.getVideoList().get(pm.getVideoList().size() - 1).getNum() > pv.getNum(); |
| | | if (pv == null || isUpdate) {//需要更新 |
| | | if (pv == null)// 首次加入 |
| | | funTVService.saveFunTVAlbum(pm, pm.getVideoList());// 保存数据到本地 |
| | | else { |
| | | for (int i = 0; i < pm.getVideoList().size(); i++) { |
| | | if (pm.getVideoList().get(i).getVid().equalsIgnoreCase(pv.getVid())) { |
| | | if (i < pm.getVideoList().size() - 1) |
| | | vlist = pm.getVideoList().subList(i + 1, pm.getVideoList().size()); |
| | | break; |
| | | } |
| | | } |
| | | funTVService.saveFunTVAlbum(pm, vlist); |
| | | } |
| | | } |
| | | // pm.setId(funTVService.getAlbumByAid(pm.getAid()).getId()); |
| | | //todo 拉取数据的时候不处理 |
| | | // if (pm.getVideoList() != null && pm.getVideoList().size() > 0) |
| | | // funTVService.addFunTVAlbumToVideoInfo(pm, isUpdate); |
| | | } |
| | | |
| | | public static List<Integer> getShortVideoType(FunTVVideo shortVideo, String cate, String subCate) { |
| | | List<Integer> list = new ArrayList<Integer>(); |
| | | if (cate.equalsIgnoreCase("微电影")) { |
| | | } else if (cate.equalsIgnoreCase("纪录片")) { |
| | | } else if (cate.equalsIgnoreCase("热点")) { |
| | | if ("社会".equalsIgnoreCase(subCate)) { |
| | | list.add(242); |
| | | } else if ("民生".equalsIgnoreCase(subCate)) { |
| | | list.add(242); |
| | | } else if ("草根".equalsIgnoreCase(subCate)) { |
| | | list.add(242); |
| | | } else if ("国际".equalsIgnoreCase(subCate)) { |
| | | list.add(290); |
| | | } else if ("政治".equalsIgnoreCase(subCate)) { |
| | | list.add(290); |
| | | } else if ("财经".equalsIgnoreCase(subCate)) { |
| | | list.add(289); |
| | | } |
| | | |
| | | } else if (cate.equalsIgnoreCase("娱乐")) { |
| | | if ("头条".equalsIgnoreCase(subCate)) { |
| | | list.add(219); |
| | | } else if ("八卦".equalsIgnoreCase(subCate)) { |
| | | list.add(219); |
| | | } else if ("明星资讯".equalsIgnoreCase(subCate)) { |
| | | list.add(288); |
| | | } else if ("电影资讯".equalsIgnoreCase(subCate)) { |
| | | list.add(288); |
| | | } else if ("电视资讯".equalsIgnoreCase(subCate)) { |
| | | list.add(288); |
| | | } else if ("音乐资讯".equalsIgnoreCase(subCate)) { |
| | | list.add(288); |
| | | } else if ("风行自制".equalsIgnoreCase(subCate)) { |
| | | list.add(219); |
| | | } else if ("MusicVideo".equalsIgnoreCase(subCate)) { |
| | | list.add(219); |
| | | } |
| | | } else if (cate.equalsIgnoreCase("体育")) { |
| | | |
| | | if ("国际足球".equalsIgnoreCase(subCate)) { |
| | | list.add(292); |
| | | } else if ("国内足球".equalsIgnoreCase(subCate)) { |
| | | list.add(292); |
| | | } else if ("篮球".equalsIgnoreCase(subCate)) { |
| | | list.add(292); |
| | | } else if ("格斗".equalsIgnoreCase(subCate)) { |
| | | list.add(295); |
| | | } else if ("综合体育".equalsIgnoreCase(subCate)) { |
| | | list.add(287); |
| | | } else if ("风流体坛".equalsIgnoreCase(subCate)) { |
| | | list.add(287); |
| | | } else if ("体育节目类".equalsIgnoreCase(subCate)) { |
| | | list.add(287); |
| | | } |
| | | |
| | | } else if (cate.equalsIgnoreCase("游戏")) { |
| | | if ("解说".equalsIgnoreCase(subCate)) { |
| | | list.add(272); |
| | | } else if ("电子竞技".equalsIgnoreCase(subCate)) { |
| | | list.add(212); |
| | | } else if ("游戏赛事".equalsIgnoreCase(subCate)) { |
| | | list.add(212); |
| | | } else if ("游戏攻略".equalsIgnoreCase(subCate)) { |
| | | list.add(272); |
| | | } else if ("网络游戏".equalsIgnoreCase(subCate)) { |
| | | list.add(212); |
| | | } else if ("电玩世界".equalsIgnoreCase(subCate)) { |
| | | list.add(213); |
| | | } else if ("玩家原创".equalsIgnoreCase(subCate)) { |
| | | list.add(298); |
| | | } else if ("主机游戏".equalsIgnoreCase(subCate)) { |
| | | list.add(213); |
| | | } else if ("小游戏".equalsIgnoreCase(subCate)) { |
| | | list.add(213); |
| | | } |
| | | |
| | | if (shortVideo.getTitle().contains("王者荣耀")) { |
| | | list.clear(); |
| | | list.add(214); |
| | | } |
| | | |
| | | } else if (cate.equalsIgnoreCase("搞笑")) { |
| | | if ("疯狂恶搞".equalsIgnoreCase(subCate)) { |
| | | list.add(216); |
| | | } else if ("犀利辣评".equalsIgnoreCase(subCate)) { |
| | | list.add(285); |
| | | } else if ("萌宠日常".equalsIgnoreCase(subCate)) { |
| | | list.add(220); |
| | | } else if ("搞笑联盟".equalsIgnoreCase(subCate)) { |
| | | list.add(216); |
| | | } else if ("开心宝贝".equalsIgnoreCase(subCate)) { |
| | | list.add(216); |
| | | } else if ("美女恶搞".equalsIgnoreCase(subCate)) { |
| | | list.add(216); |
| | | } else if ("小品相声".equalsIgnoreCase(subCate)) { |
| | | list.add(217); |
| | | } |
| | | |
| | | } else if (cate.equalsIgnoreCase("军事")) { |
| | | list.add(223); |
| | | } else if (cate.equalsIgnoreCase("广场舞")) { |
| | | if ("知名舞队".equalsIgnoreCase(subCate)) { |
| | | list.add(303); |
| | | } else if ("精彩舞曲".equalsIgnoreCase(subCate)) { |
| | | list.add(301); |
| | | } else if ("广场舞教学".equalsIgnoreCase(subCate)) { |
| | | list.add(303); |
| | | } else if ("广场舞比赛".equalsIgnoreCase(subCate)) { |
| | | list.add(303); |
| | | } |
| | | } else if (cate.equalsIgnoreCase("汽车")) { |
| | | if ("风FUN车闻".equalsIgnoreCase(subCate)) { |
| | | list.add(226); |
| | | } else if ("风FUN伙伴".equalsIgnoreCase(subCate)) { |
| | | list.add(226); |
| | | } else if ("风FUN专访".equalsIgnoreCase(subCate)) { |
| | | list.add(226); |
| | | } else if ("风FUN试驾".equalsIgnoreCase(subCate)) { |
| | | list.add(226); |
| | | } else if ("香车美女".equalsIgnoreCase(subCate)) { |
| | | list.add(226); |
| | | } else if ("用车玩车".equalsIgnoreCase(subCate)) { |
| | | list.add(226); |
| | | } |
| | | } else if (cate.equalsIgnoreCase("旅游")) { |
| | | if ("编辑推荐".equalsIgnoreCase(subCate)) { |
| | | list.add(229); |
| | | } else if ("环球八卦".equalsIgnoreCase(subCate)) { |
| | | list.add(229); |
| | | } else if ("寰宇世界".equalsIgnoreCase(subCate)) { |
| | | list.add(229); |
| | | } else if ("户外探险".equalsIgnoreCase(subCate)) { |
| | | list.add(229); |
| | | } else if ("舌尖刺激".equalsIgnoreCase(subCate)) { |
| | | list.add(228); |
| | | } |
| | | } else if (cate.equalsIgnoreCase("时尚")) { |
| | | list.add(232); |
| | | } else if (cate.equalsIgnoreCase("母婴")) { |
| | | if ("母婴".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("妈妈学堂".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("亲子秀".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("早期教育".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } |
| | | } else if (cate.equalsIgnoreCase("健康")) { |
| | | if ("健康".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("健康贴士".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("瘦身瑜伽".equalsIgnoreCase(subCate)) { |
| | | list.add(235); |
| | | } else if ("常识".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("健身".equalsIgnoreCase(subCate)) { |
| | | list.add(235); |
| | | } else if ("美容".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("两性".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } |
| | | } else if (cate.equalsIgnoreCase("科技")) { |
| | | list.add(222); |
| | | } else if (cate.equalsIgnoreCase("生活")) { |
| | | if ("美食".equalsIgnoreCase(subCate)) { |
| | | list.add(228); |
| | | } else if ("星座".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("妙招".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("手工".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("家居".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("奇闻".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("运动".equalsIgnoreCase(subCate)) { |
| | | list.add(234); |
| | | } else if ("职场".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("法制".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("情感".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("财经".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("房产".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } else if ("生活百科".equalsIgnoreCase(subCate)) { |
| | | list.add(230); |
| | | } |
| | | |
| | | } else if (cate.equalsIgnoreCase("电影片花")) { |
| | | } else if (cate.equalsIgnoreCase("电视片花")) { |
| | | } else if (cate.equalsIgnoreCase("动漫片花")) { |
| | | } else if (cate.equalsIgnoreCase("综艺片花")) { |
| | | } else if (cate.equalsIgnoreCase("原创")) { |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static int getPlayType(FunTVVideo2 video2) { |
| | | if (video2.getStatus().equalsIgnoreCase("1")) |
| | | return PLAY_HTML; |
| | | else |
| | | return PLAY_NONE; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.funtv.entity; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Document(collection = "funTVAlbum2") |
| | | public class FunTVAlbum2 implements Serializable { |
| | | /** |
| | | * id : 媒体ID |
| | | * name : 中文名称 |
| | | * channel : 媒体频道(例如:电影 电视剧 动画 ) |
| | | * channel_id : 媒体频道id(1,2,3……) |
| | | * still : 横图 |
| | | * poster : 竖图 |
| | | * release : 上映时间,形如2014年2月14日 |
| | | * score : 媒体评分,形如9.8 |
| | | * director : 导演名字 |
| | | * actor : 演员名字(综艺时为主持人名字) |
| | | * category : 题材之间,形如爱情,家庭,剧情 |
| | | * area : 地域,形如北京,上海 |
| | | * aword : 一句话推荐 |
| | | * description : 简介 |
| | | * totalnum : 总集数,有可能是空 |
| | | * update : 剧集更新信息,字符串,例如:更新至第10集,或总24集 |
| | | * isend : 是否完结 1表示完结,0表示未完结 |
| | | * vv : 播放数 |
| | | * status : 状态,0不可用(下线),1可用 |
| | | * isvip : 是否会员片才能观看,取值0/1,VIP会员可免费观看风行VIP片库影片 |
| | | * isfee : 是否单独付费片,单独付费的片源即使用户是风行VIP会员也需要单独支付才能观看 |
| | | */ |
| | | |
| | | @Id |
| | | private String id; |
| | | private String name; |
| | | @Indexed |
| | | private String channel; |
| | | @SerializedName("channel_id") |
| | | private String channelId; |
| | | private String still; |
| | | private String poster; |
| | | private String release; |
| | | private String score; |
| | | private String director; |
| | | private String actor; |
| | | private String category; |
| | | private String area; |
| | | private String aword; |
| | | private String description; |
| | | private String totalnum; |
| | | private String update; |
| | | private String isend; |
| | | private String vv; |
| | | private String status; |
| | | private String isvip; |
| | | private String isfee; |
| | | @Transient |
| | | private List<FunTVVideo2> episodes;//分集,不入数据库 |
| | | |
| | | public List<FunTVVideo2> getEpisodes() { |
| | | return episodes; |
| | | } |
| | | |
| | | public void setEpisodes(List<FunTVVideo2> episodes) { |
| | | this.episodes = episodes; |
| | | } |
| | | |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | | |
| | | public void setChannelId(String channelId) { |
| | | this.channelId = channelId; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | |
| | | public String getStill() { |
| | | return still; |
| | | } |
| | | |
| | | public void setStill(String still) { |
| | | this.still = still; |
| | | } |
| | | |
| | | public String getPoster() { |
| | | return poster; |
| | | } |
| | | |
| | | public void setPoster(String poster) { |
| | | this.poster = poster; |
| | | } |
| | | |
| | | public String getRelease() { |
| | | return release; |
| | | } |
| | | |
| | | public void setRelease(String release) { |
| | | this.release = release; |
| | | } |
| | | |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getDirector() { |
| | | return director; |
| | | } |
| | | |
| | | public void setDirector(String director) { |
| | | this.director = director; |
| | | } |
| | | |
| | | public String getActor() { |
| | | return actor; |
| | | } |
| | | |
| | | public void setActor(String actor) { |
| | | this.actor = actor; |
| | | } |
| | | |
| | | public String getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(String category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public String getArea() { |
| | | return area; |
| | | } |
| | | |
| | | public void setArea(String area) { |
| | | this.area = area; |
| | | } |
| | | |
| | | public String getAword() { |
| | | return aword; |
| | | } |
| | | |
| | | public void setAword(String aword) { |
| | | this.aword = aword; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getTotalnum() { |
| | | return totalnum; |
| | | } |
| | | |
| | | public void setTotalnum(String totalnum) { |
| | | this.totalnum = totalnum; |
| | | } |
| | | |
| | | public String getUpdate() { |
| | | return update; |
| | | } |
| | | |
| | | public void setUpdate(String update) { |
| | | this.update = update; |
| | | } |
| | | |
| | | public String getIsend() { |
| | | return isend; |
| | | } |
| | | |
| | | public void setIsend(String isend) { |
| | | this.isend = isend; |
| | | } |
| | | |
| | | public String getVv() { |
| | | return vv; |
| | | } |
| | | |
| | | public void setVv(String vv) { |
| | | this.vv = vv; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getIsvip() { |
| | | return isvip; |
| | | } |
| | | |
| | | public void setIsvip(String isvip) { |
| | | this.isvip = isvip; |
| | | } |
| | | |
| | | public String getIsfee() { |
| | | return isfee; |
| | | } |
| | | |
| | | public void setIsfee(String isfee) { |
| | | this.isfee = isfee; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.funtv.entity; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | //风行视频 |
| | | @Document(collection = "funTvShortVideo") |
| | | public class FunTVShortVideo2 implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * id : 视频唯一标识 |
| | | * name : 视频名称 |
| | | * channel_id : 视频频道ID |
| | | * channel : 视频频道(搞笑、体育、娱乐) |
| | | * still : 横图 |
| | | * poster : 竖图(一般为空) |
| | | * category : 题材 |
| | | * aword : 一句话推荐 |
| | | * brief : 简介 |
| | | * duration : 时长,格式: 分钟:秒,例如90:23表示视频时长90分钟23秒 |
| | | * player_url : 播放器样式的h5播放页地址(展示样式:页面只含有一个播放器,无其他信息) |
| | | * fun_h5_url : 风行定制样式的h5播放页地址(展示样式:页面包含播放器、剧集信息、相关视频等其他内容),格式形如http://m.fun.tv/focplay/?vid={短视频ID}&malliance={$cp} |
| | | * status : 状态,0不可用(下线),1可用 |
| | | * vv : 观看数 |
| | | * release : 视频发布时间(最后更新时间)格式yyyy-mm-dd hh:ii:ss |
| | | * android_deeplink : 安卓拉起APP deeplink,形如fsp://m.fun.tv/vplay/m-{短视频ID} |
| | | * ios_deeplink : IOS拉起APP deeplink,形如funtv://?mtype=vplay&mid={短视频ID}&cid={短视频频道ID} |
| | | * display_ratio : 宽高比,float型,display_ratio>=1表示横屏,display_ratio<1表示竖屏,0表示无法分辨横竖屏 |
| | | * provider : {"cp_id":"CPID","name":"CP名称","icon":"CP头像"} |
| | | */ |
| | | |
| | | @Id |
| | | private String id; |
| | | private String name; |
| | | @Indexed |
| | | @SerializedName("channel_id") |
| | | private String channelId; |
| | | private String channel; |
| | | private String still; |
| | | private String poster; |
| | | private String category; |
| | | private String aword; |
| | | private String brief; |
| | | private String duration; |
| | | @SerializedName("player_url") |
| | | private String playerUrl; |
| | | @SerializedName("fun_h5_url") |
| | | private String funH5Url; |
| | | private String status; |
| | | private String vv; |
| | | private String release; |
| | | @SerializedName("android_deeplink") |
| | | private String androidDeeplink; |
| | | @SerializedName("ios_deeplink") |
| | | private String iosDeeplink; |
| | | @SerializedName("display_ratio") |
| | | private String displayRatio; |
| | | private ProviderBean provider; |
| | | |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | | |
| | | public void setChannelId(String channelId) { |
| | | this.channelId = channelId; |
| | | } |
| | | |
| | | public String getPlayerUrl() { |
| | | return playerUrl; |
| | | } |
| | | |
| | | public void setPlayerUrl(String playerUrl) { |
| | | this.playerUrl = playerUrl; |
| | | } |
| | | |
| | | public String getFunH5Url() { |
| | | return funH5Url; |
| | | } |
| | | |
| | | public void setFunH5Url(String funH5Url) { |
| | | this.funH5Url = funH5Url; |
| | | } |
| | | |
| | | public String getAndroidDeeplink() { |
| | | return androidDeeplink; |
| | | } |
| | | |
| | | public void setAndroidDeeplink(String androidDeeplink) { |
| | | this.androidDeeplink = androidDeeplink; |
| | | } |
| | | |
| | | public String getIosDeeplink() { |
| | | return iosDeeplink; |
| | | } |
| | | |
| | | public void setIosDeeplink(String iosDeeplink) { |
| | | this.iosDeeplink = iosDeeplink; |
| | | } |
| | | |
| | | public String getDisplayRatio() { |
| | | return displayRatio; |
| | | } |
| | | |
| | | public void setDisplayRatio(String displayRatio) { |
| | | this.displayRatio = displayRatio; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public String getStill() { |
| | | return still; |
| | | } |
| | | |
| | | public void setStill(String still) { |
| | | this.still = still; |
| | | } |
| | | |
| | | public String getPoster() { |
| | | return poster; |
| | | } |
| | | |
| | | public void setPoster(String poster) { |
| | | this.poster = poster; |
| | | } |
| | | |
| | | public String getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(String category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public String getAword() { |
| | | return aword; |
| | | } |
| | | |
| | | public void setAword(String aword) { |
| | | this.aword = aword; |
| | | } |
| | | |
| | | public String getBrief() { |
| | | return brief; |
| | | } |
| | | |
| | | public void setBrief(String brief) { |
| | | this.brief = brief; |
| | | } |
| | | |
| | | public String getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(String duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getVv() { |
| | | return vv; |
| | | } |
| | | |
| | | public void setVv(String vv) { |
| | | this.vv = vv; |
| | | } |
| | | |
| | | public String getRelease() { |
| | | return release; |
| | | } |
| | | |
| | | public void setRelease(String release) { |
| | | this.release = release; |
| | | } |
| | | |
| | | public ProviderBean getProvider() { |
| | | return provider; |
| | | } |
| | | |
| | | public void setProvider(ProviderBean provider) { |
| | | this.provider = provider; |
| | | } |
| | | |
| | | public static class ProviderBean { |
| | | /** |
| | | * cp_id : CPID |
| | | * name : CP名称 |
| | | * icon : CP头像 |
| | | */ |
| | | |
| | | private String cp_id; |
| | | private String name; |
| | | private String icon; |
| | | |
| | | public String getCp_id() { |
| | | return cp_id; |
| | | } |
| | | |
| | | public void setCp_id(String cp_id) { |
| | | this.cp_id = cp_id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.funtv.entity; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Document(collection = "funTVVideo2") |
| | | public class FunTVVideo2 implements Serializable { |
| | | /** |
| | | * id : 分集ID |
| | | * name : 分集名称 |
| | | * num : 分集num |
| | | * status : 状态,0不可用(下线),1可用 |
| | | * duration : 时长,格式 分钟:秒,例如90:45表示90分钟45秒 |
| | | * still : 横图 |
| | | * fun_h5_url : 风行定制样式的h5播放页地址(展示样式:页面包含播放器、剧集信息、相关视频等其他内容) |
| | | * isvip : 是否VIP会员才能观看 |
| | | * isfee : 是单独付费 |
| | | * android_deeplink : 安卓拉起APP deeplink |
| | | * ios_deeplink : IOS拉起APP deeplink |
| | | */ |
| | | @Id |
| | | private String id; |
| | | @Indexed |
| | | private String mediaId; |
| | | private String name; |
| | | @Indexed |
| | | private String num; |
| | | private String status; |
| | | private String duration; |
| | | private String still; |
| | | @SerializedName("fun_h5_url") |
| | | private String funH5Url; |
| | | private String isvip; |
| | | private String isfee; |
| | | @SerializedName("android_deeplink") |
| | | private String androidDeeplink; |
| | | @SerializedName("ios_deeplink") |
| | | private String iosDeeplink; |
| | | |
| | | |
| | | |
| | | public String getMediaId() { |
| | | return mediaId; |
| | | } |
| | | |
| | | public void setMediaId(String mediaId) { |
| | | this.mediaId = mediaId; |
| | | } |
| | | |
| | | public String getFunH5Url() { |
| | | return funH5Url; |
| | | } |
| | | |
| | | public void setFunH5Url(String funH5Url) { |
| | | this.funH5Url = funH5Url; |
| | | } |
| | | |
| | | public String getAndroidDeeplink() { |
| | | return androidDeeplink; |
| | | } |
| | | |
| | | public void setAndroidDeeplink(String androidDeeplink) { |
| | | this.androidDeeplink = androidDeeplink; |
| | | } |
| | | |
| | | public String getIosDeeplink() { |
| | | return iosDeeplink; |
| | | } |
| | | |
| | | public void setIosDeeplink(String iosDeeplink) { |
| | | this.iosDeeplink = iosDeeplink; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(String num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(String duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getStill() { |
| | | return still; |
| | | } |
| | | |
| | | public void setStill(String still) { |
| | | this.still = still; |
| | | } |
| | | |
| | | |
| | | public String getIsvip() { |
| | | return isvip; |
| | | } |
| | | |
| | | public void setIsvip(String isvip) { |
| | | this.isvip = isvip; |
| | | } |
| | | |
| | | public String getIsfee() { |
| | | return isfee; |
| | | } |
| | | |
| | | public void setIsfee(String isfee) { |
| | | this.isfee = isfee; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.funtv.entity; |
| | | |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | @Document(collection = "videoFunTV2") |
| | | public class VideoFunTV2 { |
| | | @Indexed |
| | | @Id |
| | | private Long videoId; |
| | | @Indexed |
| | | @Field |
| | | private String mediaId; |
| | | @Indexed |
| | | @Field |
| | | private String vid; |
| | | |
| | | public Long getVideoId() { |
| | | return videoId; |
| | | } |
| | | |
| | | public void setVideoId(Long videoId) { |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public String getMediaId() { |
| | | return mediaId; |
| | | } |
| | | |
| | | public void setMediaId(String mediaId) { |
| | | this.mediaId = mediaId; |
| | | } |
| | | |
| | | public String getVid() { |
| | | return vid; |
| | | } |
| | | |
| | | public void setVid(String vid) { |
| | | this.vid = vid; |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static IqiyiAlbum2 getAlbumOrVideoDetail(Long id) { |
| | | List<Long> ids = new ArrayList<>(); |
| | | ids.add(id); |
| | | List<IqiyiAlbum2> list = getAlbumOrVideoDetail(ids); |
| | | |
| | | if (list != null && list.size() > 0) |
| | | return list.get(0); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取更新的专辑 |
| | | * |
| | |
| | | |
| | | static Logger logger = Logger.getLogger(IqiyiUtil.class); |
| | | |
| | | |
| | | public final static int RESOURCE_ID = 13; |
| | | public final static String RESOURCE_NAME = "爱奇艺"; |
| | | |
| | | public final int PLAY_NONE = 0;// 不能播放 |
| | | public final int PLAY_HTML = 1;// 跳转移动端网页播放 |
| | | public final int PLAY_SWF = 2;// 嵌套网页播放 |
| | |
| | | public final static int PLAY_HTML = 1;// 跳转移动端网页播放 |
| | | public final static int PLAY_SWF = 2;// 嵌套网页播放 |
| | | |
| | | public final static long RESOURCE_ID = 22L; |
| | | public final static int RESOURCE_ID = 22; |
| | | public final static String RESOURCE_NAME = "爱奇艺."; |
| | | @Resource |
| | | private Iqiyi2Service iqiyi2Service; |
| | | |
| | |
| | | } |
| | | } |
| | | iqiyi2Service.saveIqiyiAlbum(album); |
| | | CMQManager.getInstance().addAlbumUpdateMsg(album.getId()); |
| | | CMQManager.getInstance().addIqiyiAlbumUpdateMsg(album.getId()); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.yeshi.buwan.job; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.Config; |
| | | import com.yeshi.buwan.domain.DetailSystem; |
| | | import com.yeshi.buwan.service.imp.ConfigService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.util.EHCacheManager; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | //10409568 |
| | | @Component |
| | | public class AdJob { |
| | | @Resource |
| | | private ConfigService configService; |
| | | @Resource |
| | | private SystemService systemService; |
| | | @Resource |
| | | private EHCacheManager ehCacheManager; |
| | | |
| | | |
| | | //打开华为应用市场的广告 |
| | | @XxlJob("ad-hw-check") |
| | | public ReturnT<String> openHWAd(String params) throws Exception { |
| | | JSONObject paramsJson = JSONObject.fromObject(params); |
| | | String appId = paramsJson.optString("appId"); |
| | | String systemId = paramsJson.optString("detailSystemId"); |
| | | //应用市场的版本 |
| | | String onLineVersion = AppMarketUtil.getHWLatestVersion(appId); |
| | | if (StringUtil.isNullOrEmpty(onLineVersion)) { |
| | | throw new Exception("应用市场版本获取失败:" + appId); |
| | | } |
| | | |
| | | //获取正在上线的版本 |
| | | DetailSystem detailSystem = systemService.getDetailSystemById(systemId); |
| | | Map<String, String> map = configService.getConfigAsMap(detailSystem, 1); |
| | | //正在上线的版本 |
| | | String onLiningVersionInfo = map.get("ad_hw_online_version_info"); |
| | | JSONObject onLiningVersionInfoJson = JSONObject.fromObject(onLiningVersionInfo); |
| | | String onLiningVersionName = onLiningVersionInfoJson.optString("versionName"); |
| | | int onLiningVersionCode = onLiningVersionInfoJson.optInt("versionCode"); |
| | | //是否已经上线完成 |
| | | if (Integer.parseInt(onLineVersion.replace(".", "")) >= Integer.parseInt(onLiningVersionName.replace(".", ""))) { |
| | | //已经上线,设置 |
| | | showAd("huawei", detailSystem, onLiningVersionCode + 1); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 打开广告 |
| | | * |
| | | * @param detailSystem |
| | | * @param version |
| | | */ |
| | | public void showAd(String channel, DetailSystem detailSystem, int version) { |
| | | Config config = configService.getConfigByKey("video_detail_full_video_version_channel", detailSystem, version); |
| | | updateVersionConfig(channel, config, version); |
| | | config = configService.getConfigByKey("ad_splash_config", detailSystem, version); |
| | | updateVersionConfig(channel, config, version); |
| | | if (!channel.equalsIgnoreCase("vivo")) {//VIVO屏蔽其他广告位 |
| | | config = configService.getConfigByKey("ad_other_open_settings", detailSystem, version); |
| | | updateVersionConfig(channel, config, version); |
| | | } |
| | | config = configService.getConfigByKey("ad_play_video_pre", detailSystem, version); |
| | | updateVersionConfig(channel, config, version); |
| | | config = configService.getConfigByKey("ad_exit_app", detailSystem, version); |
| | | updateVersionConfig(channel, config, version); |
| | | |
| | | config = configService.getConfigByKey("ad_video_detail_full_video", detailSystem, version); |
| | | updateVersionConfig(channel, config, version); |
| | | |
| | | //删除缓存 |
| | | ehCacheManager.removeCacheByCacheName("configCache"); |
| | | } |
| | | |
| | | /** |
| | | * 获取正在上线的版本 |
| | | * |
| | | * @return |
| | | */ |
| | | public int getOnliningVersionCode(DetailSystem detailSystem) { |
| | | Config config = configService.getConfigByKey("ad_click_download_version", detailSystem, 1); |
| | | return Integer.parseInt(config.getValue()); |
| | | } |
| | | |
| | | public void setOnliningVersionCode(int versionCode, DetailSystem detailSystem) { |
| | | Config config = configService.getConfigByKey("ad_click_download_version", detailSystem, 1); |
| | | config.setValue(versionCode + ""); |
| | | configService.updateConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * 更新version |
| | | * |
| | | * @param config |
| | | * @param version |
| | | */ |
| | | private void updateVersionConfig(String channel, Config config, int version) { |
| | | channel = channel.toLowerCase(); |
| | | if (config == null) |
| | | return; |
| | | if (StringUtil.isNullOrEmpty(config.getValue())) |
| | | return; |
| | | JSONObject json = JSONObject.fromObject(config.getValue()); |
| | | if (json.opt(channel) == null) |
| | | return; |
| | | |
| | | if (json.opt(channel) instanceof Integer) { |
| | | if (json.optInt(channel) < version) |
| | | json.put(channel, version); |
| | | } else { |
| | | JSONObject item = json.optJSONObject(channel); |
| | | if (item != null && !StringUtil.isNullOrEmpty(item.optString("version"))) { |
| | | if (Integer.parseInt(item.optString("version")) < version) |
| | | item.put("version", version); |
| | | } |
| | | json.put(channel, item); |
| | | } |
| | | config.setValue(json.toString()); |
| | | configService.updateConfig(config); |
| | | } |
| | | |
| | | |
| | | } |
File was renamed from src/main/java/com/yeshi/buwan/job/VideoUpdateJob.java |
| | |
| | | * |
| | | */ |
| | | @Component |
| | | public class VideoUpdateJob { |
| | | public class JuHeVideoUpdateJob { |
| | | @Resource |
| | | private IqiyiUtil iqiyiUtil; |
| | | @Resource |
| | |
| | | |
| | | private static int c = 1; |
| | | |
| | | public VideoUpdateJob() { |
| | | public JuHeVideoUpdateJob() { |
| | | System.out.println("============================================实例化次数:" + c); |
| | | ++c; |
| | | } |
| | |
| | | |
| | | @Scheduled(cron = "0 0 2 * * ?") |
| | | public void updateAcFun() { |
| | | if (!Constant.JobTasker) |
| | | return; |
| | | // if (!Constant.JobTasker) |
| | | // return; |
| | | |
| | | AcfunVideoResult result = AcfunApiUtil.videoList(""); |
| | | while (result != null && result.pcursor != null && !result.pcursor.equalsIgnoreCase("no_more")) { |
New file |
| | |
| | | package com.yeshi.buwan.job; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.LinuxRemoteCommandUtil; |
| | | |
| | | |
| | | /** |
| | | * @author Administrator |
| | | */ |
| | | @Component |
| | | public class SolrJob { |
| | | |
| | | @XxlJob("solr-watch") |
| | | public ReturnT<String> reStartSolr(String param) throws Exception { |
| | | String solrIP = "172.16.16.12"; |
| | | String serverAccount = "root"; |
| | | String serverPwd = "Yeshi2016@"; |
| | | LinuxRemoteCommandUtil.execute(solrIP, serverAccount, serverPwd, param); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.job.video; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.funtv.FunTVNewApi; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.vo.video.funtv.Funtv2ResultVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class FunTV2VideoUpdate { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(FunTV2VideoUpdate.class); |
| | | |
| | | @Resource |
| | | private FunTV2Service funTV2Service; |
| | | |
| | | |
| | | @XxlJob("video-update-funtv2-updateLatestVideo") |
| | | public ReturnT<String> updateLatestVideo(String param) throws Exception { |
| | | int d = 1; |
| | | if (!StringUtil.isNullOrEmpty(param)) |
| | | d = Integer.parseInt(param); |
| | | //获取最近1天的专辑 |
| | | List<FunTVAlbum2> list = getLatestAlbum(d); |
| | | for (FunTVAlbum2 album2 : list) { |
| | | funTV2Service.saveAlbum(album2); |
| | | if (album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | funTV2Service.saveVideo(video2); |
| | | CMQManager.getInstance().addFunTVAlbumUpdateMsg(album2.getId()); |
| | | } |
| | | |
| | | //获取最近一天的短视频 |
| | | List<FunTVShortVideo2> shortVideo2List = getLatestShortVideo(d); |
| | | if (shortVideo2List != null) |
| | | for (FunTVShortVideo2 video2 : shortVideo2List) |
| | | funTV2Service.saveShortVideo(video2); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | @XxlJob("video-update-funtv2-updateAlbumById") |
| | | public ReturnT<String> updateAlbumById(String param) throws Exception { |
| | | FunTVAlbum2 album2 = FunTVNewApi.getAlbumsDetail(param); |
| | | if (album2 != null) { |
| | | funTV2Service.saveAlbum(album2); |
| | | if (album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | funTV2Service.saveVideo(video2); |
| | | CMQManager.getInstance().addFunTVAlbumUpdateMsg(album2.getId()); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 获取最近的短视频 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<FunTVShortVideo2> getLatestShortVideo(int d) { |
| | | List<FunTVShortVideo2> shortVideo2List = new ArrayList<>(); |
| | | int pageSize = 100; |
| | | long now = System.currentTimeMillis(); |
| | | int page = 1; |
| | | int totalPage = -1; |
| | | while (true) { |
| | | Funtv2ResultVO result = FunTVNewApi.getVideos(page, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, null); |
| | | if (result != null) { |
| | | for (Serializable a : result.getList()) { |
| | | FunTVShortVideo2 video2 = (FunTVShortVideo2) a; |
| | | shortVideo2List.add(video2); |
| | | } |
| | | } |
| | | int count = result.getCount(); |
| | | if (totalPage < 0) |
| | | totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | if (page > totalPage) |
| | | break; |
| | | page++; |
| | | } |
| | | return shortVideo2List; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取最近的专辑 |
| | | * |
| | | * @return |
| | | */ |
| | | private List<FunTVAlbum2> getLatestAlbum(int d) { |
| | | List<FunTVAlbum2> funTVAlbum2List = new ArrayList<>(); |
| | | int pageSize = 100; |
| | | long now = System.currentTimeMillis(); |
| | | int page = 1; |
| | | int totalPage = -1; |
| | | while (true) { |
| | | Funtv2ResultVO result = FunTVNewApi.getAlbums(page, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, null); |
| | | if (result != null) { |
| | | for (Serializable a : result.getList()) { |
| | | FunTVAlbum2 video2 = (FunTVAlbum2) a; |
| | | funTVAlbum2List.add(video2); |
| | | } |
| | | } |
| | | int count = result.getCount(); |
| | | if (totalPage < 0) |
| | | totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | if (page > totalPage) |
| | | break; |
| | | page++; |
| | | } |
| | | return funTVAlbum2List; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Component |
| | | public class Iqiyi2VideoUpdate { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(Iqiyi2VideoUpdate.class); |
| | | |
| | | @Resource |
| | | private IqiyiUtil2 iqiyiUtil2; |
| | |
| | | for (String url : urlList) { |
| | | String aid = IqiYiNewAPI.getAidByUrl(url); |
| | | iqiyiUtil2.syncByAid(Long.parseLong(aid)); |
| | | logger.info("更新专辑:" + aid); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 根据视频播放链接更新专辑 |
| | | * |
| | | * @param param |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @XxlJob("video-update-iqiyi-updateVideoByPlayerUrl") |
| | | public ReturnT<String> updateVideoByPlayerUrl(String param) throws Exception { |
| | | String aid = IqiYiNewAPI.getAidByUrl(param); |
| | | iqiyiUtil2.syncByAid(Long.parseLong(aid)); |
| | | logger.info("更新专辑:" + aid); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.job.video; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumDataManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Component |
| | | public class VideoUpdateJob { |
| | | |
| | | @Resource |
| | | private SolrAlbumDataManager solrAlbumDataManager; |
| | | |
| | | /** |
| | | * 同步所有专辑 |
| | | * |
| | | * @param param |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @XxlJob("video-update-solr-syncAllAlbum") |
| | | public ReturnT<String> syncAllAlbum(String param) throws Exception { |
| | | solrAlbumDataManager.syncAllAlbum(); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | } |
| | |
| | | |
| | | @Component |
| | | public class PPTVUtil { |
| | | |
| | | public final static int RESOURCE_ID = 16; |
| | | public final static String RESOURCE_NAME = "PPTV"; |
| | | |
| | | @Resource |
| | | private PPTVService pptvService; |
| | | @Resource |
| | | private PPTVMovieVideoDao pptvMovieVideoDao; |
| | | |
| | | |
| | | |
| | | // 解析电影 |
| | | public void startParseMovie() { |
| | | List<String> urlList = PPTVApi.getPageUrl(PPTVApi.PPTV_UPDATE_MOVIE); |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取资源列表 |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | | public List<ResourceVideo> getResourceList(String videoId) { |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | videoInfoList.add(new VideoInfo(videoId)); |
| | | return getResourceList(videoInfoList); |
| | | } |
| | | |
| | | public void save(ResourceVideo resourceVideo) { |
| | | resourceVideoDao.save(resourceVideo); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public void delete(ResourceVideo rv){ |
| | | resourceVideoDao.delete(rv); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public List<VideoInfo> listByVideoIds(List<String> videoIds) { |
| | | |
| | | return videoInfoDao.listByVideoIds(videoIds); |
| | | |
| | | } |
| | | |
| | | public void hiddenVideo(String id) { |
| | | VideoInfo videoInfo = videoInfoDao.find(VideoInfo.class, id); |
| | | if (videoInfo != null && "1".equalsIgnoreCase(videoInfo.getShow())) { |
| | | videoInfo.setShow("0"); |
| | | videoInfoDao.update(videoInfo); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.juhe; |
| | | |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class AlbumVideoMapServiceImpl implements AlbumVideoMapService { |
| | | |
| | | @Resource |
| | | private AlbumVideoMapDao albumVideoMapDao; |
| | | |
| | | |
| | | @Override |
| | | public List<AlbumVideoMap> listAll(int page, int pageSize) { |
| | | return albumVideoMapDao.listAll((page - 1) * pageSize, pageSize); |
| | | } |
| | | |
| | | @Override |
| | | public long countAll() { |
| | | return albumVideoMapDao.countAll(); |
| | | } |
| | | |
| | | @Override |
| | | public AlbumVideoMap selectByVideoId(String videoId) { |
| | | return albumVideoMapDao.selectByVideoId(videoId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.juhe; |
| | | |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVAlbum2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVShortVideo2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.VideoFunTV2Dao; |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.ResourceVideo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.funtv.entity.VideoFunTV2; |
| | | import com.yeshi.buwan.service.imp.CategoryVideoService; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class FunTV2ServiceImpl implements FunTV2Service { |
| | | |
| | | @Resource |
| | | private FunTVAlbum2Dao funTVAlbum2Dao; |
| | | |
| | | @Resource |
| | | private FunTVVideo2Dao funTVVideo2Dao; |
| | | |
| | | @Resource |
| | | private FunTVShortVideo2Dao funTVShortVideo2Dao; |
| | | |
| | | @Resource |
| | | private VideoFunTV2Dao videoFunTV2Dao; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private VideoInfoDao videoInfoDao; |
| | | |
| | | @Resource |
| | | private AlbumVideoMapDao albumVideoMapDao; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private CategoryVideoService categoryVideoService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | |
| | | @Override |
| | | public void saveAlbum(FunTVAlbum2 album2) { |
| | | funTVAlbum2Dao.save(album2); |
| | | } |
| | | |
| | | @Override |
| | | public void saveVideo(FunTVVideo2 video) { |
| | | funTVVideo2Dao.save(video); |
| | | } |
| | | |
| | | @Override |
| | | public void saveShortVideo(FunTVShortVideo2 shortVideo2) { |
| | | funTVShortVideo2Dao.save(shortVideo2); |
| | | } |
| | | |
| | | @Override |
| | | public void addToVideoInfo(FunTVAlbum2 album) { |
| | | if (album.getEpisodes() != null && album.getEpisodes().size() <= 0) |
| | | return; |
| | | |
| | | VideoInfo newVideoInfo = FunTVUtil2.convertFunTVAlbumToVideoInfo(album); |
| | | VideoFunTV2 videoFunTV2 = videoFunTV2Dao.selectByMediaId(album.getId()); |
| | | if (videoFunTV2 != null) {//渠道视频已经存在 |
| | | VideoInfo videoInfo = videoInfoService.getVideoInfo(videoFunTV2.getVideoId() + ""); |
| | | if (videoInfo == null) |
| | | return; |
| | | newVideoInfo.setId(videoInfo.getId()); |
| | | if (!newVideoInfo.getTag().equalsIgnoreCase(videoInfo.getTag())) { |
| | | newVideoInfo.setCreatetime(videoInfo.getCreatetime()); |
| | | //更新信息tag信息 |
| | | videoInfo.setVideocount(newVideoInfo.getVideocount()); |
| | | videoInfo.setTag(newVideoInfo.getTag()); |
| | | videoInfo.setPicture(newVideoInfo.getPicture()); |
| | | videoInfo.setHpicture(newVideoInfo.getHpicture()); |
| | | videoInfo.setVpicture(newVideoInfo.getVpicture()); |
| | | videoInfo.setShow(newVideoInfo.getShow()); |
| | | videoInfo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfoDao.update(videoInfo); |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideo(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoDao.save(newVideoInfo); |
| | | newVideoInfo.setId(id + ""); |
| | | } else {//为同一视频 |
| | | //更新tag |
| | | newVideoInfo.setId(oldVideo.getId()); |
| | | oldVideo.setVideocount(newVideoInfo.getVideocount()); |
| | | oldVideo.setTag(newVideoInfo.getTag()); |
| | | oldVideo.setPicture(newVideoInfo.getPicture()); |
| | | oldVideo.setHpicture(newVideoInfo.getHpicture()); |
| | | oldVideo.setVpicture(newVideoInfo.getVpicture()); |
| | | oldVideo.setShow(newVideoInfo.getShow()); |
| | | oldVideo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfoDao.update(oldVideo); |
| | | } |
| | | |
| | | //加入专辑视频映射 |
| | | AlbumVideoMap map = new AlbumVideoMap(); |
| | | map.setCreateTime(new Date()); |
| | | map.setVideoId(newVideoInfo.getId()); |
| | | map.setRootVideoType(newVideoInfo.getVideoType().getId()); |
| | | map.setVideoCount(newVideoInfo.getVideocount()); |
| | | albumVideoMapDao.save(map); |
| | | |
| | | //加入映射 |
| | | VideoFunTV2 vi = new VideoFunTV2(); |
| | | vi.setMediaId(album.getId()); |
| | | vi.setVideoId(Long.parseLong(newVideoInfo.getId())); |
| | | videoFunTV2Dao.save(vi); |
| | | } |
| | | |
| | | //添加视频来源映射 |
| | | resourceVideoService.addVideoResource(newVideoInfo.getId(), FunTVUtil2.RESOURCE_ID + ""); |
| | | //添加视频分类映射 |
| | | categoryVideoService.addCategoryVideo(newVideoInfo.getId(), newVideoInfo.getVideoType().getId()); |
| | | CMQManager.getInstance().addSolrMsg(newVideoInfo.getId()); |
| | | } |
| | | |
| | | @Override |
| | | public FunTVAlbum2 getAlbumDetail(String id) { |
| | | FunTVAlbum2 album2 = funTVAlbum2Dao.get(id); |
| | | if (album2 == null) |
| | | return null; |
| | | List<FunTVVideo2> video2List = funTVVideo2Dao.listByMediaId(id); |
| | | if (video2List != null) { |
| | | Comparator<FunTVVideo2> cm = new Comparator<FunTVVideo2>() { |
| | | @Override |
| | | public int compare(FunTVVideo2 o1, FunTVVideo2 o2) { |
| | | return Integer.parseInt(o1.getNum()) - Integer.parseInt(o2.getNum()); |
| | | } |
| | | }; |
| | | Collections.sort(video2List, cm); |
| | | } |
| | | album2.setEpisodes(video2List); |
| | | return album2; |
| | | } |
| | | |
| | | @Override |
| | | public List<VideoDetailInfo> getVideoDetailList(String id) { |
| | | VideoFunTV2 videoFunTV2 = videoFunTV2Dao.selectByVideoId(id); |
| | | if (videoFunTV2 == null) |
| | | return null; |
| | | FunTVAlbum2 album2 = getAlbumDetail(videoFunTV2.getMediaId()); |
| | | List<VideoDetailInfo> list = new ArrayList<>(); |
| | | if (album2 != null && album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | list.add(FunTVUtil2.convertFunTVVideoToVideoDetail(video2, album2)); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public VideoDetailInfo getLatestVideoDetail(String id) { |
| | | VideoFunTV2 videoFunTV2 = videoFunTV2Dao.selectByVideoId(id); |
| | | if (videoFunTV2 == null) |
| | | return null; |
| | | FunTVAlbum2 album2 = getAlbumDetail(videoFunTV2.getMediaId()); |
| | | if (album2 != null && album2.getEpisodes() != null && album2.getEpisodes().size() > 0) |
| | | return FunTVUtil2.convertFunTVVideoToVideoDetail(album2.getEpisodes().get(album2.getEpisodes().size() - 1), album2); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getShowType(String videoid) { |
| | | VideoInfo videoInfo = videoInfoDao.find(VideoInfo.class, videoid); |
| | | if (videoInfo.getVideoType() != null && (videoInfo.getVideoType().getId() == VideoConstant.VIDEO_CATEGORY_DIANSHIJU || videoInfo.getVideoType().getId() == VideoConstant.VIDEO_CATEGORY_DONGMAN)) |
| | | return 2; |
| | | else |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public PlayUrl getPlayUrl(String detailSystemId, int resourceId, String id, String videoId) { |
| | | FunTVVideo2 video2 = funTVVideo2Dao.get(id); |
| | | VideoResource vr = videoResourceService.getResource(resourceId + ""); |
| | | int t = FunTVUtil2.getPlayType(video2); |
| | | PlayUrl pu = new PlayUrl(); |
| | | pu.setParams(""); |
| | | pu.setPlayType(t); |
| | | pu.setResource(vr); |
| | | |
| | | if (t == FunTVUtil2.PLAY_NONE) { |
| | | pu.setUrl(""); |
| | | } else if (t == FunTVUtil2.PLAY_HTML) { |
| | | pu.setUrl(video2.getFunH5Url()); |
| | | } |
| | | return pu; |
| | | } |
| | | |
| | | /** |
| | | * 处理专辑 |
| | | * |
| | | * @param album2 |
| | | */ |
| | | @Transactional |
| | | public void processAlbum(FunTVAlbum2 album2) { |
| | | if ("1".equalsIgnoreCase(album2.getStatus())) |
| | | addToVideoInfo(album2); |
| | | else |
| | | offLineAlbum(album2.getId()); |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void offLineAlbum(String mediaId) { |
| | | //查询出对应的视频ID |
| | | VideoFunTV2 videoFunTV2 = videoFunTV2Dao.selectByMediaId(mediaId); |
| | | if (videoFunTV2 == null) |
| | | return; |
| | | |
| | | List<ResourceVideo> resourceVideoList = resourceVideoService.getResourceList(videoFunTV2.getVideoId() + ""); |
| | | for (int i = 0; i < resourceVideoList.size(); i++) { |
| | | ResourceVideo rv = resourceVideoList.get(i); |
| | | if (rv.getResource() != null && Integer.parseInt(rv.getResource().getId()) == FunTVUtil2.RESOURCE_ID) { |
| | | //删除资源映射 |
| | | resourceVideoService.delete(rv); |
| | | resourceVideoList.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | |
| | | if (resourceVideoList.size() == 0) { |
| | | //隐藏视频 |
| | | videoInfoService.hiddenVideo(videoFunTV2.getVideoId() + ""); |
| | | //更新搜索引擎 |
| | | CMQManager.getInstance().addSolrMsg(videoFunTV2.getVideoId() + ""); |
| | | } |
| | | |
| | | //删除媒体与媒体对应的视频 |
| | | funTVAlbum2Dao.delete(mediaId); |
| | | List<FunTVVideo2> video2List = funTVVideo2Dao.listByMediaId(mediaId); |
| | | if (video2List != null) |
| | | for (FunTVVideo2 video2 : video2List) |
| | | funTVVideo2Dao.delete(video2.getId()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(album.getName())) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | //只缓存有效的 |
| | | if (album.getEffect() == 0) |
| | | return; |
| | |
| | | return; |
| | | } |
| | | |
| | | if (album.getChannelId() != 1) { |
| | | //标题中只能包含中英文与数字 |
| | | String regx = "^[(\\u4e00-\\u9fa5)( )a-zA-Z0-9]+$"; |
| | | if (!Pattern.matches(regx, album.getName())) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //过滤某些短片与影评 |
| | | if (album.getName().contains("《")) |
| | | return; |
| | | |
| | | //空电视剧或者是空动漫则返回 |
| | | if (album.getChannelId() == 2 || album.getChannelId() == 4) { |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.juhe; |
| | | |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface AlbumVideoMapService { |
| | | |
| | | /** |
| | | * 拉取所有 |
| | | * |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<AlbumVideoMap> listAll(int page, int pageSize); |
| | | |
| | | |
| | | /** |
| | | * 计算所有 |
| | | * |
| | | * @return |
| | | */ |
| | | public long countAll(); |
| | | |
| | | |
| | | /** |
| | | * 通过视频ID查询 |
| | | * |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | | public AlbumVideoMap selectByVideoId(String videoId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.juhe; |
| | | |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface FunTV2Service { |
| | | |
| | | /** |
| | | * 保存专辑 |
| | | * |
| | | * @param album2 |
| | | */ |
| | | public void saveAlbum(FunTVAlbum2 album2); |
| | | |
| | | /** |
| | | * 保存视频 |
| | | * |
| | | * @param video |
| | | */ |
| | | public void saveVideo(FunTVVideo2 video); |
| | | |
| | | /** |
| | | * 保存短视频 |
| | | * |
| | | * @param shortVideo2 |
| | | */ |
| | | public void saveShortVideo(FunTVShortVideo2 shortVideo2); |
| | | |
| | | |
| | | /** |
| | | * 添加到视频 |
| | | * |
| | | * @param album2 |
| | | */ |
| | | public void addToVideoInfo(FunTVAlbum2 album2); |
| | | |
| | | |
| | | /** |
| | | * 查询媒体详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | public FunTVAlbum2 getAlbumDetail(String id); |
| | | |
| | | /** |
| | | * 获取视频列表 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public List<VideoDetailInfo> getVideoDetailList(String id); |
| | | |
| | | /** |
| | | * 查询最近一集的详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public VideoDetailInfo getLatestVideoDetail(String id); |
| | | |
| | | |
| | | |
| | | public int getShowType(String videoid) ; |
| | | |
| | | |
| | | public PlayUrl getPlayUrl(String detailSystemId, int resourceId, String id, String videoId); |
| | | |
| | | |
| | | /** |
| | | * 专辑下线 |
| | | * @param mediaId |
| | | */ |
| | | public void offLineAlbum(String mediaId); |
| | | |
| | | |
| | | /** |
| | | * 处理专辑 |
| | | * @param album2 |
| | | */ |
| | | public void processAlbum(FunTVAlbum2 album2); |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.service.manager; |
| | | |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.SolrVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; |
| | | import com.yeshi.buwan.util.factory.SolrVideoFactory; |
| | | import org.apache.solr.client.solrj.response.UpdateResponse; |
| | | import org.springframework.data.solr.core.SolrTemplate; |
| | |
| | | |
| | | @Resource |
| | | private SolrTemplate solrTemplate; |
| | | |
| | | @Resource |
| | | private AlbumVideoMapService albumVideoMapService; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | |
| | | public void saveOrUpdate(VideoInfo videoInfo) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 同步所有专辑 |
| | | */ |
| | | public void syncAllAlbum() { |
| | | long count = albumVideoMapService.countAll(); |
| | | int pageSize = 100; |
| | | int pageCount = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | | for (int i = 3; i < pageCount; i++) { |
| | | List<String> videoIds = new ArrayList<>(); |
| | | List<AlbumVideoMap> albumVideoMapList = albumVideoMapService.listAll(i + 1, pageSize); |
| | | for (AlbumVideoMap map : albumVideoMapList) { |
| | | videoIds.add(map.getVideoId()); |
| | | } |
| | | List<VideoInfo> videoList = videoInfoService.listByVideoIds(videoIds); |
| | | saveOrUpdate(videoList); |
| | | } |
| | | } |
| | | |
| | | public void syncAlbum(String videoId) { |
| | | AlbumVideoMap map = albumVideoMapService.selectByVideoId(videoId); |
| | | if (map == null) |
| | | return; |
| | | |
| | | List<VideoInfo> videoList = new ArrayList<>(); |
| | | VideoInfo video = videoInfoService.getVideoInfo(videoId); |
| | | if (video != null) |
| | | videoList.add(video); |
| | | saveOrUpdate(videoList); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Component |
| | | public class SoHuUtil { |
| | | |
| | | |
| | | public final static int RESOURCE_ID = 14; |
| | | public final static String RESOURCE_NAME = "搜狐"; |
| | | |
| | | static Logger logger = Logger.getLogger(SoHuUtil.class); |
| | | @Resource |
| | | private SoHuService soHuService; |
New file |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import com.yeshi.buwan.vo.baidu.BaiDuCPUTypeVO; |
| | | import org.xml.sax.Attributes; |
| | | import org.xml.sax.SAXException; |
| | | import org.xml.sax.helpers.DefaultHandler; |
| | | |
| | | import javax.xml.parsers.ParserConfigurationException; |
| | | import javax.xml.parsers.SAXParser; |
| | | import javax.xml.parsers.SAXParserFactory; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class BaiDuCPUUtil { |
| | | |
| | | /** |
| | | * 获取咨询的所有类型 |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<BaiDuCPUTypeVO> getNewsTotalTypes() { |
| | | InputStream inputStream = BaiDuCPUUtil.class.getClassLoader().getResourceAsStream("baidu/news.xml"); |
| | | return parse(inputStream, "total"); |
| | | } |
| | | |
| | | /** |
| | | * 获取咨询安全类型 |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<BaiDuCPUTypeVO> getNewsSafeTypes() { |
| | | |
| | | InputStream inputStream = BaiDuCPUUtil.class.getClassLoader().getResourceAsStream("baidu/news.xml"); |
| | | return parse(inputStream, "safe"); |
| | | } |
| | | |
| | | /** |
| | | * 获取视频的所有类型 |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<BaiDuCPUTypeVO> getVideosTotalTypes() { |
| | | InputStream inputStream = BaiDuCPUUtil.class.getClassLoader().getResourceAsStream("baidu/videos.xml"); |
| | | return parse(inputStream, "total"); |
| | | } |
| | | |
| | | /** |
| | | * 获取视频安全类型 |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<BaiDuCPUTypeVO> getVideoSafeTypes() { |
| | | |
| | | InputStream inputStream = BaiDuCPUUtil.class.getClassLoader().getResourceAsStream("baidu/videos.xml"); |
| | | return parse(inputStream, "safe"); |
| | | } |
| | | |
| | | private static List<BaiDuCPUTypeVO> parse(InputStream inputStream, String startKey) { |
| | | List<BaiDuCPUTypeVO> typeVOList = new ArrayList<>(); |
| | | SAXParserFactory factory = SAXParserFactory.newInstance(); |
| | | SAXParser saxParser = null; |
| | | try { |
| | | saxParser = factory.newSAXParser(); |
| | | |
| | | saxParser.parse(inputStream, new DefaultHandler() { |
| | | |
| | | String tagName = ""; |
| | | BaiDuCPUTypeVO vo = null; |
| | | boolean start = false; |
| | | |
| | | @Override |
| | | public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { |
| | | tagName = qName; |
| | | if (qName.equalsIgnoreCase(startKey)) { |
| | | typeVOList.clear(); |
| | | start = true; |
| | | } else if (qName.equalsIgnoreCase("name")) { |
| | | |
| | | } else if (qName.equalsIgnoreCase("id")) { |
| | | |
| | | } else if (qName.equalsIgnoreCase("item")) { |
| | | vo = new BaiDuCPUTypeVO(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void endElement(String uri, String localName, String qName) throws SAXException { |
| | | super.endElement(uri, localName, qName); |
| | | tagName = ""; |
| | | if (qName.equalsIgnoreCase(startKey)) { |
| | | start = false; |
| | | } else if (qName.equalsIgnoreCase("item") && vo != null) { |
| | | if (start) |
| | | typeVOList.add(vo); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void characters(char[] ch, int start, int length) throws SAXException { |
| | | super.characters(ch, start, length); |
| | | String str = new String(ch, start, length); |
| | | if (tagName.equalsIgnoreCase("name")) { |
| | | vo.setName(str); |
| | | } else if (tagName.equalsIgnoreCase("id")) { |
| | | vo.setId(Integer.parseInt(str)); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } catch (ParserConfigurationException e) { |
| | | e.printStackTrace(); |
| | | } catch (SAXException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return typeVOList; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import net.sf.ehcache.Cache; |
| | | import org.springframework.cache.ehcache.EhCacheCacheManager; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Component |
| | | public class EHCacheManager { |
| | | |
| | | @Resource(name = "cacheManager") |
| | | private EhCacheCacheManager ehCacheCacheManager; |
| | | |
| | | /** |
| | | * 删除缓存 |
| | | * |
| | | * @param cacheName |
| | | */ |
| | | public void removeCacheByCacheName(String cacheName) { |
| | | ehCacheCacheManager.getCacheManager().removeCache(cacheName); |
| | | } |
| | | |
| | | /** |
| | | * 按key值删除 |
| | | * |
| | | * @param cacheName |
| | | * @param key |
| | | */ |
| | | public void removeCache(String cacheName, String key) { |
| | | Cache cache = ehCacheCacheManager.getCacheManager().getCache(cacheName); |
| | | if (cache != null) |
| | | cache.remove(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除所有广告 |
| | | */ |
| | | public void removeAllCache() { |
| | | ehCacheCacheManager.getCacheManager().clearAll(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.dto.mq.FunTVAlbum2MQMsg; |
| | | import com.yeshi.buwan.dto.mq.IqiyiAlbum2MQMsg; |
| | | import com.yeshi.buwan.dto.mq.SolrVideoMQMsg; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.iqiyi.entity.IqiyiAlbum2; |
| | | import com.yeshi.buwan.service.imp.JobThreadExecutorServiceImpl; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumDataManager; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.context.event.ContextRefreshedEvent; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Component |
| | | public class SpringContext implements ApplicationListener<ContextRefreshedEvent> { |
| | | |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | |
| | | @Resource |
| | | private Iqiyi2Service iqiyi2Service; |
| | | |
| | | @Resource |
| | | private FunTV2Service funTV2Service; |
| | | |
| | | |
| | | private static boolean isInited = false; |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(SpringContext.class); |
| | | |
| | | public void onApplicationEvent(ContextRefreshedEvent arg0) { |
| | | if (arg0.getApplicationContext().getParent() != null) { |
| | |
| | | private void init() { |
| | | doSolrJob(); |
| | | doAddIqiyi2Video(); |
| | | doAddFunTV2Video(); |
| | | } |
| | | |
| | | private void doSolrJob() { |
| | |
| | | for (SolrVideoMQMsg solrVideo : solrMsgList) { |
| | | try { |
| | | VideoInfo videoInfo = videoInfoService.getVideoInfo(solrVideo.getId()); |
| | | if (videoInfo != null) |
| | | if (videoInfo != null) { |
| | | if ("1".equalsIgnoreCase(videoInfo.getShow())) |
| | | solrDataManager.saveOrUpdate(videoInfo); |
| | | else |
| | | solrDataManager.deleteById(videoInfo.getId()); |
| | | } |
| | | CMQManager.getInstance().deleteSolrMsg(solrVideo.getHandler()); |
| | | } catch (Exception e) { |
| | | |
| | |
| | | new JobThreadExecutorServiceImpl().run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | List<IqiyiAlbum2MQMsg> iqiyiAlbumMsgList = CMQManager.getInstance().consumeAlbumUpdateMsg(16); |
| | | List<IqiyiAlbum2MQMsg> iqiyiAlbumMsgList = CMQManager.getInstance().consumeIqiyiAlbumUpdateMsg(16); |
| | | if (iqiyiAlbumMsgList != null) |
| | | for (IqiyiAlbum2MQMsg iqiyiAlbum2MQMsg : iqiyiAlbumMsgList) { |
| | | try { |
| | |
| | | if (album2 != null) { |
| | | iqiyi2Service.addToVideoInfo(album2); |
| | | } |
| | | CMQManager.getInstance().deleteAlbumUpdateMsg(iqiyiAlbum2MQMsg.getHandler()); |
| | | CMQManager.getInstance().deleteIqiyiAlbumUpdateMsg(iqiyiAlbum2MQMsg.getHandler()); |
| | | } catch (Exception e) { |
| | | |
| | | logger.error("爱奇艺专辑添加到视频出错:" + e.getMessage()); |
| | | logger.error("ID:" + iqiyiAlbum2MQMsg.getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | private void doAddFunTV2Video() { |
| | | new JobThreadExecutorServiceImpl().run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | List<FunTVAlbum2MQMsg> funTVAlbum2MsgList = CMQManager.getInstance().consumeFunTVAlbumUpdateMsg(16); |
| | | if (funTVAlbum2MsgList != null) |
| | | for (FunTVAlbum2MQMsg funTVAlbum2MQMsg : funTVAlbum2MsgList) { |
| | | try { |
| | | String mediaId = funTVAlbum2MQMsg.getId(); |
| | | FunTVAlbum2 album2 = funTV2Service.getAlbumDetail(mediaId); |
| | | if (album2 != null) { |
| | | funTV2Service.processAlbum(album2); |
| | | } |
| | | CMQManager.getInstance().deleteFunTVAlbumUpdateMsg(funTVAlbum2MQMsg.getHandler()); |
| | | } catch (Exception e) { |
| | | logger.error("风行专辑添加到视频出错:" + e.getMessage()); |
| | | logger.error("ID:" + funTVAlbum2MQMsg.getId()); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.util.mq; |
| | | |
| | | import com.qcloud.cmq.Message; |
| | | import com.yeshi.buwan.dto.mq.FunTVAlbum2MQMsg; |
| | | import com.yeshi.buwan.dto.mq.IqiyiAlbum2MQMsg; |
| | | import com.yeshi.buwan.dto.mq.SolrVideoMQMsg; |
| | | |
| | |
| | | public static String QUEUENAME_SOLR = "buwan-solr"; |
| | | //视频更新-爱奇艺2 |
| | | public static String QUEUENAME_VIDEO_UPDATE_IQIYI_2 = "buwan-video-update-iqiyi2"; |
| | | //视频更新-风行2 |
| | | public static String QUEUENAME_VIDEO_UPDATE_FUNTV_2 = "buwan-video-update-funtv2"; |
| | | |
| | | |
| | | static { |
| | |
| | | // 最大消息为1M |
| | | cmqUtil.createQueue(QUEUENAME_SOLR, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_IQIYI_2, 1024 * 1024); |
| | | cmqUtil.createQueue(QUEUENAME_VIDEO_UPDATE_FUNTV_2, 1024 * 1024); |
| | | } |
| | | |
| | | public static CMQManager getInstance() { |
| | |
| | | |
| | | |
| | | //添加专辑更新消息 |
| | | public void addAlbumUpdateMsg(Long id) { |
| | | public void addIqiyiAlbumUpdateMsg(Long id) { |
| | | cmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_IQIYI_2, id + ""); |
| | | } |
| | | |
| | | //消费专辑更新消息 |
| | | public List<IqiyiAlbum2MQMsg> consumeAlbumUpdateMsg(int count) { |
| | | public List<IqiyiAlbum2MQMsg> consumeIqiyiAlbumUpdateMsg(int count) { |
| | | List<IqiyiAlbum2MQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_IQIYI_2); |
| | | if (msgList != null) |
| | |
| | | } |
| | | |
| | | //删除专辑更新消息 |
| | | public void deleteAlbumUpdateMsg(String handler) { |
| | | public void deleteIqiyiAlbumUpdateMsg(String handler) { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_IQIYI_2, handler); |
| | | } |
| | | |
| | | |
| | | //添加专辑更新消息 |
| | | public void addFunTVAlbumUpdateMsg(String id) { |
| | | cmqUtil.sendMsg(QUEUENAME_VIDEO_UPDATE_FUNTV_2, id ); |
| | | } |
| | | |
| | | //消费专辑更新消息 |
| | | public List<FunTVAlbum2MQMsg> consumeFunTVAlbumUpdateMsg(int count) { |
| | | List<FunTVAlbum2MQMsg> list = new ArrayList<>(); |
| | | List<Message> msgList = cmqUtil.recieveMsg(count, QUEUENAME_VIDEO_UPDATE_FUNTV_2); |
| | | if (msgList != null) |
| | | for (Message msg : msgList) { |
| | | FunTVAlbum2MQMsg mm = new FunTVAlbum2MQMsg(); |
| | | mm.setHandler(msg.receiptHandle); |
| | | mm.setId(msg.msgBody); |
| | | list.add(mm); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | //删除专辑更新消息 |
| | | public void deleteFunTVAlbumUpdateMsg(String handler) { |
| | | cmqUtil.deleteMsg(QUEUENAME_VIDEO_UPDATE_FUNTV_2, handler); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 搜索引擎 |
| | | * @param id |
| | |
| | | params.put("pcursor", pcursor); |
| | | params.put("count", "100"); |
| | | String result = baseRequest(url, params); |
| | | System.out.println(result); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | if (resultJSON.optInt("code") == 0) { |
| | | JSONObject data = resultJSON.optJSONObject("data"); |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | AcfunVideoNewService acfunVideoNewService = BeanUtil.getBean(AcfunVideoNewService.class); |
| | | AcfunVideoResult result = videoList(""); |
| | | while (result != null && result.pcursor != null && !result.pcursor.equalsIgnoreCase("no_more")) { |
| | | if (result.videoList != null) |
| | | acfunVideoNewService.save(result.videoList); |
| | | result = videoList(result.pcursor); |
| | | try { |
| | | Thread.sleep(2000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // AcfunVideoNewService acfunVideoNewService = BeanUtil.getBean(AcfunVideoNewService.class); |
| | | // AcfunVideoResult result = videoList(""); |
| | | // while (result != null && result.pcursor != null && !result.pcursor.equalsIgnoreCase("no_more")) { |
| | | // if (result.videoList != null) |
| | | // acfunVideoNewService.save(result.videoList); |
| | | // result = videoList(result.pcursor); |
| | | // try { |
| | | // Thread.sleep(2000); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | videoList(""); |
| | | |
| | | // String[] sts = new String[] { "5xzzqkwh73r27gq", "5xzzknzyuvvd9vc" }; |
| | | // List<Boolean> list = listValid(Arrays.asList(sts)); |
| | |
| | | package com.yeshi.buwan.util.video; |
| | | |
| | | import com.yeshi.buwan.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.ResourceVideo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.funtv.FunTVUtil2; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.juhe.*; |
| | | import com.yeshi.buwan.service.imp.juhe.FunTVService; |
| | | import com.yeshi.buwan.service.imp.juhe.IqiyiService; |
| | | import com.yeshi.buwan.service.imp.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.imp.juhe.SoHuService; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.sohu.SoHuUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | |
| | | |
| | | @Resource |
| | | private FunTVService funTVService; |
| | | |
| | | @Resource |
| | | private FunTV2Service funTV2Service; |
| | | |
| | | @Resource |
| | | private PPTVService pptvService; |
| | |
| | | } |
| | | |
| | | private List<VideoDetailInfo> getVideoDetailList(String videoid, VideoResource vr) { |
| | | if (vr.getName().contains("爱奇艺2")) { |
| | | int resourceId = Integer.parseInt(vr.getId()); |
| | | switch (resourceId) { |
| | | case IqiyiUtil2.RESOURCE_ID: |
| | | return iqiyi2Service.getVideoDetailList(videoid); |
| | | } else if (vr.getName().contains("爱奇艺")) { |
| | | case IqiyiUtil.RESOURCE_ID: |
| | | return iqiyiService.getVideoDetailList(videoid); |
| | | } else if (vr.getName().contains("搜狐")) { |
| | | return soHuService.getVideoDetailList(videoid); |
| | | } else if (vr.getName().contains("PPTV")) |
| | | return pptvService.getVideoDetailList(videoid); |
| | | else if (vr.getName().contains("风行")) |
| | | case FunTVUtil2.RESOURCE_ID: |
| | | return funTV2Service.getVideoDetailList(videoid); |
| | | case FunTVUtil.RESOURCE_ID: |
| | | return funTVService.getVideoDetailList(videoid); |
| | | else if (vr.getName().contains("AcFun")) { |
| | | case PPTVUtil.RESOURCE_ID: |
| | | return pptvService.getVideoDetailList(videoid); |
| | | case AcFunUtil.RESOURCE_ID: |
| | | return videoInfoService.getVideoDetailList(videoid, vr); |
| | | } |
| | | case SoHuUtil.RESOURCE_ID: |
| | | return soHuService.getVideoDetailList(videoid); |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public VideoDetailInfo getLatestVideoDetail(String videoid, VideoResource vr) { |
| | | if (vr.getName().contains("爱奇艺2")) { |
| | | |
| | | int resourceId = Integer.parseInt(vr.getId()); |
| | | switch (resourceId) { |
| | | case IqiyiUtil2.RESOURCE_ID: |
| | | return iqiyi2Service.getLatestVideoDetail(videoid); |
| | | } else if (vr.getName().contains("爱奇艺")) { |
| | | case IqiyiUtil.RESOURCE_ID: |
| | | return iqiyiService.getLatestVideoDetail(videoid); |
| | | } else if (vr.getName().contains("搜狐")) { |
| | | return soHuService.getLatestVideoDetail(videoid); |
| | | } else if (vr.getName().contains("PPTV")) |
| | | return pptvService.getLatestVideoDetail(videoid); |
| | | else if (vr.getName().contains("风行")) |
| | | case FunTVUtil2.RESOURCE_ID: |
| | | return funTV2Service.getLatestVideoDetail(videoid); |
| | | case FunTVUtil.RESOURCE_ID: |
| | | return funTVService.getLatestVideoDetail(videoid); |
| | | case PPTVUtil.RESOURCE_ID: |
| | | return pptvService.getLatestVideoDetail(videoid); |
| | | case SoHuUtil.RESOURCE_ID: |
| | | return soHuService.getLatestVideoDetail(videoid); |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public int getShowType(String videoid, VideoResource vr) { |
| | | if (vr.getName().contains("爱奇艺2")) { |
| | | int resourceId = Integer.parseInt(vr.getId()); |
| | | switch (resourceId) { |
| | | case IqiyiUtil2.RESOURCE_ID: |
| | | return iqiyi2Service.getShowType(videoid); |
| | | } else if (vr.getName().contains("爱奇艺")) { |
| | | case IqiyiUtil.RESOURCE_ID: |
| | | return iqiyiUtil.getShowType(videoid); |
| | | } else if (vr.getName().contains("搜狐")) { |
| | | return soHuUtil.getShowType(videoid); |
| | | } else if (vr.getName().contains("PPTV")) { |
| | | return pptvService.getShowType(videoid); |
| | | } else if (vr.getName().contains("风行")) { |
| | | case FunTVUtil2.RESOURCE_ID: |
| | | return funTV2Service.getShowType(videoid); |
| | | case FunTVUtil.RESOURCE_ID: |
| | | return funTVService.getShowType(videoid); |
| | | } |
| | | case PPTVUtil.RESOURCE_ID: |
| | | return pptvService.getShowType(videoid); |
| | | case SoHuUtil.RESOURCE_ID: |
| | | return soHuUtil.getShowType(videoid); |
| | | default: |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | public PlayUrl getPlayUrl(String detailSystemId, String id, String type, int resourceid, String videoid) { |
| | | if (resourceid == 13) {// 爱奇艺 |
| | | return iqiyiUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | | } else if (resourceid == 14) {// 搜狐 |
| | | return soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | | } else if (resourceid == 16)// PPTV |
| | | return pptvService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | else if (resourceid == 19)// 风行 |
| | | return funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | else if (resourceid == 21)//acfun |
| | | return videoInfoService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | else if (resourceid == 22)//爱奇艺2 |
| | | |
| | | switch (resourceid) { |
| | | case IqiyiUtil2.RESOURCE_ID: |
| | | return iqiyi2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); |
| | | case IqiyiUtil.RESOURCE_ID: |
| | | return iqiyiUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | | case FunTVUtil2.RESOURCE_ID: |
| | | return funTV2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); |
| | | case FunTVUtil.RESOURCE_ID: |
| | | return funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | case PPTVUtil.RESOURCE_ID: |
| | | return pptvService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | case SoHuUtil.RESOURCE_ID: |
| | | return soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | | case AcFunUtil.RESOURCE_ID: |
| | | return videoInfoService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | |
| | | public class HomeClassVO extends VideoType { |
| | | public final static String DATA_TYPE_RECOMMEND="recommend"; |
| | | public final static String DATA_TYPE_CLASS="class"; |
| | | public final static String DATA_TYPE_NOVEL="novel"; |
| | | |
| | | @Expose |
| | | private String dataType;//数据类型 "recommend"-推荐 "class"-分类 "novel"-小说 |
| | | |
| | | public String getDataType() { |
| | | return dataType; |
| | | } |
| | | |
| | | public void setDataType(String dataType) { |
| | | this.dataType = dataType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo.baidu; |
| | | |
| | | /** |
| | | * 百度内容联盟分类 |
| | | */ |
| | | public class BaiDuCPUTypeVO { |
| | | private String name; |
| | | private int id; |
| | | |
| | | public BaiDuCPUTypeVO() { |
| | | } |
| | | |
| | | public BaiDuCPUTypeVO(String name, int id) { |
| | | this.name = name; |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo.video.funtv; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | public class Funtv2ResultVO { |
| | | private int count; |
| | | private List<? extends Serializable> list; |
| | | |
| | | public Funtv2ResultVO(int count, List<? extends Serializable> list) { |
| | | this.count = count; |
| | | this.list = list; |
| | | } |
| | | |
| | | public int getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(int count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public List<? extends Serializable> getList() { |
| | | return list; |
| | | } |
| | | |
| | | public void setList(List<? extends Serializable> list) { |
| | | this.list = list; |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <root> |
| | | <total> |
| | | <item> |
| | | <name>推荐</name> |
| | | <id>1022</id> |
| | | </item> |
| | | <item> |
| | | <name>今日热点</name> |
| | | <id>1021</id> |
| | | </item> |
| | | <item> |
| | | <name>美女</name> |
| | | <id>1024</id> |
| | | </item> |
| | | <item> |
| | | <name>娱乐八卦</name> |
| | | <id>1001</id> |
| | | </item> |
| | | <item> |
| | | <name>大家在看</name> |
| | | <id>1090</id> |
| | | </item> |
| | | <item> |
| | | <name>实时资讯</name> |
| | | <id>1081</id> |
| | | </item> |
| | | <item> |
| | | <name>军事视野</name> |
| | | <id>1012</id> |
| | | </item> |
| | | <item> |
| | | <name>女人</name> |
| | | <id>1034</id> |
| | | </item> |
| | | <item> |
| | | <name>笑一笑</name> |
| | | <id>1025</id> |
| | | </item> |
| | | <item> |
| | | <name>游戏</name> |
| | | <id>1040</id> |
| | | </item> |
| | | <item> |
| | | <name>动漫</name> |
| | | <id>1055</id> |
| | | </item> |
| | | <item> |
| | | <name>奇闻</name> |
| | | <id>1089</id> |
| | | </item> |
| | | <item> |
| | | <name>精彩看点</name> |
| | | <id>1047</id> |
| | | </item> |
| | | <item> |
| | | <name>本地热榜</name> |
| | | <id>1080</id> |
| | | </item> |
| | | <item> |
| | | <name>广场舞</name> |
| | | <id>1088</id> |
| | | </item> |
| | | <item> |
| | | <name>健康</name> |
| | | <id>1043</id> |
| | | </item> |
| | | <item> |
| | | <name>母婴</name> |
| | | <id>1042</id> |
| | | </item> |
| | | <item> |
| | | <name>时尚</name> |
| | | <id>1009</id> |
| | | </item> |
| | | <item> |
| | | <name>汽车</name> |
| | | <id>1007</id> |
| | | </item> |
| | | <item> |
| | | <name>文化</name> |
| | | <id>1036</id> |
| | | </item> |
| | | <item> |
| | | <name>生活</name> |
| | | <id>1035</id> |
| | | </item> |
| | | <item> |
| | | <name>体育</name> |
| | | <id>1002</id> |
| | | </item> |
| | | <item> |
| | | <name>财经</name> |
| | | <id>1006</id> |
| | | </item> |
| | | <item> |
| | | <name>科技</name> |
| | | <id>1013</id> |
| | | </item> |
| | | <item> |
| | | <name>房产</name> |
| | | <id>1008</id> |
| | | </item> |
| | | <item> |
| | | <name>手机</name> |
| | | <id>1005</id> |
| | | </item> |
| | | </total> |
| | | |
| | | <safe> |
| | | <item> |
| | | <name>实时资讯</name> |
| | | <id>1081</id> |
| | | </item> |
| | | <item> |
| | | <name>军事视野</name> |
| | | <id>1012</id> |
| | | </item> |
| | | <item> |
| | | <name>健康</name> |
| | | <id>1043</id> |
| | | </item> |
| | | <item> |
| | | <name>体育</name> |
| | | <id>1002</id> |
| | | </item> |
| | | <item> |
| | | <name>财经</name> |
| | | <id>1006</id> |
| | | </item> |
| | | <item> |
| | | <name>科技</name> |
| | | <id>1013</id> |
| | | </item> |
| | | <item> |
| | | <name>手机</name> |
| | | <id>1005</id> |
| | | </item> |
| | | <item> |
| | | <name>房产</name> |
| | | <id>1008</id> |
| | | </item> |
| | | </safe> |
| | | </root> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <root> |
| | | <total> |
| | | <item> |
| | | <name>影视</name> |
| | | <id>1060</id> |
| | | </item> |
| | | <item> |
| | | <name>小视频</name> |
| | | <id>1085</id> |
| | | </item> |
| | | <item> |
| | | <name>小品</name> |
| | | <id>1062</id> |
| | | </item> |
| | | <item> |
| | | <name>观天下</name> |
| | | <id>1064</id> |
| | | </item> |
| | | <item> |
| | | <name>搞笑</name> |
| | | <id>1059</id> |
| | | </item> |
| | | <item> |
| | | <name>娱乐</name> |
| | | <id>1061</id> |
| | | </item> |
| | | <item> |
| | | <name>社会</name> |
| | | <id>1063</id> |
| | | </item> |
| | | <item> |
| | | <name>游戏</name> |
| | | <id>1067</id> |
| | | </item> |
| | | <item> |
| | | <name>生活</name> |
| | | <id>1066</id> |
| | | </item> |
| | | <item> |
| | | <name>音乐</name> |
| | | <id>1058</id> |
| | | </item> |
| | | <item> |
| | | <name>萌萌哒</name> |
| | | <id>1065</id> |
| | | </item> |
| | | </total> |
| | | |
| | | <safe> |
| | | <item> |
| | | <name>小品</name> |
| | | <id>1062</id> |
| | | </item> |
| | | <item> |
| | | <name>音乐</name> |
| | | <id>1058</id> |
| | | </item> |
| | | <item> |
| | | <name>萌萌哒</name> |
| | | <id>1065</id> |
| | | </item> |
| | | |
| | | </safe> |
| | | </root> |
| | |
| | | redis.addr=192.168.1.253 |
| | | redis.addr=192.168.3.253 |
| | | redis.port=6379 |
| | | redis.auth=123456 |
| | | #193.112.34.40 |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!--scan为true(默认每一分钟扫描一下配置文件,如果发生更改就重新加载配置文件) |
| | | scanPeriod设置扫描配置文件的时间间隔(如果没有指定单位默认为毫秒) |
| | | debug 如果设置为true,在控制台中打印logback内部运行日志(内部状态信息,如果配置文件有错误 |
| | | 也会输出),由于logback已经很稳定了,我们一般设置为false,以免干扰我们查看有用的日志信息 --> |
| | | <configuration scan="true" scanPeriod="60 seconds" debug="false"> |
| | | |
| | | <!--定义参数常量(全局变量)--> |
| | | <!--设置Logger的等级 (TRACE<DEBUG<INFO<WARN<ERROR),假设配置为INFO,那么debug将不会被 |
| | | 输出,我们一般会把debug,info,error的信息分别输出到文件中--> |
| | | <property name="log.level" value="debug"/> |
| | | <!--归档日志文件保存的最大时间(单位跟按什么轮转有关,比如按天轮转那么单位就为天) --> |
| | | <property name="log.maxHistory" value="30"/> |
| | | <!--日志存储的根路径 ${catalina.base}指向每个Tomcat目录私有信息的位置, |
| | | 就是conf、logs、temp、webapps和work的父目录--> |
| | | <property name="log.filePath" value="/usr/local/tomcat/logs"/> |
| | | <!--日志展示的格式--> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"/> |
| | | |
| | | <!--appender是为了配置日志信息输出到哪个地方--> |
| | | <!--控制台设置,输出到控制台中--> |
| | | <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--encoder作用是既把日志信息转换为字符串,也输出到指定的位置 --> |
| | | <encoder> |
| | | <!--pattern为配置输出的格式--> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- DEBUG --> |
| | | <!-- 把DEBUG信息输出到指定文件中--> |
| | | <appender name="debugAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/debug.log</file> |
| | | <!-- 防止日志文件过大,按一定的策略(按时间周期,或者文件达到一定大小)生成新的日志文件--> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!--文件名称,即指示存到哪里和按什么周期轮转,按天轮转--> |
| | | <fileNamePattern>${log.filePath}/debug/debug.%d{yyyy-MM-dd}.log.gz</fileNamePattern> |
| | | <!-- 归档日志文件保存的最大历史时间(这里单位是天) --> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <!--encoder作用是既把日志信息转换为字符串,也输出到指定的位置(文件) --> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <!--基于级别来过滤日志事件 |
| | | 只输出DEBUG级别的日志事件,过滤掉其他日志事件--> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>DEBUG</level> |
| | | <onMatch>ACCEPT</onMatch><!-- 如果是debug级别的信息就记录--> |
| | | <onMismatch>DENY</onMismatch><!--如果不是debug级别的信息不记录--> |
| | | </filter> |
| | | </appender> |
| | | <!-- INFO --> |
| | | <appender name="infoAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/info.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/info/info.%d{yyyy-MM-dd}.log.gz</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>INFO</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | <!-- ERROR --> |
| | | <appender name="errorAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/error.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/error/error.%d{yyyy-MM-dd}.log.gz</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!--name表示为哪一个logger指定层级和输出的方式 |
| | | additivity表示叠加祖先的输出方式(默认为true,会叠加),所以com.lxc.o2o以及其子类都会输出在控制台中,因为这个logger继承了root中的appender |
| | | level表示级别大于等于${log.level}的信息才会输出,输出方式为配置的appender, |
| | | 由于这里level为debug(重写了,就不会继承root的level了), |
| | | 所以控制台中会输出大于等于debug等级的日志(包括持久层执行的mysql) |
| | | 并且 |
| | | debug日志会输出到debugAppender指定的文件中 |
| | | info日志会输出到infoAppender指定的文件中 |
| | | error日志会输出到errorAppender指定的文件中--> |
| | | <logger name="com.lxc.o2o" level="${log.level}" additivity="true"> |
| | | <appender-ref ref="debugAppender"></appender-ref> |
| | | <appender-ref ref="infoAppender"></appender-ref> |
| | | <appender-ref ref="errorAppender"></appender-ref> |
| | | <!--这里还会继承root logger的appender,打印信息在控制台中--> |
| | | </logger> |
| | | |
| | | <!-- 一切logger都会继承自root,root默认的层级level为debug --> |
| | | <root level="info"> |
| | | <!--在控制台中输出所在层级对应level(以及大于level)的日志信息,因为这里并没有设置LevelFilter--> |
| | | <appender-ref ref="infoAppender"></appender-ref> |
| | | </root> |
| | | </configuration> |
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" |
| | | xmlns:cache="http://www.springframework.org/schema/cache" |
| | | xmlns:context="http://www.springframework.org/schema/context" |
| | | xmlns:jdbc="http://www.springframework.org/schema/jdbc" |
| | | xmlns:mvc="http://www.springframework.org/schema/mvc" |
| | | xmlns:task="http://www.springframework.org/schema/task" |
| | | xmlns:tx="http://www.springframework.org/schema/tx" |
| | |
| | | http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd |
| | | http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.2.xsd |
| | | http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd |
| | | http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd |
| | | |
| | | http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd |
| | | http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd |
| | | http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd |
| | | http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr.xsd |
| | | |
| | | http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd"> |
| | | |
| | | <!-- 组件扫描 --> |
New file |
| | |
| | | <html lang="zh-cn"> |
| | | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| | | <title>爱奇艺专辑更新</title> |
| | | <link href="css/bootstrap.min.css" rel="stylesheet"> |
| | | <link href="css/maincontent.css" rel="stylesheet"> |
| | | <link href="css/tablestyle.css" rel="stylesheet"> |
| | | <style> |
| | | .form-group { |
| | | margin-bottom: 30px; |
| | | } |
| | | |
| | | .checkbox input[type=checkbox] { |
| | | top: 6px; |
| | | } |
| | | |
| | | #dialog-chooselink select { |
| | | width: 100px; |
| | | } |
| | | |
| | | #dialog-chooselink label { |
| | | display: inline; |
| | | } |
| | | |
| | | #dialog-chooselink input[type=text] { |
| | | display: inline; |
| | | width: 500px; |
| | | } |
| | | |
| | | #dialog-chooselink ul { |
| | | display: block; |
| | | list-style: none; |
| | | } |
| | | |
| | | #dialog-chooselink ul li { |
| | | display: inline; |
| | | list-style: none; |
| | | width: 33%; |
| | | float: left; |
| | | } |
| | | |
| | | #dialog-chooselink input[type=radio] { |
| | | width: 20px; |
| | | height: 20px; |
| | | } |
| | | |
| | | #dialog-chooselink .search-result { |
| | | height: 630px; |
| | | overflow-y: scroll; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <nav class="navbar navbar-default navbar-fixed-top"></nav> |
| | | <div id="mainbody"> |
| | | <div id="sidebar"> |
| | | <dl> |
| | | </dl> |
| | | </div> |
| | | <div id="neirong"> |
| | | <div class="erjidh"> |
| | | <ol class="breadcrumb"> |
| | | <li><a href="tuijian-lanmuneirong.html">广告</a></li> |
| | | <li class="active">广告显示设置</li> |
| | | </ol> |
| | | </div> |
| | | <form class="form-horizontal" |
| | | style="width: 800px; margin-top: 10px; border-style: solid; border-width: 2px; padding: 10px;"> |
| | | |
| | | <h4>设置正在上线版本号</h4> |
| | | |
| | | <div class="form-group"> |
| | | <label class="changdu1 control-label">版本号(整数型)</label> |
| | | <div class="col-sm-7"> |
| | | <input type="text" class="form-control" id="versionCode" |
| | | placeholder="版本号"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="button0"> |
| | | <div class="button"> |
| | | <button type="button" class="btn btn-primary saveVersion">设置</button> |
| | | </div> |
| | | <div class="button"> |
| | | <input type="reset" class="btn btn-default" value="重置"/> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | |
| | | |
| | | <div |
| | | style="width: 800px; margin-top: 100px; border-style: solid; border-width: 2px; padding: 10px;"> |
| | | <h4>设置已经上线的渠道</h4> |
| | | |
| | | <div class="form-group"> |
| | | <label class="changdu1 control-label">上线渠道</label> |
| | | <div class="col-sm-7"> |
| | | <select id="channels"> |
| | | <option value="vivo">VIVO</option> |
| | | <option value="oppo">OPPO</option> |
| | | <option value="huawei">华为</option> |
| | | <option value="xiaomi">小米</option> |
| | | <option value="qq">应用宝</option> |
| | | <option value="meizu">魅族</option> |
| | | <option value="baidu">百度</option> |
| | | <option value="360">360</option> |
| | | <option value="wandoujia">豌豆荚</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="button0"> |
| | | <div class="button"> |
| | | <button type="button" class="btn btn-primary saveChannel">设置</button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script> |
| | | <script src="js/bootstrap.min.js"></script> |
| | | <script src="js/nav.js"></script> |
| | | <script src="js/common.js"></script> |
| | | <script src="layer/layer.js"></script> |
| | | <script> |
| | | $(function () { |
| | | //获取正在上线的版本 |
| | | $.post('/BuWan/admin/new/api/ad/getOnLiningVersion', {}, function (data) { |
| | | if (data.code == 0) { |
| | | $("#versionCode").val(data.data.versionCode); |
| | | } |
| | | }, 'json'); |
| | | |
| | | //设置版本 |
| | | $(".saveVersion").click( |
| | | function () { |
| | | if ($("#versionCode").val() == '' |
| | | || $("#versionCode").val().length <= 0) |
| | | return; |
| | | |
| | | $.post('/BuWan/admin/new/api/ad/setOnLiningVersion', { |
| | | versionCode: $("#versionCode").val() |
| | | }, function (data) { |
| | | if (data.code == 0) { |
| | | alert("更新成功") |
| | | } |
| | | }, 'json'); |
| | | }); |
| | | |
| | | //设置版本上线 |
| | | $(".saveChannel").click( |
| | | function () { |
| | | $.post('/BuWan/admin/new/api/ad/setChannelOnLine', { |
| | | channel: $("#channels").val() |
| | | }, function (data) { |
| | | if (data.code == 0) { |
| | | alert("更新成功") |
| | | } |
| | | }, 'json'); |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | <!-- 网页链接 --> |
| | | <url></url> |
| | | </secondNav> |
| | | |
| | | <secondNav url="ad-update.html" name="广告设置"> |
| | | <!-- 网页链接 --> |
| | | <url></url> |
| | | </secondNav> |
| | | |
| | | </topNav> |
| | | </nav> |
| | |
| | | import java.io.InputStreamReader; |
| | | |
| | | import com.yeshi.buwan.domain.AcFunTemporary; |
| | | import com.yeshi.buwan.job.VideoUpdateJob; |
| | | import com.yeshi.buwan.job.JuHeVideoUpdateJob; |
| | | import com.yeshi.buwan.service.imp.AcFunTemporaryService; |
| | | import com.yeshi.buwan.util.BeanUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class AcfunTest { |
| | | |
| | | @Resource |
| | | private JuHeVideoUpdateJob juHeVideoUpdateJob; |
| | | |
| | | @org.junit.Test |
| | | public void test1() { |
| | | VideoUpdateJob videoUpdateJob = BeanUtil.getBean(VideoUpdateJob.class); |
| | | videoUpdateJob.updateAcFun(); |
| | | juHeVideoUpdateJob.updateAcFun(); |
| | | } |
| | | |
| | | @org.junit.Test |
New file |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.util.BaiDuCPUUtil; |
| | | import com.yeshi.buwan.vo.baidu.BaiDuCPUTypeVO; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class BaiDuTest { |
| | | |
| | | |
| | | @Test |
| | | public void news() { |
| | | List<SpinnerItem> itemList = new ArrayList<>(); |
| | | itemList.add(new SpinnerItem("影视", 1060)); |
| | | itemList.add(new SpinnerItem("小视频", 1085)); |
| | | itemList.add(new SpinnerItem("小品", 1062)); |
| | | itemList.add(new SpinnerItem("观天下", 1064)); |
| | | itemList.add(new SpinnerItem("搞笑", 1059)); |
| | | itemList.add(new SpinnerItem("娱乐", 1061)); |
| | | itemList.add(new SpinnerItem("社会", 1063)); |
| | | itemList.add(new SpinnerItem("游戏", 1067)); |
| | | itemList.add(new SpinnerItem("生活", 1066)); |
| | | itemList.add(new SpinnerItem("音乐", 1058)); |
| | | itemList.add(new SpinnerItem("萌萌哒", 1065)); |
| | | for (SpinnerItem item : itemList) { |
| | | System.out.println(String.format("<item>\n\r<name>%s</name>\n\r<id>%s</id>\n\r</item>", item.getmName(), item.getmId())); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void parse() { |
| | | List<BaiDuCPUTypeVO> list = BaiDuCPUUtil.getNewsTotalTypes(); |
| | | list = BaiDuCPUUtil.getNewsSafeTypes(); |
| | | list = BaiDuCPUUtil.getVideosTotalTypes(); |
| | | list = BaiDuCPUUtil.getVideoSafeTypes(); |
| | | System.out.println(list); |
| | | } |
| | | |
| | | class SpinnerItem { |
| | | /** |
| | | * 名称 |
| | | */ |
| | | String mName; |
| | | /** |
| | | * id |
| | | */ |
| | | int mId; |
| | | |
| | | public SpinnerItem(String name, int id) { |
| | | mName = name; |
| | | mId = id; |
| | | } |
| | | |
| | | public String getmName() { |
| | | return mName; |
| | | } |
| | | |
| | | public void setmName(String mName) { |
| | | this.mName = mName; |
| | | } |
| | | |
| | | public int getmId() { |
| | | return mId; |
| | | } |
| | | |
| | | public void setmId(int mId) { |
| | | this.mId = mId; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.domain.Config; |
| | | import com.yeshi.buwan.service.imp.ConfigService; |
| | | import com.yeshi.buwan.util.BeanUtil; |
| | | import com.yeshi.buwan.job.AdJob; |
| | | import org.json.JSONObject; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class ConfigTest { |
| | | |
| | | @Resource |
| | | private AdJob adJob; |
| | | |
| | | @Test |
| | | public void test1() { |
| | | ConfigService configService = BeanUtil.getBean(ConfigService.class); |
| | | List<Config> configList = configService.getConfig(44L, 1); |
| | | } |
| | | |
| | | @Test |
| | | public void test2(){ |
| | | String resourceName = "爱奇艺"; |
| | | if (resourceName.indexOf("爱奇艺") > -1 || resourceName.indexOf("搜狐") > -1 || resourceName.indexOf("腾讯") > -1 || resourceName.indexOf("乐视") > -1 || resourceName.indexOf("AcFun") > -1 || resourceName.indexOf("风行") > -1) { |
| | | System.out.println(resourceName); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("appId", "10409568"); |
| | | jsonObject.put("detailSystemId", "44"); |
| | | try { |
| | | adJob.openHWAd(jsonObject.toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | public class DES { |
| | | @org.junit.Test |
| | | public void test1() { |
| | | String content = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsBUCzbtjAkAjiqjqVOhpqJelsTwCSAOVl3p/WthwtOVRV4/3O7LxPALv7CzRppknK0XIwtaKpnqIOJsqoIoihKt+WYujLwhBQzB43Z7WyTro8UvUT419tZTxqsIQYuiv9o4Eu4/pcrMwrDP60A5BXKGkPdA1sdn/37oFGf0VjOzZgg+3gcRTD49ITa+T5XQ96cqc/8PcCniLM7B4oZvSSIN68ekKZyWs5BHZcDV2OtEzW5LyGiXYOQN/PQByuWb2iUOUT6WTagbWERVV8p0bRGEc4Ij7bSJcZXzEC5zA30TKtVrNFLqj9R1qnbFp5ZJk9GenI2sIa8ytMxEfuu6Su60AXeH3Y1gIttqFMs3/n4XmzA5Q8rG9sFjLxIYzorld8Cr5BFTIBg/HMEa2Qp1XRqtZ7YMImKinp55BtxVMqWcJYyjMSiEP5EdZzQcHG/FbgL8K+zDchBfFFl+xz3yJIXcopApy0MjVsO4QzMPkSoPzUkGt4HvsDzJfe2TitiE014FPOu8c88A0TwLeO8vfh/IbFwqprmEO5Orm3da02yroMgsfIHZrpFuffjZCTWvNpMx8przydM8BcMmVZ3unsordkwGk5HfMDOZYBYmIeQkxNZsg9Gz7JRRzYYGS9G/3/zvSRtUMO5TEROWpucZ6Vr1spU7CnzTlBwEbhQwmhsK2AoklZ6+sNNwEqQCdB7l8ws/tJiaxqrYDhFIHe7aJSgJf4sdnqKqES8OJWkXiIc5fRn1s9XmGHZfraGVS9CalCw8d+NFcCB8ZrM2PXeGxZHLheVVGWShlh181zjr2/ZXLfmUTUS0+bFgmHyvkWBWyhnfSmM/arH8S8BxbKLHp7Vovxq7if+0PfYxUyS4va+rF/JQ4sOdnVn3b3v/BwWSISYtYHvQlz6NJBfTcAAamrpXf5K3Y/OIci5NkyrS55m7aAHIkR71at6R6vtz+RvTHwYdaPk3qnmblvCEz+PsxhsA4h2zyTG4oBVth7pmqMF//kI4eFd3MgitIiZbpbfmgKQ24xRi9c+w8o3WpBJZxlNDEWUeK9u2LZyDmcGuhPhxJKhRLoDXiYiztnLsHcw7M2BslLebBU0YWar28JrpXV3TSy3yZADD4NqCGdqYdIzAnFwR+RFg2eQv5C0byr9F4RFDOcXTz0J3sCQX5KYx65GP4DWxHprzwsQHCMrSAu76vFbq5n8p41VQ=="; |
| | | String content = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsJzQ3UJcF2YVWOKa55S9JLX9Y2szf7GuFiEGM418zI+M="; |
| | | System.out.println(DESUtil.decode(content)); } |
| | | } |
New file |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVAlbum2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao; |
| | | import com.yeshi.buwan.funtv.FunTVNewApi; |
| | | import com.yeshi.buwan.funtv.entity.FunTVAlbum2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVShortVideo2; |
| | | import com.yeshi.buwan.funtv.entity.FunTVVideo2; |
| | | import com.yeshi.buwan.job.video.FunTV2VideoUpdate; |
| | | import com.yeshi.buwan.service.inter.juhe.FunTV2Service; |
| | | import com.yeshi.buwan.vo.video.funtv.Funtv2ResultVO; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | //@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | //@ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | //@WebAppConfiguration |
| | | public class FunTV2 { |
| | | |
| | | @Resource |
| | | private FunTV2Service funTV2Service; |
| | | |
| | | @Resource |
| | | private FunTVAlbum2Dao funTVAlbum2Dao; |
| | | |
| | | @Resource |
| | | private FunTVVideo2Dao funTVVideo2Dao; |
| | | |
| | | @Resource |
| | | private FunTV2VideoUpdate funTV2VideoUpdate; |
| | | |
| | | @Test |
| | | public void test1() { |
| | | long now = System.currentTimeMillis(); |
| | | for (int d = 200; d >= 100; d--) { |
| | | Funtv2ResultVO result = FunTVNewApi.getVideos(1, 20, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), 1013, 1); |
| | | if (result != null && result.getList() != null && result.getList().size() > 0) |
| | | System.out.println(result); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void syncAlbum() { |
| | | Funtv2ResultVO vo = FunTVNewApi.getAlbums(1, 20, null, null, 5, 1); |
| | | int totalCount = vo.getCount(); |
| | | int pageSize = 20; |
| | | int totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1; |
| | | for (int p = 0; p < totalPage; p++) { |
| | | Funtv2ResultVO result = FunTVNewApi.getAlbums(p + 1, pageSize, null, null, 5, 1); |
| | | if (result != null) |
| | | for (Serializable a : result.getList()) { |
| | | FunTVAlbum2 album2 = (FunTVAlbum2) a; |
| | | funTV2Service.saveAlbum(album2); |
| | | if (album2.getEpisodes() != null) |
| | | for (FunTVVideo2 video2 : album2.getEpisodes()) |
| | | funTV2Service.saveVideo(video2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void syncShortVideo() { |
| | | long now = System.currentTimeMillis(); |
| | | for (int d = 30; d >= 0; d--) { |
| | | List<FunTVShortVideo2> shortVideo2List = new ArrayList<>(); |
| | | int pageSize = 100; |
| | | Funtv2ResultVO result = FunTVNewApi.getVideos(1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1); |
| | | if (result != null) { |
| | | for (Serializable a : result.getList()) { |
| | | FunTVShortVideo2 video2 = (FunTVShortVideo2) a; |
| | | shortVideo2List.add(video2); |
| | | } |
| | | } |
| | | int count = result.getCount(); |
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; |
| | | if (totalPage > 1) |
| | | for (int p = 1; p < totalPage; p++) { |
| | | result = FunTVNewApi.getVideos(p + 1, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, 1); |
| | | if (result != null) { |
| | | for (Serializable a : result.getList()) { |
| | | FunTVShortVideo2 video2 = (FunTVShortVideo2) a; |
| | | shortVideo2List.add(video2); |
| | | } |
| | | } |
| | | } |
| | | for (FunTVShortVideo2 video2 : shortVideo2List) { |
| | | funTV2Service.saveShortVideo(video2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void getAlbumDetail() { |
| | | FunTVAlbum2 album2 = FunTVNewApi.getAlbumsDetail("99989"); |
| | | System.out.println(album2); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void addToVideoInfo() { |
| | | List<FunTVAlbum2> album2List = funTVAlbum2Dao.listByChannelId(1, 300, 500); |
| | | for (FunTVAlbum2 album2 : album2List) { |
| | | List<FunTVVideo2> list = funTVVideo2Dao.listByMediaId(album2.getId()); |
| | | album2.setEpisodes(list); |
| | | funTV2Service.addToVideoInfo(album2); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void getAccessToken(){ |
| | | System.out.println(FunTVNewApi.getAccessToken()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.dao.juhe.iqiyi.IqiyiAlbum2Dao; |
| | | import com.yeshi.buwan.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.iqiyi.entity.IqiyiAlbum2; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | |
| | | |
| | | @Test |
| | | public void addToVideoInfo() { |
| | | List<IqiyiAlbum2> list = iqiyiAlbum2Dao.listByChannelId(4, 0, 500, 500); |
| | | List<IqiyiAlbum2> list = iqiyiAlbum2Dao.listByChannelId(1, null, 1,11000, 3000); |
| | | for (IqiyiAlbum2 album : list) |
| | | try { |
| | | iqiyi2Service.addToVideoInfo(album); |
| | |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void test6() { |
| | | List<IqiyiAlbum2> list = iqiyiAlbum2Dao.listByChannelId(1, null, 1, 0, 1000); |
| | | for (IqiyiAlbum2 album : list) |
| | | System.out.println(album.getName()); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import org.junit.Test; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public class LogTest { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(LogTest.class); |
| | | |
| | | @Test |
| | | public void testLog() { |
| | | logger.info("测试"); |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import org.junit.Test; |
| | | |
| | | import com.yeshi.buwan.util.SolrUtil; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | import org.yeshi.utils.LinuxRemoteCommandUtil; |
| | | |
| | | public class Solr { |
| | | |
| | |
| | | |
| | | @Test |
| | | public void test2() { |
| | | Map<String, Object> map = SolrUtil.getCategoryVideoList(1, "我的父亲我的兵", 1, null, "id desc"); |
| | | System.out.println(map); |
| | | String solrIP = "203.195.196.115"; |
| | | String serverAccount = "root"; |
| | | String serverPwd = "Yeshi2016@"; |
| | | try { |
| | | LinuxRemoteCommandUtil.execute(solrIP, serverAccount, serverPwd, "/solr/solr-7.5.0/solr_restart.sh"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void test3() { |
| | | String appId = "10409568"; |
| | | String version = AppMarketUtil.getHWLatestVersion(appId); |
| | | System.out.println(version); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | |
| | | //@RunWith(SpringJUnit4ClassRunner.class) |
| | | //@ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | //@WebAppConfiguration |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class SolrTest { |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Test |
| | | public void addSolrAlbum(){ |
| | | // solrDataManager.saveOrUpdate(videoInfoService.getVideoInfo("7967903")); |
| | | System.out.println( IqiyiUtil.getVPicture("http://pic3.iqiyipic.com/image/20200817/a4/f5/a_100390080_m_601_m15.jpg")); |
| | | |
| | | solrDataManager.syncAllAlbum(); |
| | | } |
| | | |
| | | |