shish 6 年 前
コミット
53ab08cd3a

+ 3 - 3
app/business/controllers/GoodsController.php

@@ -57,20 +57,20 @@ class GoodsController extends BaseController
 		$goods = GoodsService::getGoodsInfo($id);
 		util::success($goods);
 	}
-	
+
 	//更新商品 shish 2019.12.7
 	public function actionUpdate()
 	{
 		$data = Yii::$app->request->post();
 		$id = isset($data['id']) ? $data['id'] : 0;
-		unset($data['id']);
 		$info = GoodsService::getById($id);
 		GoodsService::valid($info, $this->merchantId);
+		echo 'ok';die;
 		$data['merchantId'] = $this->merchantId;
 		GoodsService::updateGoods($id, $data);
 		util::ok();
 	}
-	
+
 	//商品排序
 	public function actionSort()
 	{

+ 1 - 2
biz/goods/classes/GoodsClass.php

@@ -3,7 +3,6 @@
 namespace biz\goods\classes;
 
 use biz\goods\services\GoodsCategoryService;
-use biz\goods\services\GoodsStyleService;
 use biz\merchant\services\MerchantService;
 use common\components\business;
 use common\components\stringUtil;
@@ -45,7 +44,7 @@ class GoodsClass extends BaseClass
 			//免费配送范围
 			$val['freeSendDist'] = 5;
 			//多款式
-			$val['goodsStyleList'] = isset($val['goodsStyle']) && $val['goodsStyle'] == 1 ? GoodsStyleService::getStyle($id) : [];
+			$val['goodsStyleList'] = isset($val['goodsStyle']) && $val['goodsStyle'] == 1 ? GoodsStyleClass::getStyleList($id) : [];
 			$val['createDate'] = date("Y-m-d", strtotime($val['createTime']));
 			$merchantId = $val['merchantId'];
 			$val['merchantName'] = isset($merchantList[$merchantId]['merchantName']) ? $merchantList[$merchantId]['merchantName'] : '';

+ 12 - 0
biz/goods/classes/GoodsStyleClass.php

@@ -21,4 +21,16 @@ class GoodsStyleClass extends BaseClass
 		}
 		return $list;
 	}
+
+	//取商品的款式和价格
+	public static function getStyleList($id)
+	{
+		$list = self::getAllByCondition(['goodsId' => $id], 'inTurn DESC', '*','id');
+		if (empty($list)) {
+			return $list;
+		}
+		$new = self::groupStyleInfo($list);
+		return $new;
+	}
+
 }

+ 1 - 12
biz/goods/services/GoodsStyleService.php

@@ -10,18 +10,7 @@ use linslin\yii2\curl;
 
 class GoodsStyleService extends BaseService
 {
-	
-	public static $baseFile = '\biz\goods\classes\GoodsStyleClass';
 
-	//取商品的款式和价格
-	public static function getStyle($id)
-	{
-		$list = GoodsStyleClass::getAllByCondition(['goodsId' => $id], 'inTurn DESC', '*','id');
-		if (empty($list)) {
-			return $list;
-		}
-		$new = GoodsStyleClass::groupStyleInfo($list);
-		return $new;
-	}
+	public static $baseFile = '\biz\goods\classes\GoodsStyleClass';
 
 }