init
This commit is contained in:
47
app/admin/behavior/UserAction.php
Executable file
47
app/admin/behavior/UserAction.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\behavior;
|
||||
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
|
||||
class UserAction {
|
||||
|
||||
private $Request;
|
||||
|
||||
/**
|
||||
* 日志记录
|
||||
*/
|
||||
public function run($call) {
|
||||
$this->Request = Request::instance();
|
||||
$domainurl = $this->Request->url(true);
|
||||
$module = $this->Request->module();
|
||||
$controller = $this->Request->controller();
|
||||
$action = $this->Request->action();
|
||||
$method = $this->Request->method();
|
||||
switch ($controller) {
|
||||
case 'Translate':
|
||||
action_log($controller . '控制器' . $action . '动作操作记录', "翻译操作记录{$module}-{$controller}-{$action}-{$method}-" . date('Y-m-d H:i:s'), null);
|
||||
break;
|
||||
case 'Webuploader':
|
||||
action_log($controller . '控制器' . $action . '动作操作记录', "文件管理操作记录{$module}-{$controller}-{$action}-{$method}-" . date('Y-m-d H:i:s'), null);
|
||||
break;
|
||||
case 'Dbmanager':
|
||||
action_log($controller . '控制器' . $action . '动作操作记录', "数据管理操作记录{$module}-{$controller}-{$action}-{$method}-" . date('Y-m-d H:i:s'), null);
|
||||
break;
|
||||
case 'Sysconfig':
|
||||
action_log($controller . '控制器' . $action . '动作操作记录', "系统配置管理操作记录{$module}-{$controller}-{$action}-{$method}-" . date('Y-m-d H:i:s'), null);
|
||||
break;
|
||||
case 'Ueditor':
|
||||
action_log($controller . '控制器' . $action . '动作操作记录', "编辑器操作记录{$module}-{$controller}-{$action}-{$method}-" . date('Y-m-d H:i:s'), null);
|
||||
break;
|
||||
default:
|
||||
$actions = ['create', 'update', 'delete', 'deletes', 'distory', 'distorys', 'recovery', 'recoverys', 'setting', 'recycle', 'recommends'];
|
||||
if (in_array($action, $actions) || stripos($action, 'toggle') === 0 || stripos($action, 'update') === 0) {
|
||||
action_log($controller . '控制器' . $action . '动作操作记录', "{$module}-{$controller}-{$action}-{$method}-" . date('Y-m-d H:i:s'), null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user