Jelajahi Sumber

Merge branch 'redesign‌-260706' of git.huaml.com:zhh/huahuibao into redesign‌-260706

shizhongqi 3 hari lalu
induk
melakukan
807b4ff278

+ 3 - 0
app-hd/controllers/ItemController.php

@@ -132,6 +132,9 @@ class ItemController extends BaseController
             $list = ProductClass::kdItemGroup($list, $level);
         } elseif ($requestType == 'itemList') {
             $list = ProductClass::itemListGroup($list, $level);
+        } elseif ($requestType == 'outList') {
+            // 已下架列表:字段加工与花材列表一致(原先落入 else 导致接口失败)
+            $list = ProductClass::itemListGroup($list, 1);
         } elseif ($requestType == 'changePrice') {
             $list = ProductClass::changePriceGroup($list, $level);
         } elseif ($requestType == 'break') {

+ 10 - 0
app-hd/controllers/ShopController.php

@@ -143,6 +143,16 @@ class ShopController extends BaseController
         util::success($shop);
     }
 
+    /**
+     * 判断当前登录门店所属 mainId 是否已开通花材批发店(xhShop.ptStyle=2)
+     * 供零售端花材列表/商品管理拦截:有批发店则引导去销花宝批发端改花材
+     */
+    public function actionHasPfShop()
+    {
+        $mainId = (int) ($this->shop->mainId ?? 0);
+        util::success(ShopClass::hasPfShopByMainId($mainId));
+    }
+
     //门店列表 ssh 20202.2.29
     public function actionList()
     {

+ 12 - 2
app-hd/controllers/ShopNoticeController.php

@@ -13,16 +13,26 @@ class ShopNoticeController extends BaseController
 {
     /**
      * 管理端公告列表
+     * 支持 title / position / status 筛选(PC 公告管理设计稿)
      */
     public function actionList()
     {
         $get = Yii::$app->request->get();
-        $list = ShopNoticeClass::searchList([
+        $params = [
             'mainId' => $this->mainId,
             'title' => $get['title'] ?? '',
             'isDel' => 0,
             'order' => 'id DESC',
-        ]);
+        ];
+        // 展示位置:1商城首页 2分类菜单 4购物车 8订单提交
+        if (isset($get['position']) && $get['position'] !== '' && $get['position'] !== null) {
+            $params['position'] = $get['position'];
+        }
+        // 状态:1显示中 0已隐藏;不传则查全部
+        if (isset($get['status']) && $get['status'] !== '' && $get['status'] !== null) {
+            $params['status'] = $get['status'];
+        }
+        $list = ShopNoticeClass::searchList($params);
         util::success($list);
     }
 

+ 2 - 1
biz-ghs/item/classes/ItemClassClass.php

@@ -157,7 +157,8 @@ class ItemClassClass extends BaseClass
     public static function getGhsItemClassAll($mainId)
     {
         $where = ['mainId' => $mainId];
-        $data = self::getAllList('id,name,cover,print,isDefault', $where, 'inTurn desc');
+        // 含 inTurn:分类管理列表要展示排序;开单页忽略多余字段即可
+        $data = self::getAllList('id,name,cover,print,isDefault,inTurn', $where, 'inTurn desc');
         if (!empty($data)) {
             foreach ($data as $key => $val) {
                 $shortCover = $val['cover'] ?? '';

+ 26 - 0
biz/shop/classes/ShopClass.php

@@ -1065,6 +1065,32 @@ class ShopClass extends BaseClass
         PtYeChangeClass::addChange($change, true);
     }
 
+    /**
+     * 按 mainId 判断是否已开通花材批发店:xhShop 存在 ptStyle=2 且未删除的记录。
+     * 零售端花材列表等入口据此拦截,引导去批发端维护花材(不能仅看当前店 pfShopId)。
+     *
+     * @param int $mainId 中央账号 id(xhShop.mainId)
+     * @return array{has:int,pfShopId:int,mainId:int} has=1 表示已开通;pfShopId 为首个批发店 id
+     */
+    public static function hasPfShopByMainId($mainId)
+    {
+        $mainId = (int) $mainId;
+        if ($mainId <= 0) {
+            return ['has' => 0, 'pfShopId' => 0, 'mainId' => 0];
+        }
+        $pfShop = self::getByCondition([
+            'mainId' => $mainId,
+            'ptStyle' => 2,
+            'delStatus' => 0,
+        ], false, 'id ASC', 'id,mainId,ptStyle');
+        $pfShopId = (int) ($pfShop['id'] ?? 0);
+        return [
+            'has' => $pfShopId > 0 ? 1 : 0,
+            'pfShopId' => $pfShopId,
+            'mainId' => $mainId,
+        ];
+    }
+
     /**
      * xhShop 门店展示名称:首店仅返回 merchantName,分店返回 merchantName-分店名
      *