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)
{
// 获取路由附加的参数
$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;
@@ -105,7 +103,6 @@ class Index extends BaseController
$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);
}

View File

@@ -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
@@ -204,7 +201,6 @@ class Novel extends BaseController
]);
// 生成多少个干扰吗
$this->generateGrm(2, $strGender . '-' . $strCategory . '-' . $strStatus . '-' . $intPage, 30);
return $this->rending($strTemplate);
}
@@ -271,7 +267,6 @@ class Novel extends BaseController
$strView = $boolIsMobile ? '' : 'pc/getNovelChannel';
// 生成多少个干扰吗
$this->generateGrm(2, $strNovelChannel, 50);
return $this->rending($strView);
}

View File

@@ -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();

View File

@@ -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 = [

View File

@@ -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'];

View File

@@ -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

View File

@@ -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';
/**

View File

@@ -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