Forráskód Böngészése

Merge branch 'master' into zhongqi-memberLevel

shish 5 hónapja
szülő
commit
84cbf8bcbf
45 módosított fájl, 597 hozzáadás és 349 törlés
  1. 1 1
      app-ghs/controllers/AdminController.php
  2. 2 2
      app-ghs/controllers/ConsoleController.php
  3. 1 1
      app-ghs/controllers/CustomController.php
  4. 53 2
      app-ghs/controllers/ItemController.php
  5. 0 2
      app-ghs/controllers/NoticeController.php
  6. 70 46
      app-ghs/controllers/OrderController.php
  7. 40 17
      app-ghs/controllers/ProductController.php
  8. 33 85
      app-ghs/controllers/PurchaseOrderController.php
  9. 5 0
      app-ghs/controllers/StatItemController.php
  10. 5 3
      app-ghs/controllers/TestController.php
  11. 0 3
      app-ghs/models/order/CreateOrderForm.php
  12. 1 1
      app-hd/controllers/AdminController.php
  13. 1 1
      app-hd/controllers/ConsoleController.php
  14. 18 30
      app-hd/controllers/CustomController.php
  15. 12 8
      app-hd/controllers/NoticeController.php
  16. 23 13
      app-hd/controllers/OrderController.php
  17. 0 33
      app-hd/controllers/PlantCgController.php
  18. 31 13
      app-hd/controllers/ProductController.php
  19. 10 4
      app-hd/controllers/PurchaseController.php
  20. 4 9
      app-hd/controllers/ShopController.php
  21. 5 3
      app-mall/controllers/NoticeController.php
  22. 1 3
      app-mall/controllers/OrderController.php
  23. 1 1
      app-mall/controllers/UserController.php
  24. 1 1
      app-pt/controllers/WxController.php
  25. 3 3
      app-pt/views/main/app.php
  26. 0 6
      biz-ghs/cg/services/CgRefundService.php
  27. 25 18
      biz-ghs/express/classes/GhsDeliveryOrderClass.php
  28. 1 1
      biz-ghs/item/classes/ItemClass.php
  29. 62 9
      biz-ghs/order/classes/OrderClass.php
  30. 3 0
      biz-ghs/order/classes/OrderClearClass.php
  31. 0 7
      biz-ghs/order/classes/PurchaseOrderClass.php
  32. 4 1
      biz-ghs/order/services/OrderService.php
  33. 1 0
      biz-ghs/product/classes/ProductClass.php
  34. 2 2
      biz-ghs/stat/classes/StatKdClass.php
  35. 1 1
      biz-hd/custom/classes/CustomClass.php
  36. 20 13
      biz-hd/express/classes/HdDeliveryOrderClass.php
  37. 1 1
      biz-hd/item/classes/ItemClass.php
  38. 2 0
      biz-hd/purchase/classes/PurchaseClass.php
  39. 16 1
      biz-hd/staff/classes/StaffClass.php
  40. 1 1
      common/components/book.php
  41. 8 1
      common/components/delivery/util/DeliveryQuoteUtil.php
  42. 1 0
      common/components/push.php
  43. 2 1
      common/components/rabbitmq/notifyConsumer.php
  44. 2 1
      common/components/sms.php
  45. 124 0
      console/controllers/TestController.php

+ 1 - 1
app-ghs/controllers/AdminController.php

@@ -110,7 +110,7 @@ class AdminController extends BaseController
     {
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? '';
-        $deviceId = $get['deviceId'];
+        $deviceId = $get['deviceId'] ?? '';
         $autoLogin = $get['auto'] ?? 0; // 是否自动登录的请求
         //noticeUtil::push("批发客户端ID: " . $id);
         if (empty($id)) {

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

@@ -51,7 +51,7 @@ class ConsoleController extends BaseController
         $overview = [
             ['name' => "库存数", "url" => '/admin/stat/stock', 'value' => $totalItemNum, 'type' => 1],
             ['name' => "库存值", "url" => '/admin/stat/stock', 'value' => $totalCost, 'type' => 1],
-            ['name' => "总账", "url" => '/admin/shop/debtChange', 'value' => $totalDebt, 'type' => 1],
+            ['name' => "总账", "url" => '/admin/shop/debtChange', 'value' => $totalDebt, 'type' => 1],
             ['name' => "总客户", "url" => '/admin/home/member', 'value' => $totalCustom, 'type' => 4],
             ['name' => "总访客", "url" => '/admin/home/member', 'value' => $totalVisit, 'type' => 4],
             ['name' => "总订单", "url" => '/admin/home/order', 'value' => $totalOrder, 'type' => 4],
@@ -168,7 +168,7 @@ class ConsoleController extends BaseController
             }
         }
 
-        //$notice[] = ['title' => '赊账最近会统一更名为挂账', 'action' => '', 'page' => ''];
+        //$notice[] = ['title' => '节日期间急事找不到人连打二次 15280215347', 'action' => '', 'page' => ''];
         //$notice[] = ['title' => '新功能:客户端和后台使用跑腿的流程', 'action' => '', 'page' => '/admin/book/detail?id=use_pt'];
         //$notice[] = ['title' => '快速设置:客户下单自动计算跑腿费', 'action' => '查看', 'page' => '/admin/book/detail?id=auto_calc_pt_fee'];
         //$notice[] = ['title' => '订单上如何一键呼叫跑腿', 'action' => '查看', 'page' => '/admin/book/detail?id=one_call_pt'];

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

@@ -1193,7 +1193,7 @@ class CustomController extends BaseController
         util::success($info);
     }
 
-    //总账和总余额汇总 ssh 20250620
+    //总账和总余额汇总 ssh 20250620
     public function actionShowTotalBalance()
     {
         $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);

+ 53 - 2
app-ghs/controllers/ItemController.php

@@ -415,6 +415,7 @@ class ItemController extends BaseController
         $requestType = $get['requestType'] ?? 'kd';
         $classId = $get['classId'] ?? 0;
         $lookStock = $get['lookStock'] ?? 0;
+        $onStock = $get['onStock'] ?? 0;
 
         $where['mainId'] = $this->mainId;
         if ($requestType == 'kd') {
@@ -428,6 +429,9 @@ class ItemController extends BaseController
             if ($lookStock == 2) {
                 $where['stock'] = 0;
             }
+            if($onStock == 1){
+                $where['onStock>'] = 0;
+            }
             unset($where['status']);
         } elseif ($requestType == 'changePrice') {
             $where['delStatus'] = 0;
@@ -542,7 +546,7 @@ class ItemController extends BaseController
         } elseif ($requestType == 'changeStock') {
             $list = ProductClass::changeStockGroup($list, $level);
         } elseif ($requestType == 'kd') {
-            $list = ProductClass::kdItemGroup($list, $level,$custom);
+            $list = ProductClass::kdItemGroup($list, $level, $custom);
         } elseif ($requestType == 'book') {
             $list = ProductClass::bookItemGroup($list, $level);
         } elseif ($requestType == 'itemList') {
@@ -658,12 +662,31 @@ class ItemController extends BaseController
         util::success($respond);
     }
 
+    //全部花材取消隐藏 ssh 20260201
+    public function actionCancelAllItemHide()
+    {
+        $mainId = $this->mainId;
+        ItemClass::updateByCondition(['mainId' => $mainId, 'frontHide' => 1], ['frontHide' => 0, 'frontUse' => 0]);
+        util::complete('操作成功');
+    }
+
+    //分类下的花材取消隐藏 sssh 20260201
+    public function actionCancelClassItemHide()
+    {
+        $get = Yii::$app->request->get();
+        $classId = $get['classId'] ?? 0;
+        $mainId = $this->mainId;
+        ItemClass::updateByCondition(['mainId' => $mainId, 'classId' => $classId, 'frontHide' => 1], ['frontHide' => 0, 'frontUse' => 0]);
+        util::complete('操作成功');
+    }
+
+    //单个花材的显示和隐藏 ssh 20260201
     public function actionChangeFrontHide()
     {
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
         $status = $get['status'] ?? '';
-        if (is_numeric($status) == false) {
+        if (!is_numeric($status)) {
             util::fail('请选择方式');
         }
         $info = ItemClass::getById($id, true);
@@ -674,10 +697,38 @@ class ItemController extends BaseController
             util::fail('无法操作');
         }
         $info->frontHide = $status;
+        $info->frontUse = $status;
         $info->save();
         util::complete();
     }
 
+    //批量隐藏和显示花材 ssh 20260131
+    public function actionBatchChangeFrontHide()
+    {
+        $post = Yii::$app->request->post();
+        $ids = $post['ids'] ?? 0;
+        $ids = trim($ids);
+        if (empty($ids)) {
+            util::fail('请选花材');
+        }
+        $frontHide = $post['frontHide'] ?? 0;
+        $arr = json_decode($ids, true);
+        if (empty($arr)) {
+            util::fail('请选花材呢');
+        }
+        $list = ItemClass::getAllByCondition(['id' => ['in', $arr]], null, 'id,frontHide,mainId', null, true);
+        if (!empty($list)) {
+            foreach ($list as $key => $currentItem) {
+                if ($currentItem->mainId == $this->mainId) {
+                    $currentItem->frontHide = $frontHide;
+                    $currentItem->frontUse = $frontHide;
+                    $currentItem->save();
+                }
+            }
+        }
+        util::complete('操作成功');
+    }
+
     //检测是否要刷新
     public function actionCheckRefresh()
     {

+ 0 - 2
app-ghs/controllers/NoticeController.php

@@ -6,7 +6,6 @@ use biz\express\classes\ExpressShanClass;
 use bizGhs\express\services\DadaExpressServices;
 use bizGhs\order\classes\OrderClass;
 use bizGhs\order\classes\OrderExpressClass;
-use bizGhs\order\classes\OrderSendClass;
 use bizGhs\order\services\OrderService;
 use common\components\dict;
 use common\components\noticeUtil;
@@ -14,7 +13,6 @@ use common\components\payUtil;
 use common\components\shans\shans;
 use Yii;
 use common\components\util;
-use biz\recharge\classes\RechargeClass;
 
 class NoticeController extends PublicController
 {

+ 70 - 46
app-ghs/controllers/OrderController.php

@@ -637,6 +637,10 @@ class OrderController extends BaseController
                                 }
                             }
                         }
+
+                        //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                        GhsDeliveryOrderClass::payAfter($order);
+
                         ShopExtClass::ghsGatheringReport($order);
                     }
                     util::success(['returnStatus' => 'SUCCESS']);
@@ -817,6 +821,10 @@ class OrderController extends BaseController
                             }
                         }
                     }
+
+                    //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                    GhsDeliveryOrderClass::payAfter($order);
+
                     ShopExtClass::ghsGatheringReport($order);
                 }
                 util::success(['returnStatus' => 'SUCCESS']);
@@ -1149,7 +1157,7 @@ class OrderController extends BaseController
             $post['bookSn'] = $bookSn;
         }
 
-        $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay'); //收款方式  0:扫码付(待付款) 1:线下(已付款) 2:赊账(欠款)3:现金 4:余额
+        $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay'); //收款方式  0:扫码付 1:线下(已付款) 2:赊账(欠款)3:现金 4:余额
         $post['debt'] = OrderClass::DEBT_NO;
         if ($hasPay == dict::getDict('hasPay', 'debt')) {
             $post['debt'] = OrderClass::DEBT_YES;
@@ -1177,7 +1185,7 @@ class OrderController extends BaseController
         } else {
             if ($this->mainId == 644) {
                 if ($hasPay == 1) {
-                    util::fail('线下收款暂时无法使用');
+                    //util::fail('线下收款暂时无法使用');
                 }
             }
         }
@@ -1297,8 +1305,13 @@ class OrderController extends BaseController
             if ($hasPay == 0) {
                 util::fail('扫码付不能选订单日期');
             }
-            if (strtotime($historyDate) > strtotime(date("Y-m-d"))) {
-                util::fail('订单日期只能选历史时间');
+        }
+
+        $callErrand = $post['callErrand'] ?? 0;
+        if ($callErrand == 1) {
+            $shopExt = $this->shopExt;
+            if ($shopExt->orderFlow == 0) {
+                util::fail('下单后要变待发货,才能直接发跑腿');
             }
         }
 
@@ -1640,6 +1653,10 @@ class OrderController extends BaseController
                     }
                 }
             }
+
+            //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+            GhsDeliveryOrderClass::payAfter($order);
+
             if ($order->status != 1 && $order->status != 5) {
                 //花店采购供货商端APP收到通知
                 //NoticeClass::ghsNewOrderNotice($order);
@@ -1650,9 +1667,6 @@ class OrderController extends BaseController
 //                $push->ghsOrderMessage($shop, $cgShop, $order);
             }
 
-            if ($order->sendType == 2 && $order->status == 2) { //订单状态 2待配送
-                GhsDeliveryOrderClass::payAfter($order);// 付款成功之后呼叫跑腿
-            }
         }
 
         util::complete();
@@ -2429,50 +2443,60 @@ class OrderController extends BaseController
         if (empty($date)) {
             util::fail('请选择日期');
         }
-        $order = OrderClass::getById($id, true);
-        if (empty($order)) {
-            util::fail('没有找到订单');
-        }
-        if ($order->mainId != $this->mainId) {
-            util::fail('不是你的订单');
-        }
-        if ($order->payStatus == 0) {
-            util::fail('没有确认的订单');
-        }
-        $mainId = $this->mainId;
-        //超管或者约定的人可以修改日期
-        if (getenv('YII_ENV') == 'production') {
-            if (in_array($mainId, [23390])) {
-                if (!in_array($this->adminId, [24586, 23960, 24043])) {
-                    util::fail('你不能修改哦');
-                }
+
+        $connection = Yii::$app->db;
+        $transaction = $connection->beginTransaction();//开启事务
+        try {
+            $order = OrderClass::getById($id, true);
+            if (empty($order)) {
+                util::fail('没有找到订单');
             }
-        } else {
-            if (in_array($mainId, [644])) {
-                if (!in_array($this->adminId, [919])) {
+            if ($order->mainId != $this->mainId) {
+                util::fail('不是你的订单');
+            }
+            if ($order->payStatus == 0) {
+                util::fail('没有确认的订单');
+            }
+            $mainId = $this->mainId;
+            //超管或者约定的人可以修改日期
+            if (getenv('YII_ENV') == 'production') {
+                if (in_array($mainId, [23390])) {
+                    if (!in_array($this->adminId, [24586, 23960, 24043])) {
+                        util::fail('你不能修改哦');
+                    }
                 }
             }
-        }
 
-        $payTime = $order->payTime;
-        $time = strtotime($payTime);
-        $after = date("H:i:s", $time);
-        $new = $date . ' ' . $after;
-        $cgId = $order->purchaseId ?? 0;
-        $cg = PurchaseClass::getById($cgId, true);
-        if (empty($cg)) {
-            util::fail('没有找到订单信息');
-        }
-        if (strtotime($new) > time()) {
-            util::fail('不能修改成未来时间');
+            $payTime = $order->payTime;
+            $timeArr = explode(' ', $payTime);
+            $dateStr = $timeArr[0];
+            if ($dateStr == $date) {
+                util::fail('日期没变');
+            }
+
+            $after = $timeArr[1];
+            $new = $date . ' ' . $after;
+            $cgId = $order->purchaseId ?? 0;
+            $cg = PurchaseClass::getById($cgId, true);
+            if (empty($cg)) {
+                util::fail('没有找到订单信息');
+            }
+            $order->payTime = $new;
+            $order->save();
+            $cg->payTime = $new;
+            $cg->save();
+            //有修改账单日期需要更新到欠款变动明细,财务好对账,多个地方要同步修改,关键词 to_change_custom_debt_pay_time
+            CustomDebtChangeClass::updateByCondition(['capitalType' => 10, 'relateId' => $id], ['payTime' => $new]);
+
+            //找到当前订单客户的账单日期为 $date 的所有订单,然后更新同天内的所有订单的 sameTimeIds(加此次要改变的订单的订单号$id),有多处调用,关键词 update_same_ids
+            OrderClass::updateSameTimeIds($order, $date);
+
+            $transaction->commit();
+            util::complete('修改成功');
+        } catch (\Exception $e) {
+            $transaction->rollBack();
+            util::fail('修改失败');
         }
-        $order->payTime = $new;
-        $order->save();
-        $cg->payTime = $new;
-        $cg->save();
-        //有修改账单日期需要更新到欠款变动明细,财务好对账,多个地方要同步修改,关键词to_change_custom_debt_pay_time
-        CustomDebtChangeClass::updateByCondition(['capitalType' => 10, 'relateId' => $id], ['payTime' => $new]);
-        util::complete('修改成功');
     }
 
     //应收款统计 ssh 20240528

+ 40 - 17
app-ghs/controllers/ProductController.php

@@ -200,26 +200,43 @@ class ProductController extends BaseController
             $unit = '若干' . $info->smallUnit . '装';
         }
         $p->times = $num;
-        if (stringUtil::getWordNum($name) > 8) {
-            $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
-        } else {
-            $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+
+        if($priceOption == 2){
+            // 每7个汉字截取一次(支持汉字、字母、数字混合),多处需要同步修改,关键词 label_print_substr
+            $content = '';
+            $len = mb_strlen($name, 'UTF-8');
+            $baseNum = 30;
+            $u = 0;
+            for ($i = 0; $i < $len; $i += 6) {
+                $currentName = mb_substr($name, $i, 6, 'UTF-8');
+                $number = $baseNum + 90*$u;
+                $u++;
+                $content .= '<TEXT x="10" y="' . $number . '" font="12" w="3" h="3" r="0">' . $currentName . '</TEXT>';
+            }
+        }else{
+            if (stringUtil::getWordNum($name) > 8) {
+                $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
+            } else {
+                $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+            }
         }
 
         if ($type == 0) {
-            //打标签
-            $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $ptItemId . '</BC128>';
-            if (in_array($mainId, [52, 1459])) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
-            } elseif ($mainId == 16948) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
-            } elseif ($mainId == 72057) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
-            } else {
-                if ($priceOption == 0) {
-                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+            if($priceOption != 2) {
+                //打标签
+                $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $ptItemId . '</BC128>';
+                if (in_array($mainId, [52, 1459])) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
+                } elseif ($mainId == 16948) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+                } elseif ($mainId == 72057) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
                 } else {
-                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
+                    if ($priceOption == 0) {
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                    } else {
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
+                    }
                 }
             }
         } else {
@@ -322,7 +339,9 @@ class ProductController extends BaseController
                 $where['name'] = ['like', $name];
             }
         }
-
+        if($requestType == 'hideItem'){
+            $where['frontHide'] = 1;
+        }
         //客户等级
         $customId = Yii::$app->request->get('customId', 0);
         $level = 1;
@@ -344,6 +363,10 @@ class ProductController extends BaseController
                     $itemInfoData[$key]['shortCover'] = $shortCover;
                 }
             }
+        } elseif ($requestType == 'hideItem') {
+            //隐藏花材列表
+            $field = 'id,py,cover,name,classId,itemId,price,skPrice,hjPrice,stock,onStock,cost,avCost,addPrice,hjAddPrice,skMore';
+            $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         } elseif ($requestType == 'changePrice') {
             $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,onStock,presell,frontHide,reachNum,reachNumDiscount';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);

+ 33 - 85
app-ghs/controllers/PurchaseOrderController.php

@@ -234,27 +234,43 @@ class PurchaseOrderController extends BaseController
                 $hyPrice = floatval($hyPrice);
             }
 
-            if (stringUtil::getWordNum($name) > 8) {
-                $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
+            if ($priceOption == 2) {
+                // 每7个汉字截取一次(支持汉字、字母、数字混合),多处需要同步修改,关键词 label_print_substr
+                $content = '';
+                $len = mb_strlen($name, 'UTF-8');
+                $baseNum = 30;
+                $u = 0;
+                for ($i = 0; $i < $len; $i += 6) {
+                    $currentName = mb_substr($name, $i, 6, 'UTF-8');
+                    $number = $baseNum + 90 * $u;
+                    $u++;
+                    $content .= '<TEXT x="10" y="' . $number . '" font="12" w="3" h="3" r="0">' . $currentName . '</TEXT>';
+                }
             } else {
-                $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
-            }
-            if ($key % 2 == 1) {
-                $content .= '<TEXT x="415" y="20" font="12" w="2" h="2" r="0">.</TEXT>';
+                if (stringUtil::getWordNum($name) > 8) {
+                    $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
+                } else {
+                    $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+                }
+                if ($key % 2 == 1) {
+                    $content .= '<TEXT x="415" y="20" font="12" w="2" h="2" r="0">.</TEXT>';
+                }
             }
             if ($type == 0) {
-                $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $ptItemId . '</BC128>';
-                if (in_array($mainId, [52, 1459])) {
-                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
-                } elseif ($mainId == 16948) {
-                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
-                } elseif ($mainId == 72057) {
-                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
-                } else {
-                    if ($priceOption == 0) {
-                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                if ($priceOption != 2) {
+                    $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $ptItemId . '</BC128>';
+                    if (in_array($mainId, [52, 1459])) {
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
+                    } elseif ($mainId == 16948) {
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+                    } elseif ($mainId == 72057) {
+                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
                     } else {
-                        $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
+                        if ($priceOption == 0) {
+                            $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
+                        } else {
+                            $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . ' ' . $price . '元</TEXT>';
+                        }
                     }
                 }
             } else {
@@ -280,74 +296,6 @@ class PurchaseOrderController extends BaseController
         util::complete();
     }
 
-    //打印全部 ssh 20220
-    public function actionPrintItem()
-    {
-        $get = Yii::$app->request->get();
-        $id = $get['id'] ?? 0;
-        $type = $get['type'] ?? 0;
-        $item = PurchaseOrderItemClass::getById($id, true);
-        if (empty($item)) {
-            util::fail('没有找到花材');
-        }
-        $name = $item->name ?? '';
-        $num = !empty($item->itemNum) ? floatval($item->itemNum) : 0;
-        if (empty($num)) {
-            util::fail('没有花材数量');
-        }
-        $orderSn = $item->orderSn ?? '';
-        $order = PurchaseOrderClass::getByCondition(['orderSn' => $orderSn], true);
-        $mainId = $order->mainId ?? 0;
-
-        $ext = $this->shopExt;
-        $printLabelSn = $ext->printLabelSn ?? '';
-        if (empty($printLabelSn)) {
-            util::fail('请设置标签打印机');
-        }
-        $p = new printUtil($printLabelSn);
-
-        $productId = $item->productId ?? 0;
-        $product = ProductClass::getById($productId, true);
-        $smallUnit = $product->smallUnit ?? '';
-        $bigUnit = $product->bigUnit ?? '';
-        $ratio = $product->ratio ?? 20;
-        $ratioType = $product->ratioType ?? 0;
-        if ($ratioType == 1) {
-            $unit = '若干' . $smallUnit . '/' . $bigUnit;
-        } else {
-            $unit = $ratio . $smallUnit . '/' . $bigUnit;
-        }
-
-        $ptItemId = $item->itemId ?? '';
-
-        $p->times = $num;
-
-        if (stringUtil::getWordNum($name) > 7) {
-            $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
-        } else {
-            $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
-        }
-
-        if ($type == 0) {
-            $content .= '<BC128 x="30" y="100" h="70" s="1" r="0" n="4" w="11">' . $ptItemId . '</BC128>';
-            if (in_array($mainId, [52, 1459])) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
-            } elseif ($mainId == 16948) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
-            } elseif ($mainId == 72057) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
-            } else {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $unit . '</TEXT>';
-            }
-        } else {
-            $content .= '<QR x="35"  y="100"  e="L"  w="5">' . Yii::$app->params['mallHost'] . "/item/show-info?id=" . $productId . '</QR>';
-            $content .= '<TEXT x="40" y="270" font="12" w="1" h="1" r="0">扫码看价格</TEXT>';
-        }
-
-        $p->printLabelMsg($content);
-        util::complete();
-    }
-
     //取消入库单 ssh 20221211
     public function actionCancel()
     {

+ 5 - 0
app-ghs/controllers/StatItemController.php

@@ -82,9 +82,14 @@ class StatItemController extends BaseController
             $orderSn = $order['orderSn'] ?? '';
             $status = $order['status'] ?? 0;
             $book = $order['book'] ?? 0;
+            $actPrice = $order['actPrice'] ?? 0;
             if ($status == 5 || $status == 1 || ($book == 1 && $status == 2)) {
                 continue;
             }
+            if ($actPrice <= 0) {
+                //如果全部退款的花材也不统计
+                continue;
+            }
             $itemList = OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
             if (!empty($itemList)) {
                 foreach ($itemList as $item) {

+ 5 - 3
app-ghs/controllers/TestController.php

@@ -456,7 +456,9 @@ class TestController extends BaseController
             //['name' => '广州翰林花卉', 'merchantNo' => '8225810599201LR', 'wx' => [850644821, 850644094], 'zfb' => '2088280085826650'],
             //['name' => '昆明宅小鲜', 'merchantNo' => '8223910599200PL', 'wx' => [852957278, 852958031], 'zfb' => '2088280271476229'],
             //['name' => '昆明小向花卉批发', 'merchantNo' => '8227310599200Z2', 'wx' => [857900016, 857899180], 'zfb' => '2088280559651366'],
-            ['name' => '昆明小玖花卉批发', 'merchantNo' => '8227310599200Z3', 'wx' => [858815386, 858815193], 'zfb' => '2088280613495934'],
+            //['name' => '昆明小玖花卉批发', 'merchantNo' => '8227310599200Z3', 'wx' => [858815386, 858815193], 'zfb' => '2088280613495934'],
+            //['name' => '广州勇记鲜花', 'merchantNo' => '8225810599201NY', 'wx' => [865933677, 865933966], 'zfb' => '2088380356697908'],
+            ['name' => '永城花语鲜花批发', 'merchantNo' => '82250605992008U', 'wx' => [866677786, 866678419], 'zfb' => '2088380428301720'],
             //['name' => '厦门都市鲜花批发', 'merchantNo' => '8223930599200HZ', 'wx' => [854245016, 854244735], 'zfb' => '2088280333454097'],
             //['name' => '深圳鼎盛皇室花卉', 'merchantNo' => '8225840599201MF', 'wx' => [807078304, 807076486], 'zfb' => '2088970117746334'],
             //['name' => '东莞惠雅鲜花(莞城店)', 'merchantNo' => '8226020599200GJ', 'wx' => [796953190, 796976959], 'zfb' => '2088770940104912'],
@@ -970,7 +972,7 @@ class TestController extends BaseController
     //交易查询 ssh 20231021
     public function actionTradeQuery()
     {
-        $shopId = 7855;
+        $shopId = 80134;
         $shop = ShopClass::getById($shopId, true);
         if (empty($shop)) {
             util::stop('没有找到门店,编号677230');
@@ -986,7 +988,7 @@ class TestController extends BaseController
             'lklCertificatePath' => $lklCertificatePath,
         ];
         $laResource = new Lakala($params);
-        $orderSn = 'CG29953307';
+        $orderSn = 'CG30387429';
         $tradeNo = '';
         $queryParams = [
             'orderSn' => $orderSn,

+ 0 - 3
app-ghs/models/order/CreateOrderForm.php

@@ -110,9 +110,6 @@ class CreateOrderForm extends BaseForm
                  return;
             }
 
-            if (strtotime($this->historyDate) > strtotime(date("Y-m-d"))) {
-                $this->addError($attribute, '订单日期只能选历史时间');
-            }
         }
     }
 }

+ 1 - 1
app-hd/controllers/AdminController.php

@@ -449,7 +449,7 @@ class AdminController extends BaseController
     {
         $get = Yii::$app->request->get();
         $clientId = $get['id'] ?? '';
-        $deviceId = $get['deviceId'];
+        $deviceId = $get['deviceId'] ?? '';
         $autoLogin = $get['auto'] ?? 0; // 是否自动登录的请求
         if (empty($clientId)) {
             util::success(['returnStatus' => 'FAILURE']);

+ 1 - 1
app-hd/controllers/ConsoleController.php

@@ -47,7 +47,7 @@ class ConsoleController extends BaseController
 			['name' => "花束", "url" => '/admin/goods/list', 'value' => $goodsCount, 'type' => 1],
 			['name' => "总客户", "url" => '/admin/home/member', 'value' => $customCount, 'type' => 1],
 			['name' => "总订单", "url" => '/admin/home/order', 'value' => $orderCount, 'type' => 4],
-			['name' => "总账", "url" => '/admin/home/order', 'value' => $debtCount, 'type' => 4],
+			['name' => "总账", "url" => '/admin/home/order', 'value' => $debtCount, 'type' => 4],
 		];
 		util::success(['overview' => $overview]);
     }

+ 18 - 30
app-hd/controllers/CustomController.php

@@ -75,6 +75,7 @@ class CustomController extends BaseController
                 $msg = $e->getMessage();
                 util::fail($msg);
             }
+            //农历转阳历,有多处使用,需要同步修改,关键词 change_my_birthday
             $month = $result['gregorian_month'] ?? 1;
             $date = $result['gregorian_day'] ?? 1;
             $birthday = date("Y") . '-' . $month . '-' . $date;
@@ -83,36 +84,23 @@ class CustomController extends BaseController
         }
         $birthdayTime = strtotime($birthday);
 
-        if ($user->birthdaySet == 0) {
-            //用户自己没有设置过生日,直接改
-            $custom->lunar = $lunar;
-            $custom->birthdayDate = $birthdayDate;
-            $custom->birthdayMonth = $birthdayMonth;
-            $custom->birthday = $birthday;
-            $custom->birthdayTime = $birthdayTime;
-            $custom->save();
-
-            $user->lunar = $lunar;
-            $user->birthdayDate = $birthdayDate;
-            $user->birthdayMonth = $birthdayMonth;
-            $user->birthday = $birthday;
-            $user->birthdayTime = $birthdayTime;
-            $user->save();
-        } else {
-            //用户设置过,按用户设置的生日来走
-            $lunar = $user->lunar;
-            $birthdayDate = $user->birthdayDate;
-            $birthdayMonth = $user->birthdayMonth;
-            $birthday = $user->birthday;
-            $birthdayTime = $user->birthdayTime;
-
-            $custom->lunar = $lunar;
-            $custom->birthdayDate = $birthdayDate;
-            $custom->birthdayMonth = $birthdayMonth;
-            $custom->birthday = $birthday;
-            $custom->birthdayTime = $birthdayTime;
-            $custom->save();
+        if ($user->birthdaySet == 1) {
+            util::fail('客户已填写,不能修改');
         }
+        //用户自己没有设置过生日,直接改
+        $custom->lunar = $lunar;
+        $custom->birthdayDate = $birthdayDate;
+        $custom->birthdayMonth = $birthdayMonth;
+        $custom->birthday = $birthday;
+        $custom->birthdayTime = $birthdayTime;
+        $custom->save();
+
+        $user->lunar = $lunar;
+        $user->birthdayDate = $birthdayDate;
+        $user->birthdayMonth = $birthdayMonth;
+        $user->birthday = $birthday;
+        $user->birthdayTime = $birthdayTime;
+        $user->save();
         util::complete('修改成功');
     }
 
@@ -659,7 +647,7 @@ class CustomController extends BaseController
         util::success($user);
     }
 
-    //总账和总余额汇总 ssh 20250620
+    //总账和总余额汇总 ssh 20250620
     public function actionShowTotalBalance()
     {
         $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);

+ 12 - 8
app-hd/controllers/NoticeController.php

@@ -155,10 +155,8 @@ class NoticeController extends PublicController
                 $saleId = $cg->saleId ?? 0;
                 $order = OrderClass::getById($saleId, true);
 
-                if(!empty($order)  && $order->sendType == 2 && $order->status == 2) {
-                    //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
-                    GhsDeliveryOrderClass::payAfter($order);
-                }
+                //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                GhsDeliveryOrderClass::payAfter($order);
 
                 //不是预订单,并且供货商不是源花汇、小明鲜花、淄博花超、云漫梦金鹏、海翔,则订单直接完成掉。是预订单,则确认发货时直接完成掉。有多个地方要修改,请搜索关键词zjFinish
                 if (!empty($cg) && !empty($order)) {
@@ -372,10 +370,8 @@ class NoticeController extends PublicController
                 $saleId = $cg->saleId ?? 0;
                 $order = OrderClass::getById($saleId, true);
 
-                if(!empty($order) && $order->sendType == 2 && $order->status == 2) { //订单状态 2待配送
-                    //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
-                    GhsDeliveryOrderClass::payAfter($order);
-                }
+                //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                GhsDeliveryOrderClass::payAfter($order);
 
                 //不是预订单,并且供货商不是源花汇、小明鲜花、淄博花超、云漫梦金鹏、海翔、镜中花卉,则订单直接完成掉。是预订单,则确认发货时直接完成掉。有多个地方要修改,请搜索关键词zjFinish
                 if (!empty($cg) && !empty($order)) {
@@ -587,6 +583,10 @@ class NoticeController extends PublicController
                     $saleId = $cg->saleId ?? 0;
                     $order = OrderClass::getById($saleId, true);
                     if (!empty($order)) {
+
+                        //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                        GhsDeliveryOrderClass::payAfter($order);
+
                         //订单生成时唤起在线打印
                         if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {
                             //有几个地方要同步去修改
@@ -832,6 +832,10 @@ class NoticeController extends PublicController
                         $saleId = $cg->saleId ?? 0;
                         $order = OrderClass::getById($saleId, true);
                         if (!empty($order)) {
+
+                            //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                            GhsDeliveryOrderClass::payAfter($order);
+
                             //订单生成时唤起在线打印
                             if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {
                                 //有几个地方要同步去修改

+ 23 - 13
app-hd/controllers/OrderController.php

@@ -78,6 +78,10 @@ class OrderController extends BaseController
             }
 
             $transaction->commit();
+
+            //付款成功了,通知发跑腿功能,关键词 hd_pay_after_call_pt,多处要同步修改
+            HdDeliveryOrderClass::payAfter($info);
+
             util::complete('赊账成功');
         } catch (\Exception $exception) {
             $transaction->rollBack();
@@ -305,7 +309,7 @@ class OrderController extends BaseController
             util::fail('没有找到订单');
         }
         if ($order->forward == 1) {
-            util::fail('售后付款单不能打印');
+            util::fail('红冲订单不能打印');
         }
         OrderClass::valid($order, $this->mainId);
         OrderClass::onlinePrint($order, true);
@@ -393,6 +397,8 @@ class OrderController extends BaseController
                             $newOrder->save();
                         }
 
+                        HdDeliveryOrderClass::payAfter($newOrder);
+
                         $shopId = $newOrder->shopId ?? 0;
                         $shop = ShopClass::getById($shopId, true);
                         WxMessageClass::gatheringIncomeInform($shop, $newOrder);
@@ -539,6 +545,9 @@ class OrderController extends BaseController
 
                     //打印小票
                     OrderClass::onlinePrint($newOrder);
+
+                    HdDeliveryOrderClass::payAfter($newOrder);
+
                     //语音播报
                     ShopExtClass::hdGatheringReport($newOrder);
                     $shopId = $newOrder->shopId ?? 0;
@@ -644,22 +653,14 @@ class OrderController extends BaseController
         $forward = $post['forward'] ?? 0;
         if ($forward == 1) {
             if ($hasPay != 1) {
-                util::fail('售后付款单只能走线下转账');
+                util::fail('红冲订单只能走线下转账');
             }
             $historyDate = $post['historyDate'] ?? '';
             if (!empty($historyDate)) {
                 if ($historyDate != date("Y-m-d")) {
-                    util::fail('售后付款单不能修改账单日期,只能今天');
+                    util::fail('红冲订单不能修改账单日期,只能今天');
                 }
             }
-        } else {
-            //如果不是售后付款单,并且选的不是余额支付,余额又够付当前订单,则自动切到余额支付
-            $balance = $custom->balance ?? 0;
-            $modifyPrice = $post['modifyPrice'] ?? 0;
-            if ($hasPay != 4 && $balance > $modifyPrice) {
-                $post['hasPay'] = 4;
-                $hasPay = 4;
-            }
         }
 
         $productJson = $post['product'] ?? '';
@@ -701,6 +702,15 @@ class OrderController extends BaseController
             $productList = [['productId' => $zjGatheringItem, 'unitType' => 0, 'num' => 1, 'property' => '1', 'unitPrice' => $lsGoodsPrice]];
         }
 
+        $callErrand = $post['callErrand'] ?? 0;
+        if ($callErrand == 1) {
+            $shopId = $this->shopId;
+            $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+            if (!empty($shopExt) && $shopExt->orderFlow == 0) {
+                util::fail('下单后要变待发货,才能直接发跑腿');
+            }
+        }
+
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
@@ -1221,7 +1231,7 @@ class OrderController extends BaseController
 
         $forwardMap = [];
         if ($detail['forward'] == 1) {
-            //当前单如果已经是售后付款单,则取出其对应的原单
+            //当前单如果已经是红冲订单,则取出其对应的原单
             $map = OrderForwardClass::getByCondition(['shOrderId' => $id], true);
             if (!empty($map)) {
                 $originOrderId = $map->orderId ?? 0;
@@ -1237,7 +1247,7 @@ class OrderController extends BaseController
         $detail['shOrderMap'] = $shOrderMap;
 
         $main = $this->main;
-        //是否走售后付款单模式判断 ssh
+        //是否走红冲订单模式判断 ssh
         $ret = OrderClass::ifShPay($detail, $main, 0);
         $shAddPay = $ret['shAddPay'];
         $shAddPayReason = $ret['shAddPayReason'];

+ 0 - 33
app-hd/controllers/PlantCgController.php

@@ -51,39 +51,6 @@ class PlantCgController extends BaseController
         util::complete();
     }
 
-    //打印全部 ssh 20220
-    public function actionPrintItem()
-    {
-        $get = Yii::$app->request->get();
-        $id = $get['id'] ?? 0;
-        $item = PlantCgItemClass::getById($id, true);
-        if (empty($item)) {
-            util::fail('没有找到花材');
-        }
-        $name = $item->name ?? '';
-        $num = !empty($item->num) ? floatval($item->num) : 0;
-        if (empty($num)) {
-            util::fail('没有花材数量');
-        }
-
-        $shopId = $this->shopId;
-        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
-        $printLabelSn = $ext->printLabelSn ?? '';
-        if (empty($printLabelSn)) {
-            util::fail('请设置标签打印机');
-        }
-        $p = new printUtil($printLabelSn);
-
-        $goodsSn = $item->goodsSn ?? '';
-        //$price = floatval($item->price) ?? 0;
-        $content = '<TEXT x="30" y="45" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
-        $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $goodsSn . '</BC128>';
-        //$content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $price . '</TEXT>';
-        $p->times = $num;
-        $p->printLabelMsg($content);
-        util::complete();
-    }
-
     //采购详情 ssh 2020521
     public function actionDetail()
     {

+ 31 - 13
app-hd/controllers/ProductController.php

@@ -183,6 +183,7 @@ class ProductController extends BaseController
         $num = floatval($num);
         $num = (int)$num;
         $type = $get['type'] ?? 0;
+        $priceOption = $get['priceOption'] ?? 0;
         $info = ProductClass::getById($id, true);
         if (empty($info)) {
             util::fail('没有找到花材');
@@ -205,23 +206,40 @@ class ProductController extends BaseController
             $unit = '若干' . $info->smallUnit . '/' . $info->bigUnit;
         }
         $p->times = $num;
-        if (stringUtil::getWordNum($name) > 8) {
-            $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
+
+        if ($priceOption == 2) {
+            // 每7个汉字截取一次(支持汉字、字母、数字混合),多处需要同步修改,关键词 label_print_substr
+            $content = '';
+            $len = mb_strlen($name, 'UTF-8');
+            $baseNum = 30;
+            $u = 0;
+            for ($i = 0; $i < $len; $i += 6) {
+                $currentName = mb_substr($name, $i, 6, 'UTF-8');
+                $number = $baseNum + 90 * $u;
+                $u++;
+                $content .= '<TEXT x="10" y="' . $number . '" font="12" w="3" h="3" r="0">' . $currentName . '</TEXT>';
+            }
         } else {
-            $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+            if (stringUtil::getWordNum($name) > 8) {
+                $content = '<TEXT x="30" y="30" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
+            } else {
+                $content = '<TEXT x="30" y="30" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+            }
         }
 
         if ($type == 0) {
-            //打标签
-            $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $ptItemId . '</BC128>';
-            if (in_array($mainId, [52, 1459])) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
-            } elseif ($mainId == 16948) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
-            } elseif ($mainId == 72057) {
-                $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
-            } else {
-                $content .= '<TEXT x="30" y="250" font="12" w="1" h="1" r="0">' . $unit . '</TEXT>';
+            if ($priceOption != 2) {
+                //打标签
+                $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $ptItemId . '</BC128>';
+                if (in_array($mainId, [52, 1459])) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">惠雅鲜花</TEXT>';
+                } elseif ($mainId == 16948) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里鲜花</TEXT>';
+                } elseif ($mainId == 72057) {
+                    $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">淘花里小榄店</TEXT>';
+                } else {
+                    $content .= '<TEXT x="30" y="250" font="12" w="1" h="1" r="0">' . $unit . '</TEXT>';
+                }
             }
         } else {
             if (getenv('YII_ENV') == 'production') {

+ 10 - 4
app-hd/controllers/PurchaseController.php

@@ -636,6 +636,13 @@ class PurchaseController extends BaseController
                         }
                     }
 
+                    if ($ghsShopId == 77703) {
+                        //天天鲜花思明店,暂时关闭送货上门
+                        if($respond->sendType == 0){
+                            //util::fail('节日暂停送货上门,请选到店自取');
+                        }
+                    }
+
                 } else {
 
                     //好运鲜花批发,选择送货上门必须选必选商品
@@ -756,10 +763,6 @@ class PurchaseController extends BaseController
             $saleId = $info->saleId ?? 0;
             $order = OrderClass::getById($saleId, true);
             if (!empty($order)) {
-                //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
-                if ($order->sendType == 2 && $order->status == 2) {
-                    GhsDeliveryOrderClass::payAfter($order);
-                }
 
                 $shopId = $order->shopId ?? 0;
                 $shop = ShopClass::getById($shopId, true);
@@ -800,6 +803,9 @@ class PurchaseController extends BaseController
                     }
                 }
 
+                //付款成功之后呼叫跑腿,关键词 pay_after_call_pt,多处要同步修改
+                GhsDeliveryOrderClass::payAfter($order);
+
                 //更新最后下单时间
                 $customId = $order->customId ?? 0;
                 $custom = CustomClass::getById($customId, true);

+ 4 - 9
app-hd/controllers/ShopController.php

@@ -32,14 +32,9 @@ class ShopController extends BaseController
     {
         $get = Yii::$app->request->get();
         $adminId = $this->adminId;
-        if (getenv('YII_ENV') == 'production') {
-            if ($adminId != 4) {
-                util::fail('请联系管理员修改');
-            }
-        } else {
-            if ($adminId != 919) {
-                util::fail('请联系管理员修改');
-            }
+        $staff = $this->shopAdmin;
+        if ($staff->founder != 2 && $adminId != 4) {
+            util::fail('老板才能改店名');
         }
         $name = $get['name'] ?? '';
         if (empty($name)) {
@@ -244,7 +239,7 @@ class ShopController extends BaseController
                 $oldDevice->save();
             }
 
-            $newLoginDevice = \bizHd\device\classes\HdDeviceClass::getByCondition(['shopId'=>$newShopId, 'deviceId'=>$deviceId], true);
+            $newLoginDevice = \bizHd\device\classes\HdDeviceClass::getByCondition(['shopId' => $newShopId, 'deviceId' => $deviceId], true);
             if ($newLoginDevice) {
                 $newLoginDevice->status = 1;
                 $newLoginDevice->save();

+ 5 - 3
app-mall/controllers/NoticeController.php

@@ -171,9 +171,7 @@ class NoticeController extends PublicController
                         OrderClass::onlinePrint($order);
 
                         //付款成功了,通知发跑腿功能,关键词 hd_pay_after_call_pt,多处要同步修改
-                        if ($order->sendType == 2) {
-                            HdDeliveryOrderClass::payAfter($order);
-                        }
+                        HdDeliveryOrderClass::payAfter($order);
 
                         $shopId = $order->shopId ?? 0;
                         $shop = ShopClass::getById($shopId, true);
@@ -513,6 +511,10 @@ class NoticeController extends PublicController
                             $order->thirdLogNo = $thirdLogNo;
                             $order->save();
                             OrderClass::onlinePrint($order);
+
+                            //付款成功了,通知发跑腿功能,关键词 hd_pay_after_call_pt,多处要同步修改
+                            HdDeliveryOrderClass::payAfter($order);
+
                             $shopId = $order->shopId ?? 0;
                             $shop = ShopClass::getById($shopId, true);
                             //来自商城的新订单微信通知

+ 1 - 3
app-mall/controllers/OrderController.php

@@ -861,9 +861,7 @@ class OrderController extends BaseController
                     \bizHd\order\classes\OrderClass::onlinePrint($order);
 
                     //付款成功了,通知发跑腿功能,关键词 hd_pay_after_call_pt,多处要同步修改
-                    if ($order->sendType == 2) {
-                        HdDeliveryOrderClass::payAfter($order);
-                    }
+                    HdDeliveryOrderClass::payAfter($order);
 
                     $shopId = $order->shopId ?? 0;
                     $shop = ShopClass::getById($shopId, true);

+ 1 - 1
app-mall/controllers/UserController.php

@@ -76,7 +76,7 @@ class UserController extends BaseController
         }
         if ($lunar == 1) {
             try {
-                //农历转阳历,有多处使用,需要同步修改,关键词change_my_birthday
+                //农历转阳历,有多处使用,需要同步修改,关键词 change_my_birthday
                 $calendar = new Calendar();
                 $result = $calendar->lunar(date("Y"), $birthdayMonth, $birthdayDate);
                 $month = $result['gregorian_month'] ?? 1;

+ 1 - 1
app-pt/controllers/WxController.php

@@ -180,7 +180,7 @@ class WxController extends PublicController
                         noticeUtil::push('trade_manage_remind_shipping', '15280215347');
                         break;
                     case 'trade_manage_order_settlement':
-                        noticeUtil::push('trade_manage_order_settlement', '15280215347');
+                        //noticeUtil::push('trade_manage_order_settlement', '15280215347');
                         break;
                     //关注
                     case 'subscribe':

+ 3 - 3
app-pt/views/main/app.php

@@ -236,10 +236,10 @@
             }
             // 这里可以根据appType跳转到对应的下载链接
             const downloadUrls = {
-                'xiaohuabao': 'https://api.shop.hzghd.com/1277.apk', // 销花宝APP下载链接
+                'xiaohuabao': 'https://api.shop.hzghd.com/1278.apk', // 销花宝APP下载链接
                 'huazhanggui': 'https://api.shop.hzghd.com/229.apk', // 花掌柜APP下载链接
-                'huazhanggui_cashier': 'https://api.shop.hzghd.com/196.apk', // 花掌柜收银下载链接
-                'xiaohuabao_cashier': 'https://api.shop.hzghd.com/154.apk' // 销花宝收银下载链接
+                'huazhanggui_cashier': 'https://api.shop.hzghd.com/199.apk', // 花掌柜收银下载链接
+                'xiaohuabao_cashier': 'https://api.shop.hzghd.com/157.apk' // 销花宝收银下载链接
             };
             const url = downloadUrls[appType];
             if (url && url !== '#') {

+ 0 - 6
biz-ghs/cg/services/CgRefundService.php

@@ -237,11 +237,6 @@ class CgRefundService extends BaseService
         if (empty($ghs)) {
             util::fail('没有找到供货商');
         }
-        $ghsAddDebtKey = 'ghs_change_debt_' . $ghsId;
-        $lock = util::lock($ghsAddDebtKey);
-        if (!$lock) {
-            util::fail("系统繁忙,请重试");
-        }
         $ghs->debtAmount = bcsub($ghs->debtAmount, $refundPrice, 2);
         $ghs->save();
 
@@ -262,7 +257,6 @@ class CgRefundService extends BaseService
             'shopId' => $shopId,
         ];
         GhsDebtRecordClass::add($debtData);
-        util::unlock($ghsAddDebtKey);
 
         return $refund;
     }

+ 25 - 18
biz-ghs/express/classes/GhsDeliveryOrderClass.php

@@ -18,15 +18,23 @@ class GhsDeliveryOrderClass extends BaseClass
 
     public static function payAfter($order)
     {
+        if (empty($order)) {
+            return false;
+        }
+        if ($order->sendType != 2) {
+            return false;
+        }
+        if ($order->payStatus != 1) {
+            return false;
+        }
         $orderId = $order->id;
         $shopId = $order->shopId;
         try {
-            noticeUtil::push('批发,付款成功之后要发跑腿的订单:' . $orderId, '15280215347');
             $cacheKey = 'ghs_pt_cacheData:' . $orderId;
             $cachedData = Yii::$app->redis->get($cacheKey);
             if (!empty($cachedData)) {
+                noticeUtil::push('批发,付款成功之后要发跑腿的订单:' . $orderId, '15280215347');
                 $cachedData = json_decode($cachedData, true);
-
                 $data = [
                     'orderId' => $orderId,
                     'shopId' => $shopId,
@@ -46,20 +54,21 @@ class GhsDeliveryOrderClass extends BaseClass
                 ];
                 self::askCreateOrder($data);
             } else {
-                noticeUtil::push("批发-缓存数据不存在或已过期,cacheKey:{$cacheKey}");
+                //noticeUtil::push("批发-缓存数据不存在或已过期,cacheKey:{$cacheKey}");
                 // 发送 app 通知
-                $title = '发跑腿失败';
-                $msg = "批发-缓存数据不存在或已过期,cacheKey:{$cacheKey}";
-                $allDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['shopId' => $shopId]);
-                $cids = array_column($allDevices, 'clientId');
-                $push = new push('ghs', push::MSG_TYPE_WORK);
-                $push->pushByCloud($cids, $title, $msg, []);
-                return;
+                // $title = '发跑腿失败';
+                // $msg = "批发-缓存数据不存在或已过期,cacheKey:{$cacheKey}";
+                // $allDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['shopId' => $shopId]);
+                // $cids = array_column($allDevices, 'clientId');
+                // $push = new push('ghs', push::MSG_TYPE_WORK);
+                // $push->pushByCloud($cids, $title, $msg, []);
+                return false;
             }
         } catch (\Exception $e) {
             $msg = $e->getMessage();
             $remind = "批发,付款成功之后要发跑腿的订单,报错 {$orderId} {$msg}";
             noticeUtil::push($remind);
+            return false;
         }
     }
 
@@ -71,19 +80,17 @@ class GhsDeliveryOrderClass extends BaseClass
             $saleId = $order->id;
 
             if ($callErrand == 1) { // 是否立即发跑腿 1:是 0:否
-                $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay'); //收款方式  0:扫码付(待付款) 1:线下(已付款) 2:赊账(欠款)3:现金 4:余额
-
-                if ($hasPay == dict::getDict('hasPay', 'unPay')) { // 0:扫码付(待付款)
+                $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay'); //收款方式  0:扫码付 1:线下(已付款) 2:赊账(欠款)3:现金 4:余额
+                if ($hasPay == dict::getDict('hasPay', 'unPay')) { // 0:扫码付
                     $deliveryPlatform = $post['deliveryPlatform'];
                     $expireTime = 0;
-                    if($deliveryPlatform == 'shansong'){
+                    if ($deliveryPlatform == 'shansong') {
                         $expireTime = 1800 - 60;
-                    }elseif($deliveryPlatform == 'didi'){
+                    } elseif ($deliveryPlatform == 'didi') {
                         $expireTime = 7200;
-                    }else{
+                    } else {
                         $expireTime = 7200; // 默认缓存时长2小时
-                    } 
-
+                    }
                     // 把跑腿数据缓存到 redis 中,等待付款成功后,再发跑腿订单
                     $cacheKey = 'ghs_pt_cacheData:' . $saleId;
                     Yii::$app->redis->set($cacheKey, json_encode($post, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));

+ 1 - 1
biz-ghs/item/classes/ItemClass.php

@@ -442,7 +442,7 @@ class ItemClass extends BaseClass
     public static function getShowList($where, $custom)
     {
         $level = $custom->level ?? 1;
-        $field = 'id,cover,name,cost,itemId,classId,property,skPrice,variety,price,hjPrice,discountPrice,skDiscountPrice,hjDiscountPrice,stock,stockWarning,presell,reachNum,reachNumDiscount,ratioType,smallRatio,smallUnit,bigUnit,ratio,hjAddPrice,addPrice';
+        $field = 'id,cover,name,cost,itemId,classId,py,property,skPrice,variety,price,hjPrice,discountPrice,skDiscountPrice,hjDiscountPrice,stock,stockWarning,presell,reachNum,reachNumDiscount,ratioType,smallRatio,smallUnit,bigUnit,ratio,hjAddPrice,addPrice';
         $list = self::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         if (empty($list)) {
             return $list;

+ 62 - 9
biz-ghs/order/classes/OrderClass.php

@@ -1482,8 +1482,9 @@ class OrderClass extends BaseClass
     {
         //58mm的机器,一行打印16个汉字,32个字母
         $productPrice = $current['price'] ?? '';
+        $unitPrice = $current['unitPrice'] ?? '';
         $name = $current['name'] ?? '';
-        if (floatval($productPrice) == 0.01) {
+        if (floatval($unitPrice) == 0.01) {
             $name = $name . '(送)';
         }
         $productNum = $current['num'] ?? '';
@@ -1505,7 +1506,11 @@ class OrderClass extends BaseClass
             $content .= '(买' . $itemNum . $unitName . ' 退' . $refundNum . $unitName . ')<BR>';
         }
         if ($showPrice == 1) {
-            $content .= $productNum . ' = ' . $productPrice . '元<BR>';
+            if (floatval($unitPrice) == 0.01) {
+                $content .= $productNum . ' = ' . $productPrice . '元 赠送价<BR>';
+            }else{
+                $content .= $productNum . ' = ' . $productPrice . '元<BR>';
+            }
         }
         $content .= '--------------------------------<BR>';
         return $content;
@@ -1893,12 +1898,12 @@ class OrderClass extends BaseClass
         }
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
 
-        $itemList = $showItem['list'] ?? [];
-        if (count($itemList) > 40) {
-            //超出数量的打印
-            self::onlinePrintOver($showItem, $orderInfo, $currentName, $shop);
-            return true;
-        }
+//        $itemList = $showItem['list'] ?? [];
+//        if (count($itemList) > 40) {
+//            //超出数量的打印
+//            self::onlinePrintOver($showItem, $orderInfo, $currentName, $shop);
+//            return true;
+//        }
 
         $fromType = $orderInfo['fromType'] ?? dict::getDict('fromType', 'shop');
         $fromTypeMap = dict::getDict('fromTypeMap');
@@ -2120,6 +2125,7 @@ class OrderClass extends BaseClass
                         'num' => floatval($bigNum) . $xhUnitName . ' * ' . floatval($bigUnitPrice) . '元',
                         'count' => floatval($bigNum) . $xhUnitName,
                         'price' => floatval($bigTotalPrice),
+                        'unitPrice'=>floatval($bigUnitPrice),
                         'refundNum' => $refundNum,
                         'unitName' => $xhUnitName,
                         'itemNum' => $bigNum,
@@ -2133,6 +2139,7 @@ class OrderClass extends BaseClass
                         'num' => floatval($smallNum) . '支 * ' . floatval($smallUnitPrice) . '元',
                         'count' => floatval($smallNum) . '支',
                         'price' => floatval($smallTotalPrice),
+                        'unitPrice'=>floatval($smallUnitPrice),
                         'refundNum' => $refundNum,
                         'unitName' => '支',
                         'itemNum' => $smallNum,
@@ -2145,6 +2152,7 @@ class OrderClass extends BaseClass
                         'num' => floatval($giveNum) . $xhUnitName . ' * 0元',
                         'count' => floatval($giveNum) . $xhUnitName,
                         'price' => 0,
+                        'unitPrice'=>0,
                         'unitName' => $xhUnitName,
                         'itemNum' => $giveNum,
                         'remark' => $remark,
@@ -2963,7 +2971,7 @@ XL;
         $shortRemark = stringUtil::subStringUtf8($remark, 8);
 
         $wlName = $custom->wlName ?? '';
-        if(empty($wlName)){
+        if (empty($wlName)) {
             $wlName = $shortRemark;
         }
 
@@ -3021,4 +3029,49 @@ XL;
         return true;
     }
 
+    // 更新同天内的所有订单的 sameTimeIds
+    public static function updateSameTimeIds($order, $date)
+    {
+        $id = $order->id ?? 0;
+        $customId = $order->customId ?? 0;
+        $mainId = $order->mainId ?? 0;
+        $oldSameTimeIds = $order->sameTimeIds ?? '';
+
+        //找到当前订单客户的账单日期为 $date 的所有订单,然后更新同天内的所有订单的 sameTimeIds(加此次要改变的订单的订单号$id)
+        $startTime = $date . ' 00:00:00';
+        $endTime = $date . ' 23:59:59';
+        $dayOrders = self::getAllByCondition([
+            'mainId' => $mainId,
+            'customId' => $customId,
+            'payTime' => ['between', [$startTime, $endTime]]
+        ], 'id ASC', 'id, sameTimeIds');
+
+        $ids = [];
+        if (!empty($dayOrders)) {
+            $ids = array_column($dayOrders, 'id');
+        }
+        // 确保当前订单ID在列表中
+        if (!in_array($id, $ids)) {
+            $ids[] = $id;
+        }
+        // 排序并去重
+        sort($ids);
+        $ids = array_unique($ids);
+        $sameTimeIdsStr = implode(',', $ids);
+        // 更新所有相关订单
+        if (!empty($ids)) {
+            self::updateByIds($ids, ['sameTimeIds' => $sameTimeIdsStr]);
+        }
+
+        //从原先同天内的订单中删除此次要改变的订单的订单号$id
+        $oldSameTimeIdsArr = explode(',', $oldSameTimeIds);
+        if (in_array($id, $oldSameTimeIdsArr)) {
+            $oldSameTimeIdsArr = array_diff($oldSameTimeIdsArr, [$id]);
+            $oldSameTimeIdsStr = implode(',', $oldSameTimeIdsArr);
+            if (!empty($oldSameTimeIdsArr)) {
+                self::updateByIds($oldSameTimeIdsArr, ['sameTimeIds' => $oldSameTimeIdsStr]);
+            }
+        }
+    }
+
 }

+ 3 - 0
biz-ghs/order/classes/OrderClearClass.php

@@ -94,6 +94,7 @@ class OrderClearClass extends BaseClass
             'modifyPrice' => $totalAmount,
             'payWay' => 0,
             'complete' => 1,
+            'remark' => '充值余额结账',
         ];
         $clearInfo = self::clear($clearData, $idText, $sjId, $shopId);
         //结账消费余额
@@ -182,6 +183,7 @@ class OrderClearClass extends BaseClass
             $deadline = date("Y-m-d H:i:s", time() + 30 * 24 * 60 * 60);
         }
         $payWay = isset($post['payWay']) && is_numeric($post['payWay']) ? $post['payWay'] : dict::getDict('payWay', 'unPay');
+        $remark = $post['remark'] ?? '';
         $clearData = [
             'prePrice' => $amount,
             'actPrice' => $modifyPrice,
@@ -212,6 +214,7 @@ class OrderClearClass extends BaseClass
             'num' => count($ids),
             'ghsShopName' => $ghsShopName,
             'hasNoticeCustom' => 0,
+            'remark' => $remark,
         ];
         if ($modifyPrice < $amount) {
             $clearData['discountAmount'] = bcsub($amount, $modifyPrice, 2);

+ 0 - 7
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -688,12 +688,6 @@ class PurchaseOrderClass extends BaseClass
         }
 
         //锁定当前增加资产的运作,有多处,请搜索关键词 ghsAddDebtAction
-        $ghsAddDebtKey = 'ghs_change_debt_' . $ghsId;
-        $lock = util::lock($ghsAddDebtKey);
-        if (!$lock) {
-            util::fail("系统繁忙,请重试");
-        }
-
         $ghs->debt = GhsClass::DEBT_YES;
         $ghs->debtAmount = bcadd($ghs->debtAmount, $currentPrice, 2);
 
@@ -719,7 +713,6 @@ class PurchaseOrderClass extends BaseClass
             'shopId' => $shopId,
         ];
         GhsDebtRecordClass::add($debtData);
-        util::unlock($ghsAddDebtKey);
 
         //采购统计
         $cgNum = $order->itemNum ?? 0;

+ 4 - 1
biz-ghs/order/services/OrderService.php

@@ -302,8 +302,11 @@ class OrderService extends BaseService
                 $purchase->save();
                 $returnOrder->payTime = $currentPayTime;
                 $returnOrder->save();
-                //有修改账单日期需要更新到欠款变动明细,财务好对账,多个地方要同步修改,关键词to_change_custom_debt_pay_time
+                //有修改账单日期需要更新到欠款变动明细,财务好对账,多个地方要同步修改,关键词 to_change_custom_debt_pay_time
                 CustomDebtChangeClass::updateByCondition(['capitalType' => 10, 'relateId' => $returnOrder->id], ['payTime' => $currentPayTime]);
+
+                //找到当前订单客户的账单日期为 $date 的所有订单,然后更新同天内的所有订单的 sameTimeIds(加此次要改变的订单的订单号$id),有多处调用,关键词 update_same_ids
+                OrderClass::updateSameTimeIds($returnOrder, $historyDate);
             }
 
             //不是预订单,并且供货商不是源花汇、小明鲜花、淄博花超、云漫梦金鹏、海翔,则订单直接完成掉。是预订单,则确认发货时直接完成掉。有多个地方要修改,请搜索关键词zjFinish

+ 1 - 0
biz-ghs/product/classes/ProductClass.php

@@ -1480,6 +1480,7 @@ class ProductClass extends BaseClass
             $tmp['itemId'] = $itemId;
             $tmp['rank'] = $currentGhsProduct['rank'] ?? '';
             $tmp['ratio'] = $currentGhsProduct['ratio'] ?? 1;
+            $tmp['ratioType'] = $currentGhsProduct['ratioType'] ?? 0;
             $tmp['variety'] = $currentGhsProduct['variety'] ?? 0;
             $tmp['unitPrice'] = $thisPrice;
             $tmp['unitWeight'] = $currentGhsProduct['weight'] ?? 0;;

+ 2 - 2
biz-ghs/stat/classes/StatKdClass.php

@@ -86,7 +86,7 @@ class StatKdClass extends BaseClass
             'debt' => [
                 'amount' => 0,
                 'num' => 0,
-                'name' => '账(未结)',
+                'name' => '账(未结)',
                 'category' => [
                     'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
                     'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
@@ -95,7 +95,7 @@ class StatKdClass extends BaseClass
             'debtClear' => [
                 'amount' => 0,
                 'num' => 0,
-                'name' => '账(已结)',
+                'name' => '账(已结)',
                 'category' => [
                     'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
                     'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],

+ 1 - 1
biz-hd/custom/classes/CustomClass.php

@@ -696,7 +696,7 @@ class CustomClass extends BaseClass
                             CustomClass::updateByCondition(['userId' => $userId], ['birthday' => $birthday]);
                         } catch (\InvalidArgumentException $e) {
                             $msg = $e->getMessage();
-                            noticeUtil::push("更新生日出错了,userId:" . $userId . ' ' . $msg, '15280215347');
+                            noticeUtil::push("同步生日出错了,需要检查确认,userId:" . $userId . ' 月份:' . $birthdayMonth . ' 日期:' . $birthdayDate . ' ' . $msg, '15280215347');
                             $birthday = '0000-00-00 00:00:00';
                         }
                     } else {

+ 20 - 13
biz-hd/express/classes/HdDeliveryOrderClass.php

@@ -17,15 +17,23 @@ class HdDeliveryOrderClass extends BaseClass
 
     public static function payAfter($order)
     {
+        if(empty($order)){
+            return false;
+        }
+        if($order->sendType != 2){
+            return false;
+        }
+        if($order->payStatus != 1){
+            return false;
+        }
         $orderId = $order->id;
         $shopId = $order->shopId;
         try {
-            noticeUtil::push('零售,付款成功之后要发跑腿的订单:' . $orderId, '15280215347');
             $cacheKey = 'hd_pt_cacheData:' . $orderId;
             $cachedData = Yii::$app->redis->get($cacheKey);
             if (!empty($cachedData)) {
+                noticeUtil::push('零售,付款成功之后要发跑腿的订单:' . $orderId, '15280215347');
                 $cachedData = json_decode($cachedData, true);
-
                 $data = [
                     'orderId' => $orderId,
                     'shopId' => $order->shopId,
@@ -43,16 +51,15 @@ class HdDeliveryOrderClass extends BaseClass
                 ];
                 self::askCreateOrder($data);
             } else {
-                noticeUtil::push("零售-缓存数据不存在或已过期,cacheKey:{$cacheKey}");
+                //noticeUtil::push("零售-缓存数据不存在或已过期,cacheKey:{$cacheKey}");
                 // 发送 app 通知
-                $title = '发跑腿失败';
-                $msg = "零售-缓存数据不存在或已过期,cacheKey:{$cacheKey}";
-                $allDevices = \bizHd\device\classes\HdDeviceClass::getAllByCondition(['shopId' => $shopId, 'status' => 1]);
-                $cids = array_column($allDevices, 'clientId');
-                $push = new push('hd', push::MSG_TYPE_WORK);
-                $push->pushByCloud($cids, $title, $msg, []);
-
-                return;
+                // $title = '发跑腿失败';
+                // $msg = "零售-缓存数据不存在或已过期,cacheKey:{$cacheKey}";
+                // $allDevices = \bizHd\device\classes\HdDeviceClass::getAllByCondition(['shopId' => $shopId, 'status' => 1]);
+                // $cids = array_column($allDevices, 'clientId');
+                // $push = new push('hd', push::MSG_TYPE_WORK);
+                // $push->pushByCloud($cids, $title, $msg, []);
+                return false;
             }
         } catch (\Exception $e) {
             $msg = $e->getMessage();
@@ -70,8 +77,8 @@ class HdDeliveryOrderClass extends BaseClass
             $callErrand = $post['callErrand']; // 是否立即发跑腿 1:是 0:否
 
             if ($callErrand == 1) {
-                $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay'); //收款方式  0:扫码付(待付款) 1:线下(已付款) 2:赊账(欠款)3:现金 4:余额
-                if ($hasPay == dict::getDict('hasPay', 'unPay')) { // 0:扫码付(待付款)
+                $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay'); //收款方式  0:扫码付 1:线下(已付款) 2:赊账(欠款)3:现金 4:余额
+                if ($hasPay == dict::getDict('hasPay', 'unPay')) { // 0:扫码付
                     $deliveryPlatform = $post['deliveryPlatform'];
                     $expireTime = 0;
                     if($deliveryPlatform == 'shansong'){

+ 1 - 1
biz-hd/item/classes/ItemClass.php

@@ -507,7 +507,7 @@ class ItemClass extends BaseClass
     public static function getShowList($where)
     {
         $level = 0;
-        $field = 'id,cover,name,cost,itemId,classId,property,skPrice,skMore,addPrice,variety,price,discountPrice,skDiscountPrice,stock,stockWarning,presell,ratioType,smallRatio,smallUnit,bigUnit,ratio';
+        $field = 'id,cover,name,cost,itemId,classId,property,py,skPrice,skMore,addPrice,variety,price,discountPrice,skDiscountPrice,stock,stockWarning,presell,ratioType,smallRatio,smallUnit,bigUnit,ratio';
         $list = self::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         if (empty($list)) {
             return $list;

+ 2 - 0
biz-hd/purchase/classes/PurchaseClass.php

@@ -815,6 +815,7 @@ class PurchaseClass extends BaseClass
             $unitWeight = $hdProductData[$hdProductId]['weight'] ?? 0;
             $variety = $hdProductData[$hdProductId]['variety'] ?? 0;
             $ratio = $hdProductData[$hdProductId]['ratio'] ?? 0;
+            $ratioType = $hdProductData[$hdProductId]['ratioType'] ?? 0;
             $itemId = $hdProductData[$hdProductId]['itemId'] ?? 0;
             $rank = $hdProductData[$hdProductId]['rank'] ?? 'B';
             $stock = $hdProductData[$hdProductId]['stock'] ?? 0;
@@ -896,6 +897,7 @@ class PurchaseClass extends BaseClass
             $productList[$key]['smallNum'] = $product['smallNum'] ?? 0;
             $productList[$key]['price'] = $thisPrice;
             $productList[$key]['ratio'] = $ratio;
+            $productList[$key]['ratioType'] = $ratioType;
             $productList[$key]['unitWeight'] = $unitWeight;
             $productList[$key]['totalPrice'] = $productTotalPrice;
             $productList[$key]['preTotalPrice'] = $productTotalPrice;

+ 16 - 1
biz-hd/staff/classes/StaffClass.php

@@ -190,10 +190,25 @@ class StaffClass extends BaseClass
                 }
             }
             if (count($staffList) > 1) {
-                util::fail('账号异常,请联系管理员56988');
+                util::fail('账号异常,请联系管理员,异常编号56988');
             }
             $hasShop = 1;
         }
+
+        //把 xhHdDevice 与 xhGhsDevice 表下的数据更新为退出(删除)
+        $ghsDevices = \bizGhs\device\classes\GhsDeviceClass::getAllByCondition(['adminId'=>$admin->id, 'mainId'=>$staff->mainId], null, 'id,status,clientId', null, true);
+        foreach ($ghsDevices as $ghsDevice) {
+            $ghsDevice->status = 0;
+            $ghsDevice->clientId = $ghsDevice->clientId . '_delete_' . date('Y-m-d H:i:s');
+            $ghsDevice->save();
+        }
+        $hdDevices = \bizHd\device\classes\HdDeviceClass::getAllByCondition(['adminId'=>$admin->id, 'mainId'=>$staff->mainId], null, 'id,status,clientId',null, true);
+        foreach ($hdDevices as $hdDevice) {
+            $hdDevice->status = 0;
+            $hdDevice->clientId = $hdDevice->clientId . '_delete_' . date('Y-m-d H:i:s');
+            $hdDevice->save();
+        }
+
         return ['hasShop' => $hasShop];
     }
 }

+ 1 - 1
common/components/book.php

@@ -100,7 +100,7 @@ class book
             ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国200家鲜花批发店和11万家花店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
             ['style' => 'miniTitle', 'value' => '软件的研发成本巨大,不管是年费、费率和套餐,都已经底价,已无商谈的空间,请理解。付费后不支持退货。',],
             ['style' => 'miniTitle', 'value' => '以下硬件请通过我们来购买,公司统一跟厂家采购,售后各方面比较有保障。自行采购的,使用和售后有问题的,需自行解决。',],
-            ['style' => 'info', 'value' => '小票机和标签机,使用的是飞鹅4G带切刀版本,比较好维护,里面带电话卡的,第二年开始,每年要充60块话费。请不要贪便宜使用wifi版,公司将拒绝提供技术支持,因为很容易出问题,维护成本很高。',],
+            ['style' => 'info', 'value' => '小票机和标签机,使用的是飞鹅4G带切刀版本,比较好维护,里面带流量卡的,第二年开始,每年要充60块话费。请不要贪便宜使用wifi版,公司将拒绝提供技术支持,因为很容易出问题,维护成本很高。',],
             ['style' => 'info', 'value' => '提供上门培训服务,培训时间3天,需报销差旅住宿费用,公司地址在福建厦门。',],
             ['style' => 'smallTitle', 'value' => '仓库版',],
             ['style' => 'info', 'value' => '整套软件功能(一年)',],

+ 8 - 1
common/components/delivery/util/DeliveryQuoteUtil.php

@@ -84,8 +84,11 @@ class DeliveryQuoteUtil
 
         // 10. 获取报价结果
         $result = null;
-        if (in_array($params['deliveryPlatform'], ['huolala', 'fengniao'])) {
+        if (in_array($params['deliveryPlatform'], ['huolala', 'fengniao', 'didi'])) {
             $bracketContent = $params['deliveryBracketContent'] ?? '';
+            if ($params['deliveryPlatform'] == 'didi') {
+                $bracketContent = "滴滴 ({$bracketContent})";
+            }
             $key = '';
             foreach ($deliveryList as $item) {
                 if ($params['deliveryPlatform'] == 'huolala') {
@@ -94,6 +97,10 @@ class DeliveryQuoteUtil
                 if ($params['deliveryPlatform'] == 'fengniao') {
                     $key = 'base_goods_id';
                 }
+                if ($params['deliveryPlatform'] == 'didi') {
+                    $key = 'name';
+                }
+
                 if ($item[$key] == $bracketContent) {
                     $result = $item;
                 }

+ 1 - 0
common/components/push.php

@@ -258,6 +258,7 @@ class push
             'content' => $content,
             'payload' => $payload,
             'force_notification' => true, // true: 无论是离线推送还是在线推送,都自创建通知栏消息
+            // 'force_notification' => false, // false: 客户端在线时不自动创建通知栏消息,需客户端自行处理(如弹窗或存入消息中心);离线时尝试厂商通道通知
             'sign' => $sign,
             'options' => $optionsArr
         ];

+ 2 - 1
common/components/rabbitmq/notifyConsumer.php

@@ -57,7 +57,6 @@ class notifyConsumer implements ConsumerInterface
                     //供货商跑腿异常通知
                     $result = $this->ghsPtErrorAction($data);
                     break;
-                    break;
                 case 'hd_pt_error':
                     //花店跑腿异常通知
                     $result = $this->hdPtErrorAction($data);
@@ -162,6 +161,8 @@ class notifyConsumer implements ConsumerInterface
         ];
         $push = new push('hd', push::MSG_TYPE_ORDER);
         $push->pushByCloud($cids, $title, $content, $payload);
+        //$str = implode(',', $cids);
+        //noticeUtil::push("需要通知:" . $content . ' ' . $str, '15280215347');
         return true;
     }
 

+ 2 - 1
common/components/sms.php

@@ -83,7 +83,8 @@ class sms
         if (empty($open)) {
             util::fail('没有找到平台');
         }
-        $name = isset($open['name']) ? $open['name'] : '花卉宝';
+        //$name = isset($open['name']) ? $open['name'] : '花卉宝';
+        $name = '花掌柜';
         $sign = isset($merchant) == true ? "【{$merchant['name']}】" : "【{$name}】";
         $msg = $sign . $msg;
 

+ 124 - 0
console/controllers/TestController.php

@@ -8,6 +8,8 @@ use biz\item\classes\PtItemClass;
 use biz\main\classes\MainClass;
 use biz\shop\classes\ShopClass;
 use biz\sj\classes\SjClass;
+use bizGhs\admin\classes\AdminClass;
+use bizGhs\apply\classes\ApplyClass;
 use bizGhs\cg\classes\CgOrderClass;
 use bizGhs\cg\models\CgOrder;
 use bizGhs\clear\classes\ClearClass;
@@ -18,11 +20,15 @@ use bizGhs\order\classes\OrderItemClass;
 use bizGhs\order\classes\PurchaseOrderItemClass;
 use bizGhs\order\models\Order;
 use bizGhs\product\classes\ProductClass;
+use bizHd\common\classes\MobileSnClass;
 use bizHd\custom\classes\CustomClass;
 use bizHd\ghs\classes\GhsClass;
 use bizHd\order\classes\OrderClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\models\Purchase;
+use bizHd\saas\classes\StaffClass;
+use bizHd\user\classes\UserClass;
+use bizMall\hd\classes\HdClass;
 use common\components\stringUtil;
 use common\components\util;
 use mysql_xdevapi\ExecutionStatus;
@@ -32,6 +38,124 @@ use yii\console\Controller;
 class TestController extends Controller
 {
 
+    public function actionCustomBuyAmount()
+    {
+        ini_set('memory_limit', '2045M');
+        set_time_limit(0);
+        $mainId = 45354;
+        $customList = \bizGhs\custom\classes\CustomClass::getAllByCondition(['ownMainId' => $mainId], null, '*', null, true);
+        if (!empty($customList)) {
+            foreach ($customList as $custom) {
+                $customId = $custom->id ?? 0;
+                $ghsId = $custom->ghsId ?? 0;
+                $ghs = \biz\ghs\classes\GhsClass::getById($ghsId, true);
+                if (empty($ghs)) {
+                    continue;
+                }
+                $orderList = \bizGhs\order\classes\OrderClass::getAllByCondition(['customId' => $customId], null, 'id, actPrice');
+                $buyAmount = 0;
+                if (!empty($orderList)) {
+                    foreach ($orderList as $order) {
+                        $buyAmount = bcadd($buyAmount, $order['actPrice'], 2);
+                    }
+                }
+                $custom->buyAmount = $buyAmount;
+                $custom->save();
+                $ghs->expendAmount = $buyAmount;
+                $ghs->save();
+            }
+        }
+    }
+
+    public function actionShop()
+    {
+        $sql = "select id,shopName,`merchantName` ,ptStyle,mobile from xhShop where ptstyle = 4 and mobile not like '10000%'";
+        $command = Yii::$app->db->createCommand($sql);
+        $data = $command->queryAll();
+        if (empty($data)) {
+            return false;
+        }
+        foreach ($data as $shop) {
+            $mobile = $shop['mobile'];
+            $connection = Yii::$app->db;
+            $transaction = $connection->beginTransaction();
+            try {
+                $respond = MobileSnClass::add(['id' => null], true);
+                $newMobile = $respond->id;
+
+                $staffList = StaffClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($staffList)) {
+                    foreach ($staffList as $staff) {
+                        $staff->mobile = $newMobile;
+                        $staff->save();
+                    }
+                }
+                $apply = ApplyClass::getByCondition(['mobile' => $mobile], true);
+                if (!empty($apply)) {
+                    $apply->mobile = $newMobile;
+                    $apply->save();
+                }
+                $shopList = ShopClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($shopList)) {
+                    foreach ($shopList as $shop) {
+                        $shop->mobile = $newMobile;
+                        $shop->telephone = $newMobile;
+                        $shop->save();
+                    }
+                }
+                $ghsCustomList = \bizGhs\custom\classes\CustomClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($ghsCustomList)) {
+                    foreach ($ghsCustomList as $custom) {
+                        $custom->mobile = $newMobile;
+                        $custom->save();
+                    }
+                }
+                $ghsList = GhsClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($ghsList)) {
+                    foreach ($ghsList as $ghs) {
+                        $ghs->mobile = $newMobile;
+                        $ghs->save();
+                    }
+                }
+                $hdList = HdClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($hdList)) {
+                    foreach ($hdList as $hd) {
+                        $hd->mobile = $newMobile;
+                        $hd->save();
+                    }
+                }
+                $customList = CustomClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($customList)) {
+                    foreach ($customList as $custom) {
+                        $custom->mobile = $newMobile;
+                        $custom->save();
+                    }
+                }
+                $userList = UserClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($userList)) {
+                    foreach ($userList as $user) {
+                        $user->mobile = $newMobile;
+                        $user->save();
+                    }
+                }
+                $adminList = AdminClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($adminList)) {
+                    foreach ($adminList as $admin) {
+                        $admin->mobile = $newMobile;
+                        $admin->save();
+                    }
+                }
+
+                $transaction->commit();
+                echo $mobile . ' ' . $newMobile . "\n";
+            } catch (\Exception $e) {
+                $transaction->rollBack();
+                $msg = $e->getMessage();
+                echo $msg . "\n";
+            }
+        }
+    }
+
     public function actionCustom()
     {
         ini_set('memory_limit', '2045M');