Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

OrderController.php 8.6 KiB

vor 3 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 张帅
  12. * PhpStorm OrderController.php
  13. * Create By 2016/11/16 17:11 $
  14. */
  15. namespace Order\Controller;
  16. use Base\Tool\LoginTool;
  17. use Order\Service\OrderService;
  18. use Util\Controller\MvcController;
  19. use Util\Util\Util;
  20. class OrderController extends MvcController
  21. {
  22. private $service;
  23. /**
  24. * Function Description:
  25. * Function Name: getService
  26. *
  27. * @return OrderService
  28. *
  29. * @author 张帅
  30. */
  31. public function getService()
  32. {
  33. if ($this->service == '') {
  34. $this->service = new OrderService();
  35. }
  36. return $this->service;
  37. }
  38. /**
  39. * Function Description:获取初始化数据
  40. * Function Name: getRunDetailAction
  41. *
  42. * @return string
  43. *
  44. * @author 张帅
  45. */
  46. public function getRunDetailAction()
  47. {
  48. $run_id = $this->_post('run_id');//758343;
  49. $start_area_id = $this->_post('start_area_id');//3256
  50. $end_area_id = $this->_post('end_area_id');//791
  51. $channel_id = $this->_post('channel_id', 164);
  52. if (empty($run_id) || empty($start_area_id) || empty($end_area_id)) {
  53. return Util::returnJsEr('参数不全');
  54. }
  55. $run_detail = $this->getService()->getRunDetail($run_id, $start_area_id, $end_area_id, $channel_id);
  56. return json_encode($run_detail);
  57. }
  58. /**
  59. * Function Description:通过上车站点获取班次详情
  60. * Function Name: getRunDetailByStartAction
  61. *
  62. * @return string
  63. *
  64. * @author 张帅
  65. */
  66. public function getRunDetailByStartAction()
  67. {
  68. $run_id = $this->_post('run_id');//758343;
  69. $start_res_id = $this->_post('start_res_id');//9193;
  70. $end_area_id = $this->_post('end_area_id');//791;
  71. $channel_id = $this->_post('channel_id', 164);
  72. if (empty($run_id) || empty($start_res_id) || empty($end_area_id)) {
  73. return Util::returnJsEr('参数不全');
  74. }
  75. $run_detail = $this->getService()->getRunDetailByStart($run_id, $start_res_id, $end_area_id, $channel_id);
  76. return json_encode($run_detail);
  77. }
  78. /**
  79. * Function Description:通过下车站点获取班次详情
  80. * Function Name: getRunDetailByEndAction
  81. *
  82. * @return string
  83. *
  84. * @author 张帅
  85. */
  86. public function getRunDetailByEndAction()
  87. {
  88. $run_id = $this->_post('run_id');//758343
  89. $start_res_id = $this->_post('start_res_id');//9193;
  90. $end_res_id = $this->_post('end_res_id');//6;
  91. $channel_id = $this->_post('channel_id', 164);
  92. if (empty($run_id) || empty($start_res_id) || empty($end_res_id)) {
  93. return Util::returnJsEr('参数不全');
  94. }
  95. $run_detail = $this->getService()->getRunDetailByEnd($run_id, $start_res_id, $end_res_id, $channel_id);
  96. return json_encode($run_detail);
  97. }
  98. /**
  99. * Function Description:添加乘客人信息
  100. * Function Name: addCustomerAction
  101. *
  102. * @return string
  103. *
  104. * @author 张帅
  105. */
  106. public function addCustomerAction()
  107. {
  108. $checkLogin = LoginTool::checkLogin();
  109. if ($checkLogin['flag'] == false) {
  110. return json_encode($checkLogin);
  111. }
  112. $customer_name = $this->_post('customer_name');//乘客姓名
  113. $customer_id_card = $this->_post('customer_id_card');//乘客身份证
  114. $customer_card_type = $this->getService()->isCardID($customer_id_card);
  115. if (empty($customer_name) || empty($customer_id_card)) {
  116. return Util::returnJsEr('参数不全或身份证格式不正确');
  117. }
  118. if (!$customer_card_type['flag']) {
  119. return json_encode($customer_card_type);
  120. }
  121. $result = $this->getService()->addCustomer($customer_name, $customer_id_card);
  122. return $result;
  123. }
  124. /**
  125. * Function Description:修改联系人信息
  126. * Function Name: uptCustomerAction
  127. *
  128. * @return string
  129. *
  130. * @author 娄梦宁
  131. */
  132. public function uptCustomerAction()
  133. {
  134. $checkLogin = LoginTool::checkLogin();
  135. if ($checkLogin['flag'] == false) {
  136. return json_encode($checkLogin);
  137. }
  138. $customer_id = $this->_post('customer_id');//联系人id
  139. $customer_name = $this->_post('customer_name');//乘客姓名
  140. $customer_id_card = $this->_post('customer_id_card');//乘客身份证
  141. $customer_card_type = $this->getService()->isCardID($customer_id_card);
  142. if (empty($customer_name) || empty($customer_id_card)) {
  143. return Util::returnJsEr('参数不全或身份证格式不正确');
  144. }
  145. if (!$customer_card_type['flag']) {
  146. return json_encode($customer_card_type);
  147. }
  148. $result = $this->getService()->uptCustomer($customer_name, $customer_id_card, $customer_id);
  149. return json_encode($result);
  150. }
  151. /**
  152. * Function Description:获取乘客人信息
  153. * Function Name: getCustomerListAction
  154. *
  155. * @return mixed
  156. *
  157. * @author 张帅
  158. */
  159. public function getCustomerListAction()
  160. {
  161. $checkLogin = LoginTool::checkLogin();
  162. if ($checkLogin['flag'] == false) {
  163. return json_encode($checkLogin);
  164. }
  165. $result = $this->getService()->getCustomerList();
  166. return $result;
  167. }
  168. /**
  169. * Function Description:提交订单
  170. * Function Name: submitOrder
  171. *
  172. *
  173. * @author 张帅
  174. */
  175. public function submitOrderAction()
  176. {
  177. // //校验登录
  178. $checkLogin = LoginTool::checkLogin();
  179. if ($checkLogin['flag'] == false) {
  180. return json_encode($checkLogin);
  181. }
  182. $time = time();
  183. session_start();
  184. if (($time - $_SESSION['expire_time'] < 3)) {
  185. return Util::returnJsEr('请勿重复点击!','','','10001');
  186. } else {
  187. $_SESSION['expire_time'] = $time;
  188. session_write_close();
  189. }
  190. $siteContentConfig = Util::getSiteContantsConfig();
  191. //获取参数
  192. $params = array(
  193. 'channel_id' => $siteContentConfig['org_id'],//渠道商ID
  194. 'channel_order_id' => $this->_post('channel_order_id', 0),
  195. 'ticket_info' => $this->_post('ticket_info'),
  196. 'customer_info' => $this->_post('customer_info'),
  197. 'pay_type' => $this->_post('pay_type', '278'),//微信支付
  198. );
  199. if (empty($params['ticket_info']) || empty($params['customer_info'])) {
  200. return Util::returnJsEr('购票信息或乘客信息不全');
  201. }
  202. //提交订单
  203. $result = $this->getService()->submitOrder($params);
  204. return json_encode($result);
  205. }
  206. /**
  207. * Function Description:修改订单状态
  208. * Function Name: updateOrderStatusAction
  209. *
  210. * @return mixed|string
  211. *
  212. * @author 张帅
  213. */
  214. public function updateOrderStatusAction()
  215. {
  216. $order_id = $this->_post('order_id');
  217. $pay_num = $this->_post('pay_num');
  218. if (empty($order_id) || empty($pay_num)) {
  219. return Util::returnJsEr('参数不全');
  220. }
  221. $result = $this->getService()->updateOrderStatus($order_id, $pay_num);
  222. ob_clean();
  223. return json_encode($result);
  224. }
  225. /**
  226. * Function Description:退票
  227. * Function Name: cancelOrderAction
  228. *
  229. * @return string
  230. *
  231. * @author 张帅
  232. */
  233. public function cancelOrderAction()
  234. {
  235. $checkLogin = LoginTool::checkLogin();//校验用户登录状态
  236. if ($checkLogin['flag'] == false) {
  237. return json_encode($checkLogin);
  238. }
  239. $order_id = $this->_post('order_id');
  240. if (empty($order_id)) {
  241. return Util::returnJsEr('参数不全');
  242. }
  243. $result = $this->getService()->cancelOrder($order_id);
  244. return $result;
  245. }
  246. /**
  247. * Function Description:退款
  248. * Function Name: cancelPay
  249. *
  250. *
  251. * @author 张帅
  252. */
  253. public function cancelPayAction()
  254. {
  255. $order_id = $this->_post('order_id');
  256. if (empty($order_id)) {
  257. return Util::returnJsEr('参数不全');
  258. }
  259. $result = $this->getService()->cancelPay($order_id);
  260. ob_clean();
  261. return $result;
  262. }
  263. }