Parcourir la source

Merge branch 'master' of git.huaml.com:zhh/huahuibao

shizhongqi il y a 3 mois
Parent
commit
250d5499fb

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

@@ -174,7 +174,7 @@ class ConsoleController extends BaseController
 
         //$notice[] = ['title' => '急事请连续打二次电话 15280215347。', 'action' => '', 'page' => ''];
         //$notice[] = ['title' => '新功能:客户端和后台使用跑腿的流程', 'action' => '', 'page' => '/admin/book/detail?id=use_pt'];
-        $notice[] = ['title' => '限购功能升级了更好用,请看视频', 'action' => '查看', 'page' => '/admin/book/detail?id=limitBuy'];
+        //$notice[] = ['title' => '新上超级计算器功能,请看视频', 'action' => '查看', 'page' => '/admin/book/detail?id=calc'];
         //$notice[] = ['title' => '过二天,收银机点花材名字可增加数量。', 'action' => '查看', 'page' => '/admin/book/detail?id=limitBuy'];
 
         $mainId = $this->mainId;
@@ -210,7 +210,7 @@ class ConsoleController extends BaseController
             ["name" => "采购", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],
             ["name" => "采购记录", "img" => "ghs/home/icon_caigou.png", "url" => "/pagesPurchase/order"],
             ["name" => "调拨入库", "img" => "ghs/home/dbrk.png", "url" => "/pagesStorehouse/allot/allotPut"],
-            ["name" => "库存总览", "img" => "ghs/home/kcyjs.png", "url" => "/admin/stat/stock"],
+            ["name" => "计算器", "img" => "ghs/home/kcyjs.png", "url" => "/admin/tools/calculator"],
             ["name" => "进货", "img" => "ghs/home/icon_buy_item.png", "url" => "buyGhs"],
             ["name" => "进货记录", "img" => "ghs/home/icon_buy_record.png", "url" => "buyRecord", 'remindNum' => 0],
             ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
@@ -231,7 +231,7 @@ class ConsoleController extends BaseController
                 ["name" => "采购", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],
                 ["name" => "采购记录", "img" => "ghs/home/icon_caigou.png", "url" => "/pagesPurchase/order"],
                 ["name" => "调拨入库", "img" => "ghs/home/dbrk.png", "url" => "/pagesStorehouse/allot/allotPut"],
-                ["name" => "库存总览", "img" => "ghs/home/kcyjs.png", "url" => "/admin/stat/stock"],
+                ["name" => "计算器", "img" => "ghs/home/kcyjs.png", "url" => "/admin/tools/calculator"],
                 ["name" => "进货", "img" => "ghs/home/icon_buy_item.png", "url" => "buyGhs"],
                 ["name" => "进货记录", "img" => "ghs/home/icon_buy_record.png", "url" => "buyRecord", 'remindNum' => 0],
                 ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],

+ 25 - 4
app-ghs/controllers/OrderController.php

@@ -1064,8 +1064,8 @@ class OrderController extends BaseController
 
         //解决开单提交订单时,别人修改价格,造成提交价格不是真实卖价问题!!
         $dealPrice = $post['dealPrice'] ?? 0;
-        //解决重复提交问题
-        util::checkRepeatCommit($this->adminId . '_' . $dealPrice, 3);
+        //解决重复提交:同店铺 + 同操作人 + 同客户 + 同成交价,短时间内只允许一次(防连点 / 双请求)
+        util::checkRepeatCommit($shopId . '_' . $this->adminId . '_' . $customId . '_' . $dealPrice, 3);
 
         CustomClass::valid($custom, $this->shopId);
         if (!empty($custom['mainId']) && $custom['mainId'] == $custom['ownMainId']) {
@@ -1268,9 +1268,30 @@ class OrderController extends BaseController
 
         $productJson = $post['product'] ?? '';
         if (empty($productJson)) {
-            util::fail('请选择花材');
+            //直接收款
+            $zjGathering = $post['zjGathering'] ?? 0;
+            if ($zjGathering == 1) {
+                $gatheringPrice = $post['gatheringPrice'] ?? 0;
+                if (!is_numeric($gatheringPrice) || $gatheringPrice <= 0) {
+                    util::fail('请填写价格');
+                }
+                //直接收款不需要打印小票
+                $post['needPrint'] = 2;
+                $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+                $zjGatheringItem = !empty($ext) ? $ext->zjGatheringItem : 0;
+                if (empty($zjGatheringItem)) {
+                    util::fail('请设置收款的商品');
+                }
+                $zjGatheringItemInfo = ProductClass::getById($zjGatheringItem, true);
+                if (empty($zjGatheringItemInfo)) {
+                    util::fail('请设置收款的商品呢');
+                }
+                $zjPtItemId = $zjGatheringItemInfo->itemId ?? 0;
+                $productList = [['productId' => $zjGatheringItem, 'itemId' => $zjPtItemId, 'bigNum' => 1, 'smallNum' => 0, 'classId' => 0, 'price' => $gatheringPrice]];
+            }
+        } else {
+            $productList = json_decode($productJson, true);
         }
-        $productList = json_decode($productJson, true);
         if (empty($productList)) {
             util::fail('请选择花材');
         }

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

@@ -493,7 +493,7 @@ class TestController extends BaseController
             //['name' => '梅州紫荆鲜花批发', 'merchantNo' => '82259605992002Q', 'wx' => [888071609, 888012368], 'zfb' => '2088580120134569'],
             //['name' => '阜阳润泽鲜花店', 'merchantNo' => '82237205992005M', 'wx' => [889493754, 889491770], 'zfb' => '2088580468011555'],
             //['name' => '惠达', 'merchantNo' => '8225810599201RH', 'wx' => [889521902, 889520798], 'zfb' => '2088580471883271'],
-            ['name' => '广州花粉工坊', 'merchantNo' => '8225810599201RW', 'wx' => [891678659, 891678191], 'zfb' => '2088580767091852'],
+            ['name' => '广州花粉工坊', 'merchantNo' => '8225810599201RY', 'wx' => [892145716, 892145723], 'zfb' => '2088580818465548'],
             //['name' => '东莞惠雅鲜花(莞城店)', 'merchantNo' => '8226020599200GJ', 'wx' => [796953190, 796976959], 'zfb' => '2088770940104912'],
             //['name' => '东莞惠雅鲜花(南城店)', 'merchantNo' => '8226020599200JK', 'wx' => [802315656, 802315755], 'zfb' => '2088870583889365'],
             //['name' => '沈阳市云花鲜花批发-专业化扫码', 'merchantNo' => '8222210599200BT', 'wx' => [796180053], 'zfb' => '2088770820458908'],
@@ -1006,7 +1006,7 @@ class TestController extends BaseController
     //交易查询 ssh 20231021
     public function actionTradeQuery()
     {
-        $shopId = 15289;
+        $shopId = 42562;
         $shop = ShopClass::getById($shopId, true);
         if (empty($shop)) {
             util::stop('没有找到门店,编号677230');
@@ -1022,7 +1022,7 @@ class TestController extends BaseController
             'lklCertificatePath' => $lklCertificatePath,
         ];
         $laResource = new Lakala($params);
-        $orderSn = 'CG30760064';
+        $orderSn = 'CG30971394';
         $tradeNo = '66223936904050';
         $queryParams = [
             'orderSn' => $orderSn,

+ 3 - 3
app-hd/controllers/GhsController.php

@@ -472,12 +472,12 @@ class GhsController extends BaseController
         $city = $shop->city ?? '';
         $address = $shop->address ?? '';
 
-        noticeUtil::push("有新花店上来 {$this->shopId} {$toLat} {$toLnt} {$locationType} {$city}{$address}", '15280215347');
+        //noticeUtil::push("有新花店上来 {$this->shopId} {$toLat} {$toLnt} {$locationType} {$city}{$address}", '15280215347');
 
         // 找出附近批发店,之后自动给建立关系,然后补充二个店之间的距离
-        GhsClass::buildNearbyGhsRelations($this->shop['id'], $this->shop->pfShopId, $toLat, $toLnt);
+        //GhsClass::buildNearbyGhsRelations($this->shop['id'], $this->shop->pfShopId, $toLat, $toLnt);
 
-        noticeUtil::push("花店 {$name} {$mobile} 新注册,已推荐批发店", '15280215347');
+        //noticeUtil::push("花店 {$name} {$mobile} 新注册,已推荐批发店", '15280215347');
 
         util::complete();
     }

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

@@ -235,8 +235,8 @@
             }
             // 这里可以根据appType跳转到对应的下载链接
             const downloadUrls = {
-                'xiaohuabao': 'https://api.shop.hzghd.com/1288.apk', // 销花宝APP下载链接
-                'huazhanggui': 'https://api.shop.hzghd.com/236.apk', // 花掌柜APP下载链接
+                'xiaohuabao': 'https://api.shop.hzghd.com/1289.apk', // 销花宝APP下载链接
+                'huazhanggui': 'https://api.shop.hzghd.com/237.apk', // 花掌柜APP下载链接
                 'huazhanggui_cashier': 'https://api.shop.hzghd.com/200.apk', // 花掌柜收银下载链接
                 'xiaohuabao_cashier': 'https://api.shop.hzghd.com/159.apk' // 销花宝收银下载链接
             };

+ 3 - 3
biz-ghs/order/classes/CheckOrderClass.php

@@ -429,9 +429,9 @@ class CheckOrderClass extends BaseClass
                         $subAmount = bcadd($subAmount, $amount, 2);
                     }
 
-                    //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到66820,多处要同步修改,关键词 auto_add_stock
-                    if ($productData->virtualStock == 1 && $v['itemNum'] < 900) {
-                        ProductClass::updateStockById($productId, 66820, $adminId);
+                    //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到98520,多处要同步修改,关键词 auto_add_stock
+                    if ($productData->virtualStock == 1 && $v['itemNum'] < 9900) {
+                        ProductClass::updateStockById($productId, 98520, $adminId);
                     }
 
                 }

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

@@ -409,6 +409,19 @@ class PurchaseOrderClass extends BaseClass
         }
         $kindNum = $orderInfo->kind ?? 0;
         $bigNum = $orderInfo->itemNum ? floatval($orderInfo->itemNum) : 0;
+        if (!empty($itemList)) {
+            $kindNum = 0;
+            $bigNum = 0;
+            foreach ($itemList as $row) {
+                $itemNumRow = floatval($row['itemNum'] ?? 0);
+                $refundNumRow = floatval($row['refundNum'] ?? 0);
+                $netNum = max(0, $itemNumRow - $refundNumRow);
+                if ($netNum > 0) {
+                    $kindNum++;
+                    $bigNum += $netNum;
+                }
+            }
+        }
         $content .= '<BR>********************************<BR>';
         $content .= "<CB>共{$kindNum}种";
         $content .= " 数量:";

+ 19 - 15
biz-ghs/product/classes/ProductClass.php

@@ -38,7 +38,7 @@ class ProductClass extends BaseClass
     use OrderTrait;
 
     public static $baseFile = '\bizGhs\product\models\Product';
-    
+
     const PRICE_LABEL_AUTO = 1; //自动调价
     const PRICE_LABEL_CHANGE = 2; //改价
     const LOCK_STOCK = 'lock_stock';//修改库存锁
@@ -1119,9 +1119,9 @@ class ProductClass extends BaseClass
             self::updateActualSoldById($productId, $newActualSold);
         }
 
-        //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到66820,多处要同步修改,关键词 auto_add_stock
-        if ($productData->virtualStock == 1 && $newStock < 900) {
-            self::updateStockById($productId, 66820);
+        //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到98520,多处要同步修改,关键词 auto_add_stock
+        if ($productData->virtualStock == 1 && $newStock < 9900) {
+            self::updateStockById($productId, 98520);
         }
 
         //库存=0 下架商品,特价去掉,限购去掉 lqh 2021.7.9 ssh 20251106 花材满减去掉 20260318
@@ -1345,6 +1345,10 @@ class ProductClass extends BaseClass
     public static function updateStockById($id, $stock, $adminId = 0)
     {
         $data['stock'] = $stock;
+        //如果有库存需要保持上架状态
+        if ($stock > 0) {
+            $data['status'] = 1;
+        }
         if ($adminId) {
             $data['adminId'] = $adminId;
         }
@@ -1554,7 +1558,7 @@ class ProductClass extends BaseClass
             $tmp['limitBuy'] = $currentGhsProduct['limitBuy'];
             $tmp['smallUnitPrice'] = $itemPrice;
             $tmp['classId'] = $classId;
-			$tmp['kind'] = $currentGhsProduct['kind'] ?? 0;
+            $tmp['kind'] = $currentGhsProduct['kind'] ?? 0;
             $tmp['belongCost'] = $currentGhsProduct['belongCost'] ?? 0;
             $tmp['hjDiscountPrice'] = $currentGhsProduct['hjDiscountPrice'];
             $tmp['discountPrice'] = $currentGhsProduct['discountPrice'];
@@ -1990,7 +1994,7 @@ class ProductClass extends BaseClass
                 }
             }
         }
-        
+
         //不影响其它直营店花材的上下架
         unset($upData['status']);
 
@@ -2779,13 +2783,13 @@ class ProductClass extends BaseClass
                 ]),
             ]);
             Yii::info('限购延迟消息已发送: ' . json_encode([
-                'type' => 'limit_buy_clear',
-                'ptType' => 'ghs',
-                'productId' => intval($productId),
-                'clearAt' => intval($clearAt),
-                'delayMs' => intval($seconds * 1000),
-                'recurring' => $recurring ? 1 : 0,
-            ], JSON_UNESCAPED_UNICODE), __METHOD__);
+                    'type' => 'limit_buy_clear',
+                    'ptType' => 'ghs',
+                    'productId' => intval($productId),
+                    'clearAt' => intval($clearAt),
+                    'delayMs' => intval($seconds * 1000),
+                    'recurring' => $recurring ? 1 : 0,
+                ], JSON_UNESCAPED_UNICODE), __METHOD__);
         } else {
             Yii::$app->redis->executeCommand('DEL', [$clearMarkKey]);
             Yii::$app->redis->executeCommand('DEL', [$clearLoopKey]);
@@ -3113,7 +3117,7 @@ class ProductClass extends BaseClass
                     return;
                 }
 
-                util::error(-1, '累计已超出限购数', ['productId'=>$productId, 'limitBuy'=>$limitBuy, 'exceed'=>$lastNum - $limitBuy]);
+                util::error(-1, '累计已超出限购数', ['productId' => $productId, 'limitBuy' => $limitBuy, 'exceed' => $lastNum - $limitBuy]);
             }
             Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $lastNum]);
         } else {
@@ -3125,7 +3129,7 @@ class ProductClass extends BaseClass
                     return;
                 }
 
-                util::error(-1, '超出限购数', ['productId'=>$productId, 'limitBuy'=>$limitBuy, 'exceed'=>$num - $limitBuy]);
+                util::error(-1, '超出限购数', ['productId' => $productId, 'limitBuy' => $limitBuy, 'exceed' => $num - $limitBuy]);
             }
             Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $num]);
         }

+ 8 - 8
biz-hd/express/classes/HdDeliveryOrderClass.php

@@ -17,13 +17,13 @@ class HdDeliveryOrderClass extends BaseClass
 
     public static function payAfter($order)
     {
-        if(empty($order)){
+        if (empty($order)) {
             return false;
         }
-        if($order->sendType != 2){
+        if ($order->sendType != 2) {
             return false;
         }
-        if($order->payStatus != 1){
+        if ($order->payStatus != 1) {
             return false;
         }
         $orderId = $order->id;
@@ -74,18 +74,18 @@ class HdDeliveryOrderClass extends BaseClass
         try {
             //跑腿订单生产者创建订单
             $orderId = $order->id ?? 0;
-            $callErrand = $post['callErrand']; // 是否立即发跑腿 1:是 0:否
+            $callErrand = $post['callErrand'] ?? 0; // 是否立即发跑腿 1:是 0:否
 
             if ($callErrand == 1) {
                 $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小时
                     }
                     $cacheKey = 'hd_pt_cacheData:' . $orderId;
@@ -261,7 +261,7 @@ class HdDeliveryOrderClass extends BaseClass
             $shopId = $data['shopId'];
             // 发 App 通知
             self::sendAppNotice($shopId, $orderId, "订单号:{$orderId},原因:" . $e->getMessage());
-            
+
             return ConsumerInterface::MSG_REJECT;
         }
     }

+ 4 - 0
common/components/book.php

@@ -63,10 +63,14 @@ class book
             ['title' => '微信和支付宝开户认证', 'id' => 'upgrade'],
             ['title' => '换卡和新开收款账户收费标准', 'id' => 'changeCard'],
             ['title' => '公司地址', 'id' => 'aboutUs'],
+            ['title' => '超级计算器', 'id' => 'calc'],
         ]],
     ];
 
     public static $data = [
+        'calc'=>[
+            ['style' => 'video', 'value' => 'jc/calc.mp4'],
+        ],
         'distStat' => [
             ['style' => 'smallTitle', 'value' => '设置片区,按片区统计利润',],
             ['style' => 'video', 'value' => 'jc/customDist.mp4'],