getRoomList($hotel_id,$start_date,$sale_status,$current,$page_size); //date1 :库存类型id,库存类型str,total_count,已售,采购价,满 // foreach($data['room_list'] as $k=>$v){ // $temp1="";$temp2="";$temp3="";$temp4="";$temp5="";$temp6="";$temp7=""; // $date1=explode(',',$v['date1']); // $date2=explode(',',$v['date2']); // $date3=explode(',',$v['date3']); // $date4=explode(',',$v['date4']); // $date5=explode(',',$v['date5']); // $date6=explode(',',$v['date6']); // $date7=explode(',',$v['date7']); // //// echo json_encode($temp1);exit(); // $data['room_list'][$k]['date1']=$this->setTempByDate($date1); // $data['room_list'][$k]['date2']=$this->setTempByDate($date2); // $data['room_list'][$k]['date3']=$this->setTempByDate($date3); // $data['room_list'][$k]['date4']=$this->setTempByDate($date4); // $data['room_list'][$k]['date5']=$this->setTempByDate($date5); // $data['room_list'][$k]['date6']=$this->setTempByDate($date6); // $data['room_list'][$k]['date7']=$this->setTempByDate($date7); // } // $new_room_list=$data['room_list']; // $arr = array(); // // 将儿子加进父亲里面 // foreach($new_room_list as $k1=>$v1){ // if($v1['parent_room_type']=="0"){ // // // foreach($new_room_list as $k2=>$v2){ // if($v2['parent_room_type']==$v1['room_type']){ // $v1['child'][]=$v2; // $arr[]=$v1; // } // } // } // } // echo json_encode($arr);exit(); return $data; } // 处理一周的返回结果 function setTempByDate($date){ $temp['inventory_type']=isset($date[0])?$date[0]:"0"; $temp['inventory_type_str']=isset($date[1])?$date[1]:""; $temp['total_count']=isset($date[2])?$date[2]:"0"; $temp['sale_count']=isset($date[3])?$date[3]:"0"; $temp['base_price']=isset($date[4])?$date[4]:"0"; $temp['is_closed']=isset($date[5])?$date[5]:"0"; return $temp; } } $roomList=new RoomList; $data=array(); $data['code']="0"; $data['info']=""; $data=$roomList->getRoomList(); echo json_encode($data);