예제 #1
0
 /**
  * 删除设备对应的accessToken
  * @param $deviceId
  */
 public function deleteByDeviceId($deviceId)
 {
     $token = OTokens::model()->find("device_id=:id", array(":id" => $deviceId));
     if (isset($token)) {
         $accessToken = $token->oauth_token;
         ORefreshToken::model()->delete("oauth_token=:oauthToken", array(":oauthToken" => $accessToken));
         $token->delete();
     }
 }
예제 #2
0
 /**
  * 新建对象
  */
 public function create($oauthToken, $clientId, $refresh_token, $expires)
 {
     $item = ORefreshToken::model()->find("oauth_token=:oauth_token", array("oauth_token" => $token));
     if (!isset($item)) {
         $item = new ORefreshToken();
         $item->oauth_token = $oauthToken;
         $item->client_id = $clientId;
         $item->refresh_token = $refresh_token;
         $item->expires = $expires;
         $item->save();
     }
 }