Эх сурвалжийг харах

update:LoveFoot类型增加BG功能v1

tujidelv 3 жил өмнө
parent
commit
fe149dd200

+ 19 - 0
src/main/java/top/lvzhiqiang/controller/BgController.java

@@ -264,6 +264,25 @@ public class BgController {
     }
 
     /**
+     * findVideoInfoLoveFoot
+     *
+     * @author lvzhiqiang
+     * 2022/12/34 18:08
+     */
+    @RequestMapping("/findVideoInfoLoveFoot")
+    @ResponseBody
+    public String findVideoInfoLoveFoot(String identificationCode, Integer type, String order, String crudT) throws IllegalAccessException {
+        if (StringUtils.isNotEmpty(identificationCode)) {
+            identificationCode = identificationCode.toUpperCase();
+        }
+        if (StringUtils.isEmpty(crudT)) {
+            crudT = "1";
+        }
+
+        return bgService.findVideoInfoLoveFoot(identificationCode, type, order, crudT);
+    }
+
+    /**
      * findVideoInfo
      *
      * @author lvzhiqiang

+ 3 - 0
src/main/java/top/lvzhiqiang/entity/CrawlerLoveFoot.java

@@ -134,4 +134,7 @@ public class CrawlerLoveFoot implements Serializable {
      */
     @JsonFormat(pattern = DateUtils.PATTERN_TO_SECONDS)
     private LocalDateTime modifyTime;
+
+    private String score;
+    private String comment;
 }

+ 1 - 1
src/main/java/top/lvzhiqiang/entity/VideoInfo.java

@@ -141,5 +141,5 @@ public class VideoInfo implements Serializable {
     private String videoLoveFootFlag;
     private String javdbUrl;
 
-    private String source;
+    private Integer videoInfoPoolType;
 }

+ 4 - 4
src/main/java/top/lvzhiqiang/mapper/CrawlerLoveFootMapper.java

@@ -108,15 +108,15 @@ public interface CrawlerLoveFootMapper {
      * @return
      */
     @Select({"<script>" +
-            "select vip.*,vio.score,vio.comment  from crawler_lovefoot_info vip left join video_info_other vio on vip.identification_code = vio.identification_code and vio.delete_flag = 1 WHERE vip.delete_flag = 1" +
+            "select cli.*,vio.score,vio.comment  from crawler_lovefoot_info cli left join video_info_other vio on cli.identification_code = vio.identification_code and vio.delete_flag = 1 WHERE cli.delete_flag = 1" +
             "<if test=\"identificationCode != null and identificationCode != ''\">" +
-            "   and vip.identification_code like concat('%',#{identificationCode},'%')" +
+            "   and cli.identification_code like concat('%',#{identificationCode},'%')" +
             "</if>" +
             "<if test=\"type != null and type != ''\">" +
-            "   and vip.type = #{type}" +
+            "   and cli.type = #{type}" +
             "</if>" +
             "<if test=\"order != null and order != ''\">" +
-            "   order by vip.issue_date ${order}" +
+            "   order by cli.issue_date ${order}" +
             "</if>" +
             "</script>"})
     List<CrawlerLoveFoot> findByCodeAndType(String identificationCode, Integer type, String order);

+ 8 - 0
src/main/java/top/lvzhiqiang/service/BgService.java

@@ -70,6 +70,14 @@ public interface BgService {
     String findVideoInfoPool(String identificationCode, Integer type, String order, String crudT) throws IllegalAccessException;
 
     /**
+     * findVideoInfoLoveFoot
+     *
+     * @author lvzhiqiang
+     * 2022/12/34 18:08
+     */
+    String findVideoInfoLoveFoot(String identificationCode, Integer type, String order, String crudT) throws IllegalAccessException;
+
+    /**
      * findVideoInfo
      *
      * @author lvzhiqiang

+ 48 - 0
src/main/java/top/lvzhiqiang/service/impl/BgServiceImpl.java

@@ -70,6 +70,8 @@ public class BgServiceImpl implements BgService {
     private VideoInfoUncensoredMapper videoInfoUncensoredMapper;
     @Resource
     private VideoInfoInfantryMapper videoInfoInfantryMapper;
+    @Resource
+    private CrawlerLoveFootMapper crawlerLoveFootMapper;
 
     @Value("${spring.profiles.active}")
     private String env;
@@ -206,6 +208,52 @@ public class BgServiceImpl implements BgService {
     }
 
     /**
+     * findVideoInfoLoveFoot
+     *
+     * @author lvzhiqiang
+     * 2022/12/34 18:08
+     */
+    @Override
+    public String findVideoInfoLoveFoot(String identificationCode, Integer type, String order, String crudT) throws IllegalAccessException {
+        if ("2".equals(crudT)) {
+            //更新
+            if (StringUtils.isEmpty(identificationCode) || null == type) {
+                return "identificationCode和type不能为空";
+            }
+            crawlerLoveFootMapper.updateTypeByCode(identificationCode, type);
+            return "success";
+        }
+        if ("3".equals(crudT)) {
+            //删除
+            if (StringUtils.isEmpty(identificationCode)) {
+                return "dentificationCode不能为空";
+            }
+            crawlerLoveFootMapper.delByCode(identificationCode);
+            return "success";
+        }
+
+        List<CrawlerLoveFoot> crawlerLoveFootList = crawlerLoveFootMapper.findByCodeAndType(identificationCode, type, order);
+
+        StringBuffer sb = new StringBuffer("total:".concat(String.valueOf(crawlerLoveFootList.size())).concat("<br/>"));
+        for (CrawlerLoveFoot crawlerLoveFoot : crawlerLoveFootList) {
+            sb.append("<table border=\"1\" cellspacing=\"0\"><tr><th>key</th><th>value</th></tr>");
+
+            Field[] fields = crawlerLoveFoot.getClass().getDeclaredFields();
+            for (Field field : fields) {
+                field.setAccessible(true);
+                sb.append("<tr>");
+                sb.append("<td>").append(field.getName()).append("</td>");
+                sb.append("<td>").append(field.get(crawlerLoveFoot)).append("</td>");
+                sb.append("</tr>");
+            }
+            sb.append("</table>");
+        }
+
+        return sb.toString();
+    }
+
+
+    /**
      * findVideoInfo
      *
      * @author lvzhiqiang

+ 1 - 1
src/main/java/top/lvzhiqiang/service/impl/Crawler4JavbusServiceImpl.java

@@ -482,7 +482,7 @@ public class Crawler4JavbusServiceImpl implements Crawler4JavbusService {
             /**
              * 返回结果示例
              */
-            System.err.println("result:" + result);
+            // System.err.println("result:" + result);
             JSONObject jsonObject = JSONObject.parseObject(result);
             String access_token = jsonObject.getString("access_token");
             return access_token;

+ 1 - 1
src/main/resources/mapper/VideoInfoLoveFootMapper.xml

@@ -7,7 +7,7 @@
 
     <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_avnoashi_url,vi.orgin_jpfoot_url,IFNULL(vi.cast, vi.genres) AS main_who,IFNULL(vio.score, 0) AS score, IFNULL(vio.comment, '暂无评论') AS comment,
-            IFNULL(temp1.identification_code, 'false') AS videoInfoFlag,IFNULL(temp2.identification_code, 'false') AS videoInfoPoolFlag
+            IFNULL(temp1.identification_code, 'false') AS videoInfoFlag,IFNULL(temp2.identification_code, 'false') AS videoInfoPoolFlag,temp2.type AS videoInfoPoolType
         from crawler_lovefoot_info vi
         left join video_info_other vio on vi.identification_code = vio.identification_code and vio.delete_flag = 1
         left join video_info temp1 on vi.identification_code = temp1.identification_code and temp1.delete_flag = 1

+ 19 - 0
src/main/resources/static/bg.html

@@ -83,6 +83,25 @@
     </div>
     <br/>
     <div style="margin-right:20px;">
+        <span class="font">findVideoInfoLoveFoot</span>
+        <form method="post" action="bg/findVideoInfoLoveFoot">
+            <span>identificationCode</span>
+            <input type="text" name="identificationCode" placeholder="识别码,可为空"/>
+            <span>type</span>
+            <input type="text" name="type" placeholder="类型{1:爬取失败,2:待审查,3:审查已通过,4:审查未通过},可为空" style="width: 430px;"/>
+            <span>order</span>
+            <input type="text" name="order" placeholder="ass|desc,可为空"/>
+            <span>crudT</span>
+            <select name="crudT" style="height: 21.43px;">
+                <option value="1">查询</option>
+                <option value="2">更新</option>
+                <option value="3">删除</option>
+            </select>
+            <input type="submit" value="提交">
+        </form>
+    </div>
+    <br/>
+    <div style="margin-right:20px;">
         <span class="font">findVideoInfo</span>
         <form method="post" action="bg/findVideoInfo">
             <span>identificationCode</span>

+ 10 - 1
src/main/resources/static/js/my-video.js

@@ -143,8 +143,17 @@ function search(pageNo, startFlag, searchSelectFlag) {
                         scoreStr += (videoInfo.type === 1 ? '待审查' : (videoInfo.type === 2 ? '审查中' : (videoInfo.type === 3 ? '审查已通过' : '审查未通过'))) + '|';
                         scoreStr += videoInfo.score;
                     } else if (bigType == '足舐') {
+                        scoreStr += (videoInfo.orginAvnoashiUrl === null ? '' : 'avnoashi|');
+                        scoreStr += (videoInfo.orginJpfootUrl === null ? '' : 'jpfoot|');
+
                         scoreStr += (videoInfo.videoInfoFlag === 'false' ? '' : '骑兵|');
-                        scoreStr += (videoInfo.videoInfoPoolFlag === 'false' ? '' : '码池|');
+
+                        if (videoInfo.videoInfoPoolFlag === 'false') {
+                            scoreStr += '';
+                        } else {
+                            scoreStr += '码池(' + (videoInfo.videoInfoPoolType === 1 ? '待审查' : (videoInfo.videoInfoPoolType === 2 ? '审查中' : (videoInfo.videoInfoPoolType === 3 ? '审查已通过' : '审查未通过'))) + ')|';
+                        }
+
                         scoreStr += (videoInfo.type === 1 ? '爬取失败' : (videoInfo.type === 2 ? '待审查' : (videoInfo.type === 3 ? '审查已通过' : '审查未通过'))) + '|';
                         scoreStr += videoInfo.score;