diff --git a/code/app/home/BaseController.php b/code/app/home/BaseController.php index dd400b8..5c28d30 100644 --- a/code/app/home/BaseController.php +++ b/code/app/home/BaseController.php @@ -83,44 +83,12 @@ abstract class BaseController ]); } - /** - * 验证数据 - * @access protected - * @param array $data 数据 - * @param string|array $validate 验证器名或者验证规则数组 - * @param array $message 提示信息 - * @param bool $batch 是否批量验证 - * @return array|string|true - * @throws ValidateException + * return fomart view string + * + * @param string $strTemplate + * @return string */ - protected function validate(array $data, string|array $validate, array $message = [], bool $batch = false) - { - if (is_array($validate)) { - $v = new Validate(); - $v->rule($validate); - } else { - if (strpos($validate, '.')) { - // 支持场景 - [$validate, $scene] = explode('.', $validate); - } - $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); - $v = new $class(); - if (!empty($scene)) { - $v->scene($scene); - } - } - - $v->message($message); - - // 是否批量验证 - if ($batch || $this->batchValidate) { - $v->batch(true); - } - - return $v->failException(true)->check($data); - } - public function rending($strTemplate = '') { View::assign("DomainModel", $this->request->DomainModel); diff --git a/code/app/home/controller/Index.php b/code/app/home/controller/Index.php index 511366d..1ad2d09 100644 --- a/code/app/home/controller/Index.php +++ b/code/app/home/controller/Index.php @@ -40,7 +40,7 @@ class Index extends BaseController $arrMoonRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'monthly'); $strStatus = '已完结'; - $arrEndNovelRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'total',$strStatus); + $arrEndNovelRankNovel = $NovelModel->getRankNovelOnCache($strKey, 10, 0, 'total', $strStatus); // Title 模板 ConverterMovel::setVal([ @@ -49,9 +49,9 @@ class Index extends BaseController 'strIndexDescription' => $this->request->DomainModel->d_index_description, ]); // $strTitle = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__)); - $strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__).'@TITLE'); - $strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__).'@KEYWORDS'); - $strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__).'@DESCRIPTION'); + $strTitleTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@TITLE'); + $strKeywordsTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@KEYWORDS'); + $strDescriptionTemplate = $Request->DomainModel->getFomartSubject(getFomartSubjectKey(__METHOD__) . '@DESCRIPTION'); $strTitle = ConverterMovel::convert($strTitleTemplate); @@ -71,11 +71,9 @@ class Index extends BaseController 'strDescription' => $strDescription, ]); - if ($boolIsMobile) { - return View::fetch(); - } else { - return View::fetch('pc/index'); - } + $strView = $boolIsMobile ? '' : 'pc/index'; + + return $this->rending($strView); } /** @@ -92,7 +90,7 @@ class Index extends BaseController // 推荐等级为9的连载的 随机15个小说 $arrRecommendSerializationNovel = $NovelModel->getHighLevelNovelOnCache($Request->DomainModel->d_domain, 13); - + // 推荐等级为9的完结的 随机12个小说 $arrRecommendEndNovel = $NovelModel->getFinishedNovelOnCache($Request->DomainModel->d_domain, 12); @@ -157,11 +155,8 @@ class Index extends BaseController 'strDescription' => $strDescription, ]); + $strView = $boolIsMobile ? '' : 'pc/index'; - if ($boolIsMobile) { - return View::fetch(); - } else { - return View::fetch('pc/index'); - } + return $this->rending($strView); } } diff --git a/code/app/home/view/kuangyu/basePc.html b/code/app/home/view/kuangyu/basePc.html index 7965d93..691e313 100644 --- a/code/app/home/view/kuangyu/basePc.html +++ b/code/app/home/view/kuangyu/basePc.html @@ -91,14 +91,14 @@ {$DomainModel->d_statis|raw} - {Request->DomainModel->d_statis|raw} + {:request()->DomainModel->d_statis} - + {:request()->DomainModel->d_domian} \ No newline at end of file