|
...
|
...
|
@@ -550,18 +550,33 @@ class ProductLogic extends BaseLogic |
|
|
|
public function copyColumn($product_id,$new_product_id){
|
|
|
|
$columnModel = new Column();
|
|
|
|
$columnList = $columnModel->list(['product_id'=>$product_id]);
|
|
|
|
if(!empty($columnInfo)){
|
|
|
|
$data = [];
|
|
|
|
if(!empty($columnList)){
|
|
|
|
foreach ($columnList as $k => $v){
|
|
|
|
$column_id = $v['id'];
|
|
|
|
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;
|
|
|
|
$column_news_id = $columnModel->addReturnId($v);
|
|
|
|
//执行新增描述
|
|
|
|
$detailModel = new Detail();
|
|
|
|
$detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>$column_id]);
|
|
|
|
if(!empty($detailList)){
|
|
|
|
$data = [];
|
|
|
|
foreach ($detailList as $val){
|
|
|
|
unset($val['id']);
|
|
|
|
$val['css'] = Arr::a2s($val['css']);
|
|
|
|
$val['content'] = Arr::a2s($val['content']);
|
|
|
|
$val['product_id'] = $new_product_id;
|
|
|
|
$val['column_id'] = $column_news_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 $columnModel->insert($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :复制描述
|
|
...
|
...
|
@@ -572,8 +587,8 @@ class ProductLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function copyDetail($product_id,$new_product_id){
|
|
|
|
$detailModel = new Detail();
|
|
|
|
$detailList = $detailModel->list(['product_id'=>$product_id]);
|
|
|
|
if(!empty($columnInfo)){
|
|
|
|
$detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>1]);
|
|
|
|
if(!empty($detailList)){
|
|
|
|
$data = [];
|
|
|
|
foreach ($detailList as $k => $v){
|
|
|
|
unset($v['id']);
|
|
...
|
...
|
@@ -587,7 +602,6 @@ class ProductLogic extends BaseLogic |
|
|
|
return $detailModel->insert($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :复制项目扩展字段
|
|
|
|
* @name :copyExtendInfo
|
...
|
...
|
|