trigger = true; $sr->triggername = "index_login"; $config = get_addon_config(CsmContants::$ADDONS); $sr->jsondata = json_encode([ 'canadminfindpassword' => $config['canadminfindpassword'], 'canadminregister' => $config['canadminregister'] ]); return $sr; } public function actionBegin($request) { // 由于登录需要判断首次时间,而在afterlogin后首次登录状态被覆盖 $config = get_addon_config(CsmContants::$ADDONS); $needupdatepsdwhenfirstlogin = $config["needupdatepsdwhenfirstlogin"]; if ($needupdatepsdwhenfirstlogin == 'Y') { $username = $request->post('username'); $service = new AdminService(); $row = $service->getRowByUsername($username); if ($row != null) { Session::set("csmadmin_lastlogintime", $row->logintime); } else { Session::set("csmadmin_lastlogintime", time()); } } } public function appEnd($response) { $request = Request::instance(); if ($request->isAjax()) { $this->ajaxEnd($request); } } private function ajaxEnd($request) { $user = $this->getuserinfo(); // 按部门管理,就需要根据角色重新授权 $config = get_addon_config(CsmContants::$ADDONS); if ($config['canadmindepratmng'] == 'Y') { if ($user != null && $user['id']!=null){ $this->reCalcAdminAuthgroup($user['id']); } } } }