This commit is contained in:
Default
2025-05-03 23:54:37 +08:00
parent 0cd2fdcdfe
commit 577a4dab02
26 changed files with 1320 additions and 132 deletions

View File

@@ -4,7 +4,7 @@ namespace app\services;
use app\model\CategoryModel;
use app\model\VideoCategoryModel;
use app\model\VideoModel;
class StaticConfig
{
@@ -50,6 +50,7 @@ class StaticConfig
'news' => '最新入库',
'tuijian' => '推荐',
'update' => '最新更新',
'piaofang' => '票房',
];
static $arrVideoRankSortType = [
@@ -60,39 +61,234 @@ class StaticConfig
];
static $arrVideoLang = [
'hanyuputonghua' => '汉语普通话',
'yueyu' => '粤语',
'yingyu' => '语',
'guoyu' => '语',
'all' => '所有',
'yue-yu' => '粤语',
'yue-nan-yu' => '越南语',
'ying-yu-shou-yu' => '英语手语',
'ying-yu' => '英语',
'yin-niu-te-yu' => '因纽特语',
'yin-ni-yu' => '印尼语',
'yin-du-yu' => '印度语Hindi',
'yin-du-ni-xi-ya-yu' => '印度尼西亚语',
'yin-di-yu' => '印地语Hindi',
'yi-da-li-yu' => '意大利语',
'yi-da-li' => '意大利',
'yi-da' => '意大',
'xiong-ya-li-yu' => '匈牙利语',
'xi-la-yu' => '希腊语',
'xi-la' => '希腊',
'xi-ban-ya-yu' => '西班牙语',
'xi-ban' => '西班',
'wu-ke-lan' => '乌克兰',
'wu-er-dou-yu' => '乌尔都语',
'tu-ku-man-yu' => '土库曼语',
'tu-er-qi-yu' => '土耳其语',
'tu-er' => '土耳',
'tai-yu' => '泰语',
'tai-mi-er-yu' => '泰米尔语Tamil',
'tai-mi-er' => '泰米尔',
'tai-lu-gu-yu' => '泰卢固语',
'ta-jia' => '他加',
'shang-hai' => '上海',
'rui-dian-yu' => '瑞典语',
'ri-yu' => '日语',
'qi-ta' => '其它',
'pu-tong-hua' => '普通话',
'pu-tao-ya-yu' => '葡萄牙语',
'pu-tao' => '葡萄',
'nuo-wei-yu' => '挪威语',
'min-nan-yu' => '闽南语',
'mei-guo-shou-yu' => '美国手语',
'mao-li-yu' => '毛利语',
'ma-lai-yu' => '马来语',
'ma-lai-xi-ya-yu' => '马来西亚语',
'ma-la-ya-la-mu-yu' => '马拉雅拉姆语',
'lin-jia-la-yu' => '林加拉语',
'ku-er-de-yu' => '库尔德语',
'jie-ke-yu' => '捷克语',
'ji-ku-you-yu' => '基库尤语',
'he-nan-fang-yan' => '河南方言',
'he-lan-yu' => '荷兰语',
'han-yu-pu-tong-hua' => '汉语普通话Manda',
'han-yu-pu-tong' => '汉语普通',
'han-yu' => '韩语',
'guo-yu' => '国语',
'fei-lv-bin-yu' => '菲律宾语',
'fa-yu' => '法语',
'e-yu' => '俄语',
'de-yu' => '德语',
'dan-mai-yu' => '丹麦语',
'cang-yu' => '藏语',
'bo-si-yu' => '波斯语',
'bo-lan-yu' => '波兰语',
'bei-yin-du-yu' => '北印度语',
'ao-da-li-ya-yu' => '澳大利亚语',
'a-la-bo-yu' => '阿拉伯语',
'a-la-bo' => '阿拉伯',
'a-la' => '阿拉',
];
static $arrVideoArea = [
'zhongguodalu' => '中国大陆',
'zhongguotaiwang' => '中国台湾',
'zhongguoxianggan' => '中国香港',
'meiguo' => '美国',
'yingguo' => '国',
'faguo' => '法国',
'yindu' => '印度',
'riben' => '日本',
'taiguo' => '泰国',
'all' => '所有',
'zhong-guo-xiang-gang' => '中国香港',
'zhong-guo-tai-wan' => '中国台湾',
'zhong-guo-da-lu' => '中国大陆',
'zhong-guo' => '国',
'zhi-li' => '智利',
'yue-nan' => '越南',
'ying-guo' => '英国',
'yin-ni' => '印尼',
'yin-du' => '印度',
'yi-da-li' => '意大利',
'xiong-ya-li' => '匈牙利',
'xin-xi-lan' => '新西兰',
'xin-jia-po' => '新加坡',
'xiang-gang' => '香港',
'xi-de' => '西德',
'xi-ban-ya' => '西班牙',
'tu-er-qi' => '土耳其',
'tai-wan' => '台湾',
'tai-guo' => '泰国',
'si-luo-wen-ni-ya' => '斯洛文尼亚',
'rui-shi' => '瑞士',
'rui-dian' => '瑞典',
'ri-ben' => '日本',
'qi-ta' => '其它',
'pu-tao-ya' => '葡萄牙',
'nuo-wei' => '挪威',
'nei-di' => '内地',
'nan-si-la-fu' => '南斯拉夫',
'nan-fei' => '南非',
'mo-xi-ge' => '墨西哥',
'mo-luo-ge' => '摩洛哥',
'mei-guo' => '美国',
'ma-lai-xi-ya' => '马来西亚',
'ma-er-ta' => '马耳他',
'lu-sen-bao' => '卢森堡',
'la-tuo-wei-ya' => '拉脱维亚',
'jie-ke' => '捷克',
'jian-pu-zhai' => '柬埔寨',
'jia-na-da' => '加拿大',
'he-lan' => '荷兰',
'han-guo' => '韩国',
'ha-sa-ke-si-tan' => '哈萨克斯坦',
'fei-lv-bin' => '菲律宾',
'fa-guo' => '法国',
'e-luo-si' => '俄罗斯',
'de-guo' => '德国',
'dan-mai' => '丹麦',
'da-lu' => '大陆',
'bo-lan' => '波兰',
'bi-li-shi' => '比利时',
'bao-jia-li-ya' => '保加利亚',
'ba-xi' => '巴西',
'ao-di-li' => '奥地利',
'ao-da-li-ya' => '澳大利亚',
'ai-er-lan' => '爱尔兰',
'a-lian-qiu' => '阿联酋',
'a-gen-ting' => '阿根廷',
];
static $arrVideoYear = [
'all' => '所有',
'1924' => '1924',
'1935' => '1935',
'1938' => '1938',
'1940' => '1940',
'1941' => '1941',
'1942' => '1942',
'1945' => '1945',
'1948' => '1948',
'1949' => '1949',
'1950' => '1950',
'1952' => '1952',
'1953' => '1953',
'1954' => '1954',
'1955' => '1955',
'1956' => '1956',
'1957' => '1957',
'1958' => '1958',
'1959' => '1959',
'1960' => '1960',
'1962' => '1962',
'1963' => '1963',
'1964' => '1964',
'1965' => '1965',
'1966' => '1966',
'1967' => '1967',
'1968' => '1968',
'1969' => '1969',
'1970' => '1970',
'1971' => '1971',
'1972' => '1972',
'1973' => '1973',
'1974' => '1974',
'1975' => '1975',
'1976' => '1976',
'1977' => '1977',
'1978' => '1978',
'1979' => '1979',
'1980' => '1980',
'1981' => '1981',
'1982' => '1982',
'1983' => '1983',
'1984' => '1984',
'1985' => '1985',
'1986' => '1986',
'1987' => '1987',
'1988' => '1988',
'1989' => '1989',
'1990' => '1990',
'1991' => '1991',
'1992' => '1992',
'1993' => '1993',
'1994' => '1994',
'1995' => '1995',
'1996' => '1996',
'1997' => '1997',
'1998' => '1998',
'1999' => '1999',
'2000' => '2000',
'2001' => '2001',
'2002' => '2002',
'2003' => '2003',
'2004' => '2004',
'2005' => '2005',
'2006' => '2006',
'2007' => '2007',
'2008' => '2008',
'2009' => '2009',
'2010' => '2010',
'2011' => '2011',
'2012' => '2012',
'2013' => '2013',
'2014' => '2014',
'2015' => '2015',
'2016' => '2016',
'2017' => '2017',
'2018' => '2018',
'2019' => '2019',
'2020' => '2020',
'2021' => '2021',
'2022' => '2022',
'2023' => '2023',
'2024' => '2024',
'2025' => '2025',
];
static $arrVideoClass = [
"dianying" => "电影",
"dianshiju" => "电视剧",
"zonyi" => "综艺",
"donman" => "动漫",
"duanju" => "短剧",
"dian-ying" => "电影",
"dian-shi-ju" => "电视剧",
"zong-yi" => "综艺",
"dong-man" => "动漫",
"duan-ju-da-quan" => "短剧",
];
// 'v_lang', # 视频的语言(如“中文”、“英语”)
// 'v_area', # 视频的地区(如“中国”、“美国”)
// 'v_year', # 视频的发行年份(如 2023
// 'v_lang', # 视频的语言(如“中文”、“英语”)
// 'v_area', # 视频的地区(如“中国”、“美国”)
// 'v_year', # 视频的发行年份(如 2023
/**
* getNovelCategoryFilter
@@ -127,6 +323,6 @@ class StaticConfig
*/
static function getVideoCategoryTypeFilter(string $strType): array
{
return VideoCategoryModel::getCustomCategory( $strType);
return VideoCategoryModel::getCustomCategory($strType);
}
}

View File

@@ -6,6 +6,7 @@ use app\model\CategoryModel;
use app\model\ChapterModel;
use app\model\ConverterMovel;
use app\model\DomainModel;
use app\model\VideoCategoryModel;
use app\model\VideoClicksModel;
use app\model\VideoModel;
use template\page\CusteomPage02;
@@ -77,18 +78,18 @@ class VideoService
}
/**
* 获取视频分类URl
*
* @param string|NULL $strCategory
* @param string|NULL $strClass
* @param string|NULL $strArea
* @param integer|string|NULL $strLang
* @param integer|string|NULL $strYear
* @param integer|string|NULL $strOrder
* @param integer|string|NULL $intPage
* @return string
*/
/**
* 获取视频分类URl
*
* @param string|NULL $strCategory
* @param string|NULL $strClass
* @param string|NULL $strArea
* @param integer|string|NULL $strLang
* @param integer|string|NULL $strYear
* @param integer|string|NULL $strOrder
* @param integer|string|NULL $intPage
* @return string
*/
public function getVideoCategoryUrl(string|NULL $strCategory, string|NULL $strClass, string|NULL $strArea, int|string|NULL $strLang, int|string|NULL $strYear, int|string|NULL $strOrder, int|string|NULL $intPage): string
{
$strKey = 'VIDEO_CATEGORY_URL';
@@ -184,11 +185,30 @@ class VideoService
$strSortType = (string)$arrParams['sort_type'] ?? '';
$strVStatus = (string) $arrParams['v_status'] ?? '';
$strVCategoryEn = (string) $arrParams['v_category_en'] ?? '';
$strVParentCategoryEn = (string) $arrParams['v_parent_category_en'] ?? '';
$strDiffKey = (string) $arrParams['diff_key'] ?? '';
$intCacheLifeTime = (int)$arrParams['cache_life'] ?? 0;
$arrFilter = [];
# v_category_en filter
$arrFilter['v_category_en'] = NULL;
if (!empty($strVCategoryEn)) {
if (key_exists($strVCategoryEn, VideoCategoryModel::$arrCategory)) {
$arrFilter['v_category_en'] = $strVCategoryEn;
}
}
# v_parent_category_en filter
$arrFilter['v_parent_category_en'] = NULL;
if (!empty($strVParentCategoryEn)) {
if (key_exists($strVParentCategoryEn, VideoCategoryModel::$arrCategory)) {
$arrFilter['v_parent_category_en'] = $strVParentCategoryEn;
}
}
# v_isend filter
if (!empty($strVStatus)) {
switch ($strVStatus) {
@@ -225,15 +245,18 @@ class VideoService
$strCacheKey = '';
$intLifeTime = 0;
# cache filter
if ($intCacheLifeTime > 0) {
$strCacheKey = sprintf(
'VideoService:getRankList:%s:%s:%s:%s:%s',
'VideoService:getRankList:%s:%s:%s:%s:%s:%s:%s',
$this->SiteContext->DomainModel->d_domain,
md5(serialize($arrFilter)),
md5(serialize($arrSort)),
$intCount,
$strDiffKey,
(string) $arrFilter['v_category_en'],
(string) $arrFilter['v_parent_category_en'],
);
$intLifeTime = $intLifeTime;
@@ -244,6 +267,8 @@ class VideoService
$intCount,
$arrSort['v_sort_type'] ?? 'daily',
$arrFilter['v_status'] ?? NULL,
$arrFilter['v_category_en'],
$arrFilter['v_parent_category_en'],
);
return $arrVideo;
@@ -259,20 +284,33 @@ class VideoService
public function getVideoList(array $arrParams): array
{
$intCount = (int)$arrParams['count'] ?? 10;
$strNCategory = $arrParams['v_category'] ?? '';
// $strVCategory = $arrParams['v_category'] ?? '';
$strSortType = (string)$arrParams['sort_type'] ?? '';
$strVStatus = (string) $arrParams['v_status'] ?? '';
$strDiffKey = (string) $arrParams['diff_key'] ?? '';
$intCacheLifeTime = (int)$arrParams['cache_life'] ?? 0;
$strVCategoryEn = (string) $arrParams['v_category_en'] ?? '';
$strVParentCategoryEn = (string) $arrParams['v_parent_category_en'] ?? '';
$strVLangEn = (string)$arrParams['v_lang_en'] ?? 'all';
$strVAreaEn = (string)$arrParams['v_area_en'] ?? 'all';
$strVYear = (string)$arrParams['v_year'] ?? 'all';
$arrFilter = [];
# v_category filter
if (!empty($strNCategory)) {
$strNCategory = CategoryModel::getZhByPinYin($strNCategory);
if ($strNCategory) {
$arrFilter['v_category'] = $strNCategory;
# v_category_en filter
if (!empty($strVCategoryEn)) {
if (key_exists($strVCategoryEn, VideoCategoryModel::$arrCategory)) {
$arrFilter['v_category_en'] = $strVCategoryEn;
}
}
# v_parent_category_en filter
if (!empty($strVParentCategoryEn)) {
if (key_exists($strVParentCategoryEn, VideoCategoryModel::$arrCategory)) {
$arrFilter['v_parent_category_en'] = $strVParentCategoryEn;
}
}
@@ -288,6 +326,32 @@ class VideoService
}
}
# v_lang_en filter
if (!empty($strVLangEn)) {
if (key_exists($strVLangEn, StaticConfig::$arrVideoLang) && $strVYear != 'all') {
$arrFilter['v_lang_en'] = $strVLangEn;
} else {
$arrParams['v_lang_en'] = 'all';
}
}
# v_area_en filter
if (!empty($strVAreaEn)) {
if (key_exists($strVAreaEn, StaticConfig::$arrVideoArea) && $strVYear != 'all') {
$arrFilter['v_area_en'] = $strVAreaEn;
} else {
$arrParams['v_area_en'] = 'all';
}
}
# v_year filter
if (!empty($strVYear)) {
if (key_exists($strVYear, StaticConfig::$arrVideoYear) && $strVYear != 'all') {
$arrFilter['v_year'] = $strVYear;
} else {
$arrParams['v_year'] = 'all';
}
}
$arrSort = [];
# sort filter
@@ -302,6 +366,9 @@ class VideoService
case 'update':
$arrSort['v_publish_date'] = -1;
break;
case 'piaofang':
$arrSort['v_box_office'] = -1;
break;
}
}
@@ -347,9 +414,8 @@ class VideoService
'limit' => (int)($arrParams['limit'] ?? 10),
'buttov_num' => (int)($arrParams['buttov_num'] ?? 0),
'v_class' => (string)($arrParams['v_class'] ?? ''),
'v_category' => (string)($arrParams['v_category'] ?? ''),
'v_lang' => (string)($arrParams['v_lang'] ?? ''),
'v_area' => (string)($arrParams['v_area'] ?? ''),
'v_lang_en' => (string)($arrParams['v_lang_en'] ?? ''),
'v_area_en' => (string)($arrParams['v_area_en'] ?? ''),
'v_year' => (string)($arrParams['v_year'] ?? ''),
'sort_type' => (string)($arrParams['sort_type'] ?? ''),
'v_isend' => (string)($arrParams['v_isend'] ?? ''),
@@ -357,14 +423,16 @@ class VideoService
'key' => (string)($arrParams['key'] ?? ''),
'cache_life' => (int)($arrParams['cache_life'] ?? 0),
'func' => (string)($arrParams['func']),
'v_category_en' => (string)($arrParams['v_category_en']),
'v_parent_category_en' => (string)($arrParams['v_parent_category_en']),
];
$intPage = $arrParams['page'];
$intLimit = $arrParams['limit'];
$strVClass = $arrParams['v_class'];
$strNCategory = $arrParams['v_category'];
$strVLang = $arrParams['v_lang'];
$strVArea = $arrParams['v_area'];
$strVParentCategory = $arrParams['v_parent_category_en'];
$strVCategoryEn = $arrParams['v_category_en'];
$strVLangEn = $arrParams['v_lang_en'];
$strVAreaEn = $arrParams['v_area_en'];
$strVYear = $arrParams['v_year'];
$strSortType = $arrParams['sort_type'];
$strVStatus = $arrParams['v_isend'];
@@ -382,13 +450,47 @@ class VideoService
'$and' => [],
];
# v_category filter
if (!empty($strNCategory)) {
$strNCategory = CategoryModel::getZhByPinYin($strNCategory);
if ($strNCategory) {
$arrFilter['$and'][] = ['v_category' => $strNCategory];
# v_lang_en filter
if (!empty($strVLangEn)) {
if (key_exists($strVLangEn, StaticConfig::$arrVideoLang) && $strVYear != 'all') {
$arrFilter['$and'][] = ['v_lang_en' => $strVLangEn];
} else {
$arrParams['v_category'] = 'all';
$arrParams['v_lang_en'] = 'all';
}
}
# v_area_en filter
if (!empty($strVAreaEn)) {
if (key_exists($strVAreaEn, StaticConfig::$arrVideoArea) && $strVYear != 'all') {
$arrFilter['$and'][] = ['v_area_en' => $strVAreaEn];
} else {
$arrParams['v_area_en'] = 'all';
}
}
# v_year filter
if (!empty($strVYear)) {
if (key_exists($strVYear, StaticConfig::$arrVideoYear) && $strVYear != 'all') {
$arrFilter['$and'][] = ['v_year' => $strVYear];
} else {
$arrParams['v_year'] = 'all';
}
}
# v_parent_category_en filter
if (!empty($strVParentCategory)) {
if (key_exists($strVParentCategory, VideoCategoryModel::$arrCategory)) {
$arrFilter['$and'][] = ['v_parent_category_en' => $strVParentCategory];
} else {
$arrParams['v_parent_category_en'] = 'all';
}
}
# v_category_en filter
if (!empty($strVCategoryEn)) {
if (key_exists($strVCategoryEn, VideoCategoryModel::$arrCategory)) {
$arrFilter['$and'][] = ['v_category_en' => $strVCategoryEn];
} else {
$arrParams['v_category_en'] = 'all';
}
}
@@ -437,6 +539,9 @@ class VideoService
case 'update':
$arrSort['v_publish_date'] = -1;
break;
case 'piaofang':
$arrSort['v_box_office'] = -1;
break;
default:
$arrParams['sort_type'] = 'all';
break;
@@ -462,11 +567,11 @@ class VideoService
}
// 更新值
ConverterMovel::setVal([
'intPage' => $intPage,
'strVideoClassName' => empty($strVClass) ? '' : StaticConfig::$arrVideoClass[$strVClass],
'strVideoCategoryName' => empty($strNCategory) ? '' : str_replace("视频", "", $strNCategory),
// 'strVideoClassName' => empty($strVClass) ? '' : StaticConfig::$arrVideoClass[$strVClass],
'strVideoCategoryName' => empty($strVCategory) ? '' : str_replace("视频", "", $strVCategory),
'strVideoStatus' => empty($strVStatus) ? '' : StaticConfig::$arrVideoStatus[$strVStatus],
'strVideoOrder' => empty($strSortType) ? '' : StaticConfig::$arrVideoSortType[$strSortType],
'strSearchKeywords' => $strKey,
@@ -517,7 +622,7 @@ class VideoService
return $arrPaginator;
}
/**
* 分类定制分页
*
@@ -539,11 +644,10 @@ class VideoService
$intPage = $arrVideo['page'];
$intLimit = $arrVideo['limit'];
$intButtomNum = $arrParams['buttov_num'];
$strBaseUrl = app(VideoService::class)->getVideoCategoryUrl($strCategory,$strClass,$strArea,$strLang,$strYear,$strOrder ,'{page}');
$strBaseUrl = app(VideoService::class)->getVideoCategoryUrl($strCategory, $strClass, $strArea, $strLang, $strYear, $strOrder, '{page}');
$arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);
return $arrPaginator;
}