shish 4 yıl önce
ebeveyn
işleme
cb9acf0c98

+ 2 - 2
app-hd/controllers/MainController.php

@@ -48,7 +48,7 @@ class MainController extends BaseController
     //首页 ssh 2019.12.2
     public function actionIndex()
     {
-        $where = ['sjId' => $this->sjId, 'type' => 0, 'status' => 1, 'delStatus' => 0];
+        $where = ['mainId' => $this->mainId, 'type' => 0, 'status' => 1, 'delStatus' => 0];
         $adRespond = AdService::getAdList($where);
         $ad = [];
         if (isset($adRespond['list']) && !empty($adRespond['list'])) {
@@ -56,7 +56,7 @@ class MainController extends BaseController
                 $ad[] = ['adImg' => $single['adImgUrl'], 'url' => ''];
             }
         }
-        $category = CategoryService::getTopThreeCategory($this->sjId);
+        $category = CategoryService::getTopThreeCategory($this->mainId);
         $categoryList = !empty($category) ? GoodsCategoryService::getAppointCategoryList($category) : [];
         $data = ['ad' => $ad, 'category' => $categoryList, 'columnStyle' => rand(1, 2)];
         util::success($data);

+ 0 - 4
biz-mall/goods/classes/GoodsClass.php

@@ -49,7 +49,6 @@ class GoodsClass extends BaseClass
             //多款式
             $val['goodsStyleList'] = isset($val['goodsStyle']) && $val['goodsStyle'] == 1 ? GoodsStyleClass::getStyleList($id) : [];
             $val['createDate'] = date("Y-m-d", strtotime($val['createTime']));
-            $val['name'] = '';
             //节日涨价
             if (!empty($rise)) {
                 $price = $val['price'];
@@ -61,13 +60,10 @@ class GoodsClass extends BaseClass
                     $val['price'] = $price + $rise['riseAmount'];
                 }
             }
-
             //临时加100块
             //$price = $val['price'];
             //$val['price'] = $price + 100;
-
             $list[$key] = $val;
-
         }
         return $list;
     }

+ 74 - 74
biz-mall/goods/services/GoodsCategoryService.php

@@ -10,79 +10,79 @@ use linslin\yii2\curl;
 
 class GoodsCategoryService extends BaseService
 {
-	
-	public static $baseFile = '\bizMall\goods\classes\GoodsCategoryClass';
-	
-	//查询一个分类下的商品,有分页 ssh 2019.12.2
-	public static function getGoodsList($where)
-	{
-		$data = GoodsCategoryClass::getList('*', $where, 'inTurn DESC');
-		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
-		if (empty($list)) {
-			return $data;
-		}
-		$ids = array_column($list, 'gId');
-		$list = GoodsService::getAllByCondition(['id' => ['in', $ids]], 'inTurn DESC', '*');
-		$data['list'] = GoodsClass::groupGoodsBaseInfo($list);
-		return $data;
-	}
-	
-	//查询指定分类下的商品,没有分页,首页使用 ssh 2019.12.2
-	public static function getAppointCategoryList($category)
-	{
-		$ids = array_column($category, 'id');
-		//取出分类下的商品id
-		$list = GoodsCategoryClass::getAllByCondition(['cId' => ['in', $ids]], 'inTurn DESC,addTime DESC', '*');
-		if (empty($list)) {
-			foreach ($category as $key => $val) {
-				$category[$key]['goodsInfoList'] = [];
-			}
-			return $category;
-		}
-		$goodsList = [];
-		$categoryGoods = [];
-		foreach ($list as $val) {
-			$goodsList[] = $val['gId'];
-			$cId = $val['cId'];
-			$categoryGoods[$cId][] = $val['gId'];
-		}
-		//查出商品信息
-		$goodsInfoList = GoodsService::getAllByCondition(['id' => ['in', $goodsList]], 'inTurn DESC', '*', 'id');
-		$goodsInfoList = GoodsClass::groupGoodsBaseInfo($goodsInfoList);
-		
-		//每个分类取的商品数
-		$getNum = [6, 2, 4];
-		$showRowNum = [2, 1, 2];
-		
-		foreach ($category as $key => $val) {
-			$id = $val['id'];
-			//当前分类下有哪些商品id,并组合商品信息
-			$categoryGoodsIdList = isset($categoryGoods[$id]) ? $categoryGoods[$id] : [];
-			$info = [];
-			if (!empty($categoryGoodsIdList)) {
-				$currentGetNum = isset($getNum[$key]) ? $getNum[$key] : 2;
-				$categoryGoodsIdList = array_slice($categoryGoodsIdList, 0, $currentGetNum);
-				foreach ($categoryGoodsIdList as $currentGoodsId) {
-					if (isset($goodsInfoList[$currentGoodsId])) {
-						$info[] = $goodsInfoList[$currentGoodsId];
-					}
-				}
-			}
-			$category[$key]['goodsInfoList'] = $info;
-			$category[$key]['showRow'] = isset($showRowNum[$key]) ? $showRowNum[$key] : 2;
-		}
-		return $category;
-	}
-	
-	//获取商品所属的分类id  ssh 201917
-	public static function getGoodsHasCategoryIds($goodsId)
-	{
-		$categoryIdList = GoodsCategoryClass::getAllByCondition(['gId' => $goodsId], null, 'cId', 'cId');
-		if (empty($categoryIdList)) {
-			return [];
-		}
-		$ids = array_keys($categoryIdList);
-		return $ids;
-	}
+
+    public static $baseFile = '\bizMall\goods\classes\GoodsCategoryClass';
+
+    //查询一个分类下的商品,有分页 ssh 2019.12.2
+    public static function getGoodsList($where)
+    {
+        $data = GoodsCategoryClass::getList('*', $where, 'inTurn DESC');
+        $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+        if (empty($list)) {
+            return $data;
+        }
+        $ids = array_column($list, 'gId');
+        $list = GoodsService::getAllByCondition(['id' => ['in', $ids]], 'inTurn DESC', '*');
+        $data['list'] = GoodsClass::groupGoodsBaseInfo($list);
+        return $data;
+    }
+
+    //查询指定分类下的商品,没有分页,首页使用 ssh 2019.12.2
+    public static function getAppointCategoryList($category)
+    {
+        $ids = array_column($category, 'id');
+        //取出分类下的商品id
+        $list = GoodsCategoryClass::getAllByCondition(['cId' => ['in', $ids]], 'inTurn DESC,addTime DESC', '*');
+        if (empty($list)) {
+            foreach ($category as $key => $val) {
+                $category[$key]['goodsInfoList'] = [];
+            }
+            return $category;
+        }
+        $goodsList = [];
+        $categoryGoods = [];
+        foreach ($list as $val) {
+            $goodsList[] = $val['gId'];
+            $cId = $val['cId'];
+            $categoryGoods[$cId][] = $val['gId'];
+        }
+        //查出商品信息
+        $goodsInfoList = GoodsService::getAllByCondition(['id' => ['in', $goodsList]], 'inTurn DESC', '*', 'id');
+        $goodsInfoList = GoodsClass::groupGoodsBaseInfo($goodsInfoList);
+
+        //每个分类取的商品数
+        $getNum = [6, 2, 4];
+        $showRowNum = [2, 1, 2];
+
+        foreach ($category as $key => $val) {
+            $id = $val['id'];
+            //当前分类下有哪些商品id,并组合商品信息
+            $categoryGoodsIdList = isset($categoryGoods[$id]) ? $categoryGoods[$id] : [];
+            $info = [];
+            if (!empty($categoryGoodsIdList)) {
+                $currentGetNum = isset($getNum[$key]) ? $getNum[$key] : 2;
+                $categoryGoodsIdList = array_slice($categoryGoodsIdList, 0, $currentGetNum);
+                foreach ($categoryGoodsIdList as $currentGoodsId) {
+                    if (isset($goodsInfoList[$currentGoodsId])) {
+                        $info[] = $goodsInfoList[$currentGoodsId];
+                    }
+                }
+            }
+            $category[$key]['goodsInfoList'] = $info;
+            $category[$key]['showRow'] = isset($showRowNum[$key]) ? $showRowNum[$key] : 2;
+        }
+        return $category;
+    }
+
+    //获取商品所属的分类id  ssh 201917
+    public static function getGoodsHasCategoryIds($goodsId)
+    {
+        $categoryIdList = GoodsCategoryClass::getAllByCondition(['gId' => $goodsId], null, 'cId', 'cId');
+        if (empty($categoryIdList)) {
+            return [];
+        }
+        $ids = array_keys($categoryIdList);
+        return $ids;
+    }
 
 }