Bladeren bron

add:video页面添加足舐类型v1

tujidelv 3 jaren geleden
bovenliggende
commit
59aa3f26c6

+ 2 - 2
src/main/java/top/lvzhiqiang/config/MyJobs.java

@@ -192,9 +192,9 @@ public class MyJobs {
     }
 
     /**
-     * 每天21:00 jsoupLoveFoot
+     * 每天23:50 jsoupLoveFoot
      */
-    @Scheduled(cron = "0 00 21 * * ?", zone = SCHEDULED_ZONE)
+    @Scheduled(cron = "0 50 23 * * ?", zone = SCHEDULED_ZONE)
     public void jsoupLoveFoot() throws Exception {
         log.warn("jsoupLoveFoot开始==============================");
 

+ 9 - 0
src/main/java/top/lvzhiqiang/controller/QueryHeaderController.java

@@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import top.lvzhiqiang.entity.VideoCast;
 import top.lvzhiqiang.entity.VideoGenres;
+import top.lvzhiqiang.mapper.CrawlerLoveFootMapper;
 import top.lvzhiqiang.mapper.VideoInfoInfantryMapper;
 import top.lvzhiqiang.mapper.VideoInfoPoolMapper;
 import top.lvzhiqiang.mapper.VideoInfoUncensoredMapper;
@@ -41,6 +42,9 @@ public class QueryHeaderController {
     @Resource
     private VideoInfoInfantryMapper videoInfoInfantryMapper;
 
+    @Resource
+    private CrawlerLoveFootMapper crawlerLoveFootMapper;
+
     @RequestMapping("/getQueryHeaderInfo")
     @ResponseBody
     public JSONObject getQueryHeaderInfo(String bigType, String infantryType) {
@@ -71,6 +75,11 @@ public class QueryHeaderController {
             List<VideoGenres> videoGenresList = videoInfoPoolMapper.findGenres();
             result.put("videoCastList", videoCastList);
             result.put("videoGenresList", videoGenresList);
+        } else if ("足舐".equals(bigType)) {
+            List<VideoCast> videoCastList = crawlerLoveFootMapper.findCast();
+            List<VideoGenres> videoGenresList = crawlerLoveFootMapper.findGenres();
+            result.put("videoCastList", videoCastList);
+            result.put("videoGenresList", videoGenresList);
         } else {
             List<VideoCast> videoCastList = videoCastService.findAll();
             List<VideoGenres> videoGenresList = videoGenresService.findAll();

+ 10 - 0
src/main/java/top/lvzhiqiang/entity/VideoInfo.java

@@ -112,6 +112,16 @@ public class VideoInfo implements Serializable {
     @JsonFormat(pattern = DateUtils.PATTERN_TO_SECONDS)
     private LocalDateTime modifyTime;
 
+    /**
+     * update_date
+     */
+    @JsonFormat(pattern = DateUtils.PATTERN_TO_DAYS)
+    private LocalDate updateDate;
+    /**
+     * 原始URL
+     */
+    private String orginUrl;
+
     private String score;
     private String comment;
     private String commentFirst;

+ 38 - 3
src/main/java/top/lvzhiqiang/mapper/CrawlerLoveFootMapper.java

@@ -1,10 +1,16 @@
 package top.lvzhiqiang.mapper;
 
-import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import top.lvzhiqiang.entity.CrawlerLoveFoot;
+import top.lvzhiqiang.entity.VideoCast;
 import top.lvzhiqiang.entity.VideoGenres;
+import top.lvzhiqiang.entity.VideoInfo;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * LoveFoot Mapper
@@ -38,18 +44,47 @@ public interface CrawlerLoveFootMapper {
     int insertOrUpdate(CrawlerLoveFoot crawlerLoveFoot);
 
     /**
-     * 根据条件查询
+     * 获取类型
+     *
+     * @return
      */
-    @Select("select '待审查' name union select '审查中' name union select '审查已通过' name union select '审查未通过' name")
+    @Select("select '爬取失败' name union select '待审查' name union select '审查已通过' name union select '审查未通过' name")
     List<VideoGenres> findGenres();
 
     /**
+     * 获取演员
+     *
+     * @return
+     */
+    @Select("SELECT M.cast name,COUNT(M.cast) count " +
+            "FROM (" +
+            "         SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(vip.cast, ',', B.HELP_TOPIC_ID + 1), ',', - 1) AS cast" +
+            "         FROM crawler_lovefoot_info vip" +
+            "                  JOIN MYSQL.HELP_TOPIC B" +
+            "                       ON B.HELP_TOPIC_ID < (LENGTH(vip.cast) - LENGTH(REPLACE(vip.cast, ',', '')) + 1)" +
+            "         WHERE cast is not null and cast != ''" +
+            "     ) M " +
+            "GROUP BY M.cast " +
+            "ORDER BY COUNT(M.cast) DESC LIMIT 30")
+    List<VideoCast> findCast();
+
+    /**
      * 查询所有
+     *
+     * @return
      */
     @Select("SELECT * FROM crawler_lovefoot_info WHERE delete_flag = 1")
     List<CrawlerLoveFoot> findAll();
 
     /**
+     * 条件查询列表
+     *
+     * @param params
+     * @return
+     */
+    List<VideoInfo> getVideoInfoLoveFootList(Map<String, Object> params);
+
+    /**
      * 根据识别码和类型查询
      *
      * @return

+ 3 - 2
src/main/java/top/lvzhiqiang/service/impl/Crawler4LoveFootServiceImpl.java

@@ -130,6 +130,7 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
                 String sourceUrl = sourceSelect.select("a").attr("abs:href");
 
                 Integer statusInt = 2;
+                Integer typeInt = 1;
                 LocalDate clockDate = null;
                 LocalDate updateDate = null;
                 String keywords = null;
@@ -158,7 +159,7 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
                     crawlerLoveFoot.setClockDate(clockDate);
                     crawlerLoveFoot.setUpdateDate(updateDate);
                     crawlerLoveFoot.setOrginUrl(sourceUrl);
-                    crawlerLoveFoot.setType(1);
+                    crawlerLoveFoot.setType(2);
                     crawlerLoveFoot.setStatus(3);
                     String message = parseKeywordsToCode(crawlerLoveFoot, keywords);
                     if (StringUtils.isNotEmpty(message)) {
@@ -175,7 +176,7 @@ public class Crawler4LoveFootServiceImpl implements Crawler4LoveFootService {
                     crawlerLoveFoot.setClockDate(clockDate);
                     crawlerLoveFoot.setUpdateDate(updateDate);
                     crawlerLoveFoot.setName(keywords);
-                    crawlerLoveFoot.setType(1);
+                    crawlerLoveFoot.setType(typeInt);
                     crawlerLoveFoot.setStatus(statusInt);
                     crawlerLoveFoot.setCreateTime(LocalDateTime.now());
                     crawlerLoveFoot.setFailureCause(e.getMessage());

+ 6 - 4
src/main/java/top/lvzhiqiang/service/impl/VideoInfoServiceImpl.java

@@ -7,10 +7,7 @@ import org.springframework.stereotype.Service;
 import top.lvzhiqiang.config.WebAppConfig;
 import top.lvzhiqiang.entity.VideoGenres;
 import top.lvzhiqiang.entity.VideoInfo;
-import top.lvzhiqiang.mapper.VideoInfoInfantryMapper;
-import top.lvzhiqiang.mapper.VideoInfoMapper;
-import top.lvzhiqiang.mapper.VideoInfoPoolMapper;
-import top.lvzhiqiang.mapper.VideoInfoUncensoredMapper;
+import top.lvzhiqiang.mapper.*;
 import top.lvzhiqiang.service.VideoInfoService;
 
 import javax.annotation.Resource;
@@ -37,6 +34,9 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<Object> implements Vid
     @Resource
     private VideoInfoInfantryMapper videoInfoInfantryMapper;
 
+    @Resource
+    private CrawlerLoveFootMapper crawlerLoveFootMapper;
+
     @Value("${spring.profiles.active}")
     private String env;
 
@@ -89,6 +89,8 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<Object> implements Vid
             videoInfoList = videoInfoUncensoredMapper.getVideoInfoUncensoredList(params);
         } else if ("码池".equals(bigType)) {
             videoInfoList = videoInfoPoolMapper.getVideoInfoPoolList(params);
+        } else if ("足舐".equals(bigType)) {
+            videoInfoList = crawlerLoveFootMapper.getVideoInfoLoveFootList(params);
         } else {
             videoInfoList = videoInfoMapper.getVideoInfoList(params);
         }

+ 38 - 0
src/main/resources/mapper/VideoInfoLoveFootMapper.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<!-- 当Mapper接口和XML文件关联的时候,namespace的值就需要配置成接口的全限定名称 -->
+<mapper namespace="top.lvzhiqiang.mapper.CrawlerLoveFootMapper">
+
+    <select id="getVideoInfoLoveFootList" resultType="top.lvzhiqiang.entity.VideoInfo">
+        select vi.id,vi.name,vi.identification_code,vi.issue_date,vi.modify_time,vi.update_date,vi.type,vi.img_url,vi.orgin_url,IFNULL(vi.cast, vi.genres) AS main_who,IFNULL(vio.score, 0) AS score, IFNULL(vio.comment, '暂无评论') AS comment
+        from crawler_lovefoot_info vi
+        left join video_info_other vio on vi.identification_code = vio.identification_code and vio.delete_flag = 1
+        where vi.delete_flag = 1
+        <if test="keyword != null and keyword != ''">
+            and (vi.name like concat('%',#{keyword},'%')  or vi.identification_code like concat('%',#{keyword},'%'))
+        </if>
+        <if test="genres != null and genres != ''">
+            and
+            <choose>
+                <when test="genres == '爬取失败'">
+                    vi.type = 1
+                </when>
+                <when test="genres == '待审查'">
+                    vi.type = 2
+                </when>
+                <when test="genres == '审查已通过'">
+                    vi.type = 3
+                </when>
+                <when test="genres == '审查未通过'">
+                    vi.type = 4
+                </when>
+                <otherwise></otherwise>
+            </choose>
+        </if>
+        <if test="cast != null and cast != ''">
+            and vi.cast like concat('%',#{cast},'%')
+        </if>
+    </select>
+</mapper>

+ 18 - 4
src/main/resources/static/js/my-video.js

@@ -36,6 +36,12 @@ function initOther() {
         $("#bigType").attr("prepath", $(this).attr("prepath"));
         $(".dropdown-box").attr("style", "display: none;");
 
+        if ($(this).text() == '足舐') {
+            $(".lovefoot").attr("style", "display: block;");
+        }else{
+            $(".lovefoot").attr("style", "display: none;");
+        }
+
         getQueryHeaderInfo($("#bigType").text(), false, true);
         search(1, false, true);
     });
@@ -114,6 +120,8 @@ function search(pageNo, startFlag, searchSelectFlag) {
                     var date = videoInfo.issueDate;
                     if (orderField == 'vi.modify_time') {
                         date = videoInfo.modifyTime;
+                    } else if (orderField == 'vi.update_date') {
+                        date = videoInfo.updateDate;
                     }
 
                     var scoreStr = '';
@@ -138,7 +146,7 @@ function search(pageNo, startFlag, searchSelectFlag) {
                         "           <span class=\"pic-text text-right\" title='" + (videoInfo.comment === '' ? '暂无评论' : videoInfo.comment) + "'>" + scoreStr + "</span>" +
                         "       </a>" +
                         "       <div class=\"myui-vodlist__detail\">" +
-                        "           <h4 class=\"videodetail title text-overflow\" identificationCode='" + videoInfo.identificationCode + "' ><a title=\" " + videoInfo.name + " \">" + videoInfo.name + "</a></h4>" +
+                        "           <h4 class=\"videodetail title text-overflow\" identificationCode='" + videoInfo.identificationCode + "' orginUrl='" + videoInfo.orginUrl + "'><a title=\" " + videoInfo.name + " \">" + videoInfo.name + "</a></h4>" +
                         "           <p class=\"text text-overflow text-muted hidden-xs\" title='" + videoInfo.mainWho + "'>直属:" + videoInfo.mainWho + "</p>" +
                         "       </div>" +
                         "   </div>" +
@@ -323,9 +331,15 @@ function initContentEvent() {
     // });
 
     $(".videodetail").click(function () {
-        var type = $("#bigType").attr("prepath");
-        var code = $(this).attr("identificationCode");
-        window.open("voddetail.html?type=" + type + "&code=" + code, "_blank");
+        var bigTypeText = $("#bigType").text();
+        if (bigTypeText == '足舐') {
+            var orginUrl = $(this).attr("orginUrl");
+            window.open(orginUrl);
+        } else {
+            var type = $("#bigType").attr("prepath");
+            var code = $(this).attr("identificationCode");
+            window.open("voddetail.html?type=" + type + "&code=" + code, "_blank");
+        }
     });
 
     $(".bigpreview").dblclick(function () {

+ 2 - 0
src/main/resources/static/video.html

@@ -180,6 +180,7 @@
                                         <li class="" prepath="bubing">步兵</li>
                                         <li class="" prepath="liuchu">流出</li>
                                         <li class="" prepath="machi">码池</li>
+                                        <li class="" prepath="machi">足舐</li>
                                     </ul>
                                 </div>
                             </a>
@@ -206,6 +207,7 @@
                         <li><a class="btn text-muted">排序</a></li>
                         <li><a class="btn btn-warm searchbtn" orderField="vi.issue_date" order="desc">发布时间</a></li>
                         <li><a class="btn searchbtn" orderField="vi.modify_time" order="asc">更新时间</a></li>
+                        <li><a class="btn searchbtn lovefoot" orderField="vi.update_date" order="asc" style="display: none;">原始更新时间</a></li>
                         <li><a class="btn searchbtn" orderField="vio.score" order="asc">评分</a></li>
                     </ul>
                 </div>