Kaynağa Gözat

【程序目录】优化易联云小票打印流程

吴昊天 3 yıl önce
ebeveyn
işleme
d8a561c311

+ 2 - 12
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

+ 1 - 3
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;
     }
-
-
 }