1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- class CommonAction extends Action {
- /*
- */
- public function _initialize(){
- //项目信息
- $this->project_id = C('CC_PROJECT_ID');
- if(!$this->project_id){
- echo 'project_id empty';
- return;
- }
- $this->site_title = C('SITE_TITLE') ? : '用户中心';
- $this->site_copyright = C('SITE_COPYRIGHT') ? : '版权所有';
-
- //跳过检查登录的操作
- if(in_array(ACTION_NAME,array('login','login2','register','init') ))
- return;
- if(strpos(ACTION_NAME,'api_')===0)
- return;
-
- //获取用户信息
- $this->userid = \Jiaruan\UcCookie::get();
- if(!$this->userid){
- header('Location: ?s=dpqd_index/login');
- exit;
- }
- $cond = array('ID'=>$this->userid);
- $this->userinfo = M('uc_user')->where($cond)->find();
-
- //跳转到登录页面
- if(!$this->userinfo){
- header('Location: ?s=dpqd_index/login');
- exit;
- }
- }
- }
|