service == '') { $this->service = new OrderService(); } return $this->service; } /** * Function Description:获取初始化数据 * Function Name: getRunDetailAction * * @return string * * @author 张帅 */ public function getRunDetailAction() { $run_id = $this->_post('run_id');//758343; $start_area_id = $this->_post('start_area_id');//3256 $end_area_id = $this->_post('end_area_id');//791 $channel_id = $this->_post('channel_id', 164); if (empty($run_id) || empty($start_area_id) || empty($end_area_id)) { return Util::returnJsEr('参数不全'); } $run_detail = $this->getService()->getRunDetail($run_id, $start_area_id, $end_area_id, $channel_id); return json_encode($run_detail); } /** * Function Description:通过上车站点获取班次详情 * Function Name: getRunDetailByStartAction * * @return string * * @author 张帅 */ public function getRunDetailByStartAction() { $run_id = $this->_post('run_id');//758343; $start_res_id = $this->_post('start_res_id');//9193; $end_area_id = $this->_post('end_area_id');//791; $channel_id = $this->_post('channel_id', 164); if (empty($run_id) || empty($start_res_id) || empty($end_area_id)) { return Util::returnJsEr('参数不全'); } $run_detail = $this->getService()->getRunDetailByStart($run_id, $start_res_id, $end_area_id, $channel_id); return json_encode($run_detail); } /** * Function Description:通过下车站点获取班次详情 * Function Name: getRunDetailByEndAction * * @return string * * @author 张帅 */ public function getRunDetailByEndAction() { $run_id = $this->_post('run_id');//758343 $start_res_id = $this->_post('start_res_id');//9193; $end_res_id = $this->_post('end_res_id');//6; $channel_id = $this->_post('channel_id', 164); if (empty($run_id) || empty($start_res_id) || empty($end_res_id)) { return Util::returnJsEr('参数不全'); } $run_detail = $this->getService()->getRunDetailByEnd($run_id, $start_res_id, $end_res_id, $channel_id); return json_encode($run_detail); } /** * Function Description:添加乘客人信息 * Function Name: addCustomerAction * * @return string * * @author 张帅 */ public function addCustomerAction() { $checkLogin = LoginTool::checkLogin(); if ($checkLogin['flag'] == false) { return json_encode($checkLogin); } $customer_name = $this->_post('customer_name');//乘客姓名 $customer_id_card = $this->_post('customer_id_card');//乘客身份证 $customer_card_type = $this->getService()->isCardID($customer_id_card); if (empty($customer_name) || empty($customer_id_card)) { return Util::returnJsEr('参数不全或身份证格式不正确'); } if (!$customer_card_type['flag']) { return json_encode($customer_card_type); } $result = $this->getService()->addCustomer($customer_name, $customer_id_card); return $result; } /** * Function Description:修改联系人信息 * Function Name: uptCustomerAction * * @return string * * @author 娄梦宁 */ public function uptCustomerAction() { $checkLogin = LoginTool::checkLogin(); if ($checkLogin['flag'] == false) { return json_encode($checkLogin); } $customer_id = $this->_post('customer_id');//联系人id $customer_name = $this->_post('customer_name');//乘客姓名 $customer_id_card = $this->_post('customer_id_card');//乘客身份证 $customer_card_type = $this->getService()->isCardID($customer_id_card); if (empty($customer_name) || empty($customer_id_card)) { return Util::returnJsEr('参数不全或身份证格式不正确'); } if (!$customer_card_type['flag']) { return json_encode($customer_card_type); } $result = $this->getService()->uptCustomer($customer_name, $customer_id_card, $customer_id); return json_encode($result); } /** * Function Description:获取乘客人信息 * Function Name: getCustomerListAction * * @return mixed * * @author 张帅 */ public function getCustomerListAction() { $checkLogin = LoginTool::checkLogin(); if ($checkLogin['flag'] == false) { return json_encode($checkLogin); } $result = $this->getService()->getCustomerList(); return $result; } /** * Function Description:提交订单 * Function Name: submitOrder * * * @author 张帅 */ public function submitOrderAction() { // //校验登录 $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(); } $siteContentConfig = Util::getSiteContantsConfig(); //获取参数 $params = array( 'channel_id' => $siteContentConfig['org_id'],//渠道商ID 'channel_order_id' => $this->_post('channel_order_id', 0), 'ticket_info' => $this->_post('ticket_info'), 'customer_info' => $this->_post('customer_info'), 'pay_type' => $this->_post('pay_type', '278'),//微信支付 ); if (empty($params['ticket_info']) || empty($params['customer_info'])) { return Util::returnJsEr('购票信息或乘客信息不全'); } //提交订单 $result = $this->getService()->submitOrder($params); return json_encode($result); } /** * Function Description:修改订单状态 * Function Name: updateOrderStatusAction * * @return mixed|string * * @author 张帅 */ public function updateOrderStatusAction() { $order_id = $this->_post('order_id'); $pay_num = $this->_post('pay_num'); if (empty($order_id) || empty($pay_num)) { return Util::returnJsEr('参数不全'); } $result = $this->getService()->updateOrderStatus($order_id, $pay_num); ob_clean(); return json_encode($result); } /** * Function Description:退票 * Function Name: cancelOrderAction * * @return string * * @author 张帅 */ public function cancelOrderAction() { $checkLogin = LoginTool::checkLogin();//校验用户登录状态 if ($checkLogin['flag'] == false) { return json_encode($checkLogin); } $order_id = $this->_post('order_id'); if (empty($order_id)) { return Util::returnJsEr('参数不全'); } $result = $this->getService()->cancelOrder($order_id); return $result; } /** * Function Description:退款 * Function Name: cancelPay * * * @author 张帅 */ public function cancelPayAction() { $order_id = $this->_post('order_id'); if (empty($order_id)) { return Util::returnJsEr('参数不全'); } $result = $this->getService()->cancelPay($order_id); ob_clean(); return $result; } }