diff --git a/code/app/home/view/default/test/test01/index.html b/code/app/home/view/default/test/test01/index.html index a26bab7..836569f 100644 --- a/code/app/home/view/default/test/test01/index.html +++ b/code/app/home/view/default/test/test01/index.html @@ -1,114 +1,61 @@ - - - +
-
+{/video:ranklist}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+{/video:list} -->
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+{/video:category} -->
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/code/app/home/view/default/test/test01/index_bak.html b/code/app/home/view/default/test/test01/index_bak.html
new file mode 100644
index 0000000..a26bab7
--- /dev/null
+++ b/code/app/home/view/default/test/test01/index_bak.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/app/model/MongoModel.php b/code/app/model/MongoModel.php
index 9e5a0aa..cf192fa 100644
--- a/code/app/model/MongoModel.php
+++ b/code/app/model/MongoModel.php
@@ -80,6 +80,16 @@ abstract class MongoModel
{
return $this->getCol()->findOne($arrFilter, $arrOptions);
}
+ /**
+ * Undocumented function
+ *
+ * @param array $arrFilter
+ * @return array|object|null
+ */
+ public function get(array $arrFilter = [], array $arrOptions = []): array|object|null
+ {
+ return $this->getCol()->find($arrFilter, $arrOptions);
+ }
/**
* Undocumented function
diff --git a/code/app/model/VideoCategoryModel.php b/code/app/model/VideoCategoryModel.php
new file mode 100644
index 0000000..38503b6
--- /dev/null
+++ b/code/app/model/VideoCategoryModel.php
@@ -0,0 +1,86 @@
+ "大陆综艺",
+ "ai-qing-pian" => "爱情片",
+ "ke-huan-pian" => "科幻片",
+ "ri-han-zong-yi" => "日韩综艺",
+ "ri-han-dong-man" => "日韩动漫",
+ "zhan-zheng-pian" => "战争片",
+ "ou-mei-ju" => "欧美剧",
+ "lun-li-pian" => "倫理片",
+ "han-guo-ju" => "韩国剧",
+ "yin-le" => "音乐",
+ "dong-hua-pian" => "动画片",
+ "guo-chan-dong-man" => "国产动漫",
+ "kong-bu-pian" => "恐怖片",
+ "tai-wan-ju" => "台湾剧",
+ "xiang-gang-ju" => "香港剧",
+ "xi-ju-pian" => "喜剧片",
+ "ying-shi" => "影视",
+ "qi-che" => "汽车",
+ "ou-mei-zong-yi" => "欧美综艺",
+ "ju-qing-pian" => "剧情片",
+ "tai-guo-ju" => "泰国剧",
+ "hai-wai-ju" => "海外剧",
+ "guo-chan-ju" => "国产剧",
+ "fu-li" => "福利",
+ "ou-mei-dong-man" => "欧美动漫",
+ "dong-zuo-pian" => "动作片",
+ "ri-ben-ju" => "日本剧",
+ "gang-tai-zong-yi" => "港台综艺",
+ "gang-tai-dong-man" => "港台动漫",
+ "ji-lu-pian" => "记录片",
+ "duan-ju-da-quan" => "短剧大全",
+ "gao-xiao" => "搞笑",
+ "hai-wai-dong-man" => "海外动漫",
+ ];
+
+ /**
+ * get category of the videos
+ *
+ * @return array
+ */
+ static public function getCategory(): array
+ {
+ return self::$arrCategory;
+ }
+
+ /**
+ * get pinyin based on chinese characters
+ *
+ * @param string $strZh
+ * @return string
+ */
+ static public function getZhByPinYin(string $strZh)
+ {
+ $strKey = array_search($strZh, self::$arrCategory);
+ return $strKey === false ?: self::$arrCategory[$strKey];
+ }
+}
diff --git a/code/app/services/StaticConfig.php b/code/app/services/StaticConfig.php
index 3ec25c6..5e3b945 100644
--- a/code/app/services/StaticConfig.php
+++ b/code/app/services/StaticConfig.php
@@ -3,6 +3,8 @@
namespace app\services;
use app\model\CategoryModel;
+use app\model\VideoCategoryModel;
+use app\model\VideoModel;
class StaticConfig
{
@@ -50,12 +52,19 @@ class StaticConfig
'update' => '最新更新',
];
+ static $arrVideoRankSortType = [
+ 'daily' => '天',
+ 'weekly' => '周',
+ 'monthly' => '月',
+ 'total' => '总',
+ ];
+
/**
- * GetCategoryFilter
+ * getNovelCategoryFilter
*
* @return array
*/
- static function getCategoryFilter(string $strNSex = ''): array
+ static function getNovelCategoryFilter(string $strNSex = ''): array
{
if ($strNSex == 'man') {
return CategoryModel::$arrCategoryAll['man'];
@@ -65,4 +74,14 @@ class StaticConfig
return array_combine(CategoryModel::$arrCategoryPinYin, CategoryModel::$arrCategory);
}
}
+
+ /**
+ * getNovelCategoryFilter
+ *
+ * @return array
+ */
+ static function getVideoCategoryFilter(): array
+ {
+ return VideoCategoryModel::$arrCategory;
+ }
}
diff --git a/code/app/services/VideoService.php b/code/app/services/VideoService.php
index c17eb1e..235ebeb 100644
--- a/code/app/services/VideoService.php
+++ b/code/app/services/VideoService.php
@@ -60,7 +60,7 @@ class VideoService
/**
- * 获取小说分类URl
+ * 获取视频分类URl
*
* @param string $strGender
* @param string $strCategory
@@ -114,7 +114,7 @@ class VideoService
/**
* Undocumented function
- * 小说目录
+ * 视频目录
* @param int $intVId
* @param string $intPinYin
* @return string
@@ -151,7 +151,7 @@ class VideoService
}
/**
- * 获取排行榜小说
+ * 获取排行榜视频
*
* @param array $arrParams
* @return array
@@ -160,7 +160,7 @@ class VideoService
{
$intCount = (int)$arrParams['count'] ?? 10;
$strSortType = (string)$arrParams['sort_type'] ?? '';
- $strNStatus = (string) $arrParams['v_isend'] ?? '';
+ $strVStatus = (string) $arrParams['v_status'] ?? '';
$strDiffKey = (string) $arrParams['diff_key'] ?? '';
$intCacheLifeTime = (int)$arrParams['cache_life'] ?? 0;
@@ -168,8 +168,8 @@ class VideoService
$arrFilter = [];
# v_isend filter
- if (!empty($strNStatus)) {
- switch ($strNStatus) {
+ if (!empty($strVStatus)) {
+ switch ($strVStatus) {
case 'lianzai':
$arrFilter['v_isend'] = 0;
break;
@@ -220,10 +220,8 @@ class VideoService
$arrVideo = $this->VideoModel->getRankVideoOnCache(
$strCacheKey,
$intCount,
- $arrFilter['v_category_sex_zh'] ?? 0,
$arrSort['v_sort_type'] ?? 'daily',
- $arrFilter['v_isend'] ?? NULL,
- $intLifeTime,
+ $arrFilter['v_status'] ?? NULL,
);
return $arrVideo;
@@ -231,7 +229,7 @@ class VideoService
/**
- * 获取小说数据
+ * 获取视频数据
*
* @param array $arrParams
* @return array
@@ -241,7 +239,7 @@ class VideoService
$intCount = (int)$arrParams['count'] ?? 10;
$strNCategory = $arrParams['v_category'] ?? '';
$strSortType = (string)$arrParams['sort_type'] ?? '';
- $strNStatus = (string) $arrParams['v_isend'] ?? '';
+ $strVStatus = (string) $arrParams['v_status'] ?? '';
$strDiffKey = (string) $arrParams['diff_key'] ?? '';
$intCacheLifeTime = (int)$arrParams['cache_life'] ?? 0;
@@ -257,18 +255,17 @@ class VideoService
}
# v_isend filter
- if (!empty($strNStatus)) {
- switch ($strNStatus) {
+ if (!empty($strVStatus)) {
+ switch ($strVStatus) {
case 'lianzai':
- $arrFilter['v_isend'] = StaticConfig::$arrVideoStatus[$strNStatus];
+ $arrFilter['v_isend'] = 0;
break;
case 'wanjie':
- $arrFilter['v_isend'] = StaticConfig::$arrVideoStatus[$strNStatus];
+ $arrFilter['v_isend'] = 1;
break;
}
}
-
$arrSort = [];
# sort filter
@@ -281,7 +278,7 @@ class VideoService
$arrSort['v_level'] = -1;
break;
case 'update':
- $arrSort['v_update_time'] = -1;
+ $arrSort['v_publish_date'] = -1;
break;
}
}
@@ -316,7 +313,7 @@ class VideoService
/**
- * 获取小说分页数据
+ * 获取视频分页数据
*
* @param array $arrParams
* @return array
@@ -330,7 +327,6 @@ class VideoService
'v_category' => (string)($arrParams['v_category'] ?? ''),
'sort_type' => (string)($arrParams['sort_type'] ?? ''),
'v_isend' => (string)($arrParams['v_isend'] ?? ''),
- 'v_sex' => (string)($arrParams['v_sex'] ?? ''),
'diff_key' => (string)($arrParams['diff_key'] ?? ''),
'key' => (string)($arrParams['key'] ?? ''),
'cache_life' => (int)($arrParams['cache_life'] ?? 0),
@@ -341,7 +337,7 @@ class VideoService
$intLimit = $arrParams['limit'];
$strNCategory = $arrParams['v_category'];
$strSortType = $arrParams['sort_type'];
- $strNStatus = $arrParams['v_isend'];
+ $strVStatus = $arrParams['v_isend'];
$strDiffKey = $arrParams['diff_key'];
$strKey = $arrParams['key'];
@@ -367,13 +363,13 @@ class VideoService
}
# v_isend filter
- if (!empty($strNStatus)) {
- switch ($strNStatus) {
+ if (!empty($strVStatus)) {
+ switch ($strVStatus) {
case 'lianzai':
- $arrFilter['$and'][] = ['v_isend' => StaticConfig::$arrVideoStatus[$strNStatus]];
+ $arrFilter['$and'][] = ['v_isend' => 0];
break;
case 'wanjie':
- $arrFilter['$and'][] = ['v_isend' => StaticConfig::$arrVideoStatus[$strNStatus]];
+ $arrFilter['$and'][] = ['v_isend' => 1];
break;
default:
$arrParams['v_isend'] = 'all';
@@ -409,7 +405,7 @@ class VideoService
$arrSort['v_level'] = -1;
break;
case 'update':
- $arrSort['v_update_time'] = -1;
+ $arrSort['v_publish_date'] = -1;
break;
default:
$arrParams['sort_type'] = 'all';
@@ -436,18 +432,11 @@ class VideoService
}
// 更新值
- $strGender = $this->SiteContext->Request->param('strGender');
- $strNanUrlTemp = $this->SiteContext->DomainModel->getFomartSubject('NAN_SHENG_URL', '', false);
- $strNanUrl = str_replace("/", "", $strNanUrlTemp);
- $strCNSex = '全部';
- if ($strGender) {
- $strCNSex = $strGender == $strNanUrl ? '男生' : '女生';
- }
+
ConverterMovel::setVal([
'intPage' => $intPage,
- 'strVideoSex' => $strCNSex,
- 'strVideoCategoryName' => empty($strNCategory) ? '' : str_replace("小说", "", $strNCategory),
- 'strVideoStatus' => empty($strNStatus) ? '' : StaticConfig::$arrVideoStatus[$strNStatus],
+ 'strVideoCategoryName' => empty($strNCategory) ? '' : str_replace("视频", "", $strNCategory),
+ 'strVideoStatus' => empty($strVStatus) ? '' : StaticConfig::$arrVideoStatus[$strVStatus],
'strVideoOrder' => empty($strSortType) ? '' : StaticConfig::$arrVideoSortType[$strSortType],
'strSearchKeywords' => $strKey,
]);
@@ -497,82 +486,54 @@ class VideoService
return $arrPaginator;
}
+
/**
* 书库/分类定制分页
*
* @param array $arrFilter 查询条件字段
* @param array $arrSort 查询排序字段
- * @param array $arrVideo 查询出来的数据
+ * @param array $arrNovel 查询出来的数据
* @return array
*/
- public function generateCategoryPager(array $arrParams, array $arrSort, array $arrVideo): array
+ public function generateVideoPager(array $arrParams, array $arrSort, array $arrVideo): array
{
- $strGender = $arrParams['v_sex'];
- $strCategory = $arrParams['v_category'];
- $strStatus = $arrParams['v_isend'];
- $strOrder = $arrParams['sort_type'];
- $intPage = $arrVideo['page'] ?? 1;
- $intLimit = $arrVideo['limit'] ?? 10;
- $intTotal = $arrVideo['total'] ?? 0;
+ $strKey = $arrParams['key'];
+ $intPage = $arrVideo['page'];
+ $intLimit = $arrVideo['limit'];
$intButtomNum = $arrParams['buttov_num'];
- $strBaseUrl = $this->getVideoCategoryUrl($strGender, $strCategory, $strStatus, $strOrder, '{page}');
-
- $arrPaginator = CusteomPage02::generate($intPage, $intTotal, $intLimit, $strBaseUrl, $intButtomNum);
+ $strBaseUrl = app(VideoService::class)->getVideoSearchUrl($strKey, '{page}');
+ $arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);
return $arrPaginator;
+
}
/**
- * 根据VId获取小说详情
+ * 根据VId获取视频详情
*
* @param integer $intVId
* @return void
*/
- public function getVideoByVId(int $intVId, int|null $intNForgeId = 0)
+ public function getVideoByVId(int $intVId)
{
- // 小说详情
+ // 视频详情
$arrVideo = $this->VideoModel->getVideoByVId($intVId);
- if ($intNForgeId > 0) {
- foreach ($arrVideo['v_forge_novel'] as $arrForgeVideo) {
- if ($arrForgeVideo['v_forge_id'] == $intNForgeId) {
- $arrVideo['v_name'] = $arrForgeVideo['v_forge_title'];
- break;
- }
- }
- }
-
- // 分类拼音
- $arrVideo['v_category_pinyin'] = CategoryModel::getPinYin($arrVideo['v_category']);
- $arrVideo['v_category_sex_en'] = $arrVideo['v_category_sex_en'] ?? 'man';
-
// 点击数
$arrVideoClicks = $this->VideoClicksModel->getStats($intVId);
- // 推荐小说
- $arrRelateveVId = array_column($arrVideo['v_related_novel'], 'v_id');
-
- $arrRelateveVideo = $this->VideoModel->findMany(['v_id' => [
- '$in' => $arrRelateveVId,
- ]], 10);
-
-
// 更新值
ConverterMovel::setVal([
'intPage' => 1,
'strVideoName' => $arrVideo['v_name'],
- 'strVideoAuthor' => $arrVideo['v_author'],
'strVideoCategoryName' => $arrVideo['v_category'],
- 'strVideoSex' => $arrVideo['v_category_sex_en'] == 'man' ? '男生' : '女生',
'strVideoStatus' => $arrVideo['v_isend'],
'strVideoDescription' => $arrVideo['v_description'],
]);
$arrVideo['arrVideoClicks'] = $arrVideoClicks;
- $arrVideo['arrRelateveVideo'] = $arrRelateveVideo;
-
return $arrVideo;
}
diff --git a/code/app/task/crawler/youzhi/page/VideoInfoPage.php b/code/app/task/crawler/youzhi/page/VideoInfoPage.php
index 12ae063..ab1dd05 100644
--- a/code/app/task/crawler/youzhi/page/VideoInfoPage.php
+++ b/code/app/task/crawler/youzhi/page/VideoInfoPage.php
@@ -83,6 +83,9 @@ class VideoInfoPage extends BasePage
'url' => $arrVal[1] ?? $arrVal[0],
];
}
+
+ $arrVideo['vod_class'] = trim($arrVideo['vod_class']);
+
$arrVideo['vod_play_url'][$this->getsite()->getSiteCode()] = $arrPlayUrl;
$arrVideo['vod_actor'] = explode(',', $arrVideo['vod_actor']);
$arrVideo['vod_director'] = explode(',', $arrVideo['vod_director']);
diff --git a/code/app/task/logic/SiteMapLogic.php b/code/app/task/logic/SiteMapLogic.php
index 77807f7..84d1b53 100644
--- a/code/app/task/logic/SiteMapLogic.php
+++ b/code/app/task/logic/SiteMapLogic.php
@@ -45,7 +45,7 @@ class SiteMapLogic
public function __construct()
{
- $this->arrNovelCategory = StaticConfig::getCategoryFilter();
+ $this->arrNovelCategory = StaticConfig::getNovelCategoryFilter();
$this->arrNovelSort = StaticConfig::$arrNovelSortType;
diff --git a/code/config/view.php b/code/config/view.php
index 2bdee2f..4298055 100644
--- a/code/config/view.php
+++ b/code/config/view.php
@@ -27,7 +27,7 @@ return [
// 自定义标签
- 'taglib_pre_load' => '\\template\\taglib\\Ad,\\template\\taglib\\Site,\\template\\taglib\\Rs,\\template\\taglib\\Novel,\\template\\taglib\\Chapter',
+ 'taglib_pre_load' => '\\template\\taglib\\Ad,\\template\\taglib\\Site,\\template\\taglib\\Rs,\\template\\taglib\\Novel,\\template\\taglib\\Chapter,\\template\\taglib\\Video',
// 模板渲染缓存
'display_cache' => env('VIEW_DISPLAY_CACHE', false),
diff --git a/code/extend/template/taglib/Novel.php b/code/extend/template/taglib/Novel.php
index 359d610..8cb7040 100644
--- a/code/extend/template/taglib/Novel.php
+++ b/code/extend/template/taglib/Novel.php
@@ -414,7 +414,7 @@ EOT;
$strParse = <<