seed
This commit is contained in:
@@ -28,6 +28,18 @@ class CategoryModel extends MongoModel
|
||||
9 => '其他小说',
|
||||
];
|
||||
|
||||
static $arrCategoryPinYin = [
|
||||
1 => 'xuanhuan-xiuzhen', // 玄幻-修真
|
||||
2 => 'junshi-xiaoshuo', // 军史-小说
|
||||
3 => 'wangyou-xiaoshuo', // 网游-小说
|
||||
4 => 'kehuan-xiaoshuo', // 科幻-小说
|
||||
5 => 'zhongsheng-chuanyue', // 重生-穿越
|
||||
6 => 'dushi-xiaoshuo', // 都市-小说
|
||||
7 => 'lingyi-xiaoshuo', // 灵异-小说
|
||||
8 => 'yanqing-xiaoshuo', // 言情-小说
|
||||
9 => 'qita-xiaoshuo', // 其他-小说
|
||||
];
|
||||
|
||||
static $arrMan = [
|
||||
1 => '玄幻修真',
|
||||
2 => '军史小说',
|
||||
@@ -44,17 +56,17 @@ class CategoryModel extends MongoModel
|
||||
];
|
||||
|
||||
|
||||
static public function getCategory():array
|
||||
static public function getCategory(): array
|
||||
{
|
||||
return self::$arrCategory;
|
||||
}
|
||||
|
||||
static public function getManCategory():array
|
||||
static public function getManCategory(): array
|
||||
{
|
||||
return self::$arrMan;
|
||||
}
|
||||
|
||||
static public function getWomenCategory():array
|
||||
static public function getWomenCategory(): array
|
||||
{
|
||||
return self::$arrWomen;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use think\Model;
|
||||
class ConverterMovel
|
||||
{
|
||||
static private $arrMap = [
|
||||
'{strSiteTitle}' => '',
|
||||
'{strSiteName}' => '',
|
||||
'{strSiteKeywords}' => '',
|
||||
'{strSiteDescription}' => '',
|
||||
'{strNovelName}' => '',
|
||||
|
||||
@@ -15,6 +15,8 @@ class DomainModel extends BaseModel
|
||||
protected $name = 'domain';
|
||||
protected $pk = 'd_id';
|
||||
|
||||
protected $json = ['t_cfg'];
|
||||
|
||||
|
||||
static public function getDomainByCache($strDomain)
|
||||
{
|
||||
@@ -47,4 +49,54 @@ class DomainModel extends BaseModel
|
||||
|
||||
return $strWords;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strKey
|
||||
* @return void
|
||||
*/
|
||||
public function getFomartSubject($strKey) //, $intNum = 1, $boolRand = false)
|
||||
{
|
||||
// echo $strKey;
|
||||
// //exit;
|
||||
// echo '<pre>';
|
||||
// var_dump($this->t_cfg);
|
||||
// exit;
|
||||
$intSfgId = $this->t_cfg->{$strKey}['sfg_id'];
|
||||
// $SubjectFomartCol = SubjectFomartModel::where('sfg_id', $intSfgId)->select();
|
||||
|
||||
$SubjectFomartModel = SubjectFomartModel::where('sfg_id', $intSfgId)->select()->first();
|
||||
// var_dump($SubjectFomartModel->toArray());
|
||||
// exit;
|
||||
|
||||
return $SubjectFomartModel->sf_val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param array $arrArgs
|
||||
* @return void
|
||||
*/
|
||||
static public function getPageUrl($strKey, array $arrArgs): string
|
||||
{
|
||||
$Request = request();
|
||||
// $strKey = $Request->controller(false, true) . '@' .
|
||||
// $Request->action(true) . '@URL';
|
||||
// $strKey = strtoupper($strKey);
|
||||
|
||||
$strSfVal = $Request->DomainModel->getFomartSubject($strKey);
|
||||
|
||||
$arrKeys = [];
|
||||
$arrVals = [];
|
||||
foreach ($arrArgs as $strKey => $strVal) {
|
||||
$arrKeys[] = '{' . $strKey . '}';
|
||||
$arrVals[] = $strVal;
|
||||
}
|
||||
|
||||
return str_replace($arrKeys, $arrVals, $strSfVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ class NovelModel extends MongoModel
|
||||
$arrOptions = [
|
||||
'sort' => $arrSort,
|
||||
// 'limit' => $intCount * 3,
|
||||
'skip' => ($intPage - 1) * $intLimit,
|
||||
'limit' => $intLimit,
|
||||
'skip' => ($intPage - 1) * $intLimit,
|
||||
'limit' => $intLimit,
|
||||
'projection' => [
|
||||
'n_id' => 1,
|
||||
'og_novel_book_name' => 1,
|
||||
@@ -114,13 +114,15 @@ class NovelModel extends MongoModel
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$Cursor = $this->getCol()->find($arrFilter, $arrOptions);
|
||||
|
||||
$intTotal = $this->getCol()->countDocuments($arrFilter);
|
||||
|
||||
$arrResult = iterator_to_array($Cursor);
|
||||
|
||||
shuffle($arrResult);
|
||||
|
||||
|
||||
$arrResult = [
|
||||
'data' => $arrResult,
|
||||
'total' => $intTotal,
|
||||
@@ -507,21 +509,28 @@ class NovelModel extends MongoModel
|
||||
*/
|
||||
static public function getNovelInfoUrl($intNId, $intPinYin): string
|
||||
{
|
||||
$Request = request();
|
||||
$strFomart = $Request->DomainModel->d_novel_info_url_fomart;
|
||||
$strKey = 'NOVEL_INFO_URL';
|
||||
$strUrl = DomainModel::getPageUrl($strKey, [
|
||||
'intNId' => $intNId,
|
||||
'strPinYin' => $intPinYin
|
||||
]);
|
||||
return (string)$strUrl;
|
||||
|
||||
return str_replace(
|
||||
[
|
||||
'{intNId}',
|
||||
'{strPinYin}',
|
||||
],
|
||||
[
|
||||
$intNId,
|
||||
$intPinYin
|
||||
],
|
||||
$strFomart
|
||||
);
|
||||
// $Request = request();
|
||||
// $strFomart = $Request->DomainModel->d_novel_info_url_fomart;
|
||||
|
||||
return $strUrl;
|
||||
// return str_replace(
|
||||
// [
|
||||
// '{intNId}',
|
||||
// '{strPinYin}',
|
||||
// ],
|
||||
// [
|
||||
// $intNId,
|
||||
// $intPinYin
|
||||
// ],
|
||||
// $strFomart
|
||||
// );
|
||||
|
||||
// return $strUrl;
|
||||
}
|
||||
}
|
||||
|
||||
19
code/app/model/SubjectFomartGroupModel.php
Normal file
19
code/app/model/SubjectFomartGroupModel.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class SubjectFomartGroupModel extends BaseModel
|
||||
{
|
||||
protected $name = 'subject_fomart_group';
|
||||
protected $pk = 'sfg_id';
|
||||
|
||||
|
||||
}
|
||||
17
code/app/model/SubjectFomartModel.php
Normal file
17
code/app/model/SubjectFomartModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class SubjectFomartModel extends BaseModel
|
||||
{
|
||||
protected $name = 'subject_fomart';
|
||||
protected $pk = 'sf_id';
|
||||
}
|
||||
@@ -13,8 +13,26 @@ use think\Model;
|
||||
class TemplatesModel extends BaseModel
|
||||
{
|
||||
protected $name = 'templates';
|
||||
|
||||
protected $pk = 't_id';
|
||||
|
||||
protected $json = ['t_cfg_template'];
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strVal
|
||||
* @return void
|
||||
*/
|
||||
// public function getTCfgTemplatesAttr($strVal)
|
||||
// {
|
||||
|
||||
// if (!empty($strVal)) {
|
||||
// return json_decode($strVal);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
static $arrTemplates = [];
|
||||
|
||||
static public function getTemplateOnCache($intTId)
|
||||
|
||||
Reference in New Issue
Block a user