更新
This commit is contained in:
@@ -16,6 +16,8 @@ use think\facade\Session;
|
||||
*/
|
||||
class Admin {
|
||||
|
||||
public $data = [];
|
||||
|
||||
public function handle($request, \Closure $next) {
|
||||
$request->rootUid = env('rootuid');
|
||||
$request->user = Session::get('adminInfo');
|
||||
@@ -29,6 +31,20 @@ class Admin {
|
||||
MemberLog::record($request);
|
||||
|
||||
$response = $next($request);
|
||||
return $response;
|
||||
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 {
|
||||
if (\is_string($this->data) && $this->data != '') {
|
||||
return $response;
|
||||
} else {
|
||||
return json($this->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user