error('您还没有登录, 请登录', '/login'); } // // 登录用户信息 $this->uid = session('uid'); $this->username = session('username'); $this->limit = $this->request->cookie('limit') ? : 50; //记录日志 $this->addLog(); } /** * 记录日志 */ private function addLog() { $data = []; $data['querystring'] = $this->app->request->query()?'?'.$this->app->request->query():''; $data['c'] = $this->app->request->controller(); $data['a'] = $this->app->request->action(); $data['userid'] = $this->uid; $data['username'] = $this->username; $data['ip'] = $this->app->request->ip(); $data['time'] = time(); $arr = ['Index/index','SysLog/index']; if (!in_array($data['c'].'/'.$data['a'], $arr)) { Db::name('sys_log')->insert($data); } } }