|
|
|
@ -115,6 +115,7 @@ class Goods extends GoodsModel |
|
|
|
|
// 事务处理 |
|
|
|
|
$this->transaction(function () use ($data) { |
|
|
|
|
$data['data_type'] = 1; |
|
|
|
|
|
|
|
|
|
// 添加商品 |
|
|
|
|
$this->save($data); |
|
|
|
|
// 新增商品与分类关联 |
|
|
|
@ -141,13 +142,10 @@ class Goods extends GoodsModel |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function edit(array $data, $goodsModel = null): bool |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
// 创建商品数据 |
|
|
|
|
$data = $this->createData($data); |
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($data); |
|
|
|
|
// exit(); |
|
|
|
|
// 事务处理 |
|
|
|
|
$ret = $this->transaction(function () use ($data, $goodsModel) { |
|
|
|
|
|
|
|
|
@ -158,8 +156,7 @@ class Goods extends GoodsModel |
|
|
|
|
} else { |
|
|
|
|
$data['spu_id'] = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新商品 |
|
|
|
|
$this->save($data); |
|
|
|
|
// 更新商品与分类关联 |
|
|
|
@ -342,7 +339,7 @@ class Goods extends GoodsModel |
|
|
|
|
'newSpecList' => [], |
|
|
|
|
//'data_type' => 1,//数据类型 |
|
|
|
|
'newSkuList' => [], |
|
|
|
|
'store_id' => self::$storeId, |
|
|
|
|
//'store_id' => self::$storeId, |
|
|
|
|
//'sale_areas' => $arr ? implode("、", $arr) : "", |
|
|
|
|
]); |
|
|
|
|
if (isset($data['rules'])) { |
|
|
|
|