This commit is contained in:
Default
2025-04-09 03:03:09 +08:00
parent a7fb8852de
commit 806b09d751
8 changed files with 80 additions and 39 deletions

View File

@@ -23,7 +23,6 @@ class Index extends BaseController
public function index(Request $Request) public function index(Request $Request)
{ {
// 获取路由附加的参数
$boolIsMobile = $Request->param('boolIsMobile'); $boolIsMobile = $Request->param('boolIsMobile');
$intTTL = 24 * 3600; $intTTL = 24 * 3600;
@@ -93,7 +92,6 @@ class Index extends BaseController
*/ */
public function getPcIndex(Request $Request) public function getPcIndex(Request $Request)
{ {
// 获取路由附加的参数
$boolIsMobile = $Request->param('boolIsMobile'); $boolIsMobile = $Request->param('boolIsMobile');
$intTTL = 24 * 3600; $intTTL = 24 * 3600;
@@ -105,7 +103,6 @@ class Index extends BaseController
$arrRecommendSerializationNovel = $NovelModel->getCommonNovelOnCache($strKey, $intTTL, 13, 0, NULL); $arrRecommendSerializationNovel = $NovelModel->getCommonNovelOnCache($strKey, $intTTL, 13, 0, NULL);
// 推荐等级为9的完结的 随机12个小说 // 推荐等级为9的完结的 随机12个小说
$strKey = sprintf('%s:PC:INDEX:TUIJIAN:WANJIE:%s', $Request->DomainModel->d_domain, 12); $strKey = sprintf('%s:PC:INDEX:TUIJIAN:WANJIE:%s', $Request->DomainModel->d_domain, 12);
$arrRecommendEndNovel = $NovelModel->getCommonNovelOnCache($strKey, $intTTL, 12, 0, "已完结"); $arrRecommendEndNovel = $NovelModel->getCommonNovelOnCache($strKey, $intTTL, 12, 0, "已完结");
@@ -184,7 +181,6 @@ class Index extends BaseController
$strView = $boolIsMobile ? '' : 'pc/index'; $strView = $boolIsMobile ? '' : 'pc/index';
// 生成多少个干扰吗
$this->generateGrm(2, 0, 150); $this->generateGrm(2, 0, 150);
return $this->rending($strView); return $this->rending($strView);
} }

View File

@@ -10,11 +10,8 @@ use app\model\ChapterModel;
use app\model\ConverterMovel; use app\model\ConverterMovel;
use app\model\NovelClicksModel; use app\model\NovelClicksModel;
use app\model\NovelModel; use app\model\NovelModel;
use storage\StorageCore;
use think\facade\View; use think\facade\View;
use app\Request; use app\Request;
use app\task\crawler\zw630\page\ChapterPage;
use PhpOffice\PhpSpreadsheet\Calculation\Category;
use template\page\CusteomPage02; use template\page\CusteomPage02;
class Novel extends BaseController class Novel extends BaseController
@@ -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); return $this->rending($strTemplate);
} }
@@ -271,7 +267,6 @@ class Novel extends BaseController
$strView = $boolIsMobile ? '' : 'pc/getNovelChannel'; $strView = $boolIsMobile ? '' : 'pc/getNovelChannel';
// 生成多少个干扰吗
$this->generateGrm(2, $strNovelChannel, 50); $this->generateGrm(2, $strNovelChannel, 50);
return $this->rending($strView); return $this->rending($strView);
} }
@@ -458,7 +453,7 @@ class Novel extends BaseController
$strView = $boolIsMobile ? 'getNovelInfo' : 'pc/getNovelInfo'; $strView = $boolIsMobile ? 'getNovelInfo' : 'pc/getNovelInfo';
$this->generateGrm(2, $intNId.'-'.$intForgeId, 50); $this->generateGrm(2, $intNId . '-' . $intForgeId, 50);
return $this->rending($strView); return $this->rending($strView);
} }
@@ -636,7 +631,7 @@ class Novel extends BaseController
]); ]);
$strView = $boolIsMobile ? 'getNovelChapter' : 'pc/getNovelChapter'; $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); return $this->rending($strView);
} }
@@ -711,7 +706,7 @@ class Novel extends BaseController
]); ]);
$strView = $boolIsMobile ? '' : 'pc/getNovelChapter'; $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); return $this->rending($strView);
} }
@@ -793,10 +788,10 @@ class Novel extends BaseController
if ($boolIsMobile) { if ($boolIsMobile) {
$strView = ''; $strView = '';
$this->generateGrm(1, $intNId . '-' .$strOrder. '-' .$intPage, 110); $this->generateGrm(1, $intNId . '-' . $strOrder . '-' . $intPage, 110);
} else { } else {
$strView = 'pc/getNovelChapterAll'; $strView = 'pc/getNovelChapterAll';
$this->generateGrm(2, $intNId . '-' .$strOrder. '-' .$intPage, 110); $this->generateGrm(2, $intNId . '-' . $strOrder . '-' . $intPage, 110);
} }
return $this->rending($strView); return $this->rending($strView);
@@ -868,7 +863,7 @@ class Novel extends BaseController
]); ]);
$strView = $boolIsMobile ? '' : 'pc/getSearchNovel'; $strView = $boolIsMobile ? '' : 'pc/getSearchNovel';
$this->generateGrm(2, $strSearchKeywords.$intPage, 20); $this->generateGrm(2, $strSearchKeywords . $intPage, 20);
return $this->rending($strView); return $this->rending($strView);
} }

View File

@@ -6,7 +6,6 @@ namespace app\home\controller;
use app\home\BaseController; use app\home\BaseController;
use app\model\NovelModel; use app\model\NovelModel;
use storage\StorageCore;
use think\facade\View; use think\facade\View;
use app\Request; use app\Request;
@@ -14,7 +13,6 @@ class User extends BaseController
{ {
public function index(Request $Request) public function index(Request $Request)
{ {
$boolIsMobile = $Request->param('boolIsMobile'); $boolIsMobile = $Request->param('boolIsMobile');
$NovelModel = NovelModel::getInstance(); $NovelModel = NovelModel::getInstance();

View File

@@ -9,6 +9,22 @@ use storage\StorageCore;
class ChapterModel extends MongoModel 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'; protected $strCollection = 'chapter';
static public $arrChapterOptions = [ static public $arrChapterOptions = [

View File

@@ -15,6 +15,21 @@ use think\Model;
*/ */
class GanRaoMaModel extends MongoModel 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 * Undocumented variable
* *
@@ -220,6 +235,7 @@ class GanRaoMaModel extends MongoModel
$arrData = $arrFilter; $arrData = $arrFilter;
$arrData['grm_code'] = $arrGrmCode; $arrData['grm_code'] = $arrGrmCode;
self::getInstance()->insert($arrData); self::getInstance()->insert($arrData);
} else { } else {
$arrGrmCode = $arrResult['grm_code']; $arrGrmCode = $arrResult['grm_code'];

View File

@@ -15,20 +15,6 @@ use think\facade\Cache;
abstract class MongoModel 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 * collection name

View File

@@ -13,6 +13,21 @@ use think\Model;
*/ */
class NovelClicksModel extends MongoModel 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'; protected $strCollection = 'novel_clicks';
/** /**

View File

@@ -13,6 +13,21 @@ use Exception;
*/ */
class NovelModel extends MongoModel 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 * Undocumented variable
* *
@@ -246,6 +261,7 @@ class NovelModel extends MongoModel
$arrOptions['sort'] = $arrSort; $arrOptions['sort'] = $arrSort;
$arrOptions['skip'] = ($intPage - 1) * $intLimit; $arrOptions['skip'] = ($intPage - 1) * $intLimit;
$arrOptions['limit'] = $intLimit; $arrOptions['limit'] = $intLimit;
unset($arrOptions['typeMap']);
$Cursor = $this->getCol()->find($arrFilter, $arrOptions); $Cursor = $this->getCol()->find($arrFilter, $arrOptions);
@@ -346,6 +362,8 @@ class NovelModel extends MongoModel
$arrOptions['limit'] = $intCount * 3; $arrOptions['limit'] = $intCount * 3;
unset($arrOptions['typeMap']);
$Cursor = $this->getCol()->find($arrFilter, $arrOptions); $Cursor = $this->getCol()->find($arrFilter, $arrOptions);
$arrResult = iterator_to_array($Cursor); $arrResult = iterator_to_array($Cursor);
@@ -382,11 +400,10 @@ class NovelModel extends MongoModel
array $arrSort = ['n_level' => -1] array $arrSort = ['n_level' => -1]
): array { ): array {
try { try {
$arrFilter = []; $arrFilter = [];
if (in_array($intType, [1, 2])) { if (in_array($intType, [1, 2])) {
$arrFilter['og_novel_category'] = CategoryModel::getCategoryByType($intType); $arrFilter['og_novel_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
} }
if ($strStatus !== NULL) { if ($strStatus !== NULL) {
@@ -430,7 +447,7 @@ class NovelModel extends MongoModel
} }
if (in_array($intType, [1, 2])) { if (in_array($intType, [1, 2])) {
$arrFilter['og_novel_category'] = CategoryModel::getCategoryByType($intType); $arrFilter['og_novel_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
} }
$arrOptions = [ $arrOptions = [
@@ -452,6 +469,8 @@ class NovelModel extends MongoModel
$arrFilter = ['n_id' => ['$in' => $arrNId]]; $arrFilter = ['n_id' => ['$in' => $arrNId]];
$arrOptions = self::$arrOptions; $arrOptions = self::$arrOptions;
unset($arrOptions['typeMap']);
$Cursor = $this->getCol()->find( $Cursor = $this->getCol()->find(
$arrFilter, $arrFilter,
$arrOptions $arrOptions