From d8a561c31138502142f17ad759bae077a8186aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Fri, 16 Dec 2022 16:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=91=E4=BC=98=E5=8C=96=E6=98=93=E8=81=94=E4=BA=91=E5=B0=8F?= =?UTF-8?q?=E7=A5=A8=E6=89=93=E5=8D=B0=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/printer/AccessToken.php | 14 ++------------ crmeb/crmeb/services/printer/storage/YiLianYun.php | 4 +--- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/crmeb/crmeb/services/printer/AccessToken.php b/crmeb/crmeb/services/printer/AccessToken.php index 83400f109..3b1012c77 100644 --- a/crmeb/crmeb/services/printer/AccessToken.php +++ b/crmeb/crmeb/services/printer/AccessToken.php @@ -80,7 +80,6 @@ class AccessToken extends HttpService $this->machineCode = $config['terminal'] ?? null; $this->name = $name; $this->configFile = $configFile; - $this->apiUrl = Config::get($this->configFile . '.stores.' . $this->name . '.apiUrl', 'https://open-api.10ss.net/'); } /** @@ -112,7 +111,7 @@ class AccessToken extends HttpService /** @var CacheServices $cacheServices */ $cacheServices = app()->make(CacheServices::class); $this->accessToken[$this->name] = $cacheServices->getDbCache('YLY_access_token', function () { - $request = self::postRequest($this->apiUrl . 'oauth/oauth', [ + $request = self::postRequest('https://open-api.10ss.net/auth/oauth', [ 'client_id' => $this->clientId, 'grant_type' => 'client_credentials', 'sign' => strtolower(md5($this->clientId . time() . $this->apiKey)), @@ -127,22 +126,13 @@ class AccessToken extends HttpService return $request['body']['access_token'] ?? ''; } return ''; - },86400); + }, 86400); if (!$this->accessToken[$this->name]) throw new AdminException(400718); return $this->accessToken[$this->name]; } - /** - * 获取请求链接 - * @return string - */ - public function getApiUrl(string $url = '') - { - return $url ? $this->apiUrl . $url : $this->apiUrl; - } - /** * 生成UUID4 * @return string diff --git a/crmeb/crmeb/services/printer/storage/YiLianYun.php b/crmeb/crmeb/services/printer/storage/YiLianYun.php index 118c447b5..5ae721fd5 100644 --- a/crmeb/crmeb/services/printer/storage/YiLianYun.php +++ b/crmeb/crmeb/services/printer/storage/YiLianYun.php @@ -39,7 +39,7 @@ class YiLianYun extends BasePrinter if (!$this->printerContent) { return $this->setError('Missing print'); } - $request = $this->accessToken->postRequest($this->accessToken->getApiUrl('print/index'), [ + $request = $this->accessToken->postRequest('https://open-api.10ss.net/print/index', [ 'client_id' => $this->accessToken->clientId, 'access_token' => $this->accessToken->getAccessToken(), 'machine_code' => $this->accessToken->machineCode, @@ -103,6 +103,4 @@ class YiLianYun extends BasePrinter CONTENT; return $this; } - - }