fix get static config
This commit is contained in:
@@ -38,12 +38,6 @@ class ChapterService
|
||||
$this->ChapterModel = ChapterModel::getInstance();
|
||||
}
|
||||
|
||||
public $arrSortType = [
|
||||
'zheng' => '正序',
|
||||
'dao' => '倒叙',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 获取小说数据
|
||||
*
|
||||
@@ -129,7 +123,7 @@ class ChapterService
|
||||
'func' => (string)($arrParams['func']),
|
||||
];
|
||||
|
||||
if (!in_array($arrParams['sort_type'], array_keys($this->arrSortType))) {
|
||||
if (!in_array($arrParams['sort_type'], array_keys(StaticConfig::$arrChapterSortType))) {
|
||||
$arrParams['sort_type'] = 'zheng';
|
||||
}
|
||||
|
||||
@@ -225,12 +219,12 @@ class ChapterService
|
||||
{
|
||||
// 小说详情
|
||||
$arrNovel = $this->NovelModel->getNovelByNId($intNId);
|
||||
|
||||
|
||||
$ChapterModel = ChapterModel::getInstance();
|
||||
if($intCSortNum == 0 && $intCPage == 0){
|
||||
if ($intCSortNum == 0 && $intCPage == 0) {
|
||||
// 最新章节
|
||||
$arrChapter = $ChapterModel->getLatestChapterByNId($intNId);
|
||||
}else{
|
||||
} else {
|
||||
// 章节
|
||||
$arrFilter = ['n_id' => $intNId, 'c_sort_num' => $intCSortNum, 'c_page' => $intCPage];
|
||||
$arrChapter = $ChapterModel->findOne($arrFilter);
|
||||
|
||||
@@ -236,32 +236,6 @@ class NovelService
|
||||
}
|
||||
|
||||
|
||||
public $arrSortType = [
|
||||
'all' => '全部排序',
|
||||
'news' => '最新入库',
|
||||
'tuijian' => '推荐',
|
||||
'update' => '最新更新',
|
||||
];
|
||||
|
||||
static $arrRankSortType = [
|
||||
'daily' => '天',
|
||||
'weekly' => '周',
|
||||
'monthly' => '月',
|
||||
'total' => '总',
|
||||
];
|
||||
|
||||
public $arrStatus = [
|
||||
'all' => '所有',
|
||||
'lianzai' => '连载中',
|
||||
'wanjie' => '已完结',
|
||||
];
|
||||
|
||||
public $arrSex = [
|
||||
'all' => '所有',
|
||||
'man' => '男生',
|
||||
'women' => '女生',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* GetCategoryFilter
|
||||
@@ -300,10 +274,10 @@ class NovelService
|
||||
if (!empty($strNStatus)) {
|
||||
switch ($strNStatus) {
|
||||
case 'lianzai':
|
||||
$arrFilter['n_status'] = $this->arrStatus[$strNStatus];
|
||||
$arrFilter['n_status'] = StaticConfig::$arrNovelStatus[$strNStatus];
|
||||
break;
|
||||
case 'wanjie':
|
||||
$arrFilter['n_status'] = $this->arrStatus[$strNStatus];
|
||||
$arrFilter['n_status'] = StaticConfig::$arrNovelStatus[$strNStatus];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -400,10 +374,10 @@ class NovelService
|
||||
if (!empty($strNStatus)) {
|
||||
switch ($strNStatus) {
|
||||
case 'lianzai':
|
||||
$arrFilter['n_status'] = $this->arrStatus[$strNStatus];
|
||||
$arrFilter['n_status'] = StaticConfig::$arrNovelStatus[$strNStatus];
|
||||
break;
|
||||
case 'wanjie':
|
||||
$arrFilter['n_status'] = $this->arrStatus[$strNStatus];
|
||||
$arrFilter['n_status'] = StaticConfig::$arrNovelStatus[$strNStatus];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -412,10 +386,10 @@ class NovelService
|
||||
if (!empty($strNSex)) {
|
||||
switch ($strNSex) {
|
||||
case 'man':
|
||||
$arrFilter['n_category_sex_zh'] = $this->arrSex[$strNSex];
|
||||
$arrFilter['n_category_sex_zh'] = StaticConfig::$arrNovelSex[$strNSex];
|
||||
break;
|
||||
case 'women':
|
||||
$arrFilter['n_category_sex_zh'] = $this->arrSex[$strNSex];
|
||||
$arrFilter['n_category_sex_zh'] = StaticConfig::$arrNovelSex[$strNSex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -521,10 +495,10 @@ class NovelService
|
||||
if (!empty($strNStatus)) {
|
||||
switch ($strNStatus) {
|
||||
case 'lianzai':
|
||||
$arrFilter['$and'][] = ['n_status' => $this->arrStatus[$strNStatus]];
|
||||
$arrFilter['$and'][] = ['n_status' => StaticConfig::$arrNovelStatus[$strNStatus]];
|
||||
break;
|
||||
case 'wanjie':
|
||||
$arrFilter['$and'][] = ['n_status' => $this->arrStatus[$strNStatus]];
|
||||
$arrFilter['$and'][] = ['n_status' => StaticConfig::$arrNovelStatus[$strNStatus]];
|
||||
break;
|
||||
default:
|
||||
$arrParams['n_status'] = 'all';
|
||||
@@ -536,10 +510,10 @@ class NovelService
|
||||
if (!empty($strNSex)) {
|
||||
switch ($strNSex) {
|
||||
case 'man':
|
||||
$arrFilter['$and'][] = ['n_category_sex_zh' => $this->arrSex[$strNSex]];
|
||||
$arrFilter['$and'][] = ['n_category_sex_zh' => StaticConfig::$arrNovelSex[$strNSex]];
|
||||
break;
|
||||
case 'women':
|
||||
$arrFilter['$and'][] = ['n_category_sex_zh' => $this->arrSex[$strNSex]];
|
||||
$arrFilter['$and'][] = ['n_category_sex_zh' => StaticConfig::$arrNovelSex[$strNSex]];
|
||||
break;
|
||||
default:
|
||||
$arrParams['n_sex'] = 'all';
|
||||
@@ -605,16 +579,16 @@ class NovelService
|
||||
$strNanUrlTemp = $this->SiteContext->DomainModel->getFomartSubject('NAN_SHENG_URL', '', false);
|
||||
$strNanUrl = str_replace("/", "", $strNanUrlTemp);
|
||||
$strCNSex = '全部';
|
||||
if($strGender){
|
||||
if ($strGender) {
|
||||
$strCNSex = $strGender == $strNanUrl ? '男生' : '女生';
|
||||
}
|
||||
ConverterMovel::setVal([
|
||||
'intPage' => $intPage,
|
||||
'strNovelSex' => $strCNSex,
|
||||
'strNovelCategoryName' => empty($strNCategory) ? '' : str_replace("小说", "", $strNCategory),
|
||||
'strNovelStatus' => empty($strNStatus) ? '' : $this->arrStatus[$strNStatus],
|
||||
'strNovelOrder' => empty($strSortType) ? '' :$this->arrSortType[$strSortType],
|
||||
'strSearchKeywords' => $strKey,
|
||||
'strNovelStatus' => empty($strNStatus) ? '' : StaticConfig::$arrNovelStatus[$strNStatus],
|
||||
'strNovelOrder' => empty($strSortType) ? '' : StaticConfig::$arrNovelSortType[$strSortType],
|
||||
'strSearchKeywords' => $strKey,
|
||||
]);
|
||||
|
||||
if (empty($arrFilter['$and'])) {
|
||||
@@ -761,7 +735,4 @@ class NovelService
|
||||
|
||||
return $arrNovel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -314,11 +314,8 @@ class SiteContext
|
||||
$strStatus = $this->Request->param('strStatus');
|
||||
ConverterMovel::setVal([
|
||||
'intPage' => 1,
|
||||
'strNovelOrder' => NovelService::$arrRankSortType[$strOrder] ,
|
||||
'strNovelStatus' => NovelService::$arrStatus[$strStatus] ,
|
||||
'strNovelOrder' => StaticConfig::$arrNovelRankSortType[$strOrder],
|
||||
'strNovelStatus' => StaticConfig::$arrNovelStatus[$strStatus],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
38
code/app/services/StaticConfig.php
Normal file
38
code/app/services/StaticConfig.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\services;
|
||||
|
||||
|
||||
class StaticConfig
|
||||
{
|
||||
static $arrNovelSortType = [
|
||||
'all' => '全部排序',
|
||||
'news' => '最新入库',
|
||||
'tuijian' => '推荐',
|
||||
'update' => '最新更新',
|
||||
];
|
||||
|
||||
static $arrNovelRankSortType = [
|
||||
'daily' => '天',
|
||||
'weekly' => '周',
|
||||
'monthly' => '月',
|
||||
'total' => '总',
|
||||
];
|
||||
|
||||
static $arrNovelStatus = [
|
||||
'all' => '所有',
|
||||
'lianzai' => '连载中',
|
||||
'wanjie' => '已完结',
|
||||
];
|
||||
|
||||
static $arrNovelSex = [
|
||||
'all' => '所有',
|
||||
'man' => '男生',
|
||||
'women' => '女生',
|
||||
];
|
||||
|
||||
static $arrChapterSortType = [
|
||||
'zheng' => '正序',
|
||||
'dao' => '倒叙',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user