From 88f78c9db184ce2fb3041c6d3ee77b65150780de Mon Sep 17 00:00:00 2001 From: vguanyiwgd Date: Tue, 9 Apr 2024 15:52:02 +0800 Subject: [PATCH] update Change-Id: I1fb94a18b1fb480770da7ba133f21408fb3f540f --- .../api/controllers/api/Dishes.php | 72 +++++++++---------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/backstage/application/api/controllers/api/Dishes.php b/backstage/application/api/controllers/api/Dishes.php index 60174fc..17eea0b 100644 --- a/backstage/application/api/controllers/api/Dishes.php +++ b/backstage/application/api/controllers/api/Dishes.php @@ -750,25 +750,25 @@ class Dishes extends REST_Controller // 最左侧菜单 $extra_menus = ''; // 左侧的列表2 - $meal_list2 = array(); +// $meal_list2 = array(); // 左侧的列表 - $date_list = array(); +// $date_list = array(); $date_get = $this->input->get('date'); // 当前展示的日期 - $currentDateInfo = ''; - foreach($list as $item) { -// if(!empty($date_get)){ -// if($date_get == $item['dc_date']){ -// $currentDateInfo = $item['dc_date']; -// } -// }else{ -// $currentDateInfo = $list[0]['dc_date']; -// } - $date_list[$item['dc_date']][] = $item; - } +// $currentDateInfo = ''; +// foreach($list as $item) { +//// if(!empty($date_get)){ +//// if($date_get == $item['dc_date']){ +//// $currentDateInfo = $item['dc_date']; +//// } +//// }else{ +//// $currentDateInfo = $list[0]['dc_date']; +//// } +// $date_list[$item['dc_date']][] = $item; +// } - $date_key = array_keys($date_list); +// $date_key = array_keys($date_list); // 就是cp的id, 改为日期(当前日期) // if(empty($date_get)){ // $date_get = $date_key ? $date_key[0] : ''; @@ -793,27 +793,27 @@ class Dishes extends REST_Controller //print_r($userCartList);exit; // 遍历左侧日期cp - foreach ($date_list as $dc_date => $dateInfo) { - if (!empty($date_get) && $date_get != $dc_date) { - - foreach ($dateInfo as $dateInfo_k => $dateInfo_v) { - $date_id = $dateInfo_v['id']; - $dishes_type_num = 0; - foreach ($userCartList as $cItem) { - if ($cItem['dining_hall_id'] == $dining_hall_id && $cItem['date_id'] == $date_id) { - $dishes_type_num += $cItem['num']; - } - } - $cart_arr[$dateInfo_v['dc_date']] += $dishes_type_num; - } - $jcmeal[$dc_date] = array( - 'cart_num' => $cart_arr[$dc_date], - 'meal_list' => array(), - 'active' => 0 - ); - continue; - } - } +// foreach ($date_list as $dc_date => $dateInfo) { +// if (!empty($date_get) && $date_get != $dc_date) { +// +// foreach ($dateInfo as $dateInfo_k => $dateInfo_v) { +// $date_id = $dateInfo_v['id']; +// $dishes_type_num = 0; +// foreach ($userCartList as $cItem) { +// if ($cItem['dining_hall_id'] == $dining_hall_id && $cItem['date_id'] == $date_id) { +// $dishes_type_num += $cItem['num']; +// } +// } +// $cart_arr[$dateInfo_v['dc_date']] += $dishes_type_num; +// } +// $jcmeal[$dc_date] = array( +// 'cart_num' => $cart_arr[$dc_date], +// 'meal_list' => array(), +// 'active' => 0 +// ); +// continue; +// } +// } $dining_hall_ids = array_column($dining_halls, 'id'); $key = array_search($dining_hall_id, $dining_hall_ids); @@ -835,8 +835,6 @@ class Dishes extends REST_Controller foreach ($date_dish_list as $book_k => $book_v) { $date_id = $book_v['id']; -// if($book_v['dc_date'] == $dc_date){ - // 获取当天 $dishes = $this->Dishes_model->get_dishes_by_type_id($date_id, '', $dining_hall_id, $this->user->type_id); if(!empty($dishes) && empty($date_get)){ $date_get = $book_v['dc_date'];