static function getLoginUser($field = '', $getData = '')
 {
     if (!self::$adminInfo['aid']) {
         $admin = array();
         if (!$getData) {
             $getData = array('auth' => myCookie('s_auth'), 'saltkey' => myCookie('s_saltkey'));
         }
         if ($getData['auth'] && $getData['saltkey']) {
             $getData['auth'] = explode("\t", getDecode($getData['auth'], self::getAuthKey($getData['saltkey'])));
             list($aid, $psw) = empty($getData['auth']) || count($getData['auth']) < 2 ? array(0, '') : $getData['auth'];
             if ($aid) {
                 $admin = self::getUserById($aid);
                 //print_r($admin);
             }
             if ($admin && $admin['psw'] == $psw) {
                 self::$adminInfo = $admin;
                 self::$adminInfo['isHome'] = $admin['auth_id'] == 1 ? true : false;
                 //是否主帐号
                 self::$adminInfo['isAdmin'] = $admin['groupid'] == 1 ? true : false;
                 //是否管理员
                 self::$adminInfo['isEditor'] = $admin['groupid'] == 5 ? true : false;
                 //是否编辑
                 self::$adminInfo['isService'] = $admin['groupid'] == 6 ? true : false;
                 //是否客服
             }
         }
     }
     return $field && isset(self::$adminInfo[$field]) ? self::$adminInfo[$field] : self::$adminInfo;
 }
 static function getLoginUser($field = '', $auth = '', $saltKey = '')
 {
     if (!self::$userInfo['uid']) {
         if (!$auth && !$saltKey && myCookie('auth') && myCookie('saltkey')) {
             $auth = myCookie('auth');
             $saltKey = myCookie('saltkey');
         }
         if ($auth) {
             $auth = explode("\t", getDecode($auth, self::getAuthKey($saltKey)));
             list($uid, $aid) = empty($auth) || count($auth) < 2 ? array(0, 0) : $auth;
             if ($uid) {
                 self::$userInfo = self::getUserById($uid);
                 if (!self::$userInfo) {
                     showError('抱歉,你的帐号存在异常,无法登陆');
                 }
                 switch (self::$userInfo['status']) {
                     case 0:
                         //异常
                         self::setUserLoginOut();
                         showError('抱歉,你的帐号存在异常,无法登陆');
                         break;
                     case 1:
                         //帐号正常
                         break;
                     case 2:
                         //冻结
                         self::setUserLoginOut();
                         showError('抱歉,你的帐号已被冻结,无法登陆');
                         break;
                     case 3:
                         //取消关注
                         self::setUserLoginOut();
                         break;
                     default:
                         //未知情况
                         self::setUserLoginOut();
                         showError('抱歉,你的帐号存在异常,无法登陆');
                 }
                 //附加登陆来源
                 self::$userInfo['loginFrom'] = isHave($auth[2]) ? $auth[2] : 'wx';
                 if (getUserAgent() == 'weixin' && self::$userInfo['loginFrom'] != 'wx') {
                     self::setUserLoginOut();
                 }
             }
         }
     }
     return $field && isset(self::$userInfo[$field]) ? self::$userInfo[$field] : self::$userInfo;
 }
Esempio n. 3
0
 private function search($search, $field)
 {
     $this->CPanel_Model = $this->model("Cpanel_Model");
     return $this->Cpanel_Model->getSearch(getDecode($search), $field, _tLinks);
 }