From 9f7b4d491657efd0c0f873a97160ec1835387690 Mon Sep 17 00:00:00 2001 From: vguanyiwgd Date: Wed, 10 Apr 2024 15:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9index6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id02d52a7bf98353c557562dba4a8748471370ecc --- .../api/controllers/api/Dishes.php | 26 ++++++++++++------- m/js/main.js | 4 +-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/backstage/application/api/controllers/api/Dishes.php b/backstage/application/api/controllers/api/Dishes.php index 17eea0b..14d47f9 100644 --- a/backstage/application/api/controllers/api/Dishes.php +++ b/backstage/application/api/controllers/api/Dishes.php @@ -832,6 +832,8 @@ class Dishes extends REST_Controller // $month = date('n', $date); // $day = date('j', $date); // $date_text = $month . '月' . $day . '日' . '(周' . cnWeek($date) . ')'; + + // 遍历每个dc_date foreach ($date_dish_list as $book_k => $book_v) { $date_id = $book_v['id']; @@ -846,7 +848,7 @@ class Dishes extends REST_Controller $dishes = $this->sort_dishes($dishes, '' , $dining_hall_id, $date_id, 0); $explode = explode(')', $book_v['jcname']); - $meal_list[$explode[1]]['cs'] = $dishes; +// $meal_list[$explode[1]]['cs'] = $dishes; // $date_dish_list[$book_k]['jcname'] = str_replace($date_text, '', $book_v['jcname']); $dishes_type_num = 0; @@ -856,15 +858,20 @@ class Dishes extends REST_Controller $dishes_type_num += $cItem['num']; } } - $cart_arr[$book_v['dc_date']] += $dishes_type_num; +// $cart_arr[$book_v['dc_date']] += $dishes_type_num; // } - if(!empty($meal_list)){ - $jcmeal[$book_v['dc_date']] = array( - 'cart_num' => $cart_arr[$book_v['dc_date']], - 'meal_list' => $meal_list, - 'active' => $book_v['dc_date'] == $date_get ? 1 : 0 - ); - } +// if(!empty($meal_list)){ + + $jcmeal[$book_v['dc_date']]['cart_num'] += $dishes_type_num; + $jcmeal[$book_v['dc_date']]['active'] = $book_v['dc_date'] == $date_get ? 1 : 0; + $jcmeal[$book_v['dc_date']]['meal_list'][$explode[1]] = $dishes; + +// $jcmeal[$book_v['dc_date']] = array( +// 'cart_num' => $cart_arr[$book_v['dc_date']], +// 'active' => $book_v['dc_date'] == $date_get ? 1 : 0 +// ); +// $jcmeal[$book_v['dc_date']]['meal_list'][$explode[1]][] = $dishes; +// } } $data['date'] = $date_get; @@ -872,7 +879,6 @@ class Dishes extends REST_Controller ksort($jcmeal); $data['jcdata'] = array( 'jcplace' => $dining_hall_info, - 'jcdate' => $date_key, 'jcmeal' => $jcmeal ); diff --git a/m/js/main.js b/m/js/main.js index 05aa419..2480296 100644 --- a/m/js/main.js +++ b/m/js/main.js @@ -2406,8 +2406,8 @@ $(function () { $.each(meal_list, function (d, date) { var look_li = ''; var cs_li = ''; - if (date['cs'].length > 0) { - $.each(date['cs'], function (i, cs) { + if (date.length > 0) { + $.each(date, function (i, cs) { if (cs.book_type != '2') { var addClass =