|
|
@@ -67,41 +67,20 @@ class CategoryClass extends BaseClass
|
|
|
//开店初始化分类和商品 ssh 2020.2.14
|
|
|
public static function initCategoryGoods($mainId)
|
|
|
{
|
|
|
- $date = date("Y-m-d H:i:s");
|
|
|
- $list = [
|
|
|
- '花束' => [
|
|
|
- ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062359040_12358.jpg","uploads\/201906\/23\/jpg\/19062381985_12358.jpg"]', 'price' => 588, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '相思', 'itemNumber' => stringUtil::buildRandNo($mainId) . '5',],
|
|
|
- ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062352536_12358.jpg","uploads\/201906\/23\/jpg\/19062331132_12358.jpg","uploads\/201906\/23\/jpg\/19062380371_12358.jpg"]', 'price' => 688, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '女神', 'itemNumber' => stringUtil::buildRandNo($mainId) . '6',],
|
|
|
- ],
|
|
|
- '花篮' => [
|
|
|
- ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062380217_12358.jpg","uploads\/201906\/23\/jpg\/19062339442_12358.jpg","uploads\/201906\/23\/jpg\/19062382963_12358.jpg"]', 'price' => 388, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '只此一心', 'itemNumber' => stringUtil::buildRandNo($mainId) . '3',],
|
|
|
- ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062374848_12358.jpg","uploads\/201906\/23\/jpg\/19062372687_12358.jpg","uploads\/201906\/23\/jpg\/19062341158_12358.jpg"]', 'price' => 488, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '密语时光', 'itemNumber' => stringUtil::buildRandNo($mainId) . '4',],
|
|
|
- ],
|
|
|
- '永生花' => [],
|
|
|
- '绿植' => []
|
|
|
- ];
|
|
|
- foreach ($list as $key => $goodsList) {
|
|
|
- $data = ['categoryName' => $key, 'mainId' => $mainId, 'status' => 1];
|
|
|
- $cat = self::add($data);
|
|
|
- if (!empty($goodsList)) {
|
|
|
- $categoryId = $cat['id'];
|
|
|
- foreach ($goodsList as $key => $val) {
|
|
|
- $goods = GoodsClass::add($val);
|
|
|
- $goodsId = $goods['id'];
|
|
|
- $goodsCategoryData = ['cId' => $categoryId, 'gId' => $goodsId, 'mainId' => $mainId];
|
|
|
- GoodsCategoryClass::add($goodsCategoryData);
|
|
|
- }
|
|
|
- }
|
|
|
+ $catList = [['name' => '花束', 'flower' => 1], ['name' => '花篮', 'flower' => 1], ['name' => '永生花', 'flower' => 0], ['name' => '绿植', 'flower' => 0]];
|
|
|
+ foreach ($catList as $key => $cat) {
|
|
|
+ $name = $cat['name'] ?? '';
|
|
|
+ $flower = $cat['flower'];
|
|
|
+ $data = ['categoryName' => $name, 'mainId' => $mainId, 'flower' => $flower, 'status' => 1];
|
|
|
+ self::add($data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//删除分类 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]);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
}
|