update
Change-Id: I0902bd13d2f03b5da9ea78692aefe7765d7285c4
This commit is contained in:
parent
6f84de4e6e
commit
b98e7bccd9
|
@ -758,23 +758,22 @@ class Dishes extends REST_Controller
|
|||
// 当前展示的日期
|
||||
$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'];
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 就是cp的id, 改为日期(当前日期)
|
||||
if(empty($date_get)){
|
||||
$date_key = array_keys($date_list);
|
||||
$date_get = $date_key ? $date_key[0] : '';
|
||||
}
|
||||
// 就是cp的id, 改为日期(当前日期)
|
||||
// if(empty($date_get)){
|
||||
// $date_get = $date_key ? $date_key[0] : '';
|
||||
// }
|
||||
|
||||
$data['date'] = $date_get;
|
||||
|
||||
if(!$dishes_typesInfo[$dining_hall_id]) $dishes_typesInfo[$dining_hall_id] = $this->Dishes_model->get_dishes_type($this->user->type_id, 1, $this->user->area_id, $dining_hall_id);
|
||||
$dishes_types = $dishes_typesInfo[$dining_hall_id];
|
||||
|
@ -795,7 +794,8 @@ class Dishes extends REST_Controller
|
|||
|
||||
// 遍历左侧日期cp
|
||||
foreach ($date_list as $dc_date => $dateInfo) {
|
||||
if($date_get != $dc_date){
|
||||
if (!empty($date_get) && $date_get != $dc_date) {
|
||||
|
||||
foreach ($dateInfo as $dateInfo_k => $dateInfo_v) {
|
||||
$date_id = $dateInfo_v['id'];
|
||||
$dishes_type_num = 0;
|
||||
|
@ -813,6 +813,8 @@ class Dishes extends REST_Controller
|
|||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$dining_hall_ids = array_column($dining_halls, 'id');
|
||||
$key = array_search($dining_hall_id, $dining_hall_ids);
|
||||
$dining_hall_info = array();
|
||||
|
@ -820,29 +822,34 @@ class Dishes extends REST_Controller
|
|||
$dining_hall_info = (array)$dining_halls[$key];
|
||||
}
|
||||
|
||||
|
||||
// 获取当前日期的dc_type有什么菜式 -------------------
|
||||
$t_meal_dates = $this->get_meal_dates($type, $dining_hall_id, $max_book_date);
|
||||
$date_dish_list = $this->get_book_date($t_meal_dates);
|
||||
|
||||
$meal_list = array();
|
||||
|
||||
$date = strtotime($dc_date);
|
||||
$month = date('n', $date);
|
||||
$day = date('j', $date);
|
||||
$date_text = $month . '月' . $day . '日' . '(周' . cnWeek($date) . ')';
|
||||
// $date = strtotime($dc_date);
|
||||
// $month = date('n', $date);
|
||||
// $day = date('j', $date);
|
||||
// $date_text = $month . '月' . $day . '日' . '(周' . cnWeek($date) . ')';
|
||||
foreach ($date_dish_list as $book_k => $book_v) {
|
||||
$date_id = $book_v['id'];
|
||||
|
||||
if($book_v['dc_date'] == $dc_date){
|
||||
// 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'];
|
||||
}
|
||||
if(empty($dishes)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$dishes = $this->sort_dishes($dishes, '' , $dining_hall_id, $date_id, 0);
|
||||
|
||||
$explode = explode(')', $book_v['jcname']);
|
||||
$meal_list[$explode[1]]['cs'] = $dishes;
|
||||
$date_dish_list[$book_k]['jcname'] = str_replace($date_text, '', $book_v['jcname']);
|
||||
// $date_dish_list[$book_k]['jcname'] = str_replace($date_text, '', $book_v['jcname']);
|
||||
|
||||
$dishes_type_num = 0;
|
||||
foreach($userCartList as $cItem) {
|
||||
|
@ -852,17 +859,18 @@ class Dishes extends REST_Controller
|
|||
}
|
||||
}
|
||||
$cart_arr[$book_v['dc_date']] += $dishes_type_num;
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
if(!empty($meal_list)){
|
||||
$jcmeal[$dc_date] = array(
|
||||
'cart_num' => $cart_arr[$dc_date],
|
||||
$jcmeal[$book_v['dc_date']] = array(
|
||||
'cart_num' => $cart_arr[$book_v['dc_date']],
|
||||
'meal_list' => $meal_list,
|
||||
'active' => $dc_date == $date_get ? 1 : 0
|
||||
'active' => $book_v['dc_date'] == $date_get ? 1 : 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['date'] = $date_get;
|
||||
|
||||
$data['jcdata'] = array(
|
||||
'jcplace' => $dining_hall_info,
|
||||
'jcdate' => $date_key,
|
||||
|
|
Loading…
Reference in New Issue