This commit is contained in:
2020-08-15 21:50:59 +08:00
parent 2184b686f5
commit 27da9c50ca
8 changed files with 27 additions and 203 deletions

View File

@@ -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);
}
}
}
}