|
@@ -46,6 +46,8 @@ class YLYService extends HttpService implements ProviderInterface
|
|
|
*/
|
|
*/
|
|
|
protected $order_id = null;
|
|
protected $order_id = null;
|
|
|
|
|
|
|
|
|
|
+ protected $store_id = 0;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 终端号码
|
|
* 终端号码
|
|
|
* @var string
|
|
* @var string
|
|
@@ -82,20 +84,22 @@ class YLYService extends HttpService implements ProviderInterface
|
|
|
$this->terminal = $system['terminal_number'] ?? '';
|
|
$this->terminal = $system['terminal_number'] ?? '';
|
|
|
$this->getAccessToken();
|
|
$this->getAccessToken();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public function selectStore($store_id)
|
|
public function selectStore($store_id)
|
|
|
{
|
|
{
|
|
|
- $terminal_number = SystemStore::where('id',$store_id)->value('terminal_number');
|
|
|
|
|
|
|
+ $this->store_id = $store_id;
|
|
|
|
|
+ $terminal_number = SystemStore::where('id', $store_id)->value('terminal_number');
|
|
|
$this->terminal = $terminal_number;
|
|
$this->terminal = $terminal_number;
|
|
|
- $this->getAccessToken();
|
|
|
|
|
|
|
+ $this->getAccessToken($store_id);
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取AccessToken
|
|
* 获取AccessToken
|
|
|
* */
|
|
* */
|
|
|
- protected function getAccessToken($store_id=0)
|
|
|
|
|
|
|
+ protected function getAccessToken($store_id = 0)
|
|
|
{
|
|
{
|
|
|
- $this->access_token = CacheModel::getDbCache('YLY_access_token'.$store_id, function () {
|
|
|
|
|
|
|
+ $this->access_token = CacheModel::getDbCache('YLY_access_token' . $store_id, function () {
|
|
|
$request = self::postRequest($this->apiUrl . 'oauth/oauth', [
|
|
$request = self::postRequest($this->apiUrl . 'oauth/oauth', [
|
|
|
'client_id' => $this->client_id,
|
|
'client_id' => $this->client_id,
|
|
|
'grant_type' => 'client_credentials',
|
|
'grant_type' => 'client_credentials',
|
|
@@ -147,7 +151,7 @@ class YLYService extends HttpService implements ProviderInterface
|
|
|
if ($request === false) return false;
|
|
if ($request === false) return false;
|
|
|
$request = json_decode($request, true);
|
|
$request = json_decode($request, true);
|
|
|
if (isset($request['error']) && in_array($request['error'], [18, 14]) && $errorCount == 0) {
|
|
if (isset($request['error']) && in_array($request['error'], [18, 14]) && $errorCount == 0) {
|
|
|
- CacheModel::delectDbCache('YLY_access_token');
|
|
|
|
|
|
|
+ CacheModel::delectDbCache('YLY_access_token' . $this->store_id);
|
|
|
$this->getAccessToken();
|
|
$this->getAccessToken();
|
|
|
return $this->orderPrinting($order_id, 1);
|
|
return $this->orderPrinting($order_id, 1);
|
|
|
}
|
|
}
|
|
@@ -195,15 +199,11 @@ class YLYService extends HttpService implements ProviderInterface
|
|
|
$goodsStr .= '</table>';
|
|
$goodsStr .= '</table>';
|
|
|
$this->order_id = $orderInfo['order_id'];
|
|
$this->order_id = $orderInfo['order_id'];
|
|
|
$order_type = "普通订单";
|
|
$order_type = "普通订单";
|
|
|
- if($orderInfo['is_consumer']==1)
|
|
|
|
|
- {
|
|
|
|
|
- $order_type ="消费券订单";
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if($orderInfo['use_integral']>0)
|
|
|
|
|
- {
|
|
|
|
|
- $order_type ="积分订单";
|
|
|
|
|
|
|
+ if ($orderInfo['is_consumer'] == 1) {
|
|
|
|
|
+ $order_type = "消费券订单";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ($orderInfo['use_integral'] > 0) {
|
|
|
|
|
+ $order_type = "积分订单";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$count = <<<CONTENT
|
|
$count = <<<CONTENT
|