|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 张帅
- * PhpStorm OrderController.php
- * Create By 2016/11/16 17:11 $
- */
-
- namespace Order\Controller;
-
-
- use Base\Tool\LoginTool;
- use Order\Service\OrderService;
- use Util\Controller\MvcController;
- use Util\Util\Util;
-
- class OrderController extends MvcController
- {
- private $service;
-
- /**
- * Function Description:
- * Function Name: getService
- *
- * @return OrderService
- *
- * @author 张帅
- */
- public function getService()
- {
- if ($this->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;
- }
-
-
- }
|