瀏覽代碼

Merge branch 'master' into dev

shish 2 月之前
父節點
當前提交
3d5dfc2568

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

@@ -54,7 +54,7 @@ class ConsoleController extends BaseController
             ['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/home/member', 'value' => $balance, 'type' => 4],
+            ['name' => "客户余额", "url" => '/admin/home/member', 'value' => $balance, 'type' => 4],
             ['name' => "总访客", "url" => '/admin/home/member', 'value' => 0, 'type' => 4],
             ['name' => "总订单", "url" => '/admin/home/order', 'value' => 0, 'type' => 4],
         ];

+ 66 - 1
app-ghs/controllers/ItemController.php

@@ -1,7 +1,15 @@
 <?php
+/**
+ * 供货商端花材管理控制器
+ * 主要用途:供货商(批发商)后台管理花材,例如:获取花材列表、修改或清除花材展示备注说明、隐藏/显示花材等。
+ * 使用角色:供货商管理员。
+ * 解决问题:在总店修改或清除花材备注说明时,不管分店是直营还是加盟,均同步更新花材备注。
+ */
 
 namespace ghs\controllers;
 
+use bizGhs\merchant\classes\ShopClass;
+
 use biz\item\classes\PtItemClass;
 use biz\item\classes\UnitClass;
 use biz\shop\classes\ShopExtClass;
@@ -736,7 +744,13 @@ class ItemController extends BaseController
     }
 
 
-    //花材展示备注 ssh 20260527
+    /**
+     * 修改花材展示备注说明 (供货商端)
+     * 职责:更新指定供货商花材的备注内容。如果当前店铺是总店,则需将修改同步到该商户下的所有分店(不论直营还是加盟店)。
+     * 入参:id (花材ID,来自 GET 传参), itemRemark (备注内容,来自 GET 传参)
+     * 返回:保存成功提示(JSON 格式)
+     * 副作用:会更新该供货商下所有分店对应花材的备注说明。
+     */
     public function actionUpdateItemRemark()
     {
         $get = Yii::$app->request->get();
@@ -757,9 +771,38 @@ class ItemController extends BaseController
         }
         $info->itemRemark = $itemRemark;
         $info->save();
+
+        // 复杂分支:若当前店铺是总店(default = 1),不管分店是直营还是加盟,都需要将修改后的花材备注同步至旗下所有分店,保证全渠道花材备注的一致性
+        $shop = $this->shop;
+        if (isset($shop->default) && $shop->default == 1) {
+            $sjId = $shop->sjId ?? 0;
+            $ptItemId = $info->itemId ?? 0;
+            $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
+            foreach ($chainShopList as $chainShop) {
+                $chainShopId = $chainShop->id ?? 0;
+                if ($chainShopId == $shop->id) {
+                    continue;
+                }
+                $chainMainId = $chainShop->mainId ?? 0;
+                $chainProduct = ItemClass::getByCondition(['mainId' => $chainMainId, 'itemId' => $ptItemId], true);
+                if (empty($chainProduct)) {
+                    continue;
+                }
+                $chainProduct->itemRemark = $itemRemark;
+                $chainProduct->save();
+            }
+        }
+
         util::complete('保存成功');
     }
 
+    /**
+     * 清除花材展示备注说明 (供货商端)
+     * 职责:清空指定供货商花材的备注内容。如果当前店铺是总店,则需同步清除商户下的所有分店(不论直营还是加盟店)对应花材的备注内容。
+     * 入参:id (花材ID,来自 GET 传参)
+     * 返回:清除成功提示(JSON 格式)
+     * 副作用:会清空该供货商下所有分店对应花材的备注说明。
+     */
     public function actionClearItemRemark()
     {
         $get = Yii::$app->request->get();
@@ -773,6 +816,28 @@ class ItemController extends BaseController
         }
         $info->itemRemark = '';
         $info->save();
+
+        // 复杂分支:若当前店铺是总店(default = 1),不管分店是直营还是加盟,都需要同步清空其花材备注说明,确保全渠道数据同步与统一
+        $shop = $this->shop;
+        if (isset($shop->default) && $shop->default == 1) {
+            $sjId = $shop->sjId ?? 0;
+            $ptItemId = $info->itemId ?? 0;
+            $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
+            foreach ($chainShopList as $chainShop) {
+                $chainShopId = $chainShop->id ?? 0;
+                if ($chainShopId == $shop->id) {
+                    continue;
+                }
+                $chainMainId = $chainShop->mainId ?? 0;
+                $chainProduct = ItemClass::getByCondition(['mainId' => $chainMainId, 'itemId' => $ptItemId], true);
+                if (empty($chainProduct)) {
+                    continue;
+                }
+                $chainProduct->itemRemark = '';
+                $chainProduct->save();
+            }
+        }
+
         util::complete('清除成功');
     }
 

+ 66 - 1
app-hd/controllers/ItemController.php

@@ -1,7 +1,15 @@
 <?php
+/**
+ * 零售端花材管理控制器
+ * 主要用途:供花店后台管理花材,例如:获取花材列表、隐藏或显示花材、修改或清除花材展示备注说明、限购设置等。
+ * 使用角色:花店管理员/商户管理员。
+ * 解决问题:在总店修改或清除花材备注说明时,能跨越直营和加盟店的限制,一键同步更新到所有分店,保证全店备注信息统一。
+ */
 
 namespace hd\controllers;
 
+use bizHd\shop\classes\ShopClass;
+
 use biz\item\classes\PtItemClass;
 use bizHd\item\classes\ItemClass;
 use bizGhs\pictext\classes\PicTextGhsItemClass;
@@ -475,7 +483,13 @@ class ItemController extends BaseController
         util::success(['customList' => $customList]);
     }
 
-    //花材展示备注
+    /**
+     * 修改花材展示备注说明
+     * 职责:更新指定花材的备注内容。如果当前店铺是总店,则需将修改同步到商户下的所有分店(不论直营还是加盟店)。
+     * 入参:id (花材ID,来自 GET 传参), itemRemark (备注内容,来自 GET 传参)
+     * 返回:保存成功提示(JSON 格式)
+     * 副作用:会更新该商家下所有分店对应花材的备注说明。
+     */
     public function actionUpdateItemRemark()
     {
         $get = Yii::$app->request->get();
@@ -496,9 +510,38 @@ class ItemController extends BaseController
         }
         $info->itemRemark = $itemRemark;
         $info->save();
+
+        // 复杂分支:若当前店铺是总店(default = 1),不管分店是直营还是加盟,都需要将修改后的花材备注同步至旗下所有分店,保证全渠道花材备注的一致性
+        $shop = $this->shop;
+        if (isset($shop->default) && $shop->default == 1) {
+            $sjId = $shop->sjId ?? 0;
+            $ptItemId = $info->itemId ?? 0;
+            $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
+            foreach ($chainShopList as $chainShop) {
+                $chainShopId = $chainShop->id ?? 0;
+                if ($chainShopId == $shop->id) {
+                    continue;
+                }
+                $chainMainId = $chainShop->mainId ?? 0;
+                $chainProduct = ItemClass::getByCondition(['mainId' => $chainMainId, 'itemId' => $ptItemId], true);
+                if (empty($chainProduct)) {
+                    continue;
+                }
+                $chainProduct->itemRemark = $itemRemark;
+                $chainProduct->save();
+            }
+        }
+
         util::complete('保存成功');
     }
 
+    /**
+     * 清除花材展示备注说明
+     * 职责:清空指定花材的备注内容。如果当前店铺是总店,则需同步清除商户下的所有分店(不论直营还是加盟店)对应花材的备注内容。
+     * 入参:id (花材ID,来自 GET 传参)
+     * 返回:清除成功提示(JSON 格式)
+     * 副作用:会清空该商家下所有分店对应花材的备注说明。
+     */
     public function actionClearItemRemark()
     {
         $get = Yii::$app->request->get();
@@ -512,6 +555,28 @@ class ItemController extends BaseController
         }
         $info->itemRemark = '';
         $info->save();
+
+        // 复杂分支:若当前店铺是总店(default = 1),不管分店是直营还是加盟,都需要同步清空其花材备注说明,确保全渠道数据同步与统一
+        $shop = $this->shop;
+        if (isset($shop->default) && $shop->default == 1) {
+            $sjId = $shop->sjId ?? 0;
+            $ptItemId = $info->itemId ?? 0;
+            $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
+            foreach ($chainShopList as $chainShop) {
+                $chainShopId = $chainShop->id ?? 0;
+                if ($chainShopId == $shop->id) {
+                    continue;
+                }
+                $chainMainId = $chainShop->mainId ?? 0;
+                $chainProduct = ItemClass::getByCondition(['mainId' => $chainMainId, 'itemId' => $ptItemId], true);
+                if (empty($chainProduct)) {
+                    continue;
+                }
+                $chainProduct->itemRemark = '';
+                $chainProduct->save();
+            }
+        }
+
         util::complete('清除成功');
     }
 }

+ 6 - 1
biz-ghs/order/classes/OrderClass.php

@@ -1946,7 +1946,12 @@ class OrderClass extends BaseClass
             if (isset($orderInfo->mainId) && $orderInfo->mainId == 10536) {
                 $showPrice = 0;
             }
-
+            //衡阳昕得鲜花批发,线上下单,不显示价格
+            if (isset($orderInfo->mainId) && $orderInfo->mainId == 85744) {
+                if (!empty($orderInfo->customShopAdminId)) {
+                    $showPrice = 0;
+                }
+            }
             //北京花篮子,线上下单,不显示价格
             if (isset($orderInfo->mainId) && $orderInfo->mainId == 10735) {
                 if (!empty($orderInfo->customShopAdminId)) {

+ 4 - 160
biz-ghs/product/classes/ProductClass.php

@@ -8,11 +8,6 @@ use biz\item\classes\PtItemClassClass;
 use biz\item\classes\UnitClass;
 use biz\wx\classes\WxMessageClass;
 use bizGhs\base\classes\BaseClass;
-use bizGhs\cp\classes\CpClass;
-use bizGhs\cp\classes\CpClassClass;
-use bizGhs\cp\classes\CpItemClass;
-use bizGhs\cp\classes\PtCpClass;
-use bizGhs\cp\classes\PtCpClassClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\item\classes\CostChangeClass;
 use bizGhs\item\classes\ItemClassClass;
@@ -1866,7 +1861,7 @@ class ProductClass extends BaseClass
 
         if (isset($data["reachNum"]) && $data["reachNum"] > 0) {
             $upData['reachNum'] = $data['reachNum'];
-            if (isset($data['reachNumDiscount']) == false || $data['reachNumDiscount'] <= 0) {
+            if (!isset($data['reachNumDiscount']) || $data['reachNumDiscount'] <= 0) {
                 util::fail('请填写满减的优惠金额');
             }
             $reachNumDiscount = $data['reachNumDiscount'];
@@ -1951,59 +1946,6 @@ class ProductClass extends BaseClass
             CostChangeClass::addData($changeData);
         }
 
-        /***************产品模块*****************/
-        $ptCpIds = [];
-        if (isset($data['cpInfo']) && !empty($data['cpInfo'])) {
-            $dbHas = CpItemClass::getAllByCondition(['productId' => $id], null, '*', 'cpId', true);
-            $dbHasCpIds = array_keys($dbHas);
-            $cpIds = array_column($data['cpInfo'], 'cpId');
-            $cpInfoList = CpClass::getByIds($cpIds, null, 'id');
-            $ptCpIds = array_column($cpInfoList, 'ptCpId');
-            $delCpIds = array_diff($dbHasCpIds, $cpIds);
-            if (!empty($delCpIds)) {
-                foreach ($delCpIds as $delCpId) {
-                    //数据库里有,但传过来的没有,则需要删除
-                    CpItemClass::deleteByCondition(['cpId' => $delCpId, 'productId' => $id]);
-                }
-            }
-            foreach ($data['cpInfo'] as $cpKey => $cpVal) {
-                $cpId = $cpVal['cpId'] ?? 0;
-                if (isset($cpInfoList[$cpId]) == false) {
-                    util::fail('添加了无效产品');
-                }
-                $currentCp = $cpInfoList[$cpId];
-                if (isset($currentCp['mainId']) == false || $currentCp['mainId'] != $mainId) {
-                    util::fail('不是你的产品哦');
-                }
-                $cpName = $currentCp['name'] ?? '';
-                $ptCpId = $currentCp['ptCpId'] ?? 0;
-                $cpPy = $currentCp['py'] ?? '';
-                $name = $update['name'] ?? '';
-                $py = stringUtil::py($name);
-                $hasCp = CpItemClass::getByCondition(['cpId' => $cpId, 'productId' => $id], true);
-                if (empty($hasCp)) {
-                    $addCp = [
-                        'cpId' => $cpId,
-                        'ptCpId' => $ptCpId,
-                        'ptItemId' => $ptItemId,
-                        'productId' => $id,
-                        'name' => $name,
-                        'py' => $py,
-                        'cpName' => $cpName,
-                        'cpPy' => $cpPy,
-                        'mainId' => $mainId,
-                    ];
-                    CpItemClass::add($addCp);
-                }
-            }
-            $upData['hasCpId'] = 1;
-        } else {
-            if ($shop->itemToClass == 1) {
-                util::fail('请选择产品');
-            }
-        }
-        /***************产品模块*****************/
-
         self::updateById($id, $upData);
 
         //创建限购缓存
@@ -2041,10 +1983,6 @@ class ProductClass extends BaseClass
         unset($upData['status']);
 
         if (isset($shop->default) && $shop->default == 1 && isset($shop->dataSync) && $shop->dataSync == 1) {
-            /***************产品模块*****************/
-            $ptClassList = PtCpClassClass::getAllByCondition(['delStatus' => 0], null, '*', 'id');
-            /***************产品模块*****************/
-
 
             //总店修改同步到所有门店
             $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
@@ -2092,103 +2030,6 @@ class ProductClass extends BaseClass
                     }
                 }
 
-                /***************产品模块*****************/
-                if (!empty($ptCpIds)) {
-                    $chainProductId = $chainProduct->id ?? 0;
-                    $chainPtItemId = $chainProduct->itemId ?? 0;
-                    $currentCpList = CpClass::getAllByCondition(['mainId' => $chainMainId, 'ptCpId' => ['in', $ptCpIds]], null, '*', 'ptCpId', true);
-                    $hasPtCpIds = array_keys($currentCpList);
-                    $diffIds = array_diff($ptCpIds, $hasPtCpIds);
-                    //部分产品没有新建,需要新建
-                    if (!empty($diffIds)) {
-                        $ptCpInfoList = PtCpClass::getByIds($diffIds);
-                        if (empty($ptCpInfoList)) {
-                            util::fail('平台产品有问题');
-                        }
-                        $customCpClassList = CpClassClass::getAllByCondition(['mainId' => $chainMainId], null, "*");
-                        if (empty($customCpClassList)) {
-                            util::fail('没有找到产品的分类');
-                        }
-                        $defaultCpClassId = 0;
-                        foreach ($customCpClassList as $customVal) {
-                            if (isset($customVal['isDefault']) && $customVal['isDefault'] == 1) {
-                                $defaultCpClassId = $customVal['id'] ?? 0;
-                            }
-                        }
-                        if (empty($defaultCpClassId)) {
-                            util::fail('没有找到产品的默认分类');
-                        }
-                        foreach ($ptCpInfoList as $ptCpInfo) {
-                            $ptCpName = $ptCpInfo['name'] ?? '';
-                            $ptCpCover = $ptCpInfo['cover'] ?? '';
-                            $ptCpId = $ptCpInfo['id'] ?? 0;
-                            $ptCpAuth = $ptCpInfo['auth'] ?? 0;
-
-                            $ptCpClassId = $ptCpInfo['classId'] ?? 0;
-                            $ptCpClassInfo = $ptClassList[$ptCpClassId] ?? '';
-                            $ptCpClassName = $ptCpClassInfo['name'] ?? '';
-                            if (empty($ptCpClassName)) {
-                                util::fail('平台产品分类名称没有找到');
-                            }
-                            $currentClassId = 0;
-                            foreach ($customCpClassList as $customVal) {
-                                if (isset($customVal['name']) && $customVal['name'] == $ptCpClassName) {
-                                    $currentClassId = $customVal['id'] ?? 0;
-                                }
-                            }
-                            if (empty($currentClassId)) {
-                                $currentClassId = $defaultCpClassId;
-                            }
-                            $addData = [
-                                'name' => $ptCpName,
-                                'cover' => $ptCpCover,
-                                'ptCpId' => $ptCpId,
-                                'classId' => $currentClassId,
-                                'shopId' => $chainShopId,
-                                'mainId' => $chainMainId,
-                                'auth' => $ptCpAuth,
-                            ];
-                            CpClass::addCp($addData, $chainShop);
-                        }
-                    }
-                    $dbHas = CpItemClass::getAllByCondition(['productId' => $chainProductId], null, '*', 'cpId', true);
-                    $dbHasCpIds = array_keys($dbHas);
-                    $cpInfoList = CpClass::getAllByCondition(['mainId' => $chainMainId, 'ptCpId' => ['in', $ptCpIds]], null, '*', 'id');
-                    $mayHasCpIds = array_keys($cpInfoList);
-                    $delCpIds = array_diff($dbHasCpIds, $mayHasCpIds);
-                    if (!empty($delCpIds)) {
-                        foreach ($delCpIds as $delCpId) {
-                            //数据库里有,但传过来的没有,则需要删除
-                            CpItemClass::deleteByCondition(['cpId' => $delCpId, 'productId' => $chainProductId]);
-                        }
-                    }
-                    foreach ($cpInfoList as $cpKey => $currentCp) {
-                        $cpId = $currentCp['id'] ?? 0;
-                        $ptCpId = $currentCp['ptCpId'] ?? 0;
-                        $cpName = $currentCp['name'] ?? '';
-                        $cpPy = $currentCp['py'] ?? '';
-                        $name = $params['name'] ?? '';
-                        $py = stringUtil::py($name);
-                        $hasCp = CpItemClass::getByCondition(['cpId' => $cpId, 'productId' => $chainProductId], true);
-                        if (empty($hasCp)) {
-                            $addCp = [
-                                'cpId' => $cpId,
-                                'ptCpId' => $ptCpId,
-                                'productId' => $chainProductId,
-                                'ptItemId' => $chainPtItemId,
-                                'name' => $name,
-                                'py' => $py,
-                                'cpName' => $cpName,
-                                'cpPy' => $cpPy,
-                                'mainId' => $mainId,
-                            ];
-                            CpItemClass::add($addCp);
-                        }
-                    }
-                    $params['hasCpId'] = 1;
-                }
-                /***************产品模块*****************/
-
                 //加盟店仅同步名称等非重要参数
                 if ($chainShop->join == 1) {
                     unset($params['skPrice']);
@@ -2202,6 +2043,9 @@ class ProductClass extends BaseClass
                     unset($params['hjDiscountPrice']);
                     unset($params['discountPrice']);
                     unset($params['skDiscountPrice']);
+                    //满减也不能同步,惠雅鲜花批发
+                    unset($params['reachNum']);
+                    unset($params['reachNumDiscount']);
                     self::updateById($chainProduct->id, $params);
                     continue;
                 }