代码更新
This commit is contained in:
@@ -19,11 +19,15 @@ class Admin {
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$response = $next($request);
|
||||
$this->data = $response->getData();
|
||||
if (is_array($response->getData())) {
|
||||
$this->data = array_merge($this->data, $response->getData());
|
||||
} else {
|
||||
$this->data = $response->getData();
|
||||
}
|
||||
|
||||
if ($request->isAjax()) {
|
||||
return json($this->data);
|
||||
}else{
|
||||
} else {
|
||||
return $response->data($this->fetch());
|
||||
}
|
||||
}
|
||||
@@ -31,17 +35,18 @@ class Admin {
|
||||
/**
|
||||
* @title 显示类
|
||||
*/
|
||||
protected function fetch($template = ''){
|
||||
protected function fetch($template = '') {
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
$config = array(
|
||||
'tpl_replace_string' => array(
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/admin/images',
|
||||
'__css__' => '/static/admin/css',
|
||||
'__js__' => '/static/admin/js',
|
||||
'__public__' => '/static/admin',
|
||||
)
|
||||
'tpl_replace_string' => array(
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/admin/images',
|
||||
'__css__' => '/static/admin/css',
|
||||
'__js__' => '/static/admin/js',
|
||||
'__public__' => '/static/admin',
|
||||
),
|
||||
);
|
||||
|
||||
return View::config($config)->assign($this->data)->fetch($template);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user