fix: video model category
This commit is contained in:
75
code/app/task/crawler/custom/Scheduler.php
Normal file
75
code/app/task/crawler/custom/Scheduler.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\task\crawler\custom;
|
||||
|
||||
use app\model\ChapterModel;
|
||||
use app\model\CustomCrawlerModel;
|
||||
use app\task\crawler\custom\page\Site;
|
||||
use microserver\QueueManage;
|
||||
use storage\StorageCore;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class Scheduler
|
||||
{
|
||||
/**
|
||||
* Undocumented variable
|
||||
*
|
||||
* @var \microserver\QueueManage
|
||||
*/
|
||||
protected $QueueManage = NULL;
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->QueueManage = new QueueManage();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a site-wide craw task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function crawlFull()
|
||||
{
|
||||
$AllCustomCrawlerModel = CustomCrawlerModel::select();
|
||||
|
||||
foreach ($AllCustomCrawlerModel as $CustomCrawlerModel) {
|
||||
|
||||
if (
|
||||
$CustomCrawlerModel->pt_last_exec != 0 &&
|
||||
($CustomCrawlerModel->pt_last_exec + $CustomCrawlerModel->pt_limit) > time()
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$CustomCrawlerModel->pt_last_exec = time();
|
||||
|
||||
$CustomCrawlerModel->save();
|
||||
|
||||
switch ($CustomCrawlerModel->cc_code) {
|
||||
case 'PULL_WEN_XUE_GUAN':
|
||||
$arrTask = [
|
||||
'callback' => [self::class, 'createCrawlWenXueGuanTask'],
|
||||
'data' => [
|
||||
'cc_data' => $CustomCrawlerModel->cc_data
|
||||
],
|
||||
];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$this->QueueManage->set($arrTask);
|
||||
}
|
||||
}
|
||||
|
||||
public function createCrawlWenXueGuanTask(array $arrData)
|
||||
{
|
||||
$arrCcData = json_decode($arrData['cc_data'], true);
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,12 @@ class Scheduler
|
||||
return $this->Site;
|
||||
}
|
||||
|
||||
public $arrExcludeCategory = [
|
||||
'体育',
|
||||
'福利',
|
||||
'伦理',
|
||||
'伦理片',
|
||||
];
|
||||
|
||||
/**
|
||||
* create a site-wide craw task
|
||||
@@ -106,6 +112,11 @@ class Scheduler
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($arrCategory['v_category_name'], $this->arrExcludeCategory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$intTotalPage = $arrCategory['total_page'];
|
||||
$arrFilter = [];
|
||||
for ($intStartPage = 1; $intStartPage <= $intTotalPage; $intStartPage++) {
|
||||
|
||||
@@ -66,6 +66,12 @@ class Scheduler
|
||||
return $this->Site;
|
||||
}
|
||||
|
||||
public $arrExcludeCategory = [
|
||||
'体育',
|
||||
'福利',
|
||||
'伦理',
|
||||
'伦理片',
|
||||
];
|
||||
|
||||
/**
|
||||
* create a site-wide craw task
|
||||
@@ -103,6 +109,10 @@ class Scheduler
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($arrCategory['v_category_name'], $this->arrExcludeCategory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$intTotalPage = $arrCategory['total_page'];
|
||||
$arrFilter = [];
|
||||
for ($intStartPage = 1; $intStartPage <= $intTotalPage; $intStartPage++) {
|
||||
|
||||
@@ -66,6 +66,12 @@ class Scheduler
|
||||
return $this->Site;
|
||||
}
|
||||
|
||||
public $arrExcludeCategory = [
|
||||
'体育',
|
||||
'福利',
|
||||
'伦理',
|
||||
'伦理片',
|
||||
];
|
||||
|
||||
/**
|
||||
* create a site-wide craw task
|
||||
@@ -104,6 +110,10 @@ class Scheduler
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($arrCategory['v_category_name'], $this->arrExcludeCategory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$intTotalPage = $arrCategory['total_page'];
|
||||
$arrFilter = [];
|
||||
for ($intStartPage = 1; $intStartPage <= $intTotalPage; $intStartPage++) {
|
||||
|
||||
@@ -96,7 +96,7 @@ class VideoCategory
|
||||
'pinyin' => 'hai-wai-ju',
|
||||
],
|
||||
61 => [
|
||||
'name' => '?理片',
|
||||
'name' => '伦理片',
|
||||
'pinyin' => 'lun-li-pian',
|
||||
],
|
||||
62 => [
|
||||
|
||||
Reference in New Issue
Block a user