mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-04 00:24:29 +08:00
初始化项目
This commit is contained in:
41
app/middleware/AdminLog.php
Normal file
41
app/middleware/AdminLog.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleware;
|
||||
|
||||
use app\model\AdminLog as AppAdminLog;
|
||||
use app\model\AdminPermission;
|
||||
use app\Request;
|
||||
use think\Collection;
|
||||
use think\facade\Cache;
|
||||
|
||||
class AdminLog
|
||||
{
|
||||
public function handle(Request $request, \Closure $next)
|
||||
{
|
||||
$logged_admin_permission = Cache::get('logged_admin_permission');
|
||||
|
||||
if(empty($logged_admin_permission)){
|
||||
$logged_admin_permission = new Collection(AdminPermission::where('is_log',1)->select());
|
||||
}
|
||||
|
||||
|
||||
$is_exit = $logged_admin_permission->where('app',app('http')->getName())
|
||||
->where('controller',$request->controller())
|
||||
->where('action',$request->action());
|
||||
|
||||
if(!$is_exit->isEmpty()){
|
||||
AppAdminLog::create([
|
||||
'app'=>app('http')->getName(),
|
||||
'controller'=>$request->controller(),
|
||||
'action'=>$request->action(),
|
||||
'param'=>$request->param(),
|
||||
'create_time'=>time(),
|
||||
'admin_id'=>$request->session('admin_id','0'),
|
||||
'ip'=>$request->ip()
|
||||
]);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
}
|
||||
}
|
||||
32
app/middleware/ConfigInit.php
Normal file
32
app/middleware/ConfigInit.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleware;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use think\helper\Arr;
|
||||
|
||||
class ConfigInit
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
|
||||
//设置存储
|
||||
$filesystem_config = Config::get('filesystem');
|
||||
Arr::set($filesystem_config,'default','public');
|
||||
|
||||
Config::set($filesystem_config, 'filesystem');
|
||||
|
||||
// 社微信开放平台
|
||||
// $wx_open_app = [];
|
||||
// $wx_open_app = Arr::add($wx_open_app,'app_id',get_system_config('wx_open_app_id'));
|
||||
// $wx_open_app = Arr::add($wx_open_app,'secret',get_system_config('wx_open_app_secret'));
|
||||
// $wx_open_app = Arr::add($wx_open_app,'token',get_system_config('wx_open_app_token'));
|
||||
// $wx_open_app = Arr::add($wx_open_app,'aes_key',get_system_config('wx_open_app_aes_key'));
|
||||
|
||||
// Config::set($wx_open_app,'wx_open_app');
|
||||
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
15
app/middleware/PermissionRecord.php
Normal file
15
app/middleware/PermissionRecord.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleware;
|
||||
|
||||
use app\model\AdminPermission;
|
||||
use app\Request;
|
||||
|
||||
class PermissionRecord
|
||||
{
|
||||
public function handle(Request $request, \Closure $next)
|
||||
{
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user