From 3d596b12fe4b1724ce8a32cbf8f422dcc2ee3f73 Mon Sep 17 00:00:00 2001 From: yanzai Date: Wed, 16 Oct 2024 14:09:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=AD=A3=E6=80=BB=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E8=87=AA=E9=80=89=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/Services/ComboItemGroupService.php | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Laravel/app/Services/ComboItemGroupService.php b/Laravel/app/Services/ComboItemGroupService.php index 23b04c9..d1eb68d 100644 --- a/Laravel/app/Services/ComboItemGroupService.php +++ b/Laravel/app/Services/ComboItemGroupService.php @@ -97,7 +97,47 @@ class ComboItemGroupService } } } - return \Yz::Return(true, '操作完成', ['success_count' => $successCount, 'combos_count' => count($combos)]); + + } + + if(isset($res['变更收费项目'])){ + $items=$res['变更收费项目']; + foreach ($items as $item){ + if($item['变更类别']=='删除'){ + DB::table('items')->where(['item_id'=>$item['Id']])->delete(); + } + if($item['变更类别']=='修改' || $item['变更类别']=='新增'){ + $item_sex=null; + if (isset($v['性别限制'])) { + $item_sex_array = ['全部' => 0, '男' => 1, '女' => 2]; + $item_sex = $item_sex_array[$item['性别限制']] >= 0 ? $item_sex_array[$item['性别限制']] : null; + } + $ItemData=[ + 'item_id'=>$item['Id'], + 'sex'=>$item_sex, + 'can_qian_hou'=>$item['餐前餐后'], + 'name'=>$item['名称'], + 'pinyin'=>$item['拼音'], + 'price'=>$item['价格'], + 'is_choose'=>$item['可选']===false ? "0" : "1", + 'keshi_id'=>$item['科室Id'], + 'keshi_name'=>$item['科室名称'], + 'beizhu'=>$item['备注'], + 'jianjie'=>$item['简介'], + 'status'=>1, + 'updated_at'=>date('Y-m-d H:i:s'), + ]; + $cha= DB::table('items')->where(['item_id'=>$item['Id']])->get(); + if(count($cha)>0){ + DB::table('items')->where(['item_id'=>$item['Id']])->update($ItemData); + }else{ + DB::table('items')->insert($ItemData); + } + } + + } + } + return \Yz::Return(true, '操作完成', []); } }