shish преди 5 години
родител
ревизия
65dcd97dc9
променени са 3 файла, в които са добавени 33 реда и са изтрити 4 реда
  1. 7 1
      app-ghs/controllers/BaseController.php
  2. 2 2
      app-ghs/controllers/CustomController.php
  3. 24 1
      app-ghs/controllers/OrderController.php

+ 7 - 1
app-ghs/controllers/BaseController.php

@@ -5,6 +5,7 @@ namespace ghs\controllers;
 use biz\admin\classes\AdminClass;
 use biz\shop\classes\ShopAdminClass;
 use biz\shop\classes\ShopClass;
+use biz\shop\classes\ShopExtClass;
 use biz\sj\classes\SjClass;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
@@ -17,7 +18,7 @@ use common\components\util;
 class BaseController extends PublicController
 {
     public $admin, $adminId, $adminAvatar, $account;
-    public $sjId = 0, $sj = [], $sjExtend = [], $signPackage, $shop = [], $shopId = 0, $lookShopId = 0, $shopAdminId = 0, $shopAdmin = [];
+    public $sjId = 0, $sj = [], $sjExtend = [], $signPackage, $shop = [], $shopExt = [], $shopId = 0, $lookShopId = 0, $shopAdminId = 0, $shopAdmin = [];
     public $appId;
     public $isWx = false;
     public $isLogin = false;
@@ -59,6 +60,11 @@ class BaseController extends PublicController
             if (empty($shop)) {
                 util::fail('没有找到您管理的门店');
             }
+            $shopExt = ShopExtClass::getByCondition(['shopId' => $currentShopId], true);
+            if (empty($shopExt)) {
+                util::fail('没有找到门店');
+            }
+            $this->shopExt = $shopExt;
             $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0], true);
             if (empty($shopAdmin)) {
                 util::logout('没有找到员工信息');

+ 2 - 2
app-ghs/controllers/CustomController.php

@@ -124,8 +124,8 @@ class CustomController extends BaseController
             default:
         }
         if (!empty($name)) {
-            if (stringUtil::isMobile($name)) {
-                $where['mobile'] = $name;
+            if (stringUtil::isLetter($name)) {
+                $where['py'] = ['like', $name];
             } else {
                 $where['name'] = ['like', $name];
             }

+ 24 - 1
app-ghs/controllers/OrderController.php

@@ -58,7 +58,8 @@ class OrderController extends BaseController
             }
         }
         $respond = OrderClass::getOrderList($where);
-        $respond['shop'] = $this->shop->attributes;
+        $respond['shop'] = $this->shop;
+        $respond['shopExt'] = $this->shopExt;
         util::success($respond);
     }
 
@@ -239,6 +240,15 @@ class OrderController extends BaseController
         $id = $get['id'] ?? 0;
         $info = OrderService::getOrderInfo($id, true, true, true, false);
         OrderClass::valid($info, $this->shopId);
+
+        //是否有云打印判断
+        $hasCloudPrint = 0;
+        $shopExt = $this->shopExt;
+        if (isset($shopExt->printSn) && !empty($shopExt->printSn) && isset($shopExt->printKey) && !empty($shopExt->printKey)) {
+            $hasCloudPrint = 1;
+        }
+        $info['hasCloudPrint'] = $hasCloudPrint;
+
         util::success($info);
     }
 
@@ -477,4 +487,17 @@ class OrderController extends BaseController
         util::complete();
     }
 
+    //打印订单 shish 20210714
+    public function actionCloudPrintOrder()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $order = OrderClass::getById($id, true);
+        OrderClass::valid($order, $this->shopId);
+        //打印订单
+        OrderClass::onlinePrint($order);
+        $order->printNum += 1;
+        $order->save();
+        util::complete();
+    }
+
 }