合并分支 'master-server' 到 'master'
处理复制产品复制描述 查看合并请求 !976
正在显示
1 个修改的文件
包含
19 行增加
和
29 行删除
| @@ -531,7 +531,6 @@ class ProductLogic extends BaseLogic | @@ -531,7 +531,6 @@ class ProductLogic extends BaseLogic | ||
| 531 | //同步扩展字段 | 531 | //同步扩展字段 |
| 532 | $this->copyExtendInfo($info['id'],$save_id); | 532 | $this->copyExtendInfo($info['id'],$save_id); |
| 533 | $this->copyColumn($info['id'],$save_id); | 533 | $this->copyColumn($info['id'],$save_id); |
| 534 | - $this->copyDetail($info['id'],$save_id); | ||
| 535 | DB::commit(); | 534 | DB::commit(); |
| 536 | }catch (\Exception $e){ | 535 | }catch (\Exception $e){ |
| 537 | DB::rollBack(); | 536 | DB::rollBack(); |
| @@ -551,41 +550,32 @@ class ProductLogic extends BaseLogic | @@ -551,41 +550,32 @@ class ProductLogic extends BaseLogic | ||
| 551 | $columnModel = new Column(); | 550 | $columnModel = new Column(); |
| 552 | $columnList = $columnModel->list(['product_id'=>$product_id]); | 551 | $columnList = $columnModel->list(['product_id'=>$product_id]); |
| 553 | if(!empty($columnList)){ | 552 | if(!empty($columnList)){ |
| 554 | - $data = []; | ||
| 555 | foreach ($columnList as $k => $v){ | 553 | foreach ($columnList as $k => $v){ |
| 556 | unset($v['id']); | 554 | unset($v['id']); |
| 557 | $v['product_id'] = $new_product_id; | 555 | $v['product_id'] = $new_product_id; |
| 558 | $v['created_at'] = date('Y-m-d H:i:s'); | 556 | $v['created_at'] = date('Y-m-d H:i:s'); |
| 559 | $v['updated_at'] = date('Y-m-d H:i:s'); | 557 | $v['updated_at'] = date('Y-m-d H:i:s'); |
| 560 | - $data[] = $v; | ||
| 561 | - } | ||
| 562 | - return $columnModel->insert($data); | ||
| 563 | - } | ||
| 564 | - } | ||
| 565 | - | ||
| 566 | - /** | ||
| 567 | - * @remark :复制描述 | ||
| 568 | - * @name :copyDetail | ||
| 569 | - * @author :lyh | ||
| 570 | - * @method :post | ||
| 571 | - * @time :2024/12/18 16:02 | ||
| 572 | - */ | ||
| 573 | - public function copyDetail($product_id,$new_product_id){ | ||
| 574 | - $detailModel = new Detail(); | ||
| 575 | - $detailList = $detailModel->list(['product_id'=>$product_id]); | ||
| 576 | - if(!empty($detailList)){ | ||
| 577 | - $data = []; | ||
| 578 | - foreach ($detailList as $k => $v){ | ||
| 579 | - unset($v['id']); | ||
| 580 | - $v['css'] = Arr::a2s($v['css']); | ||
| 581 | - $v['content'] = Arr::a2s($v['content']); | ||
| 582 | - $v['product_id'] = $new_product_id; | ||
| 583 | - $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 584 | - $v['updated_at'] = date('Y-m-d H:i:s'); | ||
| 585 | - $data[] = $v; | 558 | + $column_id = $columnModel->addReturnId($v); |
| 559 | + //执行新增描述 | ||
| 560 | + $detailModel = new Detail(); | ||
| 561 | + $detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>$v['column_id']]); | ||
| 562 | + if(!empty($detailList)){ | ||
| 563 | + $data = []; | ||
| 564 | + foreach ($detailList as $k => $val){ | ||
| 565 | + unset($v['id']); | ||
| 566 | + $val['css'] = Arr::a2s($val['css']); | ||
| 567 | + $val['content'] = Arr::a2s($val['content']); | ||
| 568 | + $val['product_id'] = $new_product_id; | ||
| 569 | + $val['column_id'] = $column_id; | ||
| 570 | + $val['created_at'] = date('Y-m-d H:i:s'); | ||
| 571 | + $val['updated_at'] = date('Y-m-d H:i:s'); | ||
| 572 | + $data[] = $val; | ||
| 573 | + } | ||
| 574 | + $detailModel->insert($data); | ||
| 575 | + } | ||
| 586 | } | 576 | } |
| 587 | - return $detailModel->insert($data); | ||
| 588 | } | 577 | } |
| 578 | + return $this->success(); | ||
| 589 | } | 579 | } |
| 590 | 580 | ||
| 591 | /** | 581 | /** |
-
请 注册 或 登录 后发表评论