mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
【程序目录】优化易联云小票打印流程
This commit is contained in:
parent
60c2b28cba
commit
d8a561c311
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user