This commit is contained in:
Default
2025-04-08 00:27:02 +08:00
parent df4278d1d8
commit fe3fb26bd7
18 changed files with 461 additions and 46 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace app\task\crawler\zw630\page;
use app\model\ChapterModel;
use storage\StorageCore;
class ChapterPage extends BasePage
@@ -70,7 +71,7 @@ class ChapterPage extends BasePage
$arrExisting = (array) $arrExisting;
$this->arrChapterInfo = array_merge($arrExisting, $this->getChapterInfo());
$this->arrChapterInfo['updated_at'] = new \MongoDB\BSON\UTCDateTime(); // 添加更新时间
$this->arrChapterInfo['updated_at'] = new \MongoDB\BSON\UTCDateTime();
$Col->updateOne(
['c_site_uuid' => $strUUId],
['$set' => $this->arrChapterInfo],
@@ -94,6 +95,8 @@ class ChapterPage extends BasePage
$this->getMongoBase()->insertOne('chapter', $this->arrChapterInfo);
$this->updateNovelHaveChapter($intNId);
if (!StorageCore::getInstance()->has($this->arrChapterInfo['c_content_path'])) {
StorageCore::getInstance()->set($this->arrChapterInfo['c_content_path'], $this->strChapterContent);
}
@@ -106,6 +109,29 @@ class ChapterPage extends BasePage
}
}
/**
* Undocumented function
*
* @param integer $intNId
* @return void
*/
protected function updateNovelHaveChapter(int $intNId)
{
$arrFilter = [
'n_id' => $intNId,
];
$ChapterModel = new ChapterModel;
$arrLasteChapter = $ChapterModel->getLatestChapter($intNId, false);
if (!empty($arrLasteChapter)) {
$arrUpdate['$set']['n_have_chapter'] = 1;
$arrUpdate['$set']['og_novel_latest_chapter_name'] = $arrLasteChapter['name'];
$this->getMongoBase()->updateOne('novel', $arrFilter, $arrUpdate);
}
}
protected $arrNextPage;
/**

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace app\task\crawler\zw630\page;
use app\model\CategoryModel;
use ddl\DDLManage;
use QL\QueryList;
@@ -51,6 +52,7 @@ class NovelPage extends BasePage
$arrNovelInfo['n_site_uuid'] = $strUUId;
$arrNovelInfo['n_source_id'] = $intNSourceId;
$arrNovelInfo['n_level'] = 1;
$arrNovelInfo['n_have_chapter'] = 0;
$arrNovelInfo['n_id'] = $this->getMongoBase()->getNextSequence('novel');
$this->getMongoBase()->insertOne('novel', $arrNovelInfo);
}
@@ -176,7 +178,17 @@ class NovelPage extends BasePage
$this->arrNovelInfo['n_source_id'] = $this->arrData['n_source_id'];
$this->arrNovelInfo['n_id'] = $this->getMongoBase()->getNextSequence('novel');
$this->arrNovelInfo['n_level'] = 1;
$this->arrNovelInfo['n_have_chapter'] = 0;
$this->arrNovelInfo['n_cover_path'] = '/img/' . date('Y/m/d', time() - 24 * 3600 * 14) . '/' . $this->arrNovelInfo['n_id'] . '.jpg';
if (!empty($this->arrNovelInfo['og_novel_category'])) {
$this->arrNovelInfo['category_pinyin'] = CategoryModel::getPinYinByZh($this->arrNovelInfo['og_novel_category']);
$this->arrNovelInfo['category_sex'] = CategoryModel::checkSex($this->arrNovelInfo['og_novel_category']);
$this->arrNovelInfo['category_sex_zh'] = CategoryModel::checkSexZh($this->arrNovelInfo['og_novel_category']);
}
$this->getMongoBase()->insertOne('novel', $this->arrNovelInfo);
$this->boolIsFirstSave = true;

View File

@@ -25,7 +25,7 @@ class Site
*
* @var string
*/
protected $strDomain = 'https://www.630zw.org';
protected $strDomain = 'https://www.630zw.com';
/**
* Undocumented function