|
@@ -61,12 +61,12 @@ class AccessTokenServeService extends HttpService
|
|
|
* 沙盒模式
|
|
* 沙盒模式
|
|
|
* @var bool
|
|
* @var bool
|
|
|
*/
|
|
*/
|
|
|
- protected $sandBox = false;
|
|
|
|
|
|
|
+ protected $sandBox = true;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 登录接口
|
|
* 登录接口
|
|
|
*/
|
|
*/
|
|
|
- const USER_LOGIN = "user/login";
|
|
|
|
|
|
|
+ const USER_LOGIN = "v2/user/login";
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -105,11 +105,11 @@ class AccessTokenServeService extends HttpService
|
|
|
*/
|
|
*/
|
|
|
public function getToken()
|
|
public function getToken()
|
|
|
{
|
|
{
|
|
|
- $accessTokenKey = md5($this->account . '_' . $this->secret . $this->cacheTokenPrefix);
|
|
|
|
|
|
|
+ $accessTokenKey = md5($this->account . '_v2_' . $this->secret . $this->cacheTokenPrefix);
|
|
|
$cacheToken = $this->cache->get($accessTokenKey);
|
|
$cacheToken = $this->cache->get($accessTokenKey);
|
|
|
if (!$cacheToken) {
|
|
if (!$cacheToken) {
|
|
|
$getToken = $this->getTokenFromServer();
|
|
$getToken = $this->getTokenFromServer();
|
|
|
- $this->cache->set($accessTokenKey, $getToken['access_token'], 300);
|
|
|
|
|
|
|
+ $this->cache->set($accessTokenKey, $getToken['access_token'], $getToken['expires_in'] - 60);
|
|
|
$cacheToken = $getToken['access_token'];
|
|
$cacheToken = $getToken['access_token'];
|
|
|
}
|
|
}
|
|
|
$this->accessToken = $cacheToken;
|
|
$this->accessToken = $cacheToken;
|
|
@@ -125,8 +125,8 @@ class AccessTokenServeService extends HttpService
|
|
|
public function getTokenFromServer()
|
|
public function getTokenFromServer()
|
|
|
{
|
|
{
|
|
|
$params = [
|
|
$params = [
|
|
|
- 'account' => $this->account,
|
|
|
|
|
- 'secret' => $this->secret,
|
|
|
|
|
|
|
+ 'access_key' => $this->account,
|
|
|
|
|
+ 'secret_key' => $this->secret,
|
|
|
];
|
|
];
|
|
|
$response = $this->postRequest($this->get(self::USER_LOGIN), $params);
|
|
$response = $this->postRequest($this->get(self::USER_LOGIN), $params);
|
|
|
$response = json_decode($response, true);
|
|
$response = json_decode($response, true);
|