Browse Source

去掉logo

shish 11 months ago
parent
commit
8f129586f7

+ 29 - 16
app-hd/controllers/CategoryController.php

@@ -12,6 +12,20 @@ use common\components\util;
 class CategoryController extends BaseController
 {
 
+    public function actionGetMenu()
+    {
+        $mainId = $this->mainId;
+        $classInfo = CategoryClass::getMenuList($mainId);
+        $index = [];
+        if (!empty($classInfo)) {
+            foreach ($classInfo as $class) {
+                $id = $class['id'] ?? 0;
+                $index[$id] = $class;
+            }
+        }
+        util::success(['class' => $classInfo, 'classIndex' => $index]);
+    }
+
     public function actionGetAllCategory()
     {
         $where = ['mainId' => $this->mainId, 'delStatus' => 0];
@@ -23,7 +37,6 @@ class CategoryController extends BaseController
     public function actionList()
     {
         $get = Yii::$app->request->get();
-        //$flower = $get['flower'] ?? '';
         $list = CategoryService::getCategoryList($this->mainId);
         util::success($list);
     }
@@ -80,11 +93,11 @@ class CategoryController extends BaseController
         CategoryService::valid($category, $this->mainId);
 
         if ($category['goodsNum'] > 0) {
-            $goodsCateObjs = GoodsCategoryClass::getAllByCondition(['mainId'=>$this->mainId, 'cId'=>$categoryId]);
+            $goodsCateObjs = GoodsCategoryClass::getAllByCondition(['mainId' => $this->mainId, 'cId' => $categoryId]);
 
             //检查是否有默认分类,没有默认分类创建一个
-            $defaultCategory = CategoryClass::getByCondition(['mainId'=>$this->mainId, 'default'=>1]);
-            if ($defaultCategory == null){
+            $defaultCategory = CategoryClass::getByCondition(['mainId' => $this->mainId, 'default' => 1]);
+            if ($defaultCategory == null) {
                 $data = [
                     'mainId' => $this->mainId,
                     'sjId' => $this->sjId,
@@ -96,7 +109,7 @@ class CategoryController extends BaseController
             $defaultCategoryId = $defaultCategory['id'];
             foreach ($goodsCateObjs as $gcObj) {
                 // 先判断商品是否也在其它分类下
-                $goodsOtherCateCount = GoodsCategoryClass::getCount(['mainId'=>$this->mainId, 'gId'=>$gcObj['gId'], 'delStatus'=>0]);
+                $goodsOtherCateCount = GoodsCategoryClass::getCount(['mainId' => $this->mainId, 'gId' => $gcObj['gId'], 'delStatus' => 0]);
                 if ($goodsOtherCateCount == 1) {
                     // 如果商品仅在此分类下,则归到默认分类
                     GoodsCategoryClass::updateById($gcObj['id'], ['cId' => $defaultCategoryId, 'delStatus' => 0]);
@@ -134,21 +147,21 @@ class CategoryController extends BaseController
         if ($flowerNum > 0) {
             $goodsCond['flowerNum'] = $flowerNum;
         }
-        if (isset($get['lookPrice'])) { // 1:有价格 2:无价格 -- 根据前端的传值
-            $lookPrice = intval($get['lookPrice']);
-            if ($lookPrice == 1) {
+        if (isset($get['priceStatus'])) { // 1:有价格 2:无价格 -- 根据前端的传值
+            $priceStatus = intval($get['priceStatus']);
+            if ($priceStatus == 1) {
                 $goodsCond['priceType'] = 1;
             }
-            if ($lookPrice == 2) {
+            if ($priceStatus == 2) {
                 $goodsCond['priceType'] = 0;
             }
         }
-        if (isset($get['lookStock'])) { // 1:有库存 2:无库存 -- 根据前端的传值
-            $lookStock = intval($get['lookStock']);
-            if ($lookStock == 1) {
+        if (isset($get['stockStatus'])) { // 1:有库存 2:无库存 -- 根据前端的传值
+            $stockStatus = intval($get['stockStatus']);
+            if ($stockStatus == 1) {
                 $goodsCond['stock>'] = 0;
             }
-            if ($lookStock == 2) {
+            if ($stockStatus == 2) {
                 $goodsCond['stock'] = 0;
             }
         }
@@ -169,7 +182,7 @@ class CategoryController extends BaseController
 
         //验证商品
         // 提取所有商品ID
-        $categoryIds = array_map(function($item) {
+        $categoryIds = array_map(function ($item) {
             return intval($item['id']);
         }, $items);
 
@@ -177,12 +190,12 @@ class CategoryController extends BaseController
         $goodsInfos = CategoryClass::getByIds($categoryIds);
 
         // 批量验证商品
-        foreach($goodsInfos as $info) {
+        foreach ($goodsInfos as $info) {
             CategoryService::valid($info, $this->mainId);
         }
 
         // 更新商品排序
-        foreach($items as $item) {
+        foreach ($items as $item) {
             $id = intval($item['id']);
             $inTurn = intval($item['inTurn']);
             CategoryClass::updateById($id, ['inTurn' => $inTurn]);

+ 18 - 1
biz-hd/goods/classes/CategoryClass.php

@@ -3,6 +3,7 @@
 namespace bizHd\goods\classes;
 
 use common\components\business;
+use common\components\imgUtil;
 use common\components\stringUtil;
 use common\components\util;
 use Yii;
@@ -15,6 +16,22 @@ class CategoryClass extends BaseClass
 
     //可以使用的分类:花束 花盒 蝴蝶兰 花篮 植物 永生花 散花 充值卡 花艺课 花礼 瓶器
 
+    public static function getMenuList($mainId)
+    {
+        $where = ['mainId' => $mainId, 'delStatus' => 0];
+        $cat = CategoryClass::getAllByCondition($where, 'inTurn DESC', '*');
+        if (empty($cat)) {
+            return $cat;
+        }
+        foreach ($cat as $key => $info) {
+            $img = $info['img'] ?? '';
+            $cat[$key]['img'] = imgUtil::groupImg($img) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
+            $cat[$key]['bigImg'] = imgUtil::groupImg($img) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+            $cat[$key]['shortImg'] = $img;
+        }
+        return $cat;
+    }
+
     //取出商家所有的分类 ssh 2019.12.7
     public static function getCategoryIds($mainId)
     {
@@ -79,6 +96,6 @@ class CategoryClass extends BaseClass
     //删除分类 ssh 2020.3.3
     public static function deleteCategory($id)
     {
-        return self::updateByCondition(['id' => $id], ['goodsNum'=>0, 'delStatus'=>1]);
+        return self::updateByCondition(['id' => $id], ['goodsNum' => 0, 'delStatus' => 1]);
     }
 }

+ 0 - 4
biz-hd/goods/services/CategoryService.php

@@ -16,10 +16,6 @@ class CategoryService extends BaseService
     public static function getCategoryList($mainId)
     {
         $where = ['mainId' => $mainId, 'delStatus' => 0];
-        // 需求变动:不再用 flower 做区分
-        //if (is_numeric($flower)) {
-            //$where['flower'] = $flower;
-        //}
         $cat = CategoryClass::getAllByCondition($where, 'inTurn DESC', '*');
         if (empty($cat)) {
             return $cat;

+ 2 - 1
biz/shop/classes/ShopClass.php

@@ -247,7 +247,8 @@ class ShopClass extends BaseClass
         Yii::info('收款码url:' . $url);
         $gatheringCode = qrCodeUtil::generateGatheringQrCode($url, $sjId, $shopId, '', 16);
         Yii::info('gatheringCode:' . $gatheringCode);
-        $imgUrl = Yii::$app->params['hdImgHost'] . 'gathering/1.jpg?x-oss-process=image/watermark,image_' . base64_encode($gatheringCode) . ',g_nw,x_276,y_463/watermark,image_' . base64_encode('gathering/logo_big.png?x-oss-process=image/resize,P_12') . ',g_nw,x_555,y_728';
+        //$imgUrl = Yii::$app->params['hdImgHost'] . 'gathering/1.jpg?x-oss-process=image/watermark,image_' . base64_encode($gatheringCode) . ',g_nw,x_276,y_463/watermark,image_' . base64_encode('gathering/logo_big.png?x-oss-process=image/resize,P_12') . ',g_nw,x_555,y_728';
+        $imgUrl = Yii::$app->params['hdImgHost'] . 'gathering/1.jpg?x-oss-process=image/watermark,image_' . base64_encode($gatheringCode) . ',g_nw,x_276,y_463';
         return $imgUrl;
     }