You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

166 lines
5.1 KiB

  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm JourneyController.php
  13. * Create By 2016/11/17 11:38 $
  14. */
  15. namespace WeChatUser\Controller;
  16. use Base\Tool\LoginTool;
  17. use Order\Model\OrderCheckTickets;
  18. use Model\Model\OrderMain;
  19. use Base\Tool\Tool;
  20. use Util\Controller\MvcController;
  21. use Order\Service\OrderService;
  22. use WeChatUser\Model\User;
  23. use Util\Util\Util;
  24. use WeChatUser\Service\JourneyService;
  25. class JourneyController extends MvcController
  26. {
  27. private $service;
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. }
  32. /**
  33. * Function Description:获取Service
  34. * Function Name: getService
  35. *
  36. * @return JourneyService
  37. *
  38. * @author 张帅
  39. */
  40. public function getService(){
  41. if($this->service == '') {
  42. $this->service = new JourneyService();
  43. }
  44. return $this->service;
  45. }
  46. /**
  47. * User: wangxj
  48. *
  49. * 绑定订单
  50. *
  51. * @params
  52. *
  53. * @return string
  54. */
  55. public function bindAction(){
  56. $checkLogin = LoginTool::checkLogin();
  57. if($checkLogin['flag'] == false) {
  58. return json_encode($checkLogin);
  59. }
  60. $user = new User();
  61. $para_order_id = $this->_post('para_order_id');
  62. $para_tel = $this->_post('para_tel');
  63. //微信openid
  64. $para_open_id = $user->getWeChatOpenId(LoginTool::$userId);
  65. $result = $user->bindOrder($para_order_id, $para_tel, $para_open_id, LoginTool::$userId)
  66. ;
  67. return Util::returnJsSu('', $result);
  68. }
  69. /**
  70. * User: wangxj
  71. *
  72. * 获取行程列表
  73. *
  74. * @return array ['flag'=> true, 'msg'=> '信息提示', 'code'=> 3, 'data'=>[['type'=>1,'order_id'=>'113214', 'run_date'=>'2016-11-11', 'run_time'=>'08:46',
  75. * 'minutes'=>70, 'start_res_area_name'=>'上海',' start_res_name '=>'**集散中心',' end_res_area_name '=>'乌镇',' end_res_name '=>'西栅1号停车场',' e_ticket:'=>'9827988923',' line_name '=>'',' line_add '=>''],[...]]
  76. */
  77. public function getListAction(){
  78. $checkLogin = LoginTool::checkLogin();
  79. if($checkLogin['flag'] == false) {
  80. return json_encode($checkLogin);
  81. }
  82. $user = new User();
  83. $current_day = date("Y-m-d");
  84. $orderList = $user->getOrder(LoginTool::$userId, " o.order_status = 146 AND o.run_date >= '{$current_day}' ");
  85. return Util::returnJsSu('',$orderList);
  86. }
  87. /**
  88. * User: wangxj
  89. *
  90. * 获取电子车票二维码,根据订单号生成二维码和检票信息,返回二维码URL路径,订单信息
  91. *
  92. * @order_id
  93. *
  94. * @return string
  95. */
  96. public function getETicketAction(){
  97. $checkLogin = LoginTool::checkLogin();
  98. if($checkLogin['flag'] == false) {
  99. return json_encode($checkLogin);
  100. }
  101. $result = array();
  102. $order_id = $this->_post('order_id', '000000');
  103. $order = new OrderMain();
  104. $order = $order->getOrderDetail($order_id);
  105. $result['date'] = $order['RUN_DATE'];
  106. $result['time'] = $order['RUN_TIME'];
  107. $ticket = new OrderCheckTickets();
  108. $ticket = $ticket->getTicket($order_id);
  109. $result['status'] = $ticket['status']==1?true:false;
  110. if($order['RUN_DATE'] == date('Y-m-d', time())){
  111. $week = '今天';
  112. }
  113. else{
  114. $week = Tool::getWeek($order['RUN_DATE']);
  115. }
  116. $result['week'] = $week;
  117. $result['start_res_area_name'] = $order['PROD_START_STATION_AREA_NAME'];
  118. $result['start_res_name'] = $order['PROD_START_STATION_RES_NAME'];
  119. $result['end_res_area_name'] = $order['PROD_END_STATION_AREA_NAME'];
  120. $result['end_res_name'] = $order['PROD_END_STATION_RES_NAME'];
  121. $order = new OrderMain();
  122. $count = $order->getOrderCount($order_id);
  123. $result['count'] = $count;
  124. $ser = new OrderService();
  125. $result['eurl'] = $ser->getETicket($order_id);
  126. return Util::returnJsSu('',$result);
  127. }
  128. /**
  129. * Function Description:我要找车
  130. * Function Name: findCarAction
  131. *
  132. * @return string
  133. *
  134. * @author 张帅
  135. */
  136. public function findCarAction(){
  137. // $checkLogin = LoginTool::checkLogin();
  138. // if($checkLogin['flag'] == false) {
  139. // return json_encode($checkLogin);
  140. // }
  141. $order_id = $this->_post('order_id');//订单id
  142. $run_date = $this->_post('run_date');//出行日期
  143. if(empty($order_id) || empty($run_date)){
  144. return Util::returnJsEr('参数不全');
  145. }
  146. $result = $this->getService()->findCar($order_id,$run_date);
  147. return $result;
  148. }
  149. }