|
...
|
...
|
@@ -531,7 +531,6 @@ class ProductLogic extends BaseLogic |
|
|
|
//同步扩展字段
|
|
|
|
$this->copyExtendInfo($info['id'],$save_id);
|
|
|
|
$this->copyColumn($info['id'],$save_id);
|
|
|
|
$this->copyDetail($info['id'],$save_id);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
...
|
...
|
@@ -551,42 +550,33 @@ class ProductLogic extends BaseLogic |
|
|
|
$columnModel = new Column();
|
|
|
|
$columnList = $columnModel->list(['product_id'=>$product_id]);
|
|
|
|
if(!empty($columnList)){
|
|
|
|
$data = [];
|
|
|
|
foreach ($columnList as $k => $v){
|
|
|
|
unset($v['id']);
|
|
|
|
$v['product_id'] = $new_product_id;
|
|
|
|
$v['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$v['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$data[] = $v;
|
|
|
|
}
|
|
|
|
return $columnModel->insert($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :复制描述
|
|
|
|
* @name :copyDetail
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/12/18 16:02
|
|
|
|
*/
|
|
|
|
public function copyDetail($product_id,$new_product_id){
|
|
|
|
$column_id = $columnModel->addReturnId($v);
|
|
|
|
//执行新增描述
|
|
|
|
$detailModel = new Detail();
|
|
|
|
$detailList = $detailModel->list(['product_id'=>$product_id]);
|
|
|
|
$detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>$v['column_id']]);
|
|
|
|
if(!empty($detailList)){
|
|
|
|
$data = [];
|
|
|
|
foreach ($detailList as $k => $v){
|
|
|
|
foreach ($detailList as $k => $val){
|
|
|
|
unset($v['id']);
|
|
|
|
$v['css'] = Arr::a2s($v['css']);
|
|
|
|
$v['content'] = Arr::a2s($v['content']);
|
|
|
|
$v['product_id'] = $new_product_id;
|
|
|
|
$v['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$v['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$data[] = $v;
|
|
|
|
$val['css'] = Arr::a2s($val['css']);
|
|
|
|
$val['content'] = Arr::a2s($val['content']);
|
|
|
|
$val['product_id'] = $new_product_id;
|
|
|
|
$val['column_id'] = $column_id;
|
|
|
|
$val['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$val['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$data[] = $val;
|
|
|
|
}
|
|
|
|
$detailModel->insert($data);
|
|
|
|
}
|
|
|
|
return $detailModel->insert($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :复制项目扩展字段
|
...
|
...
|
|