fix: video model category
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AddGgPaiXuColumOnGuangGaoTable extends Migrator
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// $Table = $this->table('guang_gao');
|
||||
|
||||
// $Table->addColumn('gg_sort', 'integer', ['after' => 'gg_tiao_zhuan_di_zhi'])->setComment("排序")->save();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
// $Table = $this->table('guang_gao');
|
||||
// $Table->removeColumn('gg_sort')->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CredateCustomCrawlerTable extends Migrator
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$Table = $this->table('custom_crawler', ['id' => false]);
|
||||
$Table
|
||||
->addColumn(Column::integer('cc_id')->setUnsigned()->setIdentity(true)->setComment('自增主键'))
|
||||
->addColumn(Column::string('cc_code', 50)->setNullable(false)->setComment('映射代码编码'))
|
||||
->addColumn(Column::text('cc_data')->setNullable(true)->setComment('数据内容'))
|
||||
->addColumn(Column::integer('cc_limit')->setDefault(0)->setComment('采集间隔(秒)'))
|
||||
->addColumn(Column::timestamp('cc_last_exec')->setNullable(true)->setComment('最后执行时间'))
|
||||
->addIndex(['cc_id'], ['type' => 'primary'])
|
||||
->setComment('自定义爬虫表')
|
||||
->create();
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->table('custom_crawler')->drop()->save();
|
||||
}
|
||||
}
|
||||
33
code/database/seeders/CustomCrawlerSeeder.php
Normal file
33
code/database/seeders/CustomCrawlerSeeder.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace database\seeders;
|
||||
|
||||
use app\model\AdminUserModel;
|
||||
use app\model\CustomCrawlerModel;
|
||||
|
||||
class CustomCrawlerSeeder
|
||||
{
|
||||
static public function handle()
|
||||
{
|
||||
self::addCustomCrawler();
|
||||
}
|
||||
|
||||
static public function addCustomCrawler()
|
||||
{
|
||||
$arrData = [
|
||||
[
|
||||
'cc_id' => 1,
|
||||
'cc_code' => 'PULL_WEN_XUE_GUAN',
|
||||
'cc_data' => '[86114,90205]',
|
||||
'cc_limit' => 24 * 3600,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($arrData as $arrCustomCrawler) {
|
||||
$CustomCrawlerModel = CustomCrawlerModel::where('cc_code', $arrCustomCrawler['cc_code'])->find();
|
||||
if (empty($CustomCrawlerModel)) {
|
||||
CustomCrawlerModel::insert($arrCustomCrawler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,12 @@ class PlanTaskSeeder
|
||||
'pt_enable' => 0,
|
||||
'pt_limit' => 1 * 24 * 3600,
|
||||
],
|
||||
[
|
||||
'pt_name' => '自定义爬虫任务触发',
|
||||
'pt_code' => 'CUSTOM_CRAWLER',
|
||||
'pt_enable' => 0,
|
||||
'pt_limit' => 10,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($arrDataNovel as $arrPlanTask) {
|
||||
|
||||
@@ -11,5 +11,6 @@ class SeedManager
|
||||
SystemConfigSeeder::handle();
|
||||
ZiYuanDuanDianSeeder::handle();
|
||||
TemplateSeeder::handle();
|
||||
CustomCrawlerSeeder::handle();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user