Sfoglia il codice sorgente

update:影片详情页页面开发v2

tujidelv 3 anni fa
parent
commit
31f722fa98

+ 4 - 1
src/main/java/top/lvzhiqiang/config/WebAppConfig.java

@@ -1,5 +1,6 @@
 package top.lvzhiqiang.config;
 
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.converter.HttpMessageConverter;
@@ -32,6 +33,8 @@ public class WebAppConfig implements WebMvcConfigurer {
 
     @Resource
     private DicCodeMapper dicCodeMapper;
+    @Value("${spring.profiles.active}")
+    private String env;
 
     @Override
     public void addResourceHandlers(ResourceHandlerRegistry registry) {
@@ -44,7 +47,7 @@ public class WebAppConfig implements WebMvcConfigurer {
 
         // 初始化字典码表
         dicCodeList = dicCodeMapper.findAll();
-        List<DicCode> dicCodeList = WebAppConfig.dicCodeList.stream().filter(x -> 1 == x.getType()).collect(Collectors.toList());
+        List<DicCode> dicCodeList = WebAppConfig.dicCodeList.stream().filter(x -> 1 == x.getType() && env.equals(x.getEnv())).collect(Collectors.toList());
         for (DicCode dicCode : dicCodeList) {
             StringBuffer resourceHandlerSB = new StringBuffer("/");
             resourceHandlerSB.append(dicCode.getCodeKey().split("_")[0]).append("/**");

+ 8 - 3
src/main/java/top/lvzhiqiang/controller/VideoDetailController.java

@@ -4,7 +4,9 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import top.lvzhiqiang.entity.VideoInfo;
+import top.lvzhiqiang.exception.ParameterException;
 import top.lvzhiqiang.service.VideoInfoService;
+import top.lvzhiqiang.util.StringUtils;
 
 import javax.annotation.Resource;
 
@@ -31,8 +33,11 @@ public class VideoDetailController {
      * 2022/5/22 21:35
      */
     @PostMapping("/getVideoInfoDetail")
-    public VideoInfo getVideoInfoDetail(String type,String code) {
-        VideoInfo videoInfo = new VideoInfo();
-        return videoInfo;
+    public VideoInfo getVideoInfoDetail(String type, String code) {
+        if (StringUtils.isEmpty(code)) {
+            throw new ParameterException("识别码不能为空!");
+        }
+
+        return videoInfoService.getVideoInfoDetail(type, code);
     }
 }

+ 14 - 3
src/main/java/top/lvzhiqiang/mapper/VideoInfoMapper.java

@@ -2,7 +2,6 @@ package top.lvzhiqiang.mapper;
 
 import org.apache.ibatis.annotations.*;
 import top.lvzhiqiang.entity.VideoInfo;
-import top.lvzhiqiang.entity.VideoInfoUncensored;
 
 import java.util.List;
 import java.util.Map;
@@ -56,7 +55,7 @@ public interface VideoInfoMapper {
     /**
      * 查询所有识别码
      */
-    @Select("select distinct identification_code from video_info")
+    @Select("select distinct identification_code from video_info WHERE type = 1")
     List<String> findAllIcode();
 
     /**
@@ -92,7 +91,7 @@ public interface VideoInfoMapper {
     @Update("update video_info set delete_flag = 2,modify_time = now() where identification_code = #{identificationCode}")
     void delByCode(String identificationCode);
 
-    @Update("update video_info set length = #{length}, director = #{director}, maker = #{maker}, issuer = #{issuer}, issue_date = #{issueDate}, status = #{status}, modify_time = now() where identification_code = #{identificationCode}")
+    @Update("update video_info set name = #{name}, length = #{length}, director = #{director}, maker = #{maker}, issuer = #{issuer}, issue_date = #{issueDate}, genres = #{genres}, cast = #{cast}, status = #{status}, img_url = #{imgUrl}, modify_time = now() where identification_code = #{identificationCode}")
     void updateJsoupInfoByCode(VideoInfo videoInfo);
 
     /**
@@ -104,4 +103,16 @@ public interface VideoInfoMapper {
      */
     @Update("update video_info set status = #{status},modify_time = now() where identification_code = #{identificationCode}")
     int updateStatus(String identificationCode, Integer status);
+
+    /**
+     * 根据识别码获取详情
+     *
+     * @param code
+     * @return
+     */
+    @Select("select vi.*, IFNULL(vio.score, 0) AS score, IFNULL(vio.comment, '暂无评论') AS comment, IFNULL(vio.comment_first, '暂无简介') AS commentFirst" +
+            "        from video_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 and vi.identification_code=#{code}")
+    VideoInfo getVideoInfoDetail(String code);
 }

+ 9 - 0
src/main/java/top/lvzhiqiang/service/VideoInfoService.java

@@ -34,4 +34,13 @@ public interface VideoInfoService {
      * @return
      */
     PageInfo<VideoInfo> getVideoInfoPage(Map<String, Object> params);
+
+    /**
+     * 影片信息详情
+     *
+     * @param type
+     * @param code
+     * @return
+     */
+    VideoInfo getVideoInfoDetail(String type, String code);
 }

+ 53 - 0
src/main/java/top/lvzhiqiang/service/impl/VideoInfoServiceImpl.java

@@ -2,7 +2,9 @@ package top.lvzhiqiang.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Value;
 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;
@@ -12,6 +14,7 @@ import top.lvzhiqiang.mapper.VideoInfoUncensoredMapper;
 import top.lvzhiqiang.service.VideoInfoService;
 
 import javax.annotation.Resource;
+import java.io.File;
 import java.util.List;
 import java.util.Map;
 
@@ -33,6 +36,9 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<Object> implements Vid
     @Resource
     private VideoInfoInfantryMapper videoInfoInfantryMapper;
 
+    @Value("${spring.profiles.active}")
+    private String env;
+
     /**
      * 查询所有
      *
@@ -89,4 +95,51 @@ public class VideoInfoServiceImpl extends BaseServiceImpl<Object> implements Vid
         PageInfo<VideoInfo> videoInfoPageInfo = new PageInfo<>(videoInfoList);
         return videoInfoPageInfo;
     }
+
+    /**
+     * 影片信息详情
+     *
+     * @param type
+     * @param code
+     * @return
+     */
+    @Override
+    public VideoInfo getVideoInfoDetail(String type, String code) {
+        VideoInfo videoInfo;
+        if ("qibing".equals(type)) {
+            videoInfo = videoInfoMapper.getVideoInfoDetail(code);
+            if (videoInfo == null) {
+                return null;
+            }
+
+            String qibingPath = WebAppConfig.dicCodeList.stream().filter(x -> 1 == x.getType() && env.equals(x.getEnv()) && "apics_path".equals(x.getCodeKey())).findFirst().get().getCodeValue();
+            String imgPrefixPath = "骑兵步兵/".concat(videoInfo.getIdentificationCode()).concat("/img_gf/");
+            videoInfo.setImgPrefixPath(imgPrefixPath);
+
+            // 获取样品图像-官方
+            File imgGFFile = new File(qibingPath, imgPrefixPath);
+            if (imgGFFile.exists()) {
+                File[] files = imgGFFile.listFiles();
+                for (File file : files) {
+                    videoInfo.getImgGFList().add(file.getName());
+                }
+            }
+            // 获取样品图像-私有
+            File imgSYFile = new File(qibingPath, "骑兵步兵/".concat(videoInfo.getIdentificationCode()).concat("/img_sy/"));
+            if (imgSYFile.exists()) {
+                File[] files = imgSYFile.listFiles();
+                for (File file : files) {
+                    videoInfo.getImgSYList().add(file.getName());
+                }
+            }
+        } else if ("bubing".equals(type)) {
+            videoInfo = null;
+        } else if ("liuchu".equals(type)) {
+            videoInfo = null;
+        } else {
+            videoInfo = null;
+        }
+
+        return videoInfo;
+    }
 }

+ 2 - 2
src/main/resources/static/js/my-video.js

@@ -118,7 +118,7 @@ function search(pageNo, startFlag, searchSelectFlag) {
 
                     str += "<li class=\"col-lg-8 col-md-6 col-sm-4 col-xs-3\">" +
                         "   <div class=\"myui-vodlist__box\">" +
-                        "       <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;" + prepath + "/" + videoInfo.imgUrl + "&quot;);\">" +
+                        "       <a class=\"myui-vodlist__thumb lazyload\" title=\"\" style=\"background-image: url(&quot;apics/" + videoInfo.imgUrl + "&quot;);\">" +
                         "           <span class=\"playvideo play hidden-xs\" identificationCode='" + videoInfo.identificationCode + "'></span>" +
                         "           <span class=\"pic-tag pic-tag-top\">" +
                         "               <span class=\"tag identificationCode\" style=\"background-color: #FB7299;\">" + videoInfo.identificationCode + "</span>" +
@@ -319,7 +319,7 @@ function initContentEvent() {
     $(".bigpreview").dblclick(function () {
         if ($("#bigpreview").css("display") === 'none') {
             $("#bigpreview").css("display", "block");
-            $("#bigpreview").find("img").attr("src", prepath + "/" + $(this).attr("imgUrl"));
+            $("#bigpreview").find("img").attr("src", "apics/" + $(this).attr("imgUrl"));
         } else if ($("#bigpreview").css("display") === 'block') {
             $("#bigpreview").css("display", "none");
             $("#bigpreview").find("img").attr("src", "");

+ 72 - 0
src/main/resources/static/js/my-voddetail.js

@@ -7,7 +7,16 @@ $(function () {
  * 初始化其他操作
  */
 function initOther() {
+    $(".commentdiv").eq(1).css("display", "none");
 
+    $("#commentul").find("a").click(function () {
+        $("#commentul").find("a").parent().removeClass("active")
+        $(this).parent().addClass("active");
+
+        $(".commentdiv").css("display", "none");
+        var datadiv = $(this).attr("data-div");
+        $("#".concat(datadiv)).parents(".commentdiv").css("display", "block");
+    });
 }
 
 function getUrlParam(name) {
@@ -24,6 +33,16 @@ function getUrlParam(name) {
 function initDetail() {
     var type = getUrlParam('type');
     var code = getUrlParam('code');
+
+    if ('qibing' == type) {
+        $("#videoType").text('骑兵');
+    } else if ('bubing' == type) {
+        $("#videoType").text('步兵');
+    } else if ('liuchu' == type) {
+        $("#videoType").text('流出');
+    } else if ('machi' == type) {
+        $("#videoType").text('码池');
+    }
     $.ajax({
         url: "videoDetail/getVideoInfoDetail", //请求的url地址
         dataType: "json", //返回格式为json
@@ -33,6 +52,59 @@ function initDetail() {
         success: function (data) {
             //请求成功时处理
             if (data != null && $.trim(data) != "" && data.success) {
+                data = data.data;
+
+                // score
+                var score = data.score;
+                $("#scorespan").text(score);
+                if (score == 0) {
+                    $("#ratewords").text("暂无评分")
+                } else {
+                    var count;
+                    if (score >= 5) {
+                        count = 5;
+                    } else if (score >= 4) {
+                        count = 4;
+                    } else if (score >= 3) {
+                        count = 3;
+                    } else if (score >= 2) {
+                        count = 2;
+                    } else if (score >= 1) {
+                        count = 1;
+                    } else {
+                        count = 1;
+                    }
+
+                    var scoreli = $("ul.rating").find("li:lt(" + count + ")").children("i");
+                    $(scoreli).removeClass("fa-star-o");
+                    $(scoreli).addClass("fa-star");
+
+                    $("#ratewords").text($("ul.rating").find("li").eq(count -1).attr("title"));
+                }
+
+                $("#videoInfoCover").attr("src", data.imgUrl)
+                $("#videoName").text(data.name);
+                $("#identificationCode").text(data.identificationCode);
+                $("#issueDate").text(data.issueDate);
+                $("#length").text(data.length);
+                $("#director").text(data.director);
+                $("#maker").text(data.maker);
+                $("#issuer").text(data.issuer);
+
+                if (data.genres == undefined || data.genres === '') {
+                    $("#genres").text('--');
+                } else {
+                    $("#genres").text(data.genres.replaceAll(",", " "));
+                }
+                if (data.cast == undefined || data.cast === '') {
+                    $("#cast").text('--');
+                } else {
+                    $("#cast").text(data.cast.replaceAll(",", "  "));
+                }
+
+                $("#commentfirstspan").text(data.commentFirst);
+                $("#commentspan").text(data.comment);
+
                 console.log(data)
             } else {
                 alert(data.message);

+ 32 - 29
src/main/resources/static/voddetail.html

@@ -174,15 +174,13 @@
                     <div class="col-xs-1">
                         <span class="text-muted">当前位置:</span>
                         <a href="https://ty.fantuan.tv">首页</a> <i class="fa fa-angle-right text-muted"></i>
-                        <a href="/vodshow/id/23.html">其它</a> <i class="fa fa-angle-right text-muted"></i>
-                        <span class="text-muted">金属之声·奥斯卡</span>
+                        <a href="#" id ="videoType"></a> <i class="fa fa-angle-right text-muted"></i>
+                        <span class="text-muted" id ="videoName"></span>
                     </div>
                     <div class="col-xs-1">
                         <div class="myui-content__thumb">
                             <a class="myui-vodlist__thumb picture" href="#" title="金属之声·奥斯卡">
-                                <img class="lazyload"
-                                     src="qibing/(女优)岬ななみ/2022-04-08 IPX-855 「課長、一緒にぶっ飛びません?」 逆キメセク痴女子社員 出張先の相部屋で昇天する2人… 岬ななみ.jpg"
-                                     style="">
+                                <img class="lazyload" id="videoInfoCover" src="" style="">
                                 <span class="play hidden-xs"></span>
                             </a>
                         </div>
@@ -191,52 +189,51 @@
                             <div id="rating" class="score" data-mid="1" data-id="143044" data-score="2">
                                 <span class="left text-muted">评分:</span>
                                 <ul class="rating">
-                                    <li title="很差" val="1"><i class="fa fa-star"></i></li>
-                                    <li title="较差" val="2"><i class="fa fa-star"></i></li>
+                                    <li title="很差" val="1"><i class="fa fa-star-o"></i></li>
+                                    <li title="较差" val="2"><i class="fa fa-star-o"></i></li>
                                     <li title="还行" val="3"><i class="fa fa-star-o"></i></li>
                                     <li title="推荐" val="4"><i class="fa fa-star-o"></i></li>
                                     <li title="力荐" val="5"><i class="fa fa-star-o"></i></li>
                                 </ul>
-                                <span class="branch">3.0</span>
-                                <span class="text-muted" id="ratewords">较差</span>
+                                <span class="branch" id="scorespan"></span>
+                                <span class="text-muted" id="ratewords"></span>
                             </div>
                             <p class="data hidden-sm">
                                 <span class="text-muted">識別碼:</span>
-                                <span class="text-red">RBK-038</span>
+                                <span class="text-red" id="identificationCode"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">發行日期:</span>
-                                <span class="">2022-02-25</span>
+                                <span class="" id="issueDate"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">長度:</span>
-                                <span class="">120分鐘</span>
+                                <span class="" id="length"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">導演:</span>
-                                <span class="">芳賀栄太郎</span>
+                                <span class="" id="director"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">製作商:</span>
-                                <span class="">アタッカーズ</span>
+                                <span class="" id="maker"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">發行商:</span>
-                                <span class="">龍縛</span>
+                                <span class="" id="issuer"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">類別:</span>
-                                <span class="">已婚婦女 單體作品 DMM獨家 高畫質</span>
+                                <span class="" id="genres"></span>
                             </p>
                             <p class="data hidden-sm">
                                 <span class="text-muted">演員:</span>
-                                <span class="">九条みちる</span>
+                                <span class="" id="cast"></span>
                             </p>
                         </div>
                         <div class="myui-content__operate">
                             <a class="btn btn-warm" href="/vodplay/143044-1-1.html"><i class="fa fa-play"></i> 立即播放</a>
-                            <a class="btn btn-danger" href="javascript:void(0);" onclick=""><i class="fa fa-star"></i>
-                                评分</a>
+                            <a class="btn btn-danger" href="javascript:void(0);" onclick=""><i class="fa fa-star"></i>评分</a>
                         </div>
                     </div>
                 </div>
@@ -248,18 +245,24 @@
                     <div class="myui-panel_hd">
                         <div class="myui-panel__head active bottom-line clearfix">
                             <h3 class="title">样品描述</h3>
-                            <ul class="nav nav-tabs active">
-                                <li class="active"><a href="#playlist1" data-toggle="tab">剧情简介</a></li>
-                                <li class="active"><a href="#playlist1" data-toggle="tab">私有评论</a></li>
+                            <ul class="nav nav-tabs active" id ="commentul">
+                                <li class="active"><a href="javascript:void(0);" data-toggle="tab" data-div="commentfirstspan">简介</a></li>
+                                <li class=""><a href="javascript:void(0);" data-toggle="tab" data-div="commentspan">评论</a></li>
                             </ul>
                         </div>
                     </div>
-                    <div class="myui-panel_bd">
+                    <div class="myui-panel_bd commentdiv">
+                        <div class="col-pd text-collapse content">
+                            <span class="sketch content" id="commentfirstspan"></span>
+                            <span class="data" style="display: none;"></span>
+                            <!--<a class="details" href="javascript:">详情 <i class="fa fa-angle-down"></i></a>-->
+                        </div>
+                    </div>
+                    <div class="myui-panel_bd commentdiv">
                         <div class="col-pd text-collapse content">
-                            <span class="sketch content">一个摇滚乐队的鼓手突然发现自己失聪,他的乐队搭档露和他都很懊恼,但又不得不面对这残酷的现实。</span>
-                            <span class="data"
-                                  style="display: none;">一个摇滚乐队的鼓手突然发现自己失聪,他的乐队搭档露和他都很懊恼,但又不得不面对这残酷的现实。</span>
-                            <a class="details" href="javascript:">详情 <i class="fa fa-angle-down"></i></a>
+                            <span class="sketch content" id="commentspan"></span>
+                            <span class="data" style="display: none;"></span>
+                            <!--<a class="details" href="javascript:">详情 <i class="fa fa-angle-down"></i></a>-->
                         </div>
                     </div>
                 </div>
@@ -272,8 +275,8 @@
                         <div class="myui-panel__head active bottom-line clearfix">
                             <h3 class="title">样品图像 </h3>
                             <ul class="nav nav-tabs active">
-                                <li class="active"><a href="#playlist1" data-toggle="tab">官方</a></li>
-                                <li class="active"><a href="#playlist1" data-toggle="tab">自有</a></li>
+                                <li class="active"><a href="javascript:void(0);" data-toggle="tab">官方</a></li>
+                                <li class=""><a href="javascript:void(0);" data-toggle="tab">自有</a></li>
                             </ul>
                         </div>
                     </div>