Exemple #1
0
 /**
  * 静态方法, 单例统一访问入口
  * @return object  返回对象的唯一实例
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance) || !isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemple #2
0
 /**
  * 根据clientId获得Client完整信息,在整个会话期内只有一个Client对象
  * @param $token
  */
 public function getClient2($clientId)
 {
     if ($this->hasCache2 === true && $this->client !== NULL) {
         Yii::trace("MiniClient2 cache 2 get clientId:" . $clientId, "miniyun.cache2");
         return $this->client;
     }
     $this->client = MiniClient::getInstance()->getClient($clientId);
     return $this->client;
 }
Exemple #3
0
 /**
  * 搜索APP
  * @param $name
  * @param $currentPage
  * @param $pageSize
  * @return mixed
  */
 public function searchApp($name, $currentPage, $pageSize)
 {
     $data = MiniClient::getInstance()->getAppByName($name, $currentPage, $pageSize);
     return $data;
 }
Exemple #4
0
 /**
  * 根据token获得Access的完整信息
  * @param $token
  * @return array|NULL
  */
 public function getAccessInfo($token)
 {
     $tokenObject = $this->getToken($token);
     if ($tokenObject != false) {
         $clientId = $tokenObject["client_id"];
         $clientObject = MiniClient::getInstance()->getClient($clientId);
         if ($clientObject !== false) {
             //只有Client存在的情况才返回Token
             $value = array();
             $value["client_id"] = $clientObject["client_id"];
             $value["oauth_token"] = $tokenObject["oauth_token"];
             $value["expires"] = $tokenObject["expires"];
             $value["device_id"] = $tokenObject["device_id"];
             $value["scope"] = $tokenObject["scope"];
             return $value;
         }
     }
     return NULL;
 }