This commit is contained in:
Default
2025-03-18 22:51:45 +08:00
parent eb9035a7ae
commit 526d3f47f4
103 changed files with 542 additions and 4025 deletions

View File

@@ -1,21 +1,47 @@
[APP] # 应用
APP_DEBUG = true APP_DEBUG = true
SHOW_ERROR_MSG = true SHOW_ERROR_MSG = true
DEFAULT_LANG = zh-cn
DEFAULT_
[DB] # 数据库
DB_TYPE = mysql DB_TYPE = mysql
DB_HOST = 127.0.0.1 DB_HOST = 127.0.0.1
DB_NAME = test DB_NAME = seo
DB_USER = username DB_USER = root
DB_PASS = password DB_PASS = qq123123
DB_PORT = 3306 DB_PORT = 3306
DB_CHARSET = utf8mb4 DB_CHARSET = utf8mb4
DB_SQL_DEBUG = true DB_SQL_DEBUG = true
DB_FIELD_CACHE = false DB_FIELD_CACHE = false
[CACHE] # 缓存
CACHE_DRIVER = redis
CACHE_TIME = 7200
[TASK] # REDIS
REDIS_HOST = 127.0.0.1
REDIS_PORT = 6379
REDIS_PASSWORD =
REDIS_PREFIX =
REDIS_DATABASE = 0
[LANG] # TASK
DEFAULT_LANG = zh-cn TASK_PROCESS_NUM_01 = 4
TASK_PROCESS_NUM_02 = 2
# QUEUEU
QUEUE_NAME_1 = QueueKey01
QUEUE_EXEC_NUM_1 = 10
QUEUE_NAME_2 = QueueKey02
QUEUE_EXEC_NUM_2 = 10
# MINIO
MINIO_END_POINT = http://127.0.0.1:9200
MINIO_KEY = FeJI6i2j15TK5lNNRuN2
MINIO_SECRET = oTr9cVCYjql4SLehde0cXcFRCaA3QLnw4Yhnjw6N
MINIO_REGION = hk-01
MINIO_BUCKET = test001
# LocalStorage
STORAGE_LOCAL_DIR = /mnt/gluster

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace app\admin; namespace app\admin;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\service\AdminUserAuth; use app\admin\service\AdminUserAuth;
use app\Request; use app\Request;
use think\Container; use think\Container;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\BaseController; use app\admin\BaseController;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\service\AdminUserAuth; use app\admin\service\AdminUserAuth;
use app\Request; use app\Request;
use think\facade\Cache; use think\facade\Cache;

View File

@@ -5,13 +5,13 @@ declare(strict_types=1);
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\BaseController; use app\admin\BaseController;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\model\FenLeiModel; use app\model\FenLeiModel;
use app\admin\model\GuangGaoFenZuModel; use app\model\GuangGaoFenZuModel;
use app\admin\model\GuangGaoModel; use app\model\GuangGaoModel;
use app\admin\model\GuangGaoPeiZhiModel; use app\model\GuangGaoPeiZhiModel;
use app\admin\model\NvYouModel; use app\model\NvYouModel;
use app\admin\model\ShiPinModel; use app\model\ShiPinModel;
use app\Request; use app\Request;
use think\Response; use think\Response;

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\BaseController; use app\admin\BaseController;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\service\AdminUserAuth; use app\admin\service\AdminUserAuth;
use app\Request; use app\Request;
use think\facade\Cache; use think\facade\Cache;

View File

@@ -1,154 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\controller;
use app\admin\BaseController;
use app\admin\model\AdminUserModel;
use app\admin\model\BaoYangRuZhuModel;
use app\admin\model\CaiJiPeiZhiModel;
use app\admin\model\DaLiWanFanKuiModel;
use app\admin\model\DaLiWanModel;
use app\admin\model\GuanFangZiYingModel;
use app\admin\model\LouFengModel;
use app\admin\model\PlanTaskModel;
use app\admin\model\SeoKeywordsModel;
use app\admin\model\SystemConfigModel;
use app\admin\model\ZiYuanDuanDianModel;
use app\Request;
use think\Response;
class SeoKeywords extends BaseController
{
/**
* 系统配置列表
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
* @return Response
*/
public function getSeoKeywordList(Request $Request, ?AdminUserModel $AdminUserModel)
{
$arrData = [
"page" => $Request->get('page', 1),
"limit" => $Request->get('limit', 10),
"key" => $Request->get('key'),
];
$arrRule = [
'page' => 'require|number',
'limit' => 'require|number',
];
$this->validate($arrData, $arrRule);
$SeoKeywordsModel = SeoKeywordsModel::alias('sw');
if (!empty($arrData['key'])) {
$strKey = $arrData['key'];
$SeoKeywordsModel->where(function ($SeoKeywordsModel) use ($strKey) {
$SeoKeywordsModel->whereOr([
['sw.sw_title', 'like', "%" . $strKey . "%"],
['sw.sw_id', 'like', "%" . $strKey . "%"],
]);
});
}
$Paginate = $SeoKeywordsModel->paginate([
'list_rows' => $arrData['limit'],
'page' => $arrData['page'],
]);
$arrResult = [
'items' => $Paginate->items(),
'total' => $Paginate->total(),
'current_page' => $Paginate->currentPage(),
'total_pages' => $Paginate->lastPage(),
];
return $this->success($arrResult);
}
/**
* 设置系统配置
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
* @return Response
*/
public function saveSeoKeyword(Request $Request, ?AdminUserModel $AdminUserModel)
{
$arrData = [
"sw_id" => $Request->post('sw_id'),
"sw_title" => $Request->post('sw_title'),
"sw_status" => $Request->post('sw_status'),
"sw_html_path" => $Request->post('sw_html_path') ?? '',
];
$arrRule = [
// 'sw_id' => 'require',
'sw_title' => 'require',
];
$this->validate($arrData, $arrRule);
if ($arrData['sw_id'] == NULL) {
$SeoKeywordsModel = new SeoKeywordsModel;
} else {
$SeoKeywordsModel = SeoKeywordsModel::where('sw_id', $arrData['sw_id'])->find();
if (empty($SeoKeywordsModel)) {
return $this->error('9993');
}
}
if (isset($arrData['sw_status']) && empty($arrData['sw_status']) && $arrData['sw_status'] != 0) {
unset($arrData['sw_status']);
}
if (isset($arrData['sw_html_path']) && empty($arrData['sw_html_path'])) {
unset($arrData['sw_html_path']);
}
$SeoKeywordsModel->fill($arrData);
$SeoKeywordsModel->save();
$strHtmlPath = $SeoKeywordsModel->sw_html_path;
if(!empty($strHtmlPath)){
SeoKeywordsModel::flushCache($strHtmlPath);
}
return $this->success();
}
/**
* 删除
*
* @param Request $Request
* @param SeoKeywordsModel|null $SeoKeywordsModel
* @return Response
*/
public function delSeoKeyword(Request $Request, ?SeoKeywordsModel $SeoKeywordsModel)
{
$arrData = [
"sw_id" => $Request->post('sw_id'),
];
$arrRule = [
'sw_id' => 'require',
];
$this->validate($arrData, $arrRule);
$arrData['sw_id'] = explode(',', $arrData['sw_id']);
SeoKeywordsModel::whereIn('sw_id', $arrData['sw_id'])->delete();
return $this->success();
}
}

View File

@@ -5,16 +5,16 @@ declare(strict_types=1);
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\BaseController; use app\admin\BaseController;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\model\BaoYangRuZhuModel; use app\model\BaoYangRuZhuModel;
use app\admin\model\CaiJiPeiZhiModel; use app\model\CaiJiPeiZhiModel;
use app\admin\model\DaLiWanFanKuiModel; use app\model\DaLiWanFanKuiModel;
use app\admin\model\DaLiWanModel; use app\model\DaLiWanModel;
use app\admin\model\GuanFangZiYingModel; use app\model\GuanFangZiYingModel;
use app\admin\model\LouFengModel; use app\model\LouFengModel;
use app\admin\model\PlanTaskModel; use app\model\PlanTaskModel;
use app\admin\model\SystemConfigModel; use app\model\SystemConfigModel;
use app\admin\model\ZiYuanDuanDianModel; use app\model\ZiYuanDuanDianModel;
use app\Request; use app\Request;
use think\Response; use think\Response;

View File

@@ -1,179 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\controller;
use app\admin\BaseController;
use app\admin\model\AdminUserModel;
use app\admin\model\BaoYangRuZhuModel;
use app\admin\model\DaLiWanFanKuiModel;
use app\admin\model\DaLiWanModel;
use app\admin\model\GuanFangZiYingModel;
use app\admin\model\LouFengModel;
use app\admin\model\SystemConfigModel;
use app\admin\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoModel;
use app\admin\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel;
use app\Request;
use think\Response;
class XiaoShuo extends BaseController
{
/**
* 列表
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
* @return Response
*/
public function getXiaoShuoList(Request $Request, ?AdminUserModel $AdminUserModel)
{
$arrData = [
"page" => $Request->get('page', 1),
"limit" => $Request->get('limit', 10),
"key" => $Request->get('key'),
];
$arrRule = [
'page' => 'require|number',
'limit' => 'require|number',
];
$this->validate($arrData, $arrRule);
$XiaoShuoXiangQingModel = XiaoShuoXiangQingModel::alias('xsxq');
if (!empty($arrData['key'])) {
$strKey = $arrData['key'];
$XiaoShuoXiangQingModel->where(function ($XiaoShuoXiangQingModel) use ($strKey) {
$XiaoShuoXiangQingModel->whereOr([
['xsxq.xsxq_ming_zi', 'like', "%" . $strKey . "%"],
['xsxq.xsxq_id', 'like', "%" . $strKey . "%"],
]);
});
}
$Paginate = $XiaoShuoXiangQingModel->paginate([
'list_rows' => $arrData['limit'],
'page' => $arrData['page'],
]);
$arrResult = [
'items' => $Paginate->items(),
'total' => $Paginate->total(),
'current_page' => $Paginate->currentPage(),
'total_pages' => $Paginate->lastPage(),
];
return $this->success($arrResult);
}
/**
* 列表
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
* @return Response
*/
public function getXiaoShuoZhangJieList(Request $Request, ?AdminUserModel $AdminUserModel)
{
$arrData = [
"page" => $Request->get('page', 1),
"limit" => $Request->get('limit', 10),
"key" => $Request->get('key'),
"xsxq_id" => $Request->get('xsxq_id'),
];
$arrRule = [
'page' => 'require|number',
'limit' => 'require|number',
];
$this->validate($arrData, $arrRule);
$XiaoShuoZhangJieModel = XiaoShuoZhangJieModel::alias('xszj');
if (!empty($arrData['key'])) {
$strKey = $arrData['key'];
$XiaoShuoZhangJieModel->where(function ($XiaoShuoZhangJieModel) use ($strKey) {
$XiaoShuoZhangJieModel->whereOr([
['xszj.xszj_ming_zi', 'like', "%" . $strKey . "%"],
['xszj.xszj_id', 'like', "%" . $strKey . "%"],
]);
});
}
if (!empty($arrData['xsxq_id'])) {
$XiaoShuoZhangJieModel->where('xszj.xsxq_id', $arrData['xsxq_id']);
$XiaoShuoZhangJieModel->order('xszj.xszj_pai_xu', 'desc');
}
$Paginate = $XiaoShuoZhangJieModel->paginate([
'list_rows' => $arrData['limit'],
'page' => $arrData['page'],
]);
$arrResult = [
'items' => $Paginate->items(),
'total' => $Paginate->total(),
'current_page' => $Paginate->currentPage(),
'total_pages' => $Paginate->lastPage(),
];
return $this->success($arrResult);
}
/**
* 列表
*
* @param Request $Request
* @param AdminUserModel|null $AdminUserModel
* @return Response
*/
public function getXiaoShuoFenLeiList(Request $Request, ?AdminUserModel $AdminUserModel)
{
$arrData = [
"page" => $Request->get('page', 1),
"limit" => $Request->get('limit', 10),
"key" => $Request->get('key'),
];
$arrRule = [
'page' => 'require|number',
'limit' => 'require|number',
];
$this->validate($arrData, $arrRule);
$XiaoShuoFenLeiModel = XiaoShuoFenLeiModel::alias('xsfl');
if (!empty($arrData['key'])) {
$strKey = $arrData['key'];
$XiaoShuoFenLeiModel->where(function ($XiaoShuoFenLeiModel) use ($strKey) {
$XiaoShuoFenLeiModel->whereOr([
['xsfl.xsfl_name', 'like', "%" . $strKey . "%"],
['xsfl.xsfl_id', 'like', "%" . $strKey . "%"],
]);
});
}
$Paginate = $XiaoShuoFenLeiModel->paginate([
'list_rows' => $arrData['limit'],
'page' => $arrData['page'],
]);
$arrResult = [
'items' => $Paginate->items(),
'total' => $Paginate->total(),
'current_page' => $Paginate->currentPage(),
'total_pages' => $Paginate->lastPage(),
];
return $this->success($arrResult);
}
}

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace app\admin\middleware; namespace app\admin\middleware;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\service\AdminUserAuth; use app\admin\service\AdminUserAuth;
use app\Request; use app\Request;
use think\Response; use think\Response;

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace app\admin\middleware; namespace app\admin\middleware;
use app\admin\model\AdminUserModel; use app\model\AdminUserModel;
use app\admin\service\AdminUserAuth; use app\admin\service\AdminUserAuth;
use app\Request; use app\Request;
use think\Response; use think\Response;

View File

@@ -1,70 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class ContentStatsModel extends BaseModel
{
protected $name = 'content_stats';
protected $pk = 'cs_id';
static public function add($arrData): self
{
try {
$existingRecord = self::where([
'cs_md5' => $arrData['cs_md5'],
])->find();
if ($existingRecord) {
$existingRecord->cs_pv = $arrData['cs_pv'];
$existingRecord->cs_uv = $arrData['cs_uv'];
$existingRecord->updated_at = $arrData['updated_at'];
// 尝试保存数据
if (!$existingRecord->save()) {
// 数据保存失败,抛出异常
throw new \RuntimeException('数据保存失败:' . json_encode($data, JSON_UNESCAPED_UNICODE));
}
// 返回模型实例
return $existingRecord;
// return $existingRecord->save();
// return $existingRecord->save($arrData);
} else {
// 插入新记录
return self::create($arrData);
}
// if ($existingRecord) {
// // 更新记录
// $existingRecord->cs_pv = $arrData['cs_pv'];
// $existingRecord->cs_uv = $arrData['cs_uv'];
// $existingRecord->updated_at = $arrData['updated_at'];
// $existingRecord->save();
// return $existingRecord;
// }
// $existingRecord = new self;
// $existingRecord->save($arrData);
// return $existingRecord;
} catch (\Throwable $T) {
var_dump($T);
if ($T->getCode() == 10501) {
//return self::addVideoLeixin($arrData);
}
throw $T;
}
}
}

View File

@@ -1,76 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class GanRaoMaModel extends BaseModel
{
protected $name = 'gan_rao_ma';
protected $pk = 'grm_id';
/**
* 根据 HTML 路径获取值
* @param string $strHtmlPath
* @return string|null
*/
public static function getValByHtmlPath(string $strHtmlPath): ?string
{
// 尝试从缓存获取
$strGamRaoMa = Cache::get($strHtmlPath);
// 如果缓存不存在,刷新缓存
if (!$strGamRaoMa) {
self::flushCache($strHtmlPath);
$strGamRaoMa = Cache::get($strHtmlPath);
}
return $strGamRaoMa ?? null;
}
/**
* 刷新缓存数据
* @param string $strHtmlPath
* @return void
*/
public static function flushCache(string $strHtmlPath): void
{
// 初始化缓存
$cache = Cache::tag('GanRaoMaTag');
// 尝试从数据库获取
$strGamRaoMa = self::where('site_id',config('app.default_app_id'))->where('grm_html_path', $strHtmlPath)->value('grm_neirong');
if ($strGamRaoMa) {
// 设置缓存
$cache->set($strHtmlPath, $strGamRaoMa);
} else {
// 如果数据库中没有记录,生成随机内容
$fallbackKeyword = generateRandomHTML(3, 15);
if ($fallbackKeyword) {
$arrGanRaoMa = [
'grm_html_path' => $strHtmlPath,
'grm_neirong' => $fallbackKeyword,
'site_id' => config('app.default_app_id'),
];
// 保存到数据库
$model = new self();
$model->save($arrGanRaoMa);
// 设置缓存
$cache->set($strHtmlPath, $fallbackKeyword);
} else {
// 记录日志或其他处理逻辑
// Log::warning("No fallback keyword generated for path: $strHtmlPath");
}
}
}
}

View File

@@ -1,17 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class GuangGaoFenZuModel extends BaseModel
{
protected $name = 'guang_gao_fen_zu';
protected $pk = 'ggfz_id';
}

View File

@@ -1,59 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class GuangGaoModel extends BaseModel
{
protected $name = 'guang_gao';
protected $pk = 'gg_id';
static $arrGuangGao = [];
static public function getAdByCache($strGGFZCode, $intLimit = 10, $strSort = 'asc')
{
if (self::$arrGuangGao == []) {
self::$arrGuangGao = Cache::get('GuangGao');
if (empty(self::$arrGuangGao)) {
self::flushCache();
self::$arrGuangGao = Cache::get('GuangGao');
}
}
$arrTemp = self::$arrGuangGao[$strGGFZCode] ?? [];
if ($strSort == 'rand') {
shuffle($arrTemp);
}
return array_slice($arrTemp, 0, $intLimit);
}
static public function flushCache()
{
$arrGuangGao = [];
$arrGGFZCode = GuangGaoFenZuModel::column('ggfz_code', 'ggfz_id');
$GuangGaoModelAll = self::where('site_id',config('app.default_app_id'))->order('ggfz_id', 'desc')->order('gg_sort', 'desc')->where('gg_status',0)->select();
foreach ($GuangGaoModelAll as $GuangGaoModel) {
$GuangGaoModel->ggfz_id;
if (!key_exists($GuangGaoModel->ggfz_id, $arrGGFZCode)) {
continue;
}
if (!key_exists($arrGGFZCode[$GuangGaoModel->ggfz_id], $arrGuangGao)) {
$arrGuangGao[$arrGGFZCode[$GuangGaoModel->ggfz_id]] = [];
}
$arrGuangGao[$arrGGFZCode[$GuangGaoModel->ggfz_id]][] = $GuangGaoModel->toArray();
}
Cache::tag('GuangGao')->set('GuangGao', $arrGuangGao);
}
}

View File

@@ -1,40 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class GuangGaoPeiZhiModel extends BaseModel
{
protected $name = 'guang_gao_pei_zhi';
protected $pk = 'ggpz_id';
static $arrGuangGaoPeiZhi = [];
static public function getValByCode($strCode)
{
self::flushCache();
if (self::$arrGuangGaoPeiZhi == []) {
self::$arrGuangGaoPeiZhi = Cache::get('GuangGaoPeiZhi');
if (empty(self::$arrGuangGaoPeiZhi)) {
self::flushCache();
self::$arrGuangGaoPeiZhi = Cache::get('GuangGaoPeiZhi');
}
}
return self::$arrGuangGaoPeiZhi[$strCode] ?? NULL;
}
static public function flushCache()
{
$arrGuangGaoPeiZhi = self::column('ggpz_val', 'ggpz_code');
Cache::tag('GuangGaoPeiZhi')->set('GuangGaoPeiZhi', $arrGuangGaoPeiZhi);
}
}

View File

@@ -1,41 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class NovelInfoSeoModel extends BaseModel
{
protected $name = 'novel_info_seo';
protected $pk = 'nis_id';
static public function addXiaoShuoXiangQingSeo($arrData): self
{
try {
$XiaoShuoXiangQingModel = self::where('nis_md5', $arrData['nis_md5'])->find();
if ($XiaoShuoXiangQingModel) {
return $XiaoShuoXiangQingModel;
}
$XiaoShuoXiangQingModel = new self;
$XiaoShuoXiangQingModel->save($arrData);
return $XiaoShuoXiangQingModel;
} catch (\Throwable $T) {
throw $T; // 超过重试次数后抛出异常
}
}
}

View File

@@ -1,42 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\Model;
/**
* @mixin think\Model
*/
class ReSouFenZuModel extends BaseModel
{
protected $name = 're_sou_fen_zu';
protected $pk = 'rsfz_id';
static public function addReSouFenZu($arrData): self
{
try {
if (empty($arrData['rsfz_ming_zi'])) {
throw new \Exception("热搜词分组信息不全!");
}
$ReSouFenZuModel = self::where('rsfz_ming_zi', $arrData['rsfz_ming_zi'])->find();
if ($ReSouFenZuModel) {
return $ReSouFenZuModel;
}
$ReSouFenZuModel = new self;
$ReSouFenZuModel->rsfz_pai_xu = $arrData['rsfz_pai_xu'];
$ReSouFenZuModel->rsfz_ming_zi = $arrData['rsfz_ming_zi'];
$ReSouFenZuModel->save();
return $ReSouFenZuModel;
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
return self::addReSouFenZu($arrData);
}
throw $T;
}
}
}

View File

@@ -1,101 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class ReSouModel extends BaseModel
{
protected $name = 're_sou';
protected $pk = 'rs_id';
static $arrReSou = [];
static $arrReSouAll = [];
static public function addReSou($arrData): self
{
try {
if (empty($arrData['rs_ming_zi']) || empty($arrData['rsfz_id'])) {
throw new \Exception("热搜词信息不全!");
}
$ReSouModel = self::where('rs_ming_zi', $arrData['rs_ming_zi'])->find();
if ($ReSouModel) {
return $ReSouModel;
}
$ReSouModel = new self;
$ReSouModel->rs_ming_zi = $arrData['rs_ming_zi'];
$ReSouModel->rsfz_id = $arrData['rsfz_id'];
$ReSouModel->save();
return $ReSouModel;
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
return self::addReSou($arrData);
}
throw $T;
}
}
static public function getRsByCache($intLimit = 2, $strSort = 'asc')
{
if (self::$arrReSouAll == []) {
self::$arrReSouAll = Cache::get('RE_SOU_ALL');
if (empty(self::$arrReSouAll)) {
self::flushCache();
self::$arrReSouAll = Cache::get('RE_SOU_ALL');
}
}
$arrTemp = self::$arrReSouAll;
if ($strSort == 'rand') {
shuffle($arrTemp);
}
return array_slice($arrTemp, 0, $intLimit);
}
static public function getFomartDataByCache()
{
if (self::$arrReSou == []) {
self::$arrReSou = Cache::get('RE_SOU');
if (empty(self::$arrReSou)) {
self::flushCache();
self::$arrReSou = Cache::get('RE_SOU');
}
}
return self::$arrReSou;
}
static public function flushCache()
{
$FenZu = ReSouFenZuModel::order('rsfz_pai_xu', 'asc')->select();
$arrFenZu = [];
foreach ($FenZu as $FenZuOne) {
$arrFenZu[$FenZuOne->rsfz_id] = $FenZuOne->toArray();
$arrFenZu[$FenZuOne->rsfz_id]['child'] = [];
}
$ReSou = self::select();
foreach ($ReSou as $ReSouOne) {
$arrFenZu[$ReSouOne->rsfz_id]['child'][] = $ReSouOne->toArray();
}
$arrFenZu = array_values($arrFenZu);
Cache::tag('RE_SOU')->set('RE_SOU', $arrFenZu);
Cache::tag('RE_SOU_ALL')->set('RE_SOU_ALL', $ReSou->toArray());
}
}

View File

@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class SeoHtmlModel extends BaseModel
{
protected $name = 'seo_html';
protected $pk = 'sh_id';
public static function getValByHtmlPath(string $strHtmlPath): ?string
{
$strSeoKeyword = Cache::get($strHtmlPath);;
if (!$strSeoKeyword) {
self::flushCache($strHtmlPath);
$strSeoKeyword = Cache::get($strHtmlPath);;
}
return $strSeoKeyword ?? null;
}
public static function flushCache(string $strHtmlPath): void
{
$cache = Cache::tag('SeoKeywords');
$strSeoKeyword = self::where('sw_html_path', $strHtmlPath)->value('sw_title');
if ($strSeoKeyword) {
$cache->set($strHtmlPath, $strSeoKeyword);
} else {
$fallbackKeyword = self::where('sw_status', 0)->find();
if ($fallbackKeyword) {
$fallbackKeyword->sw_status = 1;
$fallbackKeyword->sw_html_path = $strHtmlPath;
$fallbackKeyword->save();
$cache->set($strHtmlPath, $fallbackKeyword->sw_title);
} else {
// 如果连 sw_status = 0 的记录也没有,则可以选择不进行任何操作或进行日志记录
// Log::warning("No available SEO keyword found for fallback.");
}
}
}
}

View File

@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class SeoKeywordsModel extends BaseModel
{
protected $name = 'seo_keywords';
protected $pk = 'sw_id';
public static function getValByHtmlPath(string $strHtmlPath): ?string
{
$strSeoKeyword = Cache::get($strHtmlPath);;
if (!$strSeoKeyword) {
self::flushCache($strHtmlPath);
$strSeoKeyword = Cache::get($strHtmlPath);;
}
return $strSeoKeyword ?? null;
}
public static function flushCache(string $strHtmlPath): void
{
$cache = Cache::tag('SeoKeywords');
$strSeoKeyword = self::where('sw_html_path', $strHtmlPath)->value('sw_title');
if ($strSeoKeyword) {
$cache->set($strHtmlPath, $strSeoKeyword);
} else {
$fallbackKeyword = self::where('sw_status', 0)->find();
if ($fallbackKeyword) {
$fallbackKeyword->sw_status = 1;
$fallbackKeyword->sw_html_path = $strHtmlPath;
$fallbackKeyword->save();
$cache->set($strHtmlPath, $fallbackKeyword->sw_title);
} else {
// 如果连 sw_status = 0 的记录也没有,则可以选择不进行任何操作或进行日志记录
// Log::warning("No available SEO keyword found for fallback.");
}
}
}
}

View File

@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class SeoTdkConfigModel extends BaseModel
{
protected $name = 'seo_tdk_config';
protected $pk = 'stc_id';
static $arrSeoTdkConfig = [];
static public function getValByCode($strCode)
{
//self::flushCache();
if (self::$arrSeoTdkConfig == []) {
self::$arrSeoTdkConfig = Cache::get('seoTdkTonfig');
if (empty(self::$arrSeoTdkConfig)) {
self::flushCache();
self::$arrSeoTdkConfig = Cache::get('seoTdkTonfig');
}
}
return self::$arrSeoTdkConfig[$strCode] ?? NULL;
}
// 标签使用
static public function getValByCodeByValCode($strCode,$strValCode)
{
if (self::$arrSeoTdkConfig == []) {
self::$arrSeoTdkConfig = Cache::get('seoTdkTonfig');
if (empty(self::$arrSeoTdkConfig)) {
self::flushCache();
self::$arrSeoTdkConfig = Cache::get('seoTdkTonfig');
}
}
return self::$arrSeoTdkConfig[$strCode][$strValCode] ?? NULL;
}
static public function flushCache()
{
// 查询所有数据
$arrSeoTdkConfig = self::where('site_id',config('app.default_app_id'))->select()->toArray();
// 按照 'stc_code' 进行键值映射
$arrSeoTdkConfig = array_column($arrSeoTdkConfig, null, 'stc_code');
// var_dump($arrSeoTdkConfig);
// $arrSeoTdkConfig = self::select();
// $arrSeoTdkConfig = self::column('stc_title', 'stc_code');
// var_dump($arrSeoTdkConfig);
Cache::tag('seoTdkTonfig')->set('seoTdkTonfig', $arrSeoTdkConfig);
}
}

View File

@@ -1,82 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class SiteModel extends BaseModel
{
protected $name = 'site';
protected $pk = 'site_id';
static $arrSite = [];
static public function addSite($arrData): self
{
try {
$SiteModel = self::where('site_name', $arrData['site_name'])->find();
if ($SiteModel) {
return $SiteModel;
}
$SiteModel = new self;
$SiteModel->save($arrData);
return $SiteModel;
} catch (\Throwable $T) {
throw $T; // 超过重试次数后抛出异常
}
}
static public function getValById($intSiteId)
{
//self::flushCache();
if (self::$arrSite == []) {
self::$arrSite = Cache::get('site');
if (empty(self::$arrSite)) {
self::flushCache();
self::$arrSite = Cache::get('site');
}
}
return self::$arrSite[$intSiteId] ?? NULL;
}
// 标签使用
static public function getValBySiteIdByValCode($strValCode)
{
if (self::$arrSite == []) {
self::$arrSite = Cache::get('site');
if (empty(self::$arrSite)) {
self::flushCache();
self::$arrSite = Cache::get('site');
}
}
return self::$arrSite[config('app.default_app_id')][$strValCode] ?? NULL;
}
static public function flushCache()
{
// 查询所有数据 where('site_id',config('app.default_app_id'))
$arrSite = self::select()->toArray();
// 按照 'stc_code' 进行键值映射
$arrSite = array_column($arrSite, null, 'site_id');
Cache::tag('site')->set('site', $arrSite);
}
}

View File

@@ -1,112 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoClassModel extends BaseModel
{
protected $name = 'video_class';
protected $pk = 'vc_id';
static $arrVideoShuoFenLei = [];
static public function addVideoFenLei($arrData): self
{
try {
if (empty($arrData['vc_name'])) {
throw new \Exception("分类信息不全!");
}
$VideoFenLeiModel = self::where('vc_name', $arrData['vc_name'])->find();
if ($VideoFenLeiModel) {
return $VideoFenLeiModel;
}
$VideoFenLeiModel = new self;
$VideoFenLeiModel->vc_name = $arrData['vc_name'];
$VideoFenLeiModel->save();
return $VideoFenLeiModel;
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
return self::addVideoFenLei($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vc_name'] == $strName) {
$intId = $arrFenLei['vc_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '未知';
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vc_id'] === $intId) {
$strName = $arrFenLei['vc_name'];
}
}
return $strName;
}
static public function getInfoById($intId)
{
$arrDefault = ['vc_id' => 1, 'vc_name' => '电影' , 'vc_necheng' => 'dy'];
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vc_id'] == $intId) {
$arrDefault = $arrFenLei;
}
}
return $arrDefault;
}
static public function getInfoByNeCheng($strNeCheng)
{
$arrDefault = ['vc_id' => 1, 'vc_source_id' => 1,'vc_name' => '电影' , 'vc_necheng' => 'dy'];
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vc_nicheng'] == $strNeCheng) {
$arrDefault = $arrFenLei;
}
}
return $arrDefault;
}
static public function getDataByCache()
{
if (self::$arrVideoShuoFenLei == []) {
self::$arrVideoShuoFenLei = Cache::get('VIDEO_FEN_LEI');
if (empty(self::$arrVideoShuoFenLei)) {
self::flushCache();
self::$arrVideoShuoFenLei = Cache::get('VIDEO_FEN_LEI');
}
}
return self::$arrVideoShuoFenLei;
}
static public function flushCache()
{
$arrVideoShuoFenLei = self::where('vc_status', 1)->where('site_id',config('app.default_app_id'))->order('vc_sort', 'asc')->select()->toArray();
self::$arrVideoShuoFenLei = $arrVideoShuoFenLei;
Cache::tag('VIDEO_FEN_LEI')->set('VIDEO_FEN_LEI', $arrVideoShuoFenLei);
}
}

View File

@@ -1,90 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoDiquModel extends BaseModel
{
protected $name = 'video_diqu';
protected $pk = 'vd_id';
static $arrVideoShuoFenLei = [];
static public function add($arrData): self
{
try {
if (empty($arrData['vd_name'])) {
throw new \Exception("地区信息不全!");
}else{
$VideoFenLeiModel = self::where('vd_name', $arrData['vd_name'])->where('vc_id', $arrData['vc_id'])->find();
if ($VideoFenLeiModel) {
return $VideoFenLeiModel;
}
$VideoFenLeiModel = new self;
$VideoFenLeiModel->save($arrData);
return $VideoFenLeiModel;
}
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
//return self::add($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vd_name'] == $strName) {
$intId = $arrFenLei['vd_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '未知';
// var_dump(self::$arrXiaoShuoFenLei);
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vd_id'] === $intId) {
$strName = $arrFenLei['vd_name'];
}
}
return $strName;
}
static public function getDataByCache()
{
if (self::$arrVideoShuoFenLei == []) {
self::$arrVideoShuoFenLei = Cache::get('VIDEO_DI_QU');
if (empty(self::$arrVideoShuoFenLei)) {
self::flushCache();
self::$arrVideoShuoFenLei = Cache::get('VIDEO_DI_QU');
}
}
return self::$arrVideoShuoFenLei;
}
static public function flushCache()
{
$arrVideoShuoFenLei = self::select()->toArray();
Cache::tag('VIDEO_DI_QU')->set('VIDEO_DI_QU', $arrVideoShuoFenLei);
}
}

View File

@@ -1,119 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
use app\admin\model\XiaoShuoFenLeiModel;
/**
* @mixin think\Model
*/
class VideoInfoModel extends BaseModel
{
protected $name = 'video_info';
protected $pk = 'v_id';
protected $append = [
'video_feng_mian_url',
'vc_name',
'arr_daoyan',
'arr_zhuyan',
'arr_juqing',
];
public function getArrDaoyanAttr($value, $data)
{
if(!empty($data['v_daoyan'])){
$arrDaoyan = explode(",", $data['v_daoyan']);
return $arrDaoyan;
}
}
public function getArrZhuyanAttr($value, $data)
{
if(!empty($data['v_zhuyan'])){
$arrZhuyan = explode(",", $data['v_zhuyan']);
return $arrZhuyan;
}
}
public function getArrJuqingAttr($value, $data)
{
if(!empty($data['v_juqing'])){
$arrJuqing = explode(",", $data['v_juqing']);
return $arrJuqing;
}
}
public function getVideoFengMianUrlAttr($value, $data)
{
// 检查 v_cover 字段是否存在并解析 JSON 数据
$arrUrl = isset($data['v_cover']) ? json_decode($data['v_cover'], true) : null;
if (json_last_error() !== JSON_ERROR_NONE || !is_array($arrUrl)) {
// 如果 JSON 解析失败或结果不是数组,返回默认值
return null; // 或者返回一个默认图片地址,例如: '/static/images/default.png'
}
// 解析域名 (可替换成动态域名获取逻辑)
// $strDomain = ZiYuanDuanDianModel::getDomainByCode($arrUrl['code']);
// $strDomain = "https://www.123yqw.com";
// 构造完整的封面 URL
$uri = $arrUrl['uri'] ?? null;
if (!$uri) {
// 如果没有 URI 字段,返回默认值
return null; // 或默认图片地址
}
// 返回完整 URL (如果需要加域名,可在此处理)
return $uri; // 或 "{$strDomain}{$uri}" 如果域名需要拼接
}
public function getXsxqTagAttr($value, $data)
{
return json_decode($data['xsxq_tag'], true);
}
public function getXsflNameAttr($value, $data)
{
$strXiaoShuoFenLeiName = XiaoShuoFenLeiModel::getNameById($data['xsfl_id']);
return $strXiaoShuoFenLeiName;
}
static public function addVideoXiangQing($arrData): array
{
try {
$VideoXiangQingModel = self::where('v_md5', $arrData['v_md5'])->find();
if ($VideoXiangQingModel) {
return [
'model' => $VideoXiangQingModel,
'isNew' => false, // 已存在
];
}
$VideoXiangQingModel = new self;
$VideoXiangQingModel->save($arrData);
return [
'model' => $VideoXiangQingModel,
'isNew' => true, // 新增
];
} catch (\Throwable $T) {
throw $T; // 超过重试次数后抛出异常
}
}
}

View File

@@ -1,41 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoInfoSeoModel extends BaseModel
{
protected $name = 'video_info_seo';
protected $pk = 'vis_id';
static public function addVideoSeo($arrData): self
{
try {
$VideoModel = self::where('vis_md5', $arrData['vis_md5'])->find();
if ($VideoModel) {
return $VideoModel;
}
$VideoModel = new self;
$VideoModel->save($arrData);
return $VideoModel;
} catch (\Throwable $T) {
throw $T; // 超过重试次数后抛出异常
}
}
}

View File

@@ -1,90 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoJuqingModel extends BaseModel
{
protected $name = 'video_juqing';
protected $pk = 'vj_id';
static $arrVideoShuoFenLei = [];
static public function add($arrData): self
{
try {
if (empty($arrData['vj_name'])) {
throw new \Exception("剧情信息不全!");
}else{
$VideoFenLeiModel = self::where('vj_name', $arrData['vj_name'])->where('vc_id', $arrData['vc_id'])->find();
if ($VideoFenLeiModel) {
return $VideoFenLeiModel;
}
$VideoFenLeiModel = new self;
$VideoFenLeiModel->save($arrData);
return $VideoFenLeiModel;
}
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
//return self::add($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vj_name'] == $strName) {
$intId = $arrFenLei['vj_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '未知';
// var_dump(self::$arrXiaoShuoFenLei);
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vj_id'] === $intId) {
$strName = $arrFenLei['vj_name'];
}
}
return $strName;
}
static public function getDataByCache()
{
if (self::$arrVideoShuoFenLei == []) {
self::$arrVideoShuoFenLei = Cache::get('VIDEO_JU_QING');
if (empty(self::$arrVideoShuoFenLei)) {
self::flushCache();
self::$arrVideoShuoFenLei = Cache::get('VIDEO_JU_QING');
}
}
return self::$arrVideoShuoFenLei;
}
static public function flushCache()
{
$arrVideoShuoFenLei = self::select()->toArray();
Cache::tag('VIDEO_JU_QING')->set('VIDEO_JU_QING', $arrVideoShuoFenLei);
}
}

View File

@@ -1,90 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoLeixinModel extends BaseModel
{
protected $name = 'video_leixin';
protected $pk = 'vl_id';
static $arrVideoShuoFenLei = [];
static public function addVideoLeixin($arrData): self
{
try {
if (empty($arrData['vl_name'])) {
throw new \Exception("类型信息不全!");
}else{
$VideoFenLeiModel = self::where('vl_name', $arrData['vl_name'])->where('vc_id', $arrData['vc_id'])->find();
if ($VideoFenLeiModel) {
return $VideoFenLeiModel;
}
$VideoFenLeiModel = new self;
$VideoFenLeiModel->save($arrData);
return $VideoFenLeiModel;
}
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
//return self::addVideoLeixin($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vl_name'] == $strName) {
$intId = $arrFenLei['vl_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '未知';
// var_dump(self::$arrXiaoShuoFenLei);
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vl_id'] === $intId) {
$strName = $arrFenLei['vl_name'];
}
}
return $strName;
}
static public function getDataByCache()
{
if (self::$arrVideoShuoFenLei == []) {
self::$arrVideoShuoFenLei = Cache::get('VIDEO_LEI_XIN');
if (empty(self::$arrVideoShuoFenLei)) {
self::flushCache();
self::$arrVideoShuoFenLei = Cache::get('VIDEO_LEI_XIN');
}
}
return self::$arrVideoShuoFenLei;
}
static public function flushCache()
{
$arrVideoShuoFenLei = self::select()->toArray();
Cache::tag('VIDEO_LEI_XIN')->set('VIDEO_LEI_XIN', $arrVideoShuoFenLei);
}
}

View File

@@ -1,96 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoPlayurlModel extends BaseModel
{
protected $name = 'video_playurl';
protected $pk = 'vp_id';
protected $append = [
'http_m3u8_url',
];
public function getHttpM3u8UrlAttr($value, $data)
{
$arrUrl = json_decode($data['vp_url'], true);
// $strDomain = ZiYuanDuanDianModel::getDomainByCode($arrUrl['code']);
// $strDomain = "https://www.123yqw.com";
return $arrUrl['uri'] ?? '';
}
static public function add($arrData): array
{
try {
// 查询是否已存在
$XiaoShuoZhangJieModel = self::where('vp_md5', $arrData['vp_md5'])->find();
// 如果已存在,返回已有模型
if ($XiaoShuoZhangJieModel) {
return [
'model' => $XiaoShuoZhangJieModel,
'isNew' => false, // 已存在
];
}
// 新增数据
$XiaoShuoZhangJieModel = new self;
$XiaoShuoZhangJieModel->save($arrData);
return [
'model' => $XiaoShuoZhangJieModel,
'isNew' => true, // 新增
];
} catch (\Throwable $T) {
var_dump($T);
throw $T;
}
}
// static public function add($arrData): self
// {
// try {
// $XiaoShuoZhangJieModel = self::where('vp_md5', $arrData['vp_md5'])->find();
// if ($XiaoShuoZhangJieModel) {
// return $XiaoShuoZhangJieModel;
// }
// $XiaoShuoZhangJieModel = new self;
// $XiaoShuoZhangJieModel->save($arrData);
// return $XiaoShuoZhangJieModel;
// } catch (\Throwable $T) {
// var_dump($T);
// // if ($T->getCode() == 10501) {
// // return self::add($arrData);
// // }
// throw $T;
// }
// }
/**
* 判断章节是否存在
*
* @param bool $strXszjSourceCode
* @return void
*/
static public function checkZhangJieExists($strXszjSourceCode)
{
$XiaoShuoZhangJieModel = self::where('vp_md5', $strXszjSourceCode)->find();
return !empty($XiaoShuoZhangJieModel);
}
}

View File

@@ -1,90 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoYearsModel extends BaseModel
{
protected $name = 'video_years';
protected $pk = 'vy_id';
static $arrVideoShuoFenLei = [];
static public function add($arrData): self
{
try {
if (empty($arrData['vy_name'])) {
throw new \Exception("年份信息不全!");
}else{
$VideoFenLeiModel = self::where('vy_name', $arrData['vy_name'])->where('vc_id', $arrData['vc_id'])->find();
if ($VideoFenLeiModel) {
return $VideoFenLeiModel;
}
$VideoFenLeiModel = new self;
$VideoFenLeiModel->save($arrData);
return $VideoFenLeiModel;
}
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
//return self::add($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vy_name'] == $strName) {
$intId = $arrFenLei['vy_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '未知';
// var_dump(self::$arrXiaoShuoFenLei);
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vy_id'] === $intId) {
$strName = $arrFenLei['vy_name'];
}
}
return $strName;
}
static public function getDataByCache()
{
if (self::$arrVideoShuoFenLei == []) {
self::$arrVideoShuoFenLei = Cache::get('VIDEO_YEARS');
if (empty(self::$arrVideoShuoFenLei)) {
self::flushCache();
self::$arrVideoShuoFenLei = Cache::get('VIDEO_YEARS');
}
}
return self::$arrVideoShuoFenLei;
}
static public function flushCache()
{
$arrVideoShuoFenLei = self::select()->toArray();
Cache::tag('VIDEO_YEARS')->set('VIDEO_YEARS', $arrVideoShuoFenLei);
}
}

View File

@@ -1,90 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class VideoYuyanModel extends BaseModel
{
protected $name = 'video_language';
protected $pk = 'vla_id';
static $arrVideoShuoFenLei = [];
static public function add($arrData): self
{
try {
if (empty($arrData['vla_name'])) {
throw new \Exception("年份信息不全!");
}else{
$VideoFenLeiModel = self::where('vla_name', $arrData['vla_name'])->where('vc_id', $arrData['vc_id'])->find();
if ($VideoFenLeiModel) {
return $VideoFenLeiModel;
}
$VideoFenLeiModel = new self;
$VideoFenLeiModel->save($arrData);
return $VideoFenLeiModel;
}
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
//return self::add($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vla_name'] == $strName) {
$intId = $arrFenLei['vla_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '未知';
// var_dump(self::$arrXiaoShuoFenLei);
foreach (self::$arrVideoShuoFenLei as $arrFenLei) {
if ($arrFenLei['vla_id'] === $intId) {
$strName = $arrFenLei['vla_name'];
}
}
return $strName;
}
static public function getDataByCache()
{
if (self::$arrVideoShuoFenLei == []) {
self::$arrVideoShuoFenLei = Cache::get('VIDEO_YUYAN');
if (empty(self::$arrVideoShuoFenLei)) {
self::flushCache();
self::$arrVideoShuoFenLei = Cache::get('VIDEO_YUYAN');
}
}
return self::$arrVideoShuoFenLei;
}
static public function flushCache()
{
$arrVideoShuoFenLei = self::select()->toArray();
Cache::tag('VIDEO_YUYAN')->set('VIDEO_YUYAN', $arrVideoShuoFenLei);
}
}

View File

@@ -1,63 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\Model;
/**
* @mixin think\Model
*/
class VisitLogsModel extends BaseModel
{
protected $name = 'visit_logs';
protected $pk = 'vil_id';
static public function add(array $arrData): self
{
// 处理数据,避免 undefined index 问题
$arrData = [
'vil_ip' => $arrData['vil_ip'] ?? '',
'vil_user_agent' => $arrData['vil_user_agent'] ?? '',
'vil_url' => $arrData['vil_url'] ?? '',
'vil_method' => $arrData['vil_method'] ?? '',
'vil_headers' => $arrData['vil_headers'] ?? '',
'vil_timestamp' => date('Y-m-d H:i:s'),
'vil_content_type' => $arrData['vil_content_type'] ?? '',
'vil_content_id' => $arrData['vil_content_id'] ?? '',
'vil_is_spider' => $arrData['vil_is_spider'] ?? '',
'vil_location' => $arrData['vil_location'] ?? '',
];
try {
// 必填字段校验
$requiredFields = ['vil_ip', 'vil_url', 'vil_content_id', 'vil_content_type', 'vil_method'];
foreach ($requiredFields as $field) {
if (empty($arrData[$field])) {
var_dump('字段缺失: {}'.$field);
// throw new \InvalidArgumentException("字段缺失: {$field}");
}
}
// 创建模型实例
$visitLogModel = new self;
// 保存数据
if (!$visitLogModel::create($arrData)) {
var_dump('保存失败: ');
// throw new \RuntimeException('访问日志保存失败: ' . json_encode($arrData, JSON_UNESCAPED_UNICODE));
}
return $visitLogModel;
} catch (\Throwable $T) {
// 如果错误码是 10501可以在这里做特殊处理
if ($T->getCode() == 10501) {
// 记录日志或进行备用操作
// logError($T->getMessage());
}
throw $T; // 继续抛出异常
}
}
}

View File

@@ -1,92 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class XiaoShuoFenLeiModel extends BaseModel
{
protected $name = 'xiao_shuo_fen_lei';
protected $pk = 'xsfl_id';
static $arrXiaoShuoFenLei = [];
static public function addXiaoShuoFenLei($arrData): self
{
try {
if (empty($arrData['xsfl_name']) || empty($arrData['xsfl_source_id'])) {
throw new \Exception("小说分类信息不全!");
}
$XiaoShuoFenLeiModel = self::where('xsfl_name', $arrData['xsfl_name'])->find();
if ($XiaoShuoFenLeiModel) {
return $XiaoShuoFenLeiModel;
}
$XiaoShuoFenLeiModel = new self;
$XiaoShuoFenLeiModel->xsfl_source_id = $arrData['xsfl_source_id'];
$XiaoShuoFenLeiModel->xsfl_source_code = $arrData['xsfl_source_code'];
$XiaoShuoFenLeiModel->xsfl_name = $arrData['xsfl_name'];
$XiaoShuoFenLeiModel->save();
return $XiaoShuoFenLeiModel;
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
return self::addXiaoShuoFenLei($arrData);
}
throw $T;
}
}
static public function getIdByName($strName)
{
$intId = 0;
foreach (self::$arrXiaoShuoFenLei as $arrFenLei) {
if ($arrFenLei['xsfl_name'] == $strName && $arrFenLei['site_id'] == config('app.default_app_id')) {
$intId = $arrFenLei['xsfl_id'];
}
}
return $intId;
}
static public function getNameById($intId)
{
static::getDataByCache();
$strName = '全部';
foreach (self::$arrXiaoShuoFenLei as $arrFenLei) {
if ($arrFenLei['xsfl_source_id'] == $intId && $arrFenLei['site_id'] == config('app.default_app_id')) {
$strName = $arrFenLei['xsfl_name'];
}
}
return $strName;
}
static public function getDataByCache()
{
$strCacheKey = 'XIAO_SHUO_FEN_LEI';
if (self::$arrXiaoShuoFenLei == []) {
self::$arrXiaoShuoFenLei = Cache::get( $strCacheKey);
if (empty(self::$arrXiaoShuoFenLei)) {
self::flushCache();
self::$arrXiaoShuoFenLei = Cache::get( $strCacheKey);
}
}
return self::$arrXiaoShuoFenLei;
}
static public function flushCache()
{
$strCacheKey = 'XIAO_SHUO_FEN_LEI';
$arrXiaoShuoFenLei = self::where('site_id',config('app.default_app_id'))->select()->toArray();
Cache::tag( $strCacheKey)->set( $strCacheKey, $arrXiaoShuoFenLei);
}
}

View File

@@ -1,86 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
use app\admin\model\XiaoShuoFenLeiModel;
/**
* @mixin think\Model
*/
class XiaoShuoXiangQingModel extends BaseModel
{
protected $name = 'xiao_shuo_xiang_qing';
protected $pk = 'xsxq_id';
protected $append = [
'xsxq_feng_mian_url',
'xsfl_name',
];
public function getXsxqFengMianUrlAttr($value, $data)
{
if(!empty($data['xsxq_feng_mian'])){
$arrUrl = json_decode($data['xsxq_feng_mian'], true);
$strDomain = ZiYuanDuanDianModel::getDomainByCode($arrUrl['code']);
return $strDomain . $arrUrl['uri'];
}
return '';
}
public function getXsxqTagAttr($value, $data)
{
return json_decode($data['xsxq_tag'], true);
}
public function getXsflNameAttr($value, $data)
{
$strXiaoShuoFenLeiName = '';
if(!empty($data['xsfl_id'])){
$strXiaoShuoFenLeiName = XiaoShuoFenLeiModel::getNameById($data['xsfl_id']);
}
return $strXiaoShuoFenLeiName;
}
static public function addXiaoShuoXiangQing($arrData): self
{
try {
$XiaoShuoXiangQingModel = self::where('xsxq_source_code', $arrData['xsxq_source_code'])->find();
if ($XiaoShuoXiangQingModel) {
if ($XiaoShuoXiangQingModel->xsxq_geng_xin_shi_jian != $arrData['xsxq_geng_xin_shi_jian']) {
$XiaoShuoXiangQingModel->xsxq_geng_xin_shi_jian = $arrData['xsxq_geng_xin_shi_jian'];
$XiaoShuoXiangQingModel->xsxq_zuozhe = $arrData['xsxq_zuozhe'];
$XiaoShuoXiangQingModel->save();
}
return $XiaoShuoXiangQingModel;
}
$XiaoShuoXiangQingModel = new self;
$XiaoShuoXiangQingModel->save($arrData);
return $XiaoShuoXiangQingModel;
} catch (\Throwable $T) {
// if ($T->getCode() == 10501 && $retryCount < 3) { // 限制重试次数
// $retryCount++;
// return self::addXiaoShuoXiangQing($arrData, $retryCount);
// }
throw $T; // 超过重试次数后抛出异常
// if ($T->getCode() == 10501) {
// return self::addXiaoShuoXiangQing($arrData);
// }
// throw $T;
}
}
}

View File

@@ -1,49 +0,0 @@
<?php
declare(strict_types=1);
namespace app\admin\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class XiaoShuoZhangJieModel extends BaseModel
{
protected $name = 'xiao_shuo_zhang_jie';
protected $pk = 'xszj_id';
static public function addXiaoShuoZhangJie($arrData): self
{
try {
$XiaoShuoZhangJieModel = self::where('xszj_source_code', $arrData['xszj_source_code'])->find();
if ($XiaoShuoZhangJieModel) {
return $XiaoShuoZhangJieModel;
}
$XiaoShuoZhangJieModel = new self;
$XiaoShuoZhangJieModel->save($arrData);
return $XiaoShuoZhangJieModel;
} catch (\Throwable $T) {
if ($T->getCode() == 10501) {
return self::addXiaoShuoZhangJie($arrData);
}
throw $T;
}
}
/**
* 判断章节是否存在
*
* @param bool $strXszjSourceCode
* @return void
*/
static public function checkZhangJieExists($strXszjSourceCode)
{
$XiaoShuoZhangJieModel = self::where('xszj_source_code', $strXszjSourceCode)->find();
return !empty($XiaoShuoZhangJieModel);
}
}

View File

@@ -0,0 +1,97 @@
<?php
declare (strict_types = 1);
namespace app\home;
use think\App;
use think\exception\ValidateException;
use think\facade\View;
use think\Validate;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
// 控制器初始化
$this->initialize();
// View::assign('')
}
// 初始化
protected function initialize()
{}
/**
* 验证数据
* @access protected
* @param array $data 数据
* @param string|array $validate 验证器名或者验证规则数组
* @param array $message 提示信息
* @param bool $batch 是否批量验证
* @return array|string|true
* @throws ValidateException
*/
protected function validate(array $data, string|array $validate, array $message = [], bool $batch = false)
{
if (is_array($validate)) {
$v = new Validate();
$v->rule($validate);
} else {
if (strpos($validate, '.')) {
// 支持场景
[$validate, $scene] = explode('.', $validate);
}
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
$v = new $class();
if (!empty($scene)) {
$v->scene($scene);
}
}
$v->message($message);
// 是否批量验证
if ($batch || $this->batchValidate) {
$v->batch(true);
}
return $v->failException(true)->check($data);
}
}

View File

@@ -0,0 +1,5 @@
<?php
use app\model\AutoSwitchViewModel;
return AutoSwitchViewModel::getViewConfig();

View File

@@ -1,17 +1,37 @@
<?php <?php
declare (strict_types = 1);
declare(strict_types=1);
namespace app\home\controller; namespace app\home\controller;
class Index use app\home\BaseController;
use storage\StorageCore;
use think\facade\View;
class Index extends BaseController
{ {
public function index() public function index()
{ {
$arrConfig = config(); return View::fetch();
echo '<pre>'; }
print_r($arrConfig);
echo '</pre>'; public function test()
// exit; {
return '您好!这是一个[home]示例应用';
$strNovelKey = "novels/12/chapters/3001.txt";
$StorageCore = StorageCore::getInstance();
// $content = '我是一个大傻逼';
$content = file_get_contents('123.txt');
if ($StorageCore->has($strNovelKey)) {
// $MinIO->update($strNovelKey, $content); // 更新已有文件
} else {
$StorageCore->write($strNovelKey, $content); // 创建新文件
}
echo $StorageCore->read($strNovelKey);
return;
} }
} }

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace app\home\controller;
use app\home\BaseController;
use storage\StorageCore;
use think\facade\View;
class Novel extends BaseController
{
public function index()
{
return View::fetch();
}
}

View File

@@ -0,0 +1 @@
12312321

View File

@@ -0,0 +1 @@
12312321

View File

@@ -1,7 +1,7 @@
<?php <?php
declare (strict_types = 1); declare (strict_types = 1);
namespace app\admin\model; namespace app\model;
use think\Model; use think\Model;

View File

@@ -1,7 +1,7 @@
<?php <?php
declare (strict_types = 1); declare (strict_types = 1);
namespace app\admin\model; namespace app\model;
use think\Model; use think\Model;
use think\facade\Cache; use think\facade\Cache;

View File

@@ -1,7 +1,7 @@
<?php <?php
declare (strict_types = 1); declare (strict_types = 1);
namespace app\admin\model; namespace app\model;
use think\Model; use think\Model;

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace app\model;
use think\Request;
class AutoSwitchViewModel
{
static public function getViewConfig(): array
{
$Request = request();
$strDomain = $Request->rootDomain();
$DomainModel = DomainModel::getDomainByCache($strDomain);
$TemplatesModel = TemplatesModel::getValByCode($DomainModel->t_id);
$Request->DomainModel = $DomainModel;
$Request->TemplatesModel = $TemplatesModel;
return [
'type' => 'Think',
'auto_rule' => 3,
'view_dir_name' => 'view',
'view_suffix' => 'html',
'view_path' => root_path($TemplatesModel->t_path),
];
}
}

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace app\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class DomainModel extends BaseModel
{
protected $name = 'domain';
protected $pk = 'd_id';
static public function getDomainByCache($strDomain)
{
$strKey = "D:" . $strDomain;
return DomainModel::where('d_domain', $strDomain)->cache($strKey, 24 * 3600)->find();
}
static public function flushDomainCache($strDomain)
{
$strKey = "D:" . $strDomain;
return Cache::delete($strKey);
}
}

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace app\model;
use think\facade\Cache;
use think\Model;
/**
* @mixin think\Model
*/
class TemplatesModel extends BaseModel
{
protected $name = 'templates';
protected $pk = 't_id';
static $arrTemplates = [];
static public function getValByCode($intTId)
{
if (self::$arrTemplates == []) {
self::$arrTemplates = Cache::get('Templates');
if (empty(self::$arrTemplates)) {
self::flushCache();
self::$arrTemplates = Cache::get('Templates');
}
}
return self::$arrTemplates[$intTId] ?? NULL;
}
static public function flushCache()
{
$TemplatesModelAll = self::select();
$TemplatesCol = $TemplatesModelAll->column(null, 't_id');
Cache::tag('Templates')->set('Templates', $TemplatesCol);
}
}

View File

@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace app\admin\model; namespace app\model;
use think\facade\Cache; use think\facade\Cache;
use think\Model; use think\Model;

View File

@@ -4,8 +4,8 @@ declare(strict_types=1);
namespace app\task\collection; namespace app\task\collection;
use app\admin\model\CaiJiPeiZhiModel; use app\model\CaiJiPeiZhiModel;
use app\admin\model\SystemConfigModel; use app\model\SystemConfigModel;
use app\task\core\TaskCore; use app\task\core\TaskCore;
use GuzzleHttp\Client; use GuzzleHttp\Client;

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace app\task\collection\biquxs; namespace app\task\collection\biquxs;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace app\task\collection\ccc5; namespace app\task\collection\ccc5;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -4,15 +4,15 @@ declare(strict_types=1);
namespace app\task\collection\dadi; namespace app\task\collection\dadi;
use app\admin\model\VideoPlayurlModel; use app\model\VideoPlayurlModel;
use app\admin\model\VideoLeixinModel; use app\model\VideoLeixinModel;
use app\admin\model\VideoDiquModel; use app\model\VideoDiquModel;
use app\admin\model\VideoYearsModel; use app\model\VideoYearsModel;
use app\admin\model\VideoJuqingModel; use app\model\VideoJuqingModel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\VideoInfoModel; use app\model\VideoInfoModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -4,15 +4,15 @@ declare(strict_types=1);
namespace app\task\collection\heimuer; namespace app\task\collection\heimuer;
use app\admin\model\VideoPlayurlModel; use app\model\VideoPlayurlModel;
use app\admin\model\VideoLeixinModel; use app\model\VideoLeixinModel;
use app\admin\model\VideoDiquModel; use app\model\VideoDiquModel;
use app\admin\model\VideoYearsModel; use app\model\VideoYearsModel;
use app\admin\model\VideoJuqingModel; use app\model\VideoJuqingModel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\VideoInfoModel; use app\model\VideoInfoModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -5,10 +5,10 @@ declare(strict_types=1);
namespace app\task\collection\novel; namespace app\task\collection\novel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\admin\model\NovelInfoSeoModel; use app\model\NovelInfoSeoModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace app\task\collection\novelone; namespace app\task\collection\novelone;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace app\task\collection\novelone; namespace app\task\collection\novelone;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -6,9 +6,9 @@ namespace app\task\collection\seo;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use app\admin\model\VideoInfoModel; use app\model\VideoInfoModel;
use app\admin\model\SystemConfigModel; use app\model\SystemConfigModel;
use app\admin\model\VideoClassModel; use app\model\VideoClassModel;
class GenerateSiteMapCol extends PullDataColBase class GenerateSiteMapCol extends PullDataColBase
{ {

View File

@@ -6,11 +6,11 @@ namespace app\task\collection\seo;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\admin\model\SystemConfigModel; use app\model\SystemConfigModel;
use app\admin\model\SiteModel; use app\model\SiteModel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
class GenerateSiteMapNovel extends PullDataColBase class GenerateSiteMapNovel extends PullDataColBase
{ {

View File

@@ -6,11 +6,11 @@ namespace app\task\collection\seo;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\NovelInfoSeoModel; use app\model\NovelInfoSeoModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\admin\model\SiteModel; use app\model\SiteModel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
class GenerateSiteMapNovelSk extends PullDataColBase class GenerateSiteMapNovelSk extends PullDataColBase
{ {

View File

@@ -6,11 +6,11 @@ namespace app\task\collection\seo;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\NovelInfoSeoModel; use app\model\NovelInfoSeoModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\admin\model\SiteModel; use app\model\SiteModel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
class GenerateSiteMapNovelZw extends PullDataColBase class GenerateSiteMapNovelZw extends PullDataColBase
{ {

View File

@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace app\task\collection\tianlai; namespace app\task\collection\tianlai;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -5,16 +5,16 @@ declare(strict_types=1);
namespace app\task\collection\visitlogs; namespace app\task\collection\visitlogs;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;
use think\facade\Cache; use think\facade\Cache;
use QL\QueryList; use QL\QueryList;
use app\admin\model\VisitLogsModel; use app\model\VisitLogsModel;
use app\admin\model\ContentStatsModel; use app\model\ContentStatsModel;
/** /**
* @mixin think\Model * @mixin think\Model

View File

@@ -5,15 +5,15 @@ declare(strict_types=1);
namespace app\task\collection\visitlogs; namespace app\task\collection\visitlogs;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;
use think\facade\Cache; use think\facade\Cache;
use QL\QueryList; use QL\QueryList;
use app\admin\model\VisitLogsModel; use app\model\VisitLogsModel;
/** /**
* @mixin think\Model * @mixin think\Model

View File

@@ -4,16 +4,16 @@ declare(strict_types=1);
namespace app\task\collection\yzzy; namespace app\task\collection\yzzy;
use app\admin\model\VideoYuyanModel; use app\model\VideoYuyanModel;
use app\admin\model\VideoPlayurlModel; use app\model\VideoPlayurlModel;
use app\admin\model\VideoLeixinModel; use app\model\VideoLeixinModel;
use app\admin\model\VideoDiquModel; use app\model\VideoDiquModel;
use app\admin\model\VideoYearsModel; use app\model\VideoYearsModel;
use app\admin\model\VideoJuqingModel; use app\model\VideoJuqingModel;
use app\admin\model\XiaoShuoFenLeiModel; use app\model\XiaoShuoFenLeiModel;
use app\admin\model\XiaoShuoXiangQingModel; use app\model\XiaoShuoXiangQingModel;
use app\admin\model\VideoInfoModel; use app\model\VideoInfoModel;
use app\admin\model\XiaoShuoZhangJieModel; use app\model\XiaoShuoZhangJieModel;
use app\task\collection\PullDataColBase; use app\task\collection\PullDataColBase;
use GuzzleHttp\Cookie\CookieJar; use GuzzleHttp\Cookie\CookieJar;
use processor\ImageProcessor; use processor\ImageProcessor;

View File

@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace app\task\logic; namespace app\task\logic;
use app\admin\model\GuangGaoFenZuModel; use app\model\GuangGaoFenZuModel;
use app\admin\model\GuangGaoModel; use app\model\GuangGaoModel;
use app\admin\model\GuangGaoPeiZhiModel; use app\model\GuangGaoPeiZhiModel;
use GuzzleHttp\Client; use GuzzleHttp\Client;
/** /**

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace app\task\module; namespace app\task\module;
use app\admin\model\PlanTaskModel; use app\model\PlanTaskModel;
use app\task\collection\ailisi\XiaoShuoCol; use app\task\collection\ailisi\XiaoShuoCol;
use app\task\collection\biquxs\BiquxsXiaoShuoCol; use app\task\collection\biquxs\BiquxsXiaoShuoCol;
use app\task\collection\ccc5\XiaoShuo5cccCol; use app\task\collection\ccc5\XiaoShuo5cccCol;

View File

@@ -25,12 +25,15 @@
"topthink/think-orm": "^3.0|^4.0", "topthink/think-orm": "^3.0|^4.0",
"topthink/think-filesystem": "^2.0", "topthink/think-filesystem": "^2.0",
"topthink/think-multi-app": "^1.1", "topthink/think-multi-app": "^1.1",
"topthink/think-view": "^1.0", "topthink/think-view": "^2.0",
"guzzlehttp/guzzle": "^7.8", "guzzlehttp/guzzle": "^7.8",
"jaeger/querylist": "^4.2", "jaeger/querylist": "^4.2",
"topthink/think-migration": "^3.1", "topthink/think-migration": "^3.1",
"topthink/think-helper": "^3.1", "topthink/think-helper": "^3.1",
"fakerphp/faker": "^1.23" "fakerphp/faker": "^1.23",
"aws/aws-sdk-php": "^3.337",
"league/flysystem": "^1.1",
"league/flysystem-aws-s3-v3": "^1.0"
}, },
"require-dev": { "require-dev": {
"topthink/think-dumper": "^1.0", "topthink/think-dumper": "^1.0",

View File

@@ -6,19 +6,32 @@
return [ return [
// 应用的命名空间 // 应用的命名空间
'app_namespace' => '', 'app_namespace' => '',
// 是否启用路由 // 是否启用路由
'with_route' => true, 'with_route' => true,
// 默认应用 // 默认应用
'default_app' => 'home', 'default_app' => 'home',
// 默认时区 // 默认时区
'default_timezone' => 'Asia/Shanghai', 'default_timezone' => 'Asia/Shanghai',
// 应用映射(自动多应用模式有效) // 应用映射(自动多应用模式有效)
'app_map' => [], 'app_map' => [
'admin' => 'admin'
],
// 域名绑定(自动多应用模式有效) // 域名绑定(自动多应用模式有效)
'domain_bind' => [], 'domain_bind' => [
'*' => 'home',
'adapi' => 'admin',
],
// 禁止URL访问的应用列表自动多应用模式有效 // 禁止URL访问的应用列表自动多应用模式有效
'deny_app_list' => [], 'deny_app_list' => [
'task',
'model',
],
// 异常页面的模板文件 // 异常页面的模板文件
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',

24
code/config/storage.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | MinIO设置
// +----------------------------------------------------------------------
return [
'minio' => [
// 端点
'endpoint' => env('MINIO_END_POINT', '127.0.0.1:9000'),
// KEY
'key' => env('MINIO_KEY', ''),
// 密钥
'secret' => env('MINIO_SECRET', ''),
// 区域
'region' => env('MINIO_REGION', 'us-east-1'),
// 桶
'bucket' => env('MINIO_BUCKET', 'my-bucket'),
],
'local' => [
'dir' => env('STORAGE_LOCAL_DIR', ''),
]
];

View File

@@ -5,16 +5,16 @@ use think\migration\db\Column;
class AddGgPaiXuColumOnGuangGaoTable extends Migrator class AddGgPaiXuColumOnGuangGaoTable extends Migrator
{ {
public function up() // public function up()
{ // {
$Table = $this->table('guang_gao'); // $Table = $this->table('guang_gao');
$Table->addColumn('gg_sort', 'integer', ['after' => 'gg_tiao_zhuan_di_zhi'])->setComment("排序")->save(); // $Table->addColumn('gg_sort', 'integer', ['after' => 'gg_tiao_zhuan_di_zhi'])->setComment("排序")->save();
} // }
public function down() // public function down()
{ // {
$Table = $this->table('guang_gao'); // $Table = $this->table('guang_gao');
$Table->removeColumn('gg_sort')->save(); // $Table->removeColumn('gg_sort')->save();
} // }
} }

View File

@@ -1,46 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class SeoKeywordsTable extends Migrator
{
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('seo_keywords', [
'id' => 'sw_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 sw_title 字段,类型为字符串
$table->addColumn('sw_title', 'string', [
'limit' => 255,
'null' => false,
'comment' => '关键词标题'
]);
// 添加 sw_status 字段,类型为布尔值或整数
$table->addColumn('sw_status', 'boolean', [
'default' => 0,
'null' => false,
'comment' => '关键词状态1表示启用0表示禁用'
]);
// 添加 sw_html_path 字段,类型为字符串
$table->addColumn('sw_html_path', 'string', [
'limit' => 255,
'null' => true,
'comment' => '关键词关联的HTML路径'
]);
// 为 sw_html_path 字段添加索引
$table->addIndex(['sw_html_path'], [
'unique' => false, // 如果你希望索引是唯一的,设置为 true
'name' => 'idx_sw_html_path' // 索引名称,可以省略,系统会自动生成
]);
// 创建表
$table->create();
}
}

View File

@@ -1,20 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class GuanggaoAddStatus extends Migrator
{
public function up()
{
$Table = $this->table('guang_gao');
$Table->addColumn('gg_status', 'integer', ['after' => 'gg_tiao_zhuan_di_zhi', 'default' => 0])->setComment("状态")->save();
}
public function down()
{
$Table = $this->table('guang_gao');
$Table->removeColumn('gg_status')->save();
}
}

View File

@@ -1,65 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoClass extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_class', [
'id' => 'vc_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 vc_name 字段,类型为字符串
$table->addColumn('vc_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '分类名称'
]);
// 添加 vc_name 字段,类型为字符串
$table->addColumn('vc_nicheng', 'string', [
'limit' => 255,
'null' => false,
'comment' => '分类昵称'
]);
$table->addColumn('vc_sort', 'integer', [
'limit' => 255,
'default'=>0,
'comment' => '排序'
]);
// 添加 vc_status 字段,类型为布尔值或整数
$table->addColumn('vc_status', 'boolean', [
'default' => 1,
'null' => false,
'comment' => '关键词状态1表示启用0表示禁用'
]);
// 创建表
$table->create();
}
}

View File

@@ -1,65 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoLeixin extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_leixin', [
'id' => 'vl_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 vc_id 字段,
$table->addColumn('vc_id', 'integer', [
'limit' => 11,
'null' => false,
'comment' => '分类id'
]);
// 添加 vl_name 字段,类型为字符串
$table->addColumn('vl_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '类型名称'
]);
// 添加 vp_sort 字段,
$table->addColumn('vl_sort', 'integer', [
'default'=>0,
'comment' => '排序'
]);
// 添加 vc_status 字段,类型为布尔值或整数
$table->addColumn('vl_status', 'boolean', [
'default' => 1,
'null' => false,
'comment' => '关键词状态1表示启用0表示禁用'
]);
// 创建表
$table->create();
}
}

View File

@@ -1,58 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoJuqing extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_juqing', [
'id' => 'vj_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 vc_id 字段,
$table->addColumn('vc_id', 'integer', [
'limit' => 11,
'null' => false,
'comment' => '分类id'
]);
// 添加 vl_name 字段,类型为字符串
$table->addColumn('vj_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '剧情名称'
]);
// 添加 vp_sort 字段,
$table->addColumn('vj_sort', 'integer', [
'default'=>0,
'comment' => '排序'
]);
// 创建表
$table->create();
}
}

View File

@@ -1,59 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoDiqu extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_diqu', [
'id' => 'vd_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 vc_id 字段,
$table->addColumn('vc_id', 'integer', [
'limit' => 11,
'null' => false,
'comment' => '分类id'
]);
// 添加 vl_name 字段,类型为字符串
$table->addColumn('vd_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '地区名称'
]);
// 添加 vp_sort 字段,
$table->addColumn('vd_sort', 'integer', [
'limit' => 255,
'default'=>0,
'comment' => '排序'
]);
// 创建表
$table->create();
}
}

View File

@@ -1,58 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoYears extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_years', [
'id' => 'vy_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 vc_id 字段,
$table->addColumn('vc_id', 'integer', [
'limit' => 11,
'null' => false,
'comment' => '分类id'
]);
// 添加 vl_name 字段,类型为字符串
$table->addColumn('vy_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '年份名称'
]);
// 添加 vp_sort 字段,
$table->addColumn('vy_sort', 'integer', [
'limit' => 255,
'default'=>0,
'comment' => '排序'
]);
// 创建表
$table->create();
}
}

View File

@@ -1,59 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoLanguage extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_language', [
'id' => 'vla_id' // 这里指定 sw_id 作为自增主键
]);
// 添加 vc_id 字段,
$table->addColumn('vc_id', 'integer', [
'limit' => 11,
'null' => false,
'comment' => '分类id'
]);
// 添加 vl_name 字段,类型为字符串
$table->addColumn('vla_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '语言名称'
]);
// 添加 vp_sort 字段,
$table->addColumn('vla_sort', 'integer', [
'limit' => 255,
'default'=>0,
'comment' => '排序'
]);
// 创建表
$table->create();
}
}

View File

@@ -1,91 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoInfo extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 video_info 表
$table = $this->table('video_info', [
'id' => 'v_id' // 这里指定 v_id 作为自增主键
]);
$table->addColumn('v_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
$table->addColumn('v_cover', 'json', ['default' => null, 'null' => true, 'comment' => '封面']);
$table->addColumn('vc_id', 'integer', ['comment' => '视频分类id:1电影,2电视剧,3综艺,4动漫']);
$table->addColumn('v_pinyin', 'string', ['limit' => 255,'comment' => '[拼音id]']);
$table->addColumn('v_leixin', 'string', ['limit' => 255,'null' => true,'comment' => '类型']);
$table->addColumn('v_juqing', 'string', ['limit' => 255,'null' => true,'comment' => '剧情']);
$table->addColumn('v_diqu', 'string', ['limit' => 255,'null' => true,'comment' => '地区']);
$table->addColumn('v_years', 'string', ['limit' => 255,'null' => true,'comment' => '年份']);
$table->addColumn('v_language', 'string', ['limit' => 255,'null' => true,'comment' => '语言']);
$table->addColumn('v_daoyan', 'string', ['limit' => 255,'null' => true,'comment' => '导演']);
$table->addColumn('v_zhuyan', 'string', ['limit' => 255,'null' => true,'comment' => '主演']);
$table->addColumn('v_orurl', 'string', ['limit' => 255,'comment' => '来源url']);
$table->addColumn('v_md5', 'string', ['limit' => 255,'comment' => 'md5:vc_id+v_name+v_orurl']);
$table->addColumn('v_jiaobiao', 'string', ['limit' => 255,'null' => true,'comment' => '角标']);
$table->addColumn('v_description', 'text', ['comment' => '简介']);
$table->addColumn('v_pingfen', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => 0, 'comment' => '评分']);
$table->addColumn('v_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
$table->addColumn('v_click', 'integer', ['default'=>0,'comment' => '点击数']);
$table->addColumn('v_recommend', 'integer', ['default'=>0,'comment' => '推荐等级']);
$table->addColumn('update_time', 'datetime', ['null' => true, 'comment' => '更新时间']);
$table->addColumn('create_time', 'datetime', ['null' => true, 'comment' => '创建时间']);
$table->addIndex('vc_id');
$table->addIndex('v_md5');
$table->addIndex('v_pinyin');
$table->addIndex('v_status');
// 添加复合索引 idx_vc_id_pingfen
$table->addIndex(['vc_id', 'v_pingfen'], [
'name' => 'idx_vc_id_pingfen',
'unique' => false
]);
// 添加复合索引 idx_vc_id_v_click
$table->addIndex(['vc_id', 'v_click'], [
'name' => 'idx_vc_id_v_click',
'unique' => false
]);
// 创建表
$table->create();
// $table->string('head_title',100)->default('')->comment('seo-标题');
// $table->string('head_keyword',200)->default('')->comment('seo-关键词');
// $table->string('head_description',255)->default('')->comment('seo-描述');
}
}

View File

@@ -1,68 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class VideoPlayurl extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_keywords 表
$table = $this->table('video_playurl', [
'id' => 'vp_id' // 这里指定 vp_id 作为自增主键
]);
// 添加 v_id 字段,
$table->addColumn('v_id', 'integer', [
'comment' => '视频id'
]);
// 添加 vp_sort 字段,
$table->addColumn('vp_sort', 'integer', [
'default'=>0,
'comment' => '线路排序'
]);
// 添加 vp_md5 字段,
$table->addColumn('vp_md5', 'string', [
'limit' => 255,
'comment' => 'md5:v_id+vp_url'
]);
// 添加 vp_name 字段,类型为字符串
$table->addColumn('vp_name', 'string', [
'limit' => 255,
'null' => false,
'comment' => '线路名称'
]);
$table->addColumn('vp_url', 'json', [ 'null' => false, 'comment' => '播放地址']);
$table->addIndex('v_id');
$table->addIndex('vp_md5');
// 创建表
$table->create();
}
}

View File

@@ -1,62 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class GanRaoMa extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 gan_rao_ma 表
$table = $this->table('gan_rao_ma', [
'id' => 'grm_id' // 这里指定 grm_id 作为自增主键
]);
// 添加 grm_neirong 字段,类型为字符串
$table->addColumn('grm_neirong', 'text', [
'null' => false,
'comment' => '干扰码内容'
]);
// 添加 grm_status 字段,类型为布尔值或整数
$table->addColumn('grm_status', 'boolean', [
'default' => 0,
'null' => false,
'comment' => '干扰码状态1表示启用0表示禁用'
]);
// 添加 grm_html_path 字段,类型为字符串
$table->addColumn('grm_html_path', 'string', [
'limit' => 255,
'null' => true,
'comment' => '干扰码关联的HTML路径'
]);
// 为 grm_html_path 字段添加索引
$table->addIndex('grm_html_path');
// 创建表
$table->create();
}
}

View File

@@ -1,48 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class SeoTdkConfig extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 seo_tdk_config 表
$table = $this->table('seo_tdk_config', [
'id' => 'stc_id' // 这里指定 stc_id 作为自增主键
]);
$table->addColumn('stc_code', 'string', ['limit' => 255,'null' => false,'comment' => '编码标识']);
$table->addColumn('stc_name', 'string', ['limit' => 255,'null' => true,'comment' => '页面名称']);
$table->addColumn('stc_title', 'string', ['limit' => 255,'null' => true,'comment' => '页面标题']);
$table->addColumn('stc_keywords', 'string', ['limit' => 255,'null' => true,'comment' => '页面关键词']);
$table->addColumn('stc_description', 'string', ['limit' => 255,'null' => true,'comment' => '页面描述']);
$table->addColumn('stc_other_conf', 'string', ['limit' => 255,'null' => true,'comment' => '其它配置']);
$table->addColumn('stc_tongji_daima', 'string', ['limit' => 255,'null' => true,'comment' => '页面统计代码']);
$table->addColumn('stc_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
$table->addIndex('stc_code');
// 创建表
$table->create();
}
}

View File

@@ -1,56 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateVisitLogs extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 visit_logs 表
$visitLogsTable = $this->table('visit_logs', [
'id' => 'vil_id' // 这里指定 stc_id 作为自增主键
]);
$visitLogsTable->addColumn('vil_ip', 'string', ['limit' => 45, 'null' => false, 'comment' => '访问者 IP 地址'])
->addColumn('vil_url', 'text', ['null' => false, 'comment' => '访问的 URL'])
->addColumn('vil_method', 'string', ['limit' => 10, 'null' => false, 'comment' => 'HTTP 方法'])
->addColumn('vil_content_type', 'enum', ['values' => ['video', 'novel', 'page'], 'null' => false, 'comment' => '内容类型(视频、小说、页面)'])
->addColumn('vil_content_id', 'string', ['default' => '','null' => false, 'comment' => '内容 ID视频、小说或页面的唯一标识'])
->addColumn('vil_user_agent', 'text', ['null' => true, 'comment' => 'User-Agent 信息'])
->addColumn('vil_headers', 'text', ['null' => true, 'comment' => '请求头信息'])
->addColumn('vil_is_spider', 'boolean', ['default' => 0, 'comment' => '是否为爬虫0-否1-是'])
->addColumn('vil_location', 'text', ['null' => true, 'comment' => '地理位置'])
->addColumn('vil_user_id', 'biginteger', ['null' => true, 'comment' => '用户 ID可选'])
->addColumn('vil_timestamp', 'datetime', ['null' => true,'default' => 'CURRENT_TIMESTAMP', 'comment' => '访问时间'])
// 添加索引
->addIndex(['vil_content_type', 'vil_content_id'], ['name' => 'idx_content_type_id'])
->addIndex('vil_timestamp', ['name' => 'idx_timestamp'])
->addIndex('vil_is_spider', ['name' => 'idx_is_spider'])
->addIndex('vil_user_id', ['name' => 'idx_user_id'])
->addIndex('vil_ip', ['name' => 'idx_ip'])
->create();
}
}

View File

@@ -1,87 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateContentStats extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 content_stats 表
$table = $this->table('content_stats', [
'id' => 'cs_id' // 这里指定 stc_id 作为自增主键
]);
$table->addColumn('cs_content_type', 'enum', [
'values' => ['video', 'novel', 'page'], // 扩展支持页面
'null' => false,
'comment' => '内容类型(视频、小说、页面)'
])
->addColumn('cs_content_id', 'string', [
'null' => false,
'comment' => '内容 ID视频、小说或页面 ID'
])
->addColumn('cs_stat_date', 'string', [
'null' => false,
'comment' => '统计日期'
])
->addColumn('cs_stat_period', 'enum', [
'values' => ['day', 'week', 'month', 'quarter', 'year'],
'null' => false,
'comment' => '统计周期'
])
->addColumn('cs_pv', 'integer', [
'null' => false,
'default' => 0,
'comment' => '页面浏览量PV'
])
->addColumn('cs_uv', 'integer', [
'null' => false,
'default' => 0,
'comment' => '独立访客量UV'
])
->addColumn('updated_at', 'timestamp', [
'default' => 'CURRENT_TIMESTAMP',
'update' => 'CURRENT_TIMESTAMP',
'comment' => '更新时间'
])
->addColumn('cs_md5', 'string', [
'default' => '',
'null' => false,
'comment' => 'md5(cs_content_type+cs_content_id+cs_stat_date+cs_stat_period'
])
// 添加索引
->addIndex('cs_content_type', ['name' => 'cs_content_type'])
->addIndex('cs_content_id', ['name' => 'cs_content_id'])
->addIndex('cs_stat_date', ['name' => 'cs_stat_date'])
->addIndex('cs_stat_period', ['name' => 'cs_stat_period'])
->addIndex(['cs_md5'], [
'unique' => true,
'name' => 'unique_cs_md5'
])
->create();
}
}

View File

@@ -1,41 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class AddNewColumnToVideoInfo extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('video_info');
// 添加 "影院售票总额" 字段
$table->addColumn('v_ticket_sales', 'decimal', [
'precision' => 12, // 最大 9999999999.99
'scale' => 2, // 保留两位小数
'default' => 0.00, // 默认值 0.00
'comment' => '影院售票总额(单位:亿元)'
])->update();
}
}

View File

@@ -1,48 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class SeoHtml extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 video_info 表
$table = $this->table('seo_html', [
'id' => 'sh_id' // 这里指定 v_id 作为自增主键
]);
$table->addColumn('sh_title', 'string', ['limit' => 255,'null' => false,'comment' => 'title']);
$table->addColumn('sh_keywords', 'string', ['limit' => 255,'null' => false,'comment' => 'keywords']);
$table->addColumn('sh_description', 'text', ['comment' => '简介']);
$table->addColumn('sh_body', 'text', ['comment' => '内容']);
$table->addColumn('sh_click', 'integer', ['default'=>0,'comment' => '点击数']);
$table->addColumn('sh_html_path', 'string', ['limit' => 255, 'null' => true,'comment' => 'HTML源文件路径']);
$table->addColumn('update_time', 'datetime', ['null' => true, 'comment' => '更新时间']);
$table->addColumn('create_time', 'datetime', ['null' => true, 'comment' => '创建时间']);
$table->addIndex('sh_html_path');
// 创建表
$table->create();
}
}

View File

@@ -1,54 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateXiaoShuoXiangQingSeo extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 video_info 表
$table = $this->table('novel_info_seo', [
'id' => 'nis_id' // 这里指定 v_id 作为自增主键
]);
$table->addColumn('nis_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
$table->addColumn('nis_jie_shao', 'text', ['comment' => '介绍']);
$table->addColumn('xsxq_id', 'integer', ['comment' => '小说详情id']);
$table->addColumn('nis_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
$table->addColumn('nis_click', 'integer', ['default'=>0,'comment' => '点击数']);
$table->addColumn('nis_md5', 'string', ['limit' => 255,'comment' => 'md5:xsxq_id+nis_name']);
$table->addIndex('xsxq_id');
$table->addIndex('nis_md5');
// 创建表
$table->create();
}
}

View File

@@ -1,56 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class AddNewColumnToXiaoShuoZhangJie extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('xiao_shuo_zhang_jie');
// 添加 "章节索引" 字段
$table->addColumn('xszj_sort', 'integer', [
'default' => 1,
'comment' => '章节索引'
]);
// 修改字段 "xszj_ming_zi",使其不能为空
$table->changeColumn('xszj_ming_zi', 'string', [
'null' => false, // 设置字段为 NOT NULL
'comment' => '章节名称'
]);
// 添加 "xszj_source_code" 字段并设置为唯一
// $table->addColumn('xszj_source_code', 'string', [
// 'null' => false,
// 'comment' => '来源代码'
// ]);
// 为 "xszj_source_code" 添加唯一索引,确保其值唯一
//$table->addIndex(['xszj_source_code'], ['unique' => true]);
$table->update();
}
}

View File

@@ -1,54 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateVideoInfoSeo extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 video_info 表
$table = $this->table('video_info_seo', [
'id' => 'vis_id' // 这里指定 v_id 作为自增主键
]);
$table->addColumn('vis_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
$table->addColumn('vis_jie_shao', 'text', ['comment' => '介绍']);
$table->addColumn('v_id', 'integer', ['comment' => '详情id']);
$table->addColumn('vis_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
$table->addColumn('vis_click', 'integer', ['default'=>0,'comment' => '点击数']);
$table->addColumn('vis_md5', 'string', ['limit' => 255,'comment' => 'md5:v_id+vis_name']);
$table->addIndex('v_id');
$table->addIndex('vis_md5');
// 创建表
$table->create();
}
}

View File

@@ -1,56 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateSite extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 创建 video_info 表
$table = $this->table('site', [
'id' => 'site_id' // 这里指定 v_id 作为自增主键
]);
$table->addColumn('site_name', 'string', ['limit' => 255,'null' => false,'comment' => '名称']);
$table->addColumn('site_type', 'string', ['limit' => 255,'null' => false,'comment' => '站点类型:novel.video']);
$table->addColumn('site_log_type', 'string', ['limit' => 255,'null' => false,'comment' => 'logo类型 1图片2文字']);
$table->addColumn('site_email', 'string', ['limit' => 255,'null' => false,'comment' => '邮箱']);
$table->addColumn('site_telegram', 'string', ['limit' => 255,'null' => false,'comment' => 'Telegram']);
$table->addColumn('site_domain', 'string', ['limit' => 255,'null' => false,'comment' => '域名']);
$table->addColumn('site_share_domain', 'string', ['limit' => 255,'null' => false,'comment' => '分享域名']);
$table->addColumn('site_version', 'string', ['limit' => 255,'null' => false,'comment' => '版本号']);
$table->addColumn('site_fenlei_path', 'string', ['limit' => 255,'null' => true,'comment' => '分类路由目录']);
$table->addColumn('site_xiangqing_path', 'string', ['limit' => 255,'null' => true,'comment' => '详情路由目录']);
$table->addColumn('site_zhangjie_path', 'string', ['limit' => 255,'null' => true,'comment' => '章节路由目录']);
$table->addColumn('site_rank_path', 'string', ['limit' => 255,'null' => true,'comment' => '排行榜路由目录']);
$table->addColumn('site_tui_jian_path', 'string', ['limit' => 255,'null' => true,'comment' => '推荐路由目录']);
$table->addColumn('site_seo_path', 'string', ['limit' => 255,'null' => true,'comment' => '详情seo词路由目录']);
$table->addColumn('site_zdy_path', 'string', ['limit' => 255,'null' => true,'comment' => '自定义seo页面路由目录']);
$table->addColumn('site_tongji', 'text', ['comment' => '统计']);
$table->addColumn('site_status', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'状态:0:正常,1:异常'));
// 创建表
$table->create();
}
}

View File

@@ -1,57 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class AddCloumaToAllTableAddSite extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
// 需要添加 `site_id` 的表 gan_rao_ma guang_gao guang_gao_pei_zhi guang_gao_fen_zu plan_task seo_tdk_config system_config video_class visit_logs content_stats xiao_shuo_fen_lei
$tables = ['gan_rao_ma', 'guang_gao', 'guang_gao_pei_zhi', 'guang_gao_fen_zu', 'plan_task', 'seo_tdk_config', 'system_config', 'video_class', 'visit_logs', 'content_stats', 'xiao_shuo_fen_lei']; // 这里填写你的表名
foreach ($tables as $table) {
if ($this->hasTable($table)) {
$tableObject = $this->table($table);
// 检查是否已经有 site_id 字段
if (!$tableObject->hasColumn('site_id')) {
$tableObject->addColumn('site_id', 'integer', [
'default' => 1,
'comment' => '站点ID'
]);
}
// 添加索引(避免重复添加索引)
if (!$tableObject->hasIndex(['site_id'])) {
$tableObject->addIndex(['site_id']);
}
$tableObject->update();
}
}
}
}

View File

@@ -1,34 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class AddCloumnToXiaoShuoFenLei extends Migrator
{
public function up()
{
$Table = $this->table('xiao_shuo_fen_lei');
if (!$Table->hasColumn('xsfl_sort')) {
$Table->addColumn('xsfl_sort', 'integer', ['after' => 'site_id'])->setComment("排序")->save();
}
$Table = $this->table('video_class');
if (!$Table->hasColumn('vc_source_id')) {
$Table->addColumn('vc_source_id', 'integer', ['after' => 'site_id'])->setComment("资源绑定真实id")->save();
}
}
public function down()
{
$Table = $this->table('xiao_shuo_fen_lei');
if ($Table->hasColumn('xsfl_sort')) {
$Table->removeColumn('xsfl_sort')->save();
}
$Table = $this->table('video_class');
if ($Table->hasColumn('vc_source_id')) {
$Table->removeColumn('vc_source_id')->save();
}
}
}

View File

@@ -9,105 +9,16 @@ class PlanTaskSeeder
{ {
static public function handle() static public function handle()
{ {
// 公共任务
$arrData = [
[ self::addNovelTypePlanTask();
'pt_name' => '统计汇总',
'pt_code' => 'PULL_TONJI_HUIZON',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
];
foreach ($arrData as $arrPlanTask) {
$PlanTaskModel = PlanTaskModel::where('pt_code', $arrPlanTask['pt_code'])->find();
if (empty($PlanTaskModel)) {
PlanTaskModel::insert($arrPlanTask);
}
}
if (config('app.default_app_type') == 'video') {
self::addVideoTypePlanTask();
}
if (config('app.default_app_type') == 'novel') {
self::addNovelTypePlanTask();
}
} }
// 添加视频类型站点 爬虫任务
static public function addVideoTypePlanTask()
{
$arrData = [
[
'pt_name' => '采集大地电影',
'pt_code' => 'PULL_DADI_DIANYHHING',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
[
'pt_name' => '采集黑木耳资源',
'pt_code' => 'PULL_HEI_MUER',
'pt_enable' => 0,
'pt_limit' => 12 * 3600,
],
[
'pt_name' => '采集优质资源',
'pt_code' => 'PULL_YOUZHI',
'pt_enable' => 0,
'pt_limit' => 12 * 3600,
]
];
foreach ($arrData as $arrPlanTask) {
$NovelOnePlanTaskModel = PlanTaskModel::where('pt_code', $arrPlanTask['pt_code'])->find();
if (empty($NovelOnePlanTaskModel)) {
PlanTaskModel::insert($arrPlanTask);
}
}
}
// 添加小说类型站点 爬虫任务 // 添加小说类型站点 爬虫任务
static public function addNovelTypePlanTask() static public function addNovelTypePlanTask()
{ {
$arrDataNovel = [ $arrDataNovel = [
[
'pt_name' => '123采集小说',
'pt_code' => 'PULL_XIAOSHUO',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
[
'pt_name' => '采集天籁小说',
'pt_code' => 'PULL_TIANLAIXIAOSHUO',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
[
'pt_name' => '采集biquxs小说',
'pt_code' => 'PULL_BIQUXSXIAOSHUO',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
[
'pt_name' => '采集5ccc小说',
'pt_code' => 'PULL_5CCCXIAOSHUO',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
[
'pt_name' => '采集630zw.org小说',
'pt_code' => 'PULL_630ZWXIAOSHUO',
'pt_enable' => 0,
'pt_limit' => 24 * 3600,
],
[
'pt_name' => '采集鬼吹灯小说', // 采集鬼吹灯-九域凡仙小说
'pt_code' => 'PULL_GUICHUIDENG_XIAOSHUO',
'pt_enable' => 0,
'pt_limit' => 24 * 3600 * 3,
],
[ [
'pt_name' => '采集文学馆小说', // 采集文学馆-都市极品医神 'pt_name' => '采集文学馆小说', // 采集文学馆-都市极品医神
'pt_code' => 'PULL_WENXUEGUAN_XIAOSHUO', 'pt_code' => 'PULL_WENXUEGUAN_XIAOSHUO',

View File

@@ -1,318 +0,0 @@
<?php
namespace database\seeders;
use app\admin\model\VideoInfoModel;
use app\admin\model\XiaoShuoXiangQingModel;
class VideoInfoSeeder
{
static public function handle()
{
/*
UPDATE `video_info` SET `v_ticket_sales` = 206.69 WHERE `v_name` = '阿凡达';
UPDATE `video_info` SET `v_ticket_sales` = 203.15 WHERE `v_name` = '复仇者联盟4终局之战';
UPDATE `video_info` SET `v_ticket_sales` = 168.25 WHERE `v_name` = '阿凡达:水之道';
UPDATE `video_info` SET `v_ticket_sales` = 161.58 WHERE `v_name` = '泰坦尼克号';
UPDATE `video_info` SET `v_ticket_sales` = 143.69 WHERE `v_name` = '星球大战7原力觉醒';
UPDATE `video_info` SET `v_ticket_sales` = 136.78 WHERE `v_name` = '复仇者联盟3无限战争';
UPDATE `video_info` SET `v_ticket_sales` = 130.20 WHERE `v_name` = '蜘蛛侠:英雄无归';
UPDATE `video_info` SET `v_ticket_sales` = 129.95 WHERE `v_name` = '侏罗纪世界';
UPDATE `video_info` SET `v_ticket_sales` = 118.23 WHERE `v_name` = '狮子王2019';
UPDATE `video_info` SET `v_ticket_sales` = 117.94 WHERE `v_name` = '复仇者联盟';
UPDATE `video_info` SET `v_ticket_sales` = 116.24 WHERE `v_name` = '速度与激情7';
UPDATE `video_info` SET `v_ticket_sales` = 114.54 WHERE `v_name` = '冰雪奇缘2';
UPDATE `video_info` SET `v_ticket_sales` = 112.57 WHERE `v_name` = '复仇者联盟2奥创纪元';
UPDATE `video_info` SET `v_ticket_sales` = 110.45 WHERE `v_name` = '黑豹';
UPDATE `video_info` SET `v_ticket_sales` = 108.34 WHERE `v_name` = '哈利·波特与死亡圣器(下)';
UPDATE `video_info` SET `v_ticket_sales` = 106.82 WHERE `v_name` = '超人总动员2';
UPDATE `video_info` SET `v_ticket_sales` = 104.85 WHERE `v_name` = '速度与激情8';
UPDATE `video_info` SET `v_ticket_sales` = 103.76 WHERE `v_name` = '美女与野兽2017';
UPDATE `video_info` SET `v_ticket_sales` = 101.75 WHERE `v_name` = '小黄人大眼萌';
UPDATE `video_info` SET `v_ticket_sales` = 95.75 WHERE `v_name` = '哪吒之魔童闹海';
UPDATE `video_info` SET `v_ticket_sales` = 98.99 WHERE `v_name` = '钢铁侠3';
UPDATE `video_info` SET `v_ticket_sales` = 96.45 WHERE `v_name` = '海王';
UPDATE `video_info` SET `v_ticket_sales` = 95.78 WHERE `v_name` = '美国队长3内战';
UPDATE `video_info` SET `v_ticket_sales` = 94.63 WHERE `v_name` = '变形金刚4绝迹重生';
UPDATE `video_info` SET `v_ticket_sales` = 93.58 WHERE `v_name` = '哈利·波特与魔法石';
UPDATE `video_info` SET `v_ticket_sales` = 92.47 WHERE `v_name` = '蜘蛛侠:英雄归来';
UPDATE `video_info` SET `v_ticket_sales` = 91.23 WHERE `v_name` = '蝙蝠侠:黑暗骑士';
UPDATE `video_info` SET `v_ticket_sales` = 90.15 WHERE `v_name` = '超凡蜘蛛侠';
UPDATE `video_info` SET `v_ticket_sales` = 89.78 WHERE `v_name` = '星球大战8最后的绝地武士';
UPDATE `video_info` SET `v_ticket_sales` = 87.45 WHERE `v_name` = '星球大战9天行者崛起';
UPDATE `video_info` SET `v_ticket_sales` = 86.12 WHERE `v_name` = '小丑';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 10.00 WHERE `v_name` = '哪吒之魔童闹海';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 9.80 WHERE `v_name` = '遮天';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 9.50 WHERE `v_name` = '熊出没·重启未来';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 9.20 WHERE `v_name` = '唐人街探案2';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 9.00 WHERE `v_name` = '美国队长4';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 9.00 WHERE `v_name` = '超凡蜘蛛侠';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.90 WHERE `v_name` = '复仇者联盟2奥创纪元';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.80 WHERE `v_name` = '哈利·波特与死亡圣器(下)';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.70 WHERE `v_name` = '速度与激情8';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.60 WHERE `v_name` = '狮子王2019';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.60 WHERE `v_name` = '星球大战8最后的绝地武士';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.50 WHERE `v_name` = '海王';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.40 WHERE `v_name` = '变形金刚4绝迹重生';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.30 WHERE `v_name` = '星球大战9天行者崛起';
UPDATE `video_info` SET `v_recommend` = 9 , `v_pingfen` = 7.20 WHERE `v_name` = '小丑';
*/
$arrData = [
['v_name' => '阿凡达', 'v_ticket_sales' => 206.69],
['v_name' => '复仇者联盟4终局之战', 'v_ticket_sales' => 203.15],
['v_name' => '阿凡达:水之道', 'v_ticket_sales' => 168.25],
['v_name' => '泰坦尼克号', 'v_ticket_sales' => 161.58],
['v_name' => '哪吒之魔童闹海', 'v_ticket_sales' => 145],
['v_name' => '星球大战7原力觉醒', 'v_ticket_sales' => 143.69],
['v_name' => '复仇者联盟3无限战争', 'v_ticket_sales' => 136.78],
['v_name' => '蜘蛛侠:英雄无归', 'v_ticket_sales' => 130.20],
['v_name' => '侏罗纪世界', 'v_ticket_sales' => 129.95],
['v_name' => '狮子王2019', 'v_ticket_sales' => 118.23],
['v_name' => '复仇者联盟', 'v_ticket_sales' => 117.94],
['v_name' => '速度与激情7', 'v_ticket_sales' => 116.24],
['v_name' => '冰雪奇缘2', 'v_ticket_sales' => 114.54],
['v_name' => '复仇者联盟2奥创纪元', 'v_ticket_sales' => 112.57],
['v_name' => '黑豹', 'v_ticket_sales' => 110.45],
['v_name' => '哈利·波特与死亡圣器(下)', 'v_ticket_sales' => 108.34],
['v_name' => '超人总动员2', 'v_ticket_sales' => 106.82],
['v_name' => '速度与激情8', 'v_ticket_sales' => 104.85],
['v_name' => '美女与野兽2017', 'v_ticket_sales' => 103.76],
['v_name' => '小黄人大眼萌', 'v_ticket_sales' => 101.75],
['v_name' => '钢铁侠3', 'v_ticket_sales' => 98.99],
['v_name' => '海王', 'v_ticket_sales' => 96.45],
['v_name' => '美国队长3内战', 'v_ticket_sales' => 95.78],
['v_name' => '变形金刚4绝迹重生', 'v_ticket_sales' => 94.63],
['v_name' => '哈利·波特与魔法石', 'v_ticket_sales' => 93.58],
['v_name' => '蜘蛛侠:英雄归来', 'v_ticket_sales' => 92.47],
['v_name' => '蝙蝠侠:黑暗骑士', 'v_ticket_sales' => 91.23],
['v_name' => '超凡蜘蛛侠', 'v_ticket_sales' => 90.15],
['v_name' => '星球大战8最后的绝地武士', 'v_ticket_sales' => 89.78],
['v_name' => '冰雪奇缘', 'v_ticket_sales' => 88.69],
['v_name' => '星球大战9天行者崛起', 'v_ticket_sales' => 87.45],
['v_name' => '小丑', 'v_ticket_sales' => 86.12],
];
foreach ($arrData as $arrDataOne) {
$VideoInfoModel = VideoInfoModel::where('v_name', $arrDataOne['v_name'])->find();
if (!empty($VideoInfoModel)) {
try {
$VideoInfoModel->v_ticket_sales = $arrDataOne['v_ticket_sales'];
$VideoInfoModel->save();
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}
}
}
self::updateVideo();
self::updateNovel();
}
static public function updateVideo()
{
/*
推荐
*/
$arrData = [
['v_name' => '遮天'],
['v_name' => '滤镜'],
['v_name' => '战狼'],
['v_name' => '战狼2'],
['v_name' => '天道'],
['v_name' => '黑冰'],
['v_name' => '长城'],
['v_name' => '异型'],
['v_name' => '滴滴代驾'],
['v_name' => '我靠鉴宝走向人生巅峰'],
['v_name' => '我叫苏妲己'],
['v_name' => '九州战神'],
['v_name' => '仙逆'],
['v_name' => '似锦'],
['v_name' => '斗破苍穹'],
['v_name' => '庆余年'],
['v_name' => '庆余年第二季'],
['v_name' => '繁花'],
['v_name' => '玫瑰的故事'],
['v_name' => '大奉打更人'],
['v_name' => '县委大院'],
['v_name' => '三国演义'],
['v_name' => '三体'],
['v_name' => '鬼吹灯'],
['v_name' => '云顶天宫'],
['v_name' => '盗墓笔记'],
['v_name' => '家有儿女'],
['v_name' => '湄公河大案'],
['v_name' => '亮剑'],
['v_name' => '爱情公寓'],
['v_name' => '爱情公寓2'],
['v_name' => '爱情公寓3'],
['v_name' => '我叫王土地'],
['v_name' => '唐人街探索案'],
['v_name' => '唐人街探索案2'],
['v_name' => '唐人街探索案3'],
['v_name' => '749局'],
['v_name' => '红海行动'],
['v_name' => '僵尸叔叔'],
['v_name' => '哈利·波特与死亡圣器(下'],
['v_name' => '超人总动员2'],
['v_name' => '速度与激情8'],
['v_name' => '美女与野兽2017'],
['v_name' => '小黄人大眼萌'],
['v_name' => '钢铁侠3'],
['v_name' => '毒液'],
['v_name' => '海王'],
['v_name' => '美国队长3内战'],
['v_name' => '变形金刚4绝迹重生'],
['v_name' => '哈利·波特与魔法石'],
['v_name' => '蜘蛛侠:英雄归来'],
['v_name' => '蝙蝠侠:黑暗骑士'],
['v_name' => '超凡蜘蛛侠'],
['v_name' => '星球大战8最后的绝地武士'],
['v_name' => '冰雪奇缘'],
['v_name' => '星球大战9天行者崛起'],
['v_name' => '小丑'],
['v_name' => '阿凡达'],
['v_name' => '复仇者联盟4终局之战'],
['v_name' => '阿凡达:水之道'],
['v_name' => '泰坦尼克号'],
['v_name' => '哪吒之魔童闹海'],
['v_name' => '星球大战7原力觉醒'],
['v_name' => '复仇者联盟3无限战争'],
['v_name' => '蜘蛛侠:英雄无归'],
['v_name' => '侏罗纪世界'],
['v_name' => '狮子王2019'],
['v_name' => '复仇者联盟'],
['v_name' => '速度与激情7'],
['v_name' => '冰雪奇缘2'],
['v_name' => '复仇者联盟2奥创纪元'],
['v_name' => '黑豹'],
['v_name' => '六姊妹'],
['v_name' => '侏罗纪世界3'],
['v_name' => '唐伯虎点点秋香'],
['v_name' => '欢乐颂'],
['v_name' => '人再囧途之泰囧'],
['v_name' => '囧途'],
['v_name' => '速度与激情10'],
['v_name' => '绝地战警:生死与共'],
['v_name' => '毒液:最后一舞'],
['v_name' => '食神'],
['v_name' => '终极代码'],
['v_name' => '终极代码'],
['v_name' => '前任4英年早婚'],
['v_name' => '前任3再见前任'],
['v_name' => '前任2备胎反击战'],
['v_name' => '前任攻略​'],
['v_name' => '下一任:前任'],
['v_name' => '诡迷心笑'],
['v_name' => '城中之城​'],
['v_name' => '精英律师'],
['v_name' => '走走停停​'],
['v_name' => '猎场'],
['v_name' => '深海狂鲨2'],
];
foreach ($arrData as $arrDataOne) {
$VideoInfoModel = VideoInfoModel::where('v_name', $arrDataOne['v_name'])->find();
if (!empty($VideoInfoModel)) {
try {
$VideoInfoModel->v_recommend = 9;
$VideoInfoModel->save();
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}
}
}
}
static public function updateNovel(){
$arrData = [
['xsxq_ming_zi' => '遮天', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '完美世界', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '圣墟', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '斗破苍穹', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '武动乾坤', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '大主宰', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '雪中悍刀行', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '择天记', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '凡人修仙传', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '仙逆', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '人间有剑', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '步步高升:从省考状元到权力巅峰', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '源力过载', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '天下长宁', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '剑来', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '捞尸人', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '轮回乐园', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '没钱修什么仙?', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '夜无疆', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '谁让他盛世美颜', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '牧神记', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '吞噬星空', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '全家偷听我心声杀疯了,我负责吃奶', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '盖世神医', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '太荒吞天诀', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '不朽剑神', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '乾坤剑神', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '帝武丹尊', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '都市武圣', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '我们的火红年代', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '利欲升迁记', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '做局', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '巅峰权力', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '狂少下山', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '对手', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '人间政道', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '官道之绝对权力', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '我的透视超给力', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '穿书七零:作精女配她暴富了', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '长生仙游', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '分手后我成了前任他小婶', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '农门长姐:我娇养了五个哥哥', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '龙血战神', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '修罗武神', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '穿到三千小世界里当炮灰', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '女总裁的全能兵王', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '九星霸体诀', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '天官赐福', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '全球高考', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '撒野', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '修罗武神', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '人皇纪', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '万古仙穹', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '元尊', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '妙医鸿途', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '最强逆袭', 'xsxq_tui_jian' => 1],
['xsxq_ming_zi' => '重生之国民男神', 'xsxq_tui_jian' => 1],
];
foreach ($arrData as $arrDataOne) {
$XiaoShuoXiangQingModel = XiaoShuoXiangQingModel::where('xsxq_ming_zi', $arrDataOne['xsxq_ming_zi'])->find();
if (!empty($XiaoShuoXiangQingModel)) {
try {
$XiaoShuoXiangQingModel->xsxq_tui_jian = $arrDataOne['xsxq_tui_jian'];
$XiaoShuoXiangQingModel->save();
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More