作者 lyh

gx脚本更新路由

... ... @@ -159,10 +159,14 @@ class ProductLogic extends BaseLogic
public function getColumnId($product_id,$column_name){
$columnModel = new Column();
$columnInfo = $columnModel->read(['column_name'=>strtolower($column_name),'product_id'=>$product_id]);
if($columnInfo === false || $columnInfo['id'] != 1){
if($columnInfo === false){
$column_id = $columnModel->addReturnId(['column_name'=>$column_name,'product_id'=>$product_id]);
}else{
$column_id = 1;
if($columnInfo['id'] != 1){
$column_id = $columnModel->addReturnId(['column_name'=>$column_name,'product_id'=>$product_id]);
}else{
$column_id = 1;
}
}
return $this->success(['column_id'=>$column_id]);
}
... ... @@ -537,8 +541,43 @@ class ProductLogic extends BaseLogic
return $this->success(['id'=>$save_id]);
}
public function copyDetail(){
/**
* @remark :复制描述
* @name :copyDetail
* @author :lyh
* @method :post
* @time :2024/12/18 15:54
*/
public function copyColumn($product_id,$new_product_id){
$columnModel = new Column();
$columnList = $columnModel->list(['product_id'=>$product_id]);
if(!empty($columnInfo)){
$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);
}
}
public function copyDetail($product_id,$new_product_id){
$detailModel = new Detail();
$detailList = $detailModel->list(['product_id'=>$product_id]);
if(!empty($columnInfo)){
$data = [];
foreach ($detailList 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 $detailModel->insert($data);
}
}
/**
... ...