From 0c386a5db2c6fab7d9649c1109fa9ea76a89811b Mon Sep 17 00:00:00 2001 From: yanzai Date: Wed, 16 Oct 2024 16:10:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=94=B9=E4=BB=B7=E6=8E=A8?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laravel/app/Services/ComboItemGroupService.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Laravel/app/Services/ComboItemGroupService.php b/Laravel/app/Services/ComboItemGroupService.php index d1eb68d..0b1a202 100644 --- a/Laravel/app/Services/ComboItemGroupService.php +++ b/Laravel/app/Services/ComboItemGroupService.php @@ -10,6 +10,17 @@ class ComboItemGroupService $combos=$res['变更套餐']; $successCount = 0;//成功的数量 foreach ($combos as $combo){ + if($combo['变更类别']=='改价'){ + DB::table('combos')->where(['combo_id' => $combo['Id']])->update([ + 'original_price'=> $combo['原价'], + 'price'=> $combo['价格'], + ]); + foreach ($combo['包含项目'] as $key => $v) { + DB::table('combo_items')->where(['combo_id' => $combo['Id'],'item_id'=>$v['Id']])->update([ + 'price'=> $v['价格'] + ]); + } + } if($combo['变更类别']=='删除'){ DB::table('combos')->where(['combo_id' => $combo['Id']])->delete(); DB::table('combo_items')->where(['combo_id' => $combo['Id']])->delete(); @@ -103,6 +114,9 @@ class ComboItemGroupService if(isset($res['变更收费项目'])){ $items=$res['变更收费项目']; foreach ($items as $item){ + if($item['变更类别']=='改价'){ + DB::table('items')->where(['item_id'=>$item['Id']])->update(['price'=>$item['价格']]); + } if($item['变更类别']=='删除'){ DB::table('items')->where(['item_id'=>$item['Id']])->delete(); }