getlist($hotel_name, $begin, $page_size); $data = array(); $data['info'] = $res['info']; $data['code'] = $res['code']; $data['hotel_list'] = $res['rowset']; $data['current'] = $current; $data['page_size'] = $page_size; $data['total'] = $res['total']; $data['total_page'] = $res['total_page']; return $data; } //修改酒店停售 public function stopsell() { $id = $_POST['id']; $ST = new HotellistAction(); $res = $ST->stopsell($id); $data = array(); if ($res['code'] != '0') { $data['code'] = $res['code']; $data['info'] = "停售失败"; // var_dump($data); return $data; } else { $data['code'] = $res['code']; $data['info'] = "停售成功"; // var_dump($data); return $data; } } //修改酒店在售 public function onsell() { $id = $_POST['id']; $ST = new HotellistAction(); $res = $ST->onsell($id); $data = array(); // var_dump($res); if ($res['code'] != '0') { $data['code'] = $res['code']; $data['info'] = "开售失败"; // var_dump($data); return $data; } else { $data['code'] = $res['code']; $data['info'] = "开售成功"; // var_dump($data); return $data; } } //酒店信息 public function getDetail(){ $id = $_POST['hotel_id']; $ST = new HotellistAction(); $res = $ST->getDetail($id); $data = array(); if ($res['code'] != '0') { $data['code'] = $res['code']; $data['info'] = "获取酒店数据失败"; return $data; } else { return $res; } } } $op = $_REQUEST['op']; $obj = new HotelList(); if ($op == 1) { $data = $obj->showlist(); } elseif ($op == 2) { $data = $obj->stopsell(); } elseif ($op == 3) { $data = $obj->onsell(); } elseif (method_exists($obj, $op)){ $data = call_user_func(array($obj, $op)); } echo json_encode($data);