service == '') { $this->service = new AroundService(); } return $this->service; } /** * Function Description:周边游列表获取 * Function Name: getListAction *传入area_id page limit * @return string * * @author 娄梦宁 */ public function getListAction(){ if(Util::checkPattern('intVal',$_POST['cityid']) && $_POST['limit']) { $page=isset($_POST['page'])?($_POST['page']-1)*5:1; $getaround=$this->getService()->getlist($_POST['cityid'],$page,$_POST['limit']); return json_encode($getaround); } return Util::returnJsEr('参数错误'); } /** * Function Description:周边游详情 * Function Name: getDetaileAction * * * @author 娄梦宁 */ public function getDetaileAction(){ if(Util::checkPattern('intVal',$_POST['pro_id'])){ $result=$this->getService()->getdetaile($_POST['pro_id']); return json_encode($result); } return Util::returnJsEr('参数错误'); } /** * Function Description:周边游下订单页面 * Function Name: getOrderAction * * @return string * * @author 娄梦宁 */ public function getOrderAction(){ $checkLogin = LoginTool::checkLogin();//校验用户登录状态 if($checkLogin['flag'] == false) { return json_encode($checkLogin); } if(Util::checkPattern('intVal',$_POST['pro_id']) && Util::checkPattern('date',$_POST['date']) && $_POST['p_num']){ if($_POST['p_num']>20){ return Util::returnJsEr('库存不足,请重新选择人数'); } $result=$this->getService()->getorder($_POST['pro_id'],$_POST['date'],$_POST['p_num']); return json_encode($result); } return Util::returnJsEr('参数错误'); } /** * Function Description:周边游价格日期接口 * Function Name: getDateAction * * @return string * * @author 娄梦宁 */ public function getDateAction(){ if(Util::checkPattern('intVal',$_POST['pro_id'] )){ $result=$this->getService()->getdate($_POST['pro_id']); return json_encode($result); } return Util::returnJsEr('参数错误'); } /** * Function Description:周边游下订单接口 * Function Name: getDateAction * * @return string * * @author 娄梦宁 */ public function makeOrderAction() { $checkLogin = LoginTool::checkLogin();//校验用户登录状态 if($checkLogin['flag'] == false) { return json_encode($checkLogin); } $time = time(); session_start(); if (($time - $_SESSION['expire_time'] < 3)) { return Util::returnJsEr('请勿重复点击!','','','10001'); } else { $_SESSION['expire_time'] = $time; session_write_close(); } $user_id =LoginTool::$userId; $ticketInfo = array( 'para_user_id'=>$user_id, 'para_line_id'=>$_POST['pro_id'], 'para_start_date'=>$_POST['start_date'], 'para_count'=>$_POST['p_num'], 'para_contact'=>'{'.$_POST['customer_name'].",".$_POST['customer_moble'].'}', 'para_remark'=>$_POST['remark'], 'para_price'=>$_POST['price']/$_POST['p_num'] ); $result=$this->getService()->makeOrder($ticketInfo); return json_encode($result); } }