Browse Source

优化商品逻辑代码

antshop
linyaostalker 5 years ago
parent
commit
590f272897
  1. 21
      backend/modules/goods/logic/goods/GoodsManager.php

21
backend/modules/goods/logic/goods/GoodsManager.php

@ -2,6 +2,7 @@
namespace backend\modules\goods\logic\goods; namespace backend\modules\goods\logic\goods;
use backend\modules\file\models\ars\File; use backend\modules\file\models\ars\File;
use Throwable;
use Yii; use Yii;
use yii\db\Exception; use yii\db\Exception;
use backend\modules\goods\models\ars\GoodsAttr; use backend\modules\goods\models\ars\GoodsAttr;
@ -9,7 +10,7 @@ use backend\modules\goods\models\ars\Attribute;
use backend\modules\goods\models\ars\GoodsSku; use backend\modules\goods\models\ars\GoodsSku;
use backend\modules\goods\models\ars\Goods; use backend\modules\goods\models\ars\Goods;
use backend\modules\goods\models\ars\FilterAttr; use backend\modules\goods\models\ars\FilterAttr;
use yii\web\HttpException;
use yii\db\StaleObjectException;
use backend\modules\file\logic\file\FileManager; use backend\modules\file\logic\file\FileManager;
use yii\web\ServerErrorHttpException; use yii\web\ServerErrorHttpException;
@ -261,6 +262,7 @@ class GoodsManager
/** /**
* @param $id * @param $id
* @param int $type
* @return mixed * @return mixed
* 已创建sku信息 * 已创建sku信息
*/ */
@ -420,8 +422,8 @@ class GoodsManager
* @param $data * @param $data
* @param $goodsId * @param $goodsId
* @return bool * @return bool
* @throws \Throwable
* @throws \yii\db\StaleObjectException
* @throws Throwable
* @throws StaleObjectException
* 删除sku * 删除sku
*/ */
public static function deleteSku($type, $data, $goodsId) public static function deleteSku($type, $data, $goodsId)
@ -444,13 +446,14 @@ class GoodsManager
foreach ($sku as $value) { foreach ($sku as $value) {
$value->delete(); $value->delete();
} }
return true;
} }
/** /**
* @param $data * @param $data
* @return bool * @return bool
* @throws Exception
* @throws HttpException
* @throws \Exception
* 创建修改商品筛选属性操作 * 创建修改商品筛选属性操作
*/ */
private static function addFilterAttributeOperating($data) private static function addFilterAttributeOperating($data)
@ -484,11 +487,12 @@ class GoodsManager
} }
} }
} }
return true;
} }
/** /**
* @param $goodsFilterAttr * @param $goodsFilterAttr
* @throws HttpException
* @throws \Exception
* 删除商品筛选属性 * 删除商品筛选属性
*/ */
private static function delFilterAttribute($goodsFilterAttr) private static function delFilterAttribute($goodsFilterAttr)
@ -553,9 +557,4 @@ class GoodsManager
} }
return false; //否则返回false,表示后台分类可以修改 return false; //否则返回false,表示后台分类可以修改
} }
public static function categoryBtreeList()
{
}
} }
Loading…
Cancel
Save