作者 lyh

gx脚本更新路由

... ... @@ -531,6 +531,7 @@ 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();
... ... @@ -577,6 +578,30 @@ class ProductLogic extends BaseLogic
}
/**
* @remark :复制描述
* @name :copyDetail
* @author :lyh
* @method :post
* @time :2024/12/18 16:02
*/
public function copyDetail($product_id,$new_product_id){
$detailModel = new Detail();
$detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>1]);
if(!empty($detailList)){
$data = [];
foreach ($detailList as $k => $v){
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;
}
return $detailModel->insert($data);
}
}
/**
* @remark :复制项目扩展字段
* @name :copyExtendInfo
* @author :lyh
... ...