This commit is contained in:
Default
2025-04-08 20:49:20 +08:00
parent 5baebea9d5
commit 114b95ed1f
5 changed files with 87 additions and 45 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace app\home;
use app\model\ConverterMovel;
use app\model\GanRaoMaModel;
use think\App;
use think\exception\ValidateException;
use think\facade\View;
@@ -93,4 +94,21 @@ abstract class BaseController
View::assign("TemplatesModel", $this->request->TemplatesModel);
return View::fetch($strTemplate);
}
/**
* generate GRM
*
* @param integer $intDeviceType
* @param integer $intNum
* @return void
*/
public function generateGrm(int $intDeviceType, string|int $strDiff, int $intNum)
{
$strDomain = $this->request->DomainModel->d_domain;
$strPageCode = $this->request->controller() . '@' . $this->request->action() . '@' . $intDeviceType;
$arrGRM = GanRaoMaModel::getGrmCode($strDomain, $strPageCode, $strDiff, $intNum);
View::assign("arrGRM", $arrGRM);
}
}

View File

@@ -22,6 +22,7 @@ class Index extends BaseController
*/
public function index(Request $Request)
{
// 获取路由附加的参数
$boolIsMobile = $Request->param('boolIsMobile');
@@ -73,6 +74,7 @@ class Index extends BaseController
$strView = $boolIsMobile ? '' : 'pc/index';
$this->generateGrm(1, 0, 30);
return $this->rending($strView);
}
@@ -157,6 +159,8 @@ class Index extends BaseController
$strView = $boolIsMobile ? '' : 'pc/index';
// 生成多少个干扰吗
$this->generateGrm(2, 0, 30);
return $this->rending($strView);
}
}

View File

@@ -713,8 +713,8 @@ class Novel extends BaseController
* 小说章节列表页面
*
* @param Request $Request
* @param [type] $intNovelId 小说id
* @param integer $intPage 目录分页
* @param int $intNovelId 小说id
* @param int $intPage 目录分页
* @param string $strOrder 正序倒叙:zheng/dao
* @return void
*/
@@ -785,7 +785,13 @@ class Novel extends BaseController
]);
$strView = $boolIsMobile ? '' : 'pc/getNovelChapterAll';
if ($boolIsMobile) {
$strView = '';
$this->generateGrm(1, $intNovelId . '-' . $intPage, 30);
} else {
$strView = 'pc/getNovelChapterAll';
$this->generateGrm(2, $intNovelId . '-' . $intPage, 20);
}
return $this->rending($strView);
}