Verify the $guid and get the userid from cas proxy server

@param $guid string  从Cas proxy server返回的guid，用于获取登录用户

@return string       返回登录用户名

@throws \XjtuAna\CASProxyClient\CASProxyClientException
172490
public function verify(string $guid) {
        if (empty($guid)) {
            throw new CasProxyClientException('GUID is required', CasProxyClientException::GUID_INVALID);
        }
        $response = $this->http()->get( $this->getVerifyUrl($guid) );
        
        if ($status = $response->getStatusCode() !== 200) {
            throw new CasProxyClientException($response->getStatusCode() . ': ' . $response->getMessage(), CasProxyClientException::HTTP_EXCEPTION);
        }

        $body = json_decode($response->getBody(), true);
        
        if (!isset($body['code']) || !isset($body['message']) || !isset($body['data'])) {
            throw new CasProxyClientException('Response Invalid', CasProxyClientException::RESPONSE_INVALID);
        }
        
        if (0 !== $body['code']) {
            throw new CasProxyClientException('Code: ' . $body['code'] . '. Message: ' . $body['messaage'], CasProxyClientException::RESPONSE_EXCEPTION);
        }
        
        if (false === $body['data']['valid']) {
            throw new CasProxyClientException('GUID Invalid', CasProxyClientException::GUID_INVALID);
        }
        
        return $body['data']['userid'];
    }
981412
public function postRelease($guid)
    {
        $uri = 'release';
        $uriData = [
            'guid' => $guid
        ];

        $response = [
            'uri' => $uri,
            'type' => 'post',
            'data' => $uriData
        ];

        return $this->processRequest($response);
    }
1217253
public function getPreviousImage($guid) {
		$imageList = $this->getImageList();
		$key = array_search($guid, $imageList);
		if ($key === false) {
			return null;
		}
		$key--;
		if ($key < 0) {
			return get_entity(end($imageList));
		}
		return get_entity($imageList[$key]);
	}
1082199
public function getUser(string $userid)
    {
        $cl = $this->getUserClass();
        $user = new $cl;
        return $user->obtainByUserID($userid);
    }
1045505
public function getReadableGUID()
    {
        $guid = $this->getGUID();
        if (preg_match(Number::GUID_REGEX, $guid)) {
            return $guid;
        }
        return Number::guid(false, false, $guid);
    }
1248344
public function generate_guid()
	{
	    return sprintf(
			'%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
			mt_rand(0, 65535),
			mt_rand(0, 65535),
			mt_rand(0, 65535),
			mt_rand(16384, 20479),
			mt_rand(32768, 49151),
			mt_rand(0, 65535),
			mt_rand(0, 65535),
			mt_rand(0, 65535)
		);
	}
842222
public static function GUID()
	{
		if ( function_exists( 'com_create_guid' ) === true )
		{
			return trim( com_create_guid(), '{}' );
		}

		return sprintf( '%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 16384, 20479 ), mt_rand( 32768, 49151 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ) );
	}
766680
public function clientGetByUid($uid)
  {
    foreach($this->clientList() as $client)
    {
      if($client["client_unique_identifier"] == $uid) return $client;
    }

    throw new Exception("invalid clientID", 0x200);
  }
375052
public static function getByID($gID)
    {
        $db = Database::connection();
        $g = CacheLocal::getEntry('group', $gID);
        if (is_object($g)) {
            return $g;
        }

        $row = $db->fetchAssoc('select * from ' . $db->getDatabasePlatform()->quoteSingleIdentifier('Groups') . ' where gID = ?', [$gID]);
        if ($row) {
            $g = \Core::make('\Concrete\Core\User\Group\Group');
            $g->setPropertiesFromArray($row);
            CacheLocal::set('group', $gID, $g);

            return $g;
        }
    }
141436
public function getUserInfo($uid) {

        $userinfo = [];

        if (empty($this->userInfo)){

            $userinfo = $this->config['auth_cache'] ? Session::get($this->getUserKey($uid)) : [];

            if (empty($userinfo) || !is_array($userinfo)){
                $user = Db::name($this->config['users']);
                // 获取用户表主键
                $_pk = is_string($user->getPk()) ? $user->getPk() : 'id';

                $userinfo = $user->field($this->config['users_auth_fields'])->where($_pk, $uid)->find();

                if ($this->config['auth_cache'])
                    Session::set($this->getUserKey($uid),$userinfo);
            }


            $this->userInfo = $userinfo;
        }

        return $this->userInfo;
    }
1121671
public function userIdToFid($uid) {
        $value = Cache::redis()->hGet('user_id_#_fid', $uid);
        Cache::release();
        return $value;
    }
999172
public function fetchTopic($guid, $options = [])
    {
        $options['guid'] = $guid;
        return $this->_request(self::FETCH_TOPIC, $options);
    }
768660
public function getGatewayCustomerId($uid)
    {
		$result = 0;
		$user   = $this->findUser( $uid );
		if (! is_null($user)) {
			$result = intval($user->getGatewayCustomerId());
		}

		return $result;
	}
678298
public static String printUUID(UUID guid)
   {
      return guid == null ? null : "{" + guid.toString().toUpperCase() + "}";
   }
600827
public function getUser($userId)
    {
        $result = $this->httpGet(self::WECHAT_USER_GET_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'userid' => $userId
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok' ? $result : false;
    }
922902
public static function is_valid( $guids = [] ) {
		$instance = self::get_instance();
		foreach ( $guids as $guid ) {
			if ( isset( $instance->plugins[ $guid ] ) && $instance->plugins[ $guid ]->valid ) {
				return true;
			}
		}

		return false;
	}
321945
public function thirdAccountInformation($uid = '') {
        $component_access_token = $this->componentAccessToken();
        #提交数据
        $data = array(
            "component_appid"  => C("wechat", "componentAppid"),
            "authorizer_appid" => $this->getUidAppid($uid, "appid"),
        );
        #提交的URL地址
        $url = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token=$component_access_token";
        $res = to_array($this->httpPost($url, $data));
        if ($res && isset($res['authorizer_info'])) {
            return $res;
        } else {
            return false;
        }
    }