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

@@ -46,6 +46,7 @@ Route::group("/novel", function () {
Route::group("/video", function () {
Route::get("/list", [Video::class, "getVideoList"])->name("Domain@getVideoList");
Route::post("/level/set", [Video::class, "updateVideoLevel"])->name("Video@updateVideoLevel");
Route::post("/boxoffice/set", [Video::class, "updateBoxOffice"])->name("Video@updateBoxOffice");
Route::get("/category/list", [Video::class, "getCategory"])->name("Video@getCategory");
})->middleware(AdminAuth::class);

View File

@@ -14,9 +14,37 @@ use think\Response;
class Video extends BaseController
{
/**
* 根据关键词修改视频票房
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
* @return Response
*/
public function updateBoxOffice(Request $Request, ?AdminUserModel $AdminUserModel)
{
$arrData = [
"keywords" => $Request->post('keywords'),
"v_box_office" => (float)$Request->post('v_box_office'),
];
$arrRule = [
'keywords' => 'require',
'v_box_office' => 'require',
];
$this->validate($arrData, $arrRule);
$arrKeywords = explode(',', $arrData['keywords']);
$arrUpdate = ['v_box_office' => $arrData['v_box_office']];
$VideoModel = VideoModel::getInstance();
$VideoModel->updateByKeywords($arrKeywords, $arrUpdate);
return $this->success();
}
/**
* 根据关键词修改小说评级
* 根据关键词修改视频评级
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
@@ -37,13 +65,15 @@ class Video extends BaseController
$this->validate($arrData, $arrRule);
$arrKeywords = explode(',', $arrData['keywords']);
$arrUpdate = ['v_level' => $arrData['v_level']];
$VideoModel = VideoModel::getInstance();
$VideoModel->updateByKeywords($arrKeywords, $arrData['v_level']);
$VideoModel->updateByKeywords($arrKeywords, $arrUpdate);
return $this->success();
}
/**
* 小说分页
* 视频分页
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel

View File

@@ -15,19 +15,27 @@ Route::post("/publish", [Statis::class, 'publish'])
->name('Statis@publish');
Route::get("/search", [Novel::class, 'search'])
// Route::get("/search", [Novel::class, 'search'])
// ->middleware(\think\middleware\Throttle::class, [
// 'visit_rate' => '1/m',
// 'key' => '__CONTROLLER__/__ACTION__/__IP__',
// ])
// ->name('Novel@search');
Route::post("/publishv", [Statis::class, 'publishV'])
// ->middleware(\think\middleware\Throttle::class, [
// 'visit_rate' => '1/m',
// 'key' => '__CONTROLLER__/__ACTION__/__IP__',
// ])
->name('Novel@search');;
->name('Statis@publishV');
Route::get("/test", [Statis::class, 'test'])
Route::get("/test0909", [Statis::class, 'test0909'])
// ->middleware(\think\middleware\Throttle::class, [
// 'visit_rate' => '1/m',
// 'key' => '__CONTROLLER__/__ACTION__/__IP__',
// ])
->name('Statis@test');
->name('Statis@test0909');

View File

@@ -8,6 +8,7 @@ use app\api\BaseController;
use app\model\CategoryModel;
use app\model\NovelClicksModel;
use app\model\NovelModel;
use app\model\VideoClicksModel;
use DateTime;
use db\mongo\MongoBase;
use ddl\DDLManage;
@@ -41,4 +42,118 @@ class Statis extends BaseController
return Response::create()->code(204);
}
/**
* novel statis
*
* @param Request $Request
* @return Response
*/
public function publishV(Request $Request): Response
{
$intNId = $Request->post('v_id/d');
if ($intNId <= 0) {
return Response::create('非法请求!')->code(400);
}
$NovelClicksModel = VideoClicksModel::getInstance();
try {
$NovelClicksModel->addStatis($intNId);
} catch (\Exception $e) {
// throw $e;
}
return Response::create()->code(204);
}
public function test0909()
{
$a = [
'Hindi',
'Malay',
'Swahili',
'Tamil',
'上海',
'丹麦语',
'乌克兰',
'乌尔都语',
'他加',
'俄语',
'其它',
'匈牙利语',
'北印度语',
'印地语',
'印地语Hindi',
'印尼语',
'印度尼西亚语',
'印度语',
'印度语Hindi',
'因纽特语',
'国语',
'土库曼语',
'土耳',
'土耳其语',
'基库尤语',
'希腊',
'希腊语',
'库尔德语',
'德语',
'意大',
'意大利',
'意大利语',
'挪威语',
'捷克语',
'日语',
'普通话',
'林加拉语',
'毛利语',
'汉语',
'汉语普通',
'汉语普通话',
'汉语普通话Manda',
'河南方言',
'法语',
'波兰语',
'波斯语',
'泰卢固语',
'泰米尔',
'泰米尔语',
'泰米尔语Tamil',
'泰语',
'澳大利亚语',
'瑞典语',
'粤语',
'美国手语',
'英语',
'英语手语',
'荷兰语',
'菲律宾语',
'葡萄',
'葡萄牙语',
'藏语',
'西班',
'西班牙语',
'越南语',
'闽南语',
'阿拉',
'阿拉伯',
'阿拉伯语',
'韩语',
'马拉雅拉姆语',
'马来西亚语',
'马来语'
];
$arrArea = [];
foreach ($a as $v) {
$arrArea[zhToPinYin($v)] = $v;
}
echo '<pre>';
krsort($arrArea);
echo var_export($arrArea, true);
}
}

View File

@@ -1,23 +1,23 @@
<pre>
{video:ranklist count="10" sort_type="total" n_status="wanjie" d_key="d_key" d_val="video" cache_life="1000"}
<!-- {video:ranklist count="10" sort_type="total" v_status="wanjie" d_key="d_key" d_val="video" cache_life="1000" diff_key="fdasfads"}
<li>
{php}var_dump($video){/php}
章节名称: {$video.v_name}
章节序号: {$video.v_category}
</li>
{/video:ranklist}
{/video:ranklist} -->
<!-- {video:pager page="1" limit="10" d_key="d_key" d_val="video" cache_life="1000" button_num="3" v_category="动作片" v_status="wanjie" sort_type="update" p_val="page_data" func="generateVideoPager"}
{video:pager page="1" limit="10" d_key="d_key" d_val="video" cache_life="1000" button_num="3" v_category_en="动作片" v_status="wanjie" sort_type="update" p_val="page_data" func="generateVideoPager"}
<li>
Index: {$d_key}
章节名称: {$video.v_name}
章节序号: {$video.v_category}
</li>
{/video:pager}
{php}var_dump($page_data);{/php} -->
<!-- {php}var_dump($page_data);{/php} -->
<!--
{video:list count="10" v_category="动作片" v_status="wanjie" sort_type="update" d_key="d_key" d_val="video" cache_life="1000" }
@@ -28,7 +28,7 @@
</li>
{/video:list} -->
<!-- {video:info v_id="12" v_key="aaa" /}
<!-- {video:info v_id="124793" v_key="aaa" /}
{php}print_r($aaa);{/php} -->
<!-- {video:ranksort d_key="key" d_val="val"}

View File

@@ -32,7 +32,7 @@ class VideoCategoryModel extends MongoModel
static $arrCategoryTypeONE = [
[
"v_category" => "电影",
"v_category_en" => "dianying",
"v_category_en" => 'dian-ying',
"children" => [
[
"v_category_en" => "dong-zuo-pian",
@@ -88,7 +88,7 @@ class VideoCategoryModel extends MongoModel
],
[
"v_category" => "电视剧",
"v_category_en" => "dianshiju",
"v_category_en" =>'dian-shi-ju',
"children" => [
[
"v_category_en" => "guo-chan-ju",
@@ -134,7 +134,7 @@ class VideoCategoryModel extends MongoModel
],
[
"v_category" => "综艺",
"v_category_en" => "zonyi",
"v_category_en" => 'zong-yi',
"children" => [
[
"v_category_en" => "da-lu-zong-yi",
@@ -160,7 +160,7 @@ class VideoCategoryModel extends MongoModel
],
[
"v_category" => "动漫",
"v_category_en" => "donman",
"v_category_en" => 'dong-man',
"children" => [
[
"v_category_en" => "guo-chan-dong-man",
@@ -191,7 +191,7 @@ class VideoCategoryModel extends MongoModel
],
[
"v_category" => "短剧",
"v_category_en" => "duanju",
"v_category_en" => 'duan-ju-da-quan',
"children" => [
[
"v_category_en" => "duan-ju-da-quan",

View File

@@ -39,12 +39,12 @@ class VideoClicksModel extends MongoModel
public function addStatis(int $intVId)
{
$NovelModel = NovelModel::getInstance();
$Novel = $NovelModel->getCol()->findOne([
$VideoModel = VideoModel::getInstance();
$Video = $VideoModel->getCol()->findOne([
"v_id" => $intVId,
]);
if (empty($Novel)) {
if (empty($Video)) {
return false;
}
@@ -70,6 +70,10 @@ class VideoClicksModel extends MongoModel
],
[
'$inc' => ['vc_clicks' => 1],
'$set' => [
'v_category' => $Video->v_category,
'v_parent_category' => $Video->v_parent_category
],
],
[
'upsert' => true

View File

@@ -49,10 +49,10 @@ class VideoModel extends MongoModel
/**
* 根据关键词数组更新小说推荐等级
* @param array $arrKeywords 关键词数组,例如 ["斗罗", "遮天", "凡人"]
* @param int $intLevel 推荐等级1~9例如 3
* @param array 待修改的字段
* @return array 更新结果
*/
public function updateByKeywords(array $arrKeywords, int $intLevel)
public function updateByKeywords(array $arrKeywords, array $arrUpdate)
{
if (empty($arrKeywords)) {
return false;
@@ -65,7 +65,7 @@ class VideoModel extends MongoModel
$UpdateResult = $this->getCol()->updateMany(
['$or' => $arrConditions],
['$set' => ['v_level' => $intLevel]]
['$set' => $arrUpdate]
);
$UpdateResult->getModifiedCount();
@@ -236,7 +236,7 @@ class VideoModel extends MongoModel
int $intLifeTime = 24 * 3600,
): array {
try {
$arrResult = $this->checkCacheByKey($strKey);
if ($arrResult !== NULL) {
return $arrResult;
@@ -409,8 +409,14 @@ class VideoModel extends MongoModel
* * total 总
* @return array
*/
public function getRankVideoOnCache(string $strKey, int $intCount = 10, $strDateType = 'daily', $strStatus = NULL): array
{
public function getRankVideoOnCache(
string $strKey,
int $intCount = 10,
$strDateType = 'daily',
$strStatus = NULL,
$strVCategoryEn = NULL,
$strVParentCategoryEn = NULL,
): array {
try {
$intLifeTime = 24 * 3600;
@@ -418,17 +424,26 @@ class VideoModel extends MongoModel
if ($arrResult !== NULL) {
return $arrResult;
}
$arrFilter = [
'nc_type' => $strDateType,
'vc_type' => $strDateType,
];
if ($strStatus !== NULL) {
$arrFilter['v_status'] = $strStatus;
}
if ($strVCategoryEn !== NULL) {
$arrFilter['v_category_en'] = $strVCategoryEn;
}
if ($strVParentCategoryEn !== NULL) {
$arrFilter['v_parent_category_en'] = $strVParentCategoryEn;
}
$arrOptions = [
'sort' => ['nc_clicks' => -1],
'sort' => ['vc_clicks' => -1],
'limit' => $intCount * 3,
'projection' => [
'v_id' => 1,
@@ -466,8 +481,4 @@ class VideoModel extends MongoModel
return [];
}
}
}

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;
}

View File

@@ -80,6 +80,9 @@ class Scheduler
// 'data' => $arrVSourceId,
// ];
// $this->QueueManage->set($arrTask);
// $this->fetchVideo($arrVSourceId);
// return;
$Site = $this->getSite();

View File

@@ -154,6 +154,18 @@ class Site
$arrContent = json_decode($strContent, true);
$arrFilter = $arrContent['class'];
// print_r($arrFilter);
// $arrA = [];
// foreach ($arrFilter as $b) {
// $arrA[$b['type_id']] = [
// 'name' => $b['type_name'],
// 'pinyin' => zhToPinYin($b['type_name']),
// ];
// }
// print_r($arrA);
$arrCategory = [];
foreach ($arrFilter as $intKey => $arrItem) {

View File

@@ -0,0 +1,147 @@
<?php
declare(strict_types=1);
namespace app\task\crawler\fengchao\page;
class VideoCategory
{
static $arrCategory = [
1 => [
'name' => '电影',
'pinyin' => 'dian-ying',
],
2 => [
'name' => '电视剧',
'pinyin' => 'dian-shi-ju',
],
3 => [
'name' => '综艺',
'pinyin' => 'zong-yi',
],
4 => [
'name' => '动漫',
'pinyin' => 'dong-man',
],
6 => [
'name' => '动作片',
'pinyin' => 'dong-zuo-pian',
],
7 => [
'name' => '喜剧片',
'pinyin' => 'xi-ju-pian',
],
8 => [
'name' => '爱情片',
'pinyin' => 'ai-qing-pian',
],
9 => [
'name' => '科幻片',
'pinyin' => 'ke-huan-pian',
],
10 => [
'name' => '恐怖片',
'pinyin' => 'kong-bu-pian',
],
11 => [
'name' => '剧情片',
'pinyin' => 'ju-qing-pian',
],
12 => [
'name' => '战争片',
'pinyin' => 'zhan-zheng-pian',
],
13 => [
'name' => '国产剧',
'pinyin' => 'guo-chan-ju',
],
14 => [
'name' => '欧美剧',
'pinyin' => 'ou-mei-ju',
],
15 => [
'name' => '韩剧',
'pinyin' => 'han-ju',
],
16 => [
'name' => '日剧',
'pinyin' => 'ri-ju',
],
17 => [
'name' => '港剧',
'pinyin' => 'gang-ju',
],
18 => [
'name' => '台剧',
'pinyin' => 'tai-ju',
],
19 => [
'name' => '泰剧',
'pinyin' => 'tai-ju',
],
20 => [
'name' => '纪录片',
'pinyin' => 'ji-lu-pian',
],
23 => [
'name' => '海外剧',
'pinyin' => 'hai-wai-ju',
],
25 => [
'name' => '大陆综艺',
'pinyin' => 'da-lu-zong-yi',
],
26 => [
'name' => '日韩综艺',
'pinyin' => 'ri-han-zong-yi',
],
27 => [
'name' => '港台综艺',
'pinyin' => 'gang-tai-zong-yi',
],
28 => [
'name' => '欧美综艺',
'pinyin' => 'ou-mei-zong-yi',
],
29 => [
'name' => '国产动漫',
'pinyin' => 'guo-chan-dong-man',
],
30 => [
'name' => '日韩动漫',
'pinyin' => 'ri-han-dong-man',
],
31 => [
'name' => '欧美动漫',
'pinyin' => 'ou-mei-dong-man',
],
39 => [
'name' => '动画片',
'pinyin' => 'dong-hua-pian',
],
44 => [
'name' => '港台动漫',
'pinyin' => 'gang-tai-dong-man',
],
45 => [
'name' => '海外动漫',
'pinyin' => 'hai-wai-dong-man',
],
47 => [
'name' => '演唱会',
'pinyin' => 'yan-chang-hui',
],
55 => [
'name' => '伦理',
'pinyin' => 'lun-li',
],
62 => [
'name' => '4K电影',
'pinyin' => 'dian-ying',
],
70 => [
'name' => '邵氏电影',
'pinyin' => 'shao-shi-dian-ying',
],
];
}

View File

@@ -6,7 +6,6 @@ namespace app\task\crawler\fengchao\page;
use app\model\CountersModel;
use app\model\VideoModel;
use storage\StorageCore;
class VideoInfoPage extends BasePage
{
@@ -84,19 +83,41 @@ class VideoInfoPage extends BasePage
];
}
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
$arrVideo['vod_lang'] = trim($arrVideo['vod_lang']);
$arrVideo['vod_area'] = trim($arrVideo['vod_area']);
$arrVideo['vod_play_url'][$this->getsite()->getSiteCode()] = $arrPlayUrl;
$arrVideo['vod_actor'] = $arrVideo['vod_actor'] === '' ? [] : explode(',', $arrVideo['vod_actor']);
$arrVideo['vod_director'] = $arrVideo['vod_director'] === '' ? [] : explode(',', $arrVideo['vod_director']);
$arrVideo['vod_class'] = $arrVideo['vod_class'] === '' ? [] : explode(',', $arrVideo['vod_class']);
$arrVideo['vod_lang'] = $arrVideo['vod_lang'] === '' ? [] : explode(',', $arrVideo['vod_lang']);
$arrVideo['vod_area'] = $arrVideo['vod_area'] === '' ? [] : explode(',', $arrVideo['vod_area']);
$arrVideo['vod_lang_en'] = $arrVideo['vod_area_en'] = [];
foreach ($arrVideo['vod_lang'] as $strVal) {
$arrVideo['vod_lang_en'][] = zhToPinYin($strVal);
}
foreach ($arrVideo['vod_area'] as $strVal) {
$arrVideo['vod_area_en'][] = zhToPinYin($strVal);
}
$arrVideo['vod_content'] = strip_tags($arrVideo['vod_content']);
$arrVideo['vod_content'] = trim($arrVideo['vod_content']);
$arrVideo['vod_content'] = mb_rtrim($arrVideo['vod_content'], '\ ');
$arrVideo['vod_content'] = ensureUtf8($arrVideo['vod_content']);
$arrVideo['v_category'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['name'];
$arrVideo['v_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['pinyin'];
$arrVideo['v_parent_category'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['name'];
$arrVideo['v_parent_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['pinyin'];
foreach ($arrVideo as $strKey => $mixedVal) {
$strKey = str_replace('vod', 'v', $strKey);
@@ -165,15 +186,19 @@ class VideoInfoPage extends BasePage
'v_id' => CountersModel::getInstance()->getNextSequence('video'),
'v_name' => $arrPageVideo['v_name'],
'v_name_en' => zhToPinYin($arrPageVideo['v_name']),
'v_parent_category' => $arrPageVideo['v_parent_category'],
'v_parent_category_en' => $arrPageVideo['v_parent_category_en'],
'v_category' => $arrPageVideo['v_category'],
'v_category_en' => zhToPinYin($arrPageVideo['v_category']),
'v_category_en' => $arrPageVideo['v_category_en'],
'v_actor' => $arrPageVideo['v_actor'],
'v_director' => $arrPageVideo['v_director'],
'v_class' => $arrPageVideo['v_class'],
'v_letter' => $arrPageVideo['v_letter'],
'v_pic' => '',
'v_lang' => $arrPageVideo['v_lang'],
'v_lang_en' => $arrPageVideo['v_lang_en'],
'v_area' => $arrPageVideo['v_area'],
'v_area_en' => $arrPageVideo['v_area_en'],
'v_year' => $arrPageVideo['v_year'],
'v_remarks' => $arrPageVideo['v_remarks'],
'v_isend' => $arrPageVideo['v_isend'],

View File

@@ -80,10 +80,10 @@ class Scheduler
// 'data' => $arrVSourceId,
// ];
// $this->QueueManage->set($arrTask);
// $this->fetchVideo($arrVSourceId);
// return;
$Site = $this->getSite();
$arrAllCategory = $Site->getCategory();
// print_r($arrAllCategory);

View File

@@ -154,6 +154,17 @@ class Site
$arrContent = json_decode($strContent, true);
$arrFilter = $arrContent['class'];
// print_r($arrFilter);
// $arrA = [];
// foreach ($arrFilter as $b) {
// $arrA[$b['type_id']] = [
// 'name' => $b['type_name'],
// 'pinyin' => zhToPinYin($b['type_name']),
// ];
// }
// print_r($arrA);
$arrCategory = [];
foreach ($arrFilter as $intKey => $arrItem) {

View File

@@ -0,0 +1,155 @@
<?php
declare(strict_types=1);
namespace app\task\crawler\wuxian\page;
class VideoCategory
{
static $arrCategory = [
1 => [
'name' => '电影',
'pinyin' => 'dian-ying',
],
2 => [
'name' => '电视剧',
'pinyin' => 'dian-shi-ju',
],
3 => [
'name' => '综艺',
'pinyin' => 'zong-yi',
],
4 => [
'name' => '动漫',
'pinyin' => 'dong-man',
],
6 => [
'name' => '动作片',
'pinyin' => 'dong-zuo-pian',
],
7 => [
'name' => '喜剧片',
'pinyin' => 'xi-ju-pian',
],
8 => [
'name' => '爱情片',
'pinyin' => 'ai-qing-pian',
],
9 => [
'name' => '科幻片',
'pinyin' => 'ke-huan-pian',
],
10 => [
'name' => '恐怖片',
'pinyin' => 'kong-bu-pian',
],
11 => [
'name' => '剧情片',
'pinyin' => 'ju-qing-pian',
],
12 => [
'name' => '战争片',
'pinyin' => 'zhan-zheng-pian',
],
13 => [
'name' => '国产剧',
'pinyin' => 'guo-chan-ju',
],
14 => [
'name' => '欧美剧',
'pinyin' => 'ou-mei-ju',
],
15 => [
'name' => '韩剧',
'pinyin' => 'han-ju',
],
16 => [
'name' => '日剧',
'pinyin' => 'ri-ju',
],
17 => [
'name' => '港剧',
'pinyin' => 'gang-ju',
],
18 => [
'name' => '台剧',
'pinyin' => 'tai-ju',
],
19 => [
'name' => '泰剧',
'pinyin' => 'tai-ju',
],
20 => [
'name' => '纪录片',
'pinyin' => 'ji-lu-pian',
],
23 => [
'name' => '海外剧',
'pinyin' => 'hai-wai-ju',
],
25 => [
'name' => '大陆综艺',
'pinyin' => 'da-lu-zong-yi',
],
26 => [
'name' => '日韩综艺',
'pinyin' => 'ri-han-zong-yi',
],
27 => [
'name' => '港台综艺',
'pinyin' => 'gang-tai-zong-yi',
],
28 => [
'name' => '欧美综艺',
'pinyin' => 'ou-mei-zong-yi',
],
29 => [
'name' => '国产动漫',
'pinyin' => 'guo-chan-dong-man',
],
30 => [
'name' => '日韩动漫',
'pinyin' => 'ri-han-dong-man',
],
31 => [
'name' => '欧美动漫',
'pinyin' => 'ou-mei-dong-man',
],
39 => [
'name' => '动画片',
'pinyin' => 'dong-hua-pian',
],
44 => [
'name' => '港台动漫',
'pinyin' => 'gang-tai-dong-man',
],
45 => [
'name' => '海外动漫',
'pinyin' => 'hai-wai-dong-man',
],
47 => [
'name' => '演唱会',
'pinyin' => 'yan-chang-hui',
],
48 => [
'name' => '体育赛事',
'pinyin' => 'ti-yu-sai-shi',
],
49 => [
'name' => '篮球',
'pinyin' => 'lan-qiu',
],
50 => [
'name' => '足球',
'pinyin' => 'zu-qiu',
],
52 => [
'name' => '斯诺克',
'pinyin' => 'si-nuo-ke',
],
55 => [
'name' => '伦理',
'pinyin' => 'lun-li',
],
];
}

View File

@@ -84,19 +84,46 @@ class VideoInfoPage extends BasePage
];
}
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
$arrVideo['vod_lang'] = trim($arrVideo['vod_lang']);
$arrVideo['vod_area'] = trim($arrVideo['vod_area']);
$arrVideo['vod_play_url'][$this->getsite()->getSiteCode()] = $arrPlayUrl;
$arrVideo['vod_actor'] = $arrVideo['vod_actor'] === '' ? [] : explode(',', $arrVideo['vod_actor']);
$arrVideo['vod_director'] = $arrVideo['vod_director'] === '' ? [] : explode(',', $arrVideo['vod_director']);
$arrVideo['vod_class'] = $arrVideo['vod_class'] === '' ? [] : explode(',', $arrVideo['vod_class']);
$arrVideo['vod_lang'] = $arrVideo['vod_lang'] === '' ? [] : explode(',', $arrVideo['vod_lang']);
$arrVideo['vod_area'] = $arrVideo['vod_area'] === '' ? [] : explode(',', $arrVideo['vod_area']);
$arrVideo['vod_lang_en'] = $arrVideo['vod_area_en'] = [];
foreach ($arrVideo['vod_lang'] as $strVal) {
$arrVideo['vod_lang_en'][] = zhToPinYin($strVal);
}
foreach ($arrVideo['vod_area'] as $strVal) {
$arrVideo['vod_area_en'][] = zhToPinYin($strVal);
}
$arrVideo['vod_content'] = strip_tags($arrVideo['vod_content']);
$arrVideo['vod_content'] = trim($arrVideo['vod_content']);
$arrVideo['vod_content'] = mb_rtrim($arrVideo['vod_content'], '\ ');
$arrVideo['vod_content'] = ensureUtf8($arrVideo['vod_content']);
$arrVideo['v_category'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['name'];
$arrVideo['v_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['pinyin'];
$arrVideo['v_parent_category'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['name'];
$arrVideo['v_parent_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['pinyin'];
// 'v_lang' => $arrPageVideo['v_lang'],
// 'v_lang_en' => zhToPinYin($arrPageVideo['v_lang']),
// 'v_area' => $arrPageVideo['v_area'],
// 'v_area_en' => zhToPinYin($arrPageVideo['v_area']),
foreach ($arrVideo as $strKey => $mixedVal) {
$strKey = str_replace('vod', 'v', $strKey);
@@ -165,15 +192,19 @@ class VideoInfoPage extends BasePage
'v_id' => CountersModel::getInstance()->getNextSequence('video'),
'v_name' => $arrPageVideo['v_name'],
'v_name_en' => zhToPinYin($arrPageVideo['v_name']),
'v_parent_category' => $arrPageVideo['v_parent_category'],
'v_parent_category_en' => $arrPageVideo['v_parent_category_en'],
'v_category' => $arrPageVideo['v_category'],
'v_category_en' => zhToPinYin($arrPageVideo['v_category']),
'v_category_en' => $arrPageVideo['v_category_en'],
'v_actor' => $arrPageVideo['v_actor'],
'v_director' => $arrPageVideo['v_director'],
'v_class' => $arrPageVideo['v_class'],
'v_letter' => $arrPageVideo['v_letter'],
'v_pic' => '',
'v_lang' => $arrPageVideo['v_lang'],
'v_lang_en' => $arrPageVideo['v_lang_en'],
'v_area' => $arrPageVideo['v_area'],
'v_area_en' => $arrPageVideo['v_area_en'],
'v_year' => $arrPageVideo['v_year'],
'v_remarks' => $arrPageVideo['v_remarks'],
'v_isend' => $arrPageVideo['v_isend'],

View File

@@ -74,18 +74,23 @@ class Scheduler
*/
public function crawlFull()
{
// $arrVSourceId = [['v_source_id' => 14256]];
// $arrVSourceId = [['v_source_id' => 66471]];
// $arrTask = [
// 'callback' => [static::class, 'fetchVideo'],
// 'data' => $arrVSourceId,
// ];
// $this->QueueManage->set($arrTask);
// $this->fetchVideo($arrVSourceId);
// return;
$Site = $this->getSite();
$arrAllCategory = $Site->getCategory();
// print_r($arrAllCategory);
// return;
$intLimit = 5;
$arrTask = [
@@ -184,7 +189,7 @@ class Scheduler
$arrPic[] = $arrPicItem;
}
}
if ($arrPic) {
$Site->downRemoteImgToLocal($arrPic);
}

View File

@@ -146,7 +146,7 @@ class Site
*/
public function getCategory(): array
{
$strUri = '/inc/api_mac10.php?ac=list&t=1&page=1';
$strUri = '/inc/api_mac10.php?ac=list&t=19&page=11';
$Response = $this->getClient()->get($strUri);
$strContent = $Response->getBody()->getContents();
@@ -154,6 +154,17 @@ class Site
$arrContent = json_decode($strContent, true);
$arrFilter = $arrContent['class'];
// print_r($arrContent);
// $arrA = [];
// foreach ($arrFilter as $b) {
// $arrA[$b['type_id']] = [
// 'name' => $b['type_name'],
// 'pinyin' => zhToPinYin($b['type_name']),
// ];
// }
// print_r($arrA);
$arrCategory = [];
foreach ($arrFilter as $intKey => $arrItem) {

View File

@@ -0,0 +1,214 @@
<?php
declare(strict_types=1);
namespace app\task\crawler\youzhi\page;
class VideoCategory
{
static $arrCategory = [
1 => [
'name' => '电影',
'pinyin' => 'dian-ying',
],
2 => [
'name' => '连续剧',
'pinyin' => 'lian-xu-ju',
],
3 => [
'name' => '综艺',
'pinyin' => 'zong-yi',
],
4 => [
'name' => '动漫',
'pinyin' => 'dong-man',
],
5 => [
'name' => '动作片',
'pinyin' => 'dong-zuo-pian',
],
6 => [
'name' => '喜剧片',
'pinyin' => 'xi-ju-pian',
],
7 => [
'name' => '爱情片',
'pinyin' => 'ai-qing-pian',
],
8 => [
'name' => '科幻片',
'pinyin' => 'ke-huan-pian',
],
9 => [
'name' => '恐怖片',
'pinyin' => 'kong-bu-pian',
],
10 => [
'name' => '剧情片',
'pinyin' => 'ju-qing-pian',
],
11 => [
'name' => '战争片',
'pinyin' => 'zhan-zheng-pian',
],
12 => [
'name' => '国产剧',
'pinyin' => 'guo-chan-ju',
],
13 => [
'name' => '台湾剧',
'pinyin' => 'tai-wan-ju',
],
14 => [
'name' => '韩国剧',
'pinyin' => 'han-guo-ju',
],
15 => [
'name' => '欧美剧',
'pinyin' => 'ou-mei-ju',
],
16 => [
'name' => '香港剧',
'pinyin' => 'xiang-gang-ju',
],
17 => [
'name' => '泰国剧',
'pinyin' => 'tai-guo-ju',
],
18 => [
'name' => '日本剧',
'pinyin' => 'ri-ben-ju',
],
19 => [
'name' => '福利',
'pinyin' => 'fu-li',
],
20 => [
'name' => '记录片',
'pinyin' => 'ji-lu-pian',
],
41 => [
'name' => '动画片',
'pinyin' => 'dong-hua-pian',
],
54 => [
'name' => '海外剧',
'pinyin' => 'hai-wai-ju',
],
61 => [
'name' => '?理片',
'pinyin' => 'lun-li-pian',
],
62 => [
'name' => '大陆综艺',
'pinyin' => 'da-lu-zong-yi',
],
63 => [
'name' => '港台综艺',
'pinyin' => 'gang-tai-zong-yi',
],
64 => [
'name' => '日韩综艺',
'pinyin' => 'ri-han-zong-yi',
],
65 => [
'name' => '欧美综艺',
'pinyin' => 'ou-mei-zong-yi',
],
66 => [
'name' => '国产动漫',
'pinyin' => 'guo-chan-dong-man',
],
67 => [
'name' => '日韩动漫',
'pinyin' => 'ri-han-dong-man',
],
68 => [
'name' => '欧美动漫',
'pinyin' => 'ou-mei-dong-man',
],
69 => [
'name' => '港台动漫',
'pinyin' => 'gang-tai-dong-man',
],
70 => [
'name' => '海外动漫',
'pinyin' => 'hai-wai-dong-man',
],
78 => [
'name' => '搞笑',
'pinyin' => 'gao-xiao',
],
79 => [
'name' => '音乐',
'pinyin' => 'yin-le',
],
80 => [
'name' => '影视',
'pinyin' => 'ying-shi',
],
81 => [
'name' => '汽车',
'pinyin' => 'qi-che',
],
83 => [
'name' => '短剧大全',
'pinyin' => 'duan-ju-da-quan',
],
92 => [
'name' => '预告片',
'pinyin' => 'yu-gao-pian',
],
93 => [
'name' => '预告片',
'pinyin' => 'yu-gao-pian',
],
94 => [
'name' => '体育',
'pinyin' => 'ti-yu',
],
];
static public $arrParent = [
1 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
20 => 1,
41 => 1,
61 => 1,
92 => 1,
2 => 2,
12 => 2,
13 => 2,
14 => 2,
15 => 2,
16 => 2,
17 => 2,
18 => 2,
54 => 2,
93 => 2,
3 => 3,
62 => 3,
63 => 3,
64 => 3,
65 => 3,
4 => 4,
66 => 4,
67 => 4,
68 => 4,
69 => 4,
70 => 4,
19 => 19,
83 => 83,
94 => 94,
];
}

View File

@@ -69,6 +69,7 @@ class VideoInfoPage extends BasePage
$arrVideo = json_decode($this->getContent(), true);
$arrVideo = $arrVideo['list'][0];
// print_r($arrVideo);
$strPlayUrl = $arrVideo['vod_play_url'];
@@ -84,19 +85,43 @@ class VideoInfoPage extends BasePage
];
}
$arrVideo['type_id_1'] = VideoCategory::$arrParent[$arrVideo['type_id']];
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
$arrVideo['vod_lang'] = trim($arrVideo['vod_lang']);
$arrVideo['vod_area'] = trim($arrVideo['vod_area']);
$arrVideo['vod_play_url'][$this->getsite()->getSiteCode()] = $arrPlayUrl;
$arrVideo['vod_actor'] = $arrVideo['vod_actor'] === '' ? [] : explode(',', $arrVideo['vod_actor']);
$arrVideo['vod_director'] = $arrVideo['vod_director'] === '' ? [] : explode(',', $arrVideo['vod_director']);
$arrVideo['vod_class'] = $arrVideo['vod_class'] === '' ? [] : explode(',', $arrVideo['vod_class']);
$arrVideo['vod_lang'] = $arrVideo['vod_lang'] === '' ? [] : explode(',', $arrVideo['vod_lang']);
$arrVideo['vod_area'] = $arrVideo['vod_area'] === '' ? [] : explode(',', $arrVideo['vod_area']);
$arrVideo['vod_lang_en'] = $arrVideo['vod_area_en'] = [];
foreach ($arrVideo['vod_lang'] as $strVal) {
$arrVideo['vod_lang_en'][] = zhToPinYin($strVal);
}
foreach ($arrVideo['vod_area'] as $strVal) {
$arrVideo['vod_area_en'][] = zhToPinYin($strVal);
}
$arrVideo['vod_content'] = strip_tags($arrVideo['vod_content']);
$arrVideo['vod_content'] = trim($arrVideo['vod_content']);
$arrVideo['vod_content'] = mb_rtrim($arrVideo['vod_content'], '\ ');
$arrVideo['vod_content'] = ensureUtf8($arrVideo['vod_content']);
$arrVideo['v_category'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['name'];
$arrVideo['v_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['pinyin'];
$arrVideo['v_parent_category'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['name'];
$arrVideo['v_parent_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['pinyin'];
foreach ($arrVideo as $strKey => $mixedVal) {
$strKey = str_replace('vod', 'v', $strKey);
@@ -165,15 +190,19 @@ class VideoInfoPage extends BasePage
'v_id' => CountersModel::getInstance()->getNextSequence('video'),
'v_name' => $arrPageVideo['v_name'],
'v_name_en' => zhToPinYin($arrPageVideo['v_name']),
'v_parent_category' => $arrPageVideo['v_parent_category'],
'v_parent_category_en' => $arrPageVideo['v_parent_category_en'],
'v_category' => $arrPageVideo['v_category'],
'v_category_en' => zhToPinYin($arrPageVideo['v_category']),
'v_category_en' => $arrPageVideo['v_category_en'],
'v_actor' => $arrPageVideo['v_actor'],
'v_director' => $arrPageVideo['v_director'],
'v_class' => $arrPageVideo['v_class'],
'v_letter' => $arrPageVideo['v_letter'],
'v_pic' => '',
'v_lang' => $arrPageVideo['v_lang'],
'v_lang_en' => $arrPageVideo['v_lang_en'],
'v_area' => $arrPageVideo['v_area'],
'v_area_en' => $arrPageVideo['v_area_en'],
'v_year' => $arrPageVideo['v_year'],
'v_remarks' => $arrPageVideo['v_remarks'],
'v_isend' => $arrPageVideo['v_isend'],