You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
1.8 KiB
93 lines
1.8 KiB
5 years ago
|
<?php
|
||
|
|
||
|
//require "../database/config.php";
|
||
|
//百度token管理
|
||
|
class ApiToken
|
||
|
{
|
||
|
private $refresh_token;
|
||
|
private $expires_in;
|
||
|
private $end_time;
|
||
|
|
||
|
/**
|
||
|
* @return false|string
|
||
|
*/
|
||
|
public function getEndTime()
|
||
|
{
|
||
|
return $this->end_time;
|
||
|
}
|
||
|
|
||
|
private $scope;
|
||
|
private $session_key;
|
||
|
private $access_token;
|
||
|
private $session_secret;
|
||
|
|
||
|
/**
|
||
|
* ApiToken constructor.
|
||
|
* @param $refresh_token
|
||
|
* @param $expires_in
|
||
|
* @param $scope
|
||
|
* @param $session_key
|
||
|
* @param $access_token
|
||
|
* @param $session_secret
|
||
|
*/
|
||
|
public function __construct($refresh_token, $expires_in, $scope, $session_key, $access_token, $session_secret)
|
||
|
{
|
||
|
$this->refresh_token = $refresh_token;
|
||
|
$this->expires_in = $expires_in;
|
||
|
$this->end_time = date_format(date_create(date(default_format))->add(date_interval_create_from_date_string($expires_in . " seconds")), default_format);
|
||
|
$this->scope = $scope;
|
||
|
$this->session_key = $session_key;
|
||
|
$this->access_token = $access_token;
|
||
|
$this->session_secret = $session_secret;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getRefreshToken()
|
||
|
{
|
||
|
return $this->refresh_token;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getExpiresIn()
|
||
|
{
|
||
|
return $this->expires_in;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getScope()
|
||
|
{
|
||
|
return $this->scope;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getSessionKey()
|
||
|
{
|
||
|
return $this->session_key;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getAccessToken()
|
||
|
{
|
||
|
return $this->access_token;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getSessionSecret()
|
||
|
{
|
||
|
return $this->session_secret;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|