diff --git a/code/app/home/controller/Index.php b/code/app/home/controller/Index.php index d916bd0..778e29e 100644 --- a/code/app/home/controller/Index.php +++ b/code/app/home/controller/Index.php @@ -23,7 +23,6 @@ class Index extends BaseController public function index(Request $Request) { - // 获取路由附加的参数 $boolIsMobile = $Request->param('boolIsMobile'); $intTTL = 24 * 3600; @@ -93,7 +92,6 @@ class Index extends BaseController */ public function getPcIndex(Request $Request) { - // 获取路由附加的参数 $boolIsMobile = $Request->param('boolIsMobile'); $intTTL = 24 * 3600; @@ -104,8 +102,7 @@ class Index extends BaseController $strKey = sprintf('%s:PC:INDEX:TUIJIAN:%s', $Request->DomainModel->d_domain, 13); $arrRecommendSerializationNovel = $NovelModel->getCommonNovelOnCache($strKey, $intTTL, 13, 0, NULL); - - + // 推荐等级为9的完结的 随机12个小说 $strKey = sprintf('%s:PC:INDEX:TUIJIAN:WANJIE:%s', $Request->DomainModel->d_domain, 12); $arrRecommendEndNovel = $NovelModel->getCommonNovelOnCache($strKey, $intTTL, 12, 0, "已完结"); @@ -184,7 +181,6 @@ class Index extends BaseController $strView = $boolIsMobile ? '' : 'pc/index'; - // 生成多少个干扰吗 $this->generateGrm(2, 0, 150); return $this->rending($strView); } diff --git a/code/app/home/controller/Novel.php b/code/app/home/controller/Novel.php index 147b9b8..567c0b3 100644 --- a/code/app/home/controller/Novel.php +++ b/code/app/home/controller/Novel.php @@ -10,11 +10,8 @@ use app\model\ChapterModel; use app\model\ConverterMovel; use app\model\NovelClicksModel; use app\model\NovelModel; -use storage\StorageCore; use think\facade\View; use app\Request; -use app\task\crawler\zw630\page\ChapterPage; -use PhpOffice\PhpSpreadsheet\Calculation\Category; use template\page\CusteomPage02; class Novel extends BaseController @@ -60,7 +57,7 @@ class Novel extends BaseController $strStatus = '已完结'; $strKey = sprintf('%s:PC:NOVEL:RANK:%s:SEX:%s:%s', $Request->DomainModel->d_domain, 'total', 0, 'finished'); $arrEdnNovelRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'total', $strStatus); - + // Title 模板 ConverterMovel::setVal([ 'intPage' => 1, @@ -204,8 +201,7 @@ class Novel extends BaseController ]); - // 生成多少个干扰吗 - $this->generateGrm(2, $strGender.'-'.$strCategory.'-'.$strStatus.'-'.$intPage, 30); + $this->generateGrm(2, $strGender . '-' . $strCategory . '-' . $strStatus . '-' . $intPage, 30); return $this->rending($strTemplate); } @@ -242,7 +238,7 @@ class Novel extends BaseController $strKey = sprintf('%s:PC:Novel:Channel:Latest:%s', $Request->DomainModel->d_domain, $intType); $intCount = 20; $arrNewsUpdateNovel = $NovelModel->getCommonNovelOnCache($strKey, $intLifeTime, $intCount, $intType, NULL, ['og_novel_update_time' => -1]); - + // 更新值 ConverterMovel::setVal([ 'intPage' => 1, @@ -271,7 +267,6 @@ class Novel extends BaseController $strView = $boolIsMobile ? '' : 'pc/getNovelChannel'; - // 生成多少个干扰吗 $this->generateGrm(2, $strNovelChannel, 50); return $this->rending($strView); } @@ -458,7 +453,7 @@ class Novel extends BaseController $strView = $boolIsMobile ? 'getNovelInfo' : 'pc/getNovelInfo'; - $this->generateGrm(2, $intNId.'-'.$intForgeId, 50); + $this->generateGrm(2, $intNId . '-' . $intForgeId, 50); return $this->rending($strView); } @@ -636,7 +631,7 @@ class Novel extends BaseController ]); $strView = $boolIsMobile ? 'getNovelChapter' : 'pc/getNovelChapter'; - $this->generateGrm(2, $intNId . '-' .$arrChapter['c_sort_num'] ?? 0, 20); + $this->generateGrm(2, $intNId . '-' . $arrChapter['c_sort_num'] ?? 0, 20); return $this->rending($strView); } @@ -711,7 +706,7 @@ class Novel extends BaseController ]); $strView = $boolIsMobile ? '' : 'pc/getNovelChapter'; - $this->generateGrm(2, $intNId . '-' .$arrChapter['c_sort_num'] ?? 0, 20); + $this->generateGrm(2, $intNId . '-' . $arrChapter['c_sort_num'] ?? 0, 20); return $this->rending($strView); } @@ -793,12 +788,12 @@ class Novel extends BaseController if ($boolIsMobile) { $strView = ''; - $this->generateGrm(1, $intNId . '-' .$strOrder. '-' .$intPage, 110); + $this->generateGrm(1, $intNId . '-' . $strOrder . '-' . $intPage, 110); } else { $strView = 'pc/getNovelChapterAll'; - $this->generateGrm(2, $intNId . '-' .$strOrder. '-' .$intPage, 110); + $this->generateGrm(2, $intNId . '-' . $strOrder . '-' . $intPage, 110); } - + return $this->rending($strView); } @@ -868,7 +863,7 @@ class Novel extends BaseController ]); $strView = $boolIsMobile ? '' : 'pc/getSearchNovel'; - $this->generateGrm(2, $strSearchKeywords.$intPage, 20); + $this->generateGrm(2, $strSearchKeywords . $intPage, 20); return $this->rending($strView); } diff --git a/code/app/home/controller/User.php b/code/app/home/controller/User.php index d85592e..c04170f 100644 --- a/code/app/home/controller/User.php +++ b/code/app/home/controller/User.php @@ -6,7 +6,6 @@ namespace app\home\controller; use app\home\BaseController; use app\model\NovelModel; -use storage\StorageCore; use think\facade\View; use app\Request; @@ -14,7 +13,6 @@ class User extends BaseController { public function index(Request $Request) { - $boolIsMobile = $Request->param('boolIsMobile'); $NovelModel = NovelModel::getInstance(); diff --git a/code/app/model/ChapterModel.php b/code/app/model/ChapterModel.php index eca5877..21ab1c5 100644 --- a/code/app/model/ChapterModel.php +++ b/code/app/model/ChapterModel.php @@ -9,6 +9,22 @@ use storage\StorageCore; class ChapterModel extends MongoModel { + + /** + * Undocumented variable + * + * @var self + */ + static public $obj; + + static public function getInstance(): self + { + if (self::$obj == NULL) { + self::$obj = new self; + } + return self::$obj; + } + protected $strCollection = 'chapter'; static public $arrChapterOptions = [ diff --git a/code/app/model/GanRaoMaModel.php b/code/app/model/GanRaoMaModel.php index c4b629f..7d824bd 100644 --- a/code/app/model/GanRaoMaModel.php +++ b/code/app/model/GanRaoMaModel.php @@ -15,6 +15,21 @@ use think\Model; */ class GanRaoMaModel extends MongoModel { + /** + * Undocumented variable + * + * @var self + */ + static public $obj; + + static public function getInstance(): self + { + if (self::$obj == NULL) { + self::$obj = new self; + } + return self::$obj; + } + /** * Undocumented variable * @@ -220,6 +235,7 @@ class GanRaoMaModel extends MongoModel $arrData = $arrFilter; $arrData['grm_code'] = $arrGrmCode; + self::getInstance()->insert($arrData); } else { $arrGrmCode = $arrResult['grm_code']; diff --git a/code/app/model/MongoModel.php b/code/app/model/MongoModel.php index ac21ca5..80f7eb1 100644 --- a/code/app/model/MongoModel.php +++ b/code/app/model/MongoModel.php @@ -15,20 +15,6 @@ use think\facade\Cache; abstract class MongoModel { - /** - * Undocumented variable - * - * @var static - */ - static public $obj; - - static public function getInstance() - { - if (static::$obj == NULL) { - static::$obj = new static; - } - return static::$obj; - } /** * collection name diff --git a/code/app/model/NovelClicksModel.php b/code/app/model/NovelClicksModel.php index 5e5c1be..69a143f 100644 --- a/code/app/model/NovelClicksModel.php +++ b/code/app/model/NovelClicksModel.php @@ -13,6 +13,21 @@ use think\Model; */ class NovelClicksModel extends MongoModel { + /** + * Undocumented variable + * + * @var self + */ + static public $obj; + + static public function getInstance(): self + { + if (self::$obj == NULL) { + self::$obj = new self; + } + return self::$obj; + } + protected $strCollection = 'novel_clicks'; /** diff --git a/code/app/model/NovelModel.php b/code/app/model/NovelModel.php index 727a8be..8e6d563 100644 --- a/code/app/model/NovelModel.php +++ b/code/app/model/NovelModel.php @@ -13,6 +13,21 @@ use Exception; */ class NovelModel extends MongoModel { + /** + * Undocumented variable + * + * @var self + */ + static public $obj; + + static public function getInstance(): self + { + if (self::$obj == NULL) { + self::$obj = new self; + } + return self::$obj; + } + /** * Undocumented variable * @@ -246,6 +261,7 @@ class NovelModel extends MongoModel $arrOptions['sort'] = $arrSort; $arrOptions['skip'] = ($intPage - 1) * $intLimit; $arrOptions['limit'] = $intLimit; + unset($arrOptions['typeMap']); $Cursor = $this->getCol()->find($arrFilter, $arrOptions); @@ -346,6 +362,8 @@ class NovelModel extends MongoModel $arrOptions['limit'] = $intCount * 3; + unset($arrOptions['typeMap']); + $Cursor = $this->getCol()->find($arrFilter, $arrOptions); $arrResult = iterator_to_array($Cursor); @@ -382,11 +400,10 @@ class NovelModel extends MongoModel array $arrSort = ['n_level' => -1] ): array { try { - $arrFilter = []; if (in_array($intType, [1, 2])) { - $arrFilter['og_novel_category'] = CategoryModel::getCategoryByType($intType); + $arrFilter['og_novel_category'] = ['$in' => CategoryModel::getCategoryByType($intType)]; } if ($strStatus !== NULL) { @@ -430,7 +447,7 @@ class NovelModel extends MongoModel } if (in_array($intType, [1, 2])) { - $arrFilter['og_novel_category'] = CategoryModel::getCategoryByType($intType); + $arrFilter['og_novel_category'] = ['$in' => CategoryModel::getCategoryByType($intType)]; } $arrOptions = [ @@ -452,6 +469,8 @@ class NovelModel extends MongoModel $arrFilter = ['n_id' => ['$in' => $arrNId]]; $arrOptions = self::$arrOptions; + unset($arrOptions['typeMap']); + $Cursor = $this->getCol()->find( $arrFilter, $arrOptions