Commit da3c6843 authored by 王源's avatar 王源 🎧

编写shopify对非私人应用的token值处理

parent d61484cf
...@@ -64,10 +64,19 @@ abstract class AbstractShopify ...@@ -64,10 +64,19 @@ abstract class AbstractShopify
$this->pluralizeKey = $this->pluralizeKey ?: $this->resourceKey . 's'; $this->pluralizeKey = $this->pluralizeKey ?: $this->resourceKey . 's';
$this->resourceUrl = ($parentResourceUrl ? "$parentResourceUrl/" : $config['api_url']) . $this->pluralizeKey . ($this->id ? "/{$this->id}" : ''); $this->resourceUrl = ($parentResourceUrl ? "$parentResourceUrl/" : $config['api_url']) . $this->pluralizeKey . ($this->id ? "/{$this->id}" : '');
$this->httpRequestJson = make(CurlHttpRequestJson::class); $this->httpRequestJson = make(CurlHttpRequestJson::class);
if (isset($config['api_password'])) { if (isset($config['is_private_app']) && $config['is_private_app'] == false) {
$this->httpHeaders['X-Shopify-Access-Token'] = $config['api_password']; // 如果不是私人应用,则使用访问令牌
} elseif (!isset($config['api_password'])) { if (isset($config['access_token'])) {
throw new Exception("请设置api_password值"); $this->httpHeaders['X-Shopify-Access-Token'] = $config['access_token'];
} elseif (!isset($config['access_token'])) {
throw new Exception("请设置access_token值");
}
} else {
if (isset($config['api_password'])) {
$this->httpHeaders['X-Shopify-Access-Token'] = $config['api_password'];
} elseif (!isset($config['api_password'])) {
throw new Exception("请设置api_password值");
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment