Browse Source

一些功能

Kirin 3 years ago
parent
commit
38535443d7

+ 1 - 1
app/admin/controller/order/StoreOrder.php

@@ -115,7 +115,7 @@ class StoreOrder extends AuthController
                 $value['productInfo']['store_name'] = StoreOrderCartInfo::getSubstrUTf8($value['productInfo']['store_name'], 10, 'UTF-8', '');
                 $product[] = $value;
             }
-            $res = YLYService::instance()->selectStore($order['store_id'])->setContent(sys_config('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting();
+            $res = YLYService::instance()->selectStore($order['store_id'])->setContent(sys_config('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting('', 0, $order['store_id']);
             if ($res) {
                 return JsonService::successful('打印成功');
             } else {

+ 1 - 1
crmeb/repositories/NoticeRepositories.php

@@ -76,7 +76,7 @@ class NoticeRepositories
                     $value['productInfo']['store_name'] = StoreOrderCartInfo::getSubstrUTf8($value['productInfo']['store_name'], 10, 'UTF-8', '');
                     $product[] = $value;
                 }
-                YLYService::instance()->selectStore($order['store_id'])->setContent(sys_config('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting();
+                YLYService::instance()->selectStore($order['store_id'])->setContent(sys_config('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting('', 0, $order['store_id']);
             } catch (\Exception $e) {
                 Log::error('小票打印出现错误,错误原因:' . $e->getMessage());
             }

+ 3 - 3
crmeb/services/YLYService.php

@@ -133,7 +133,7 @@ class YLYService extends HttpService implements ProviderInterface
      * @param string $order_id
      * @return bool|mixed
      */
-    public function orderPrinting(string $order_id = '', int $errorCount = 0)
+    public function orderPrinting(string $order_id = '', int $errorCount = 0, $store_id = 0)
     {
         $request = self::postRequest($this->apiUrl . 'print/index', [
             'client_id' => $this->client_id,
@@ -150,8 +150,8 @@ class YLYService extends HttpService implements ProviderInterface
         var_dump($request);
         if (isset($request['error']) && in_array($request['error'], [18, 14]) && $errorCount == 0) {
             CacheModel::delectDbCache('YLY_access_token');
-            $this->getAccessToken();
-            return $this->orderPrinting($order_id, 1);
+            $this->getAccessToken($store_id);
+            return $this->orderPrinting($order_id, 1, $store_id);
         }
         return $request;
     }