@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'doudian'); |
| 28 | 28 | |
| 29 | 29 | // Register the main class to use with the facade |
| 30 | - $this->app->singleton('doudian', function () { |
|
| 30 | + $this->app->singleton('doudian', function() { |
|
| 31 | 31 | $config = config('doudian'); |
| 32 | 32 | |
| 33 | 33 | return new DouDian($config); |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | public function __get($class) |
| 61 | 61 | { |
| 62 | 62 | $class = '\\Abbotton\\DouDian\\Api\\'.Str::ucfirst($class); |
| 63 | - if (! class_exists($class)) { |
|
| 63 | + if (!class_exists($class)) { |
|
| 64 | 64 | throw new Exception($class.', Not found', 404); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $this->config = $config; |
| 32 | 32 | $this->shop_id = $shop_id; |
| 33 | - if (! isset($config['app_key']) || ! $config['app_key']) { |
|
| 33 | + if (!isset($config['app_key']) || !$config['app_key']) { |
|
| 34 | 34 | throw new \InvalidArgumentException('配置有误, 请填写app_key'); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if (! isset($config['app_secret']) || ! $config['app_secret']) { |
|
| 37 | + if (!isset($config['app_secret']) || !$config['app_secret']) { |
|
| 38 | 38 | throw new \InvalidArgumentException('配置有误, 请填写app_secret'); |
| 39 | 39 | } |
| 40 | 40 | $this->client = new Client(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $url = str_replace('/', '.', $url); |
| 104 | 104 | |
| 105 | 105 | $accessToken = ""; |
| 106 | - if (! in_array($url, ["token.create","token.refresh"])) { |
|
| 106 | + if (!in_array($url, ["token.create", "token.refresh"])) { |
|
| 107 | 107 | $accessToken = $this->getAccessToken(); |
| 108 | 108 | }; |
| 109 | 109 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | private function getAccessToken(): string |
| 143 | 143 | { |
| 144 | 144 | $oauthToken = Cache::get(self::OAUTH_CACHE_KEY.$this->shop_id, []); |
| 145 | - if (! $oauthToken || ! $oauthToken['refresh_token']) { |
|
| 145 | + if (!$oauthToken || !$oauthToken['refresh_token']) { |
|
| 146 | 146 | return $this->requestAccessToken(); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $response = $this->httpGet('token/create', $param, true); |
| 177 | - if (! $response || $response['code'] > 10000) { |
|
| 177 | + if (!$response || $response['code'] > 10000) { |
|
| 178 | 178 | trigger_error("token/create 接口异常[{$response['code']}]"); |
| 179 | 179 | } |
| 180 | 180 | $response['data']['access_token_expired_at'] = time() + $response['data']['expires_in']; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | ]; |
| 206 | 206 | |
| 207 | 207 | $response = $this->httpGet('token/refresh', $param, true); |
| 208 | - if (! $response || $response['code'] > 10000) { |
|
| 208 | + if (!$response || $response['code'] > 10000) { |
|
| 209 | 209 | trigger_error("token/refresh 接口异常[{$response['code']}]"); |
| 210 | 210 | } |
| 211 | 211 | $response['data']['access_token_expired_at'] = time() + $response['data']['expires_in']; |