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

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