debug
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,14 +91,14 @@
|
||||
|
||||
<!-- 现在是使用这个 -->
|
||||
{$DomainModel->d_statis|raw}
|
||||
{Request->DomainModel->d_statis|raw}
|
||||
{:request()->DomainModel->d_statis}
|
||||
<!-- FIXED 打开TP模板文档,找到变量原样输出 -->
|
||||
<!-- TODO 问题描述:下面 -->
|
||||
<!-- 我这边测试: 无法调用用 Request 渲染 , 只能渲染 通过 view:assign() 传递过来的变量 START-->
|
||||
<!-- 1.{Request->DomainModel->d_statis|raw} 这个在页面上展示的 就是: {Request->DomainModel->d_statis} -->
|
||||
<!-- 2.{$DomainModel->d_statis|raw} 使用这个是可以正常渲染的,这个在basecontroll 里面 加入 assign了,你看看这样操作行不-->
|
||||
<!-- TODO END -->
|
||||
|
||||
{:request()->DomainModel->d_domian}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user