Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

212 linhas
6.5 KiB

  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm TravelController.php
  13. * Create By 2017/6/28 11:18 $
  14. */
  15. namespace zzcx\controllers\user;
  16. use common\Controller\ZzcxController;
  17. use common\models\OrderTravel;
  18. use common\service\login\LoginService;
  19. use common\util\Util;
  20. use zzcx\service\user\Travel;
  21. class TravelController extends ZzcxController
  22. {
  23. public $service = null;
  24. public function service()
  25. {
  26. if ($this->service == null) {
  27. $this->service = new Travel();
  28. }
  29. return $this->service;
  30. }
  31. /**
  32. * Des:添加评论
  33. * Name: actionAddTravel
  34. * @return string
  35. * @author 孙彤
  36. */
  37. public function actionAddTravel()
  38. {
  39. $param = [
  40. 'travel_id' => $this->_post('travel_id', ''),
  41. 'prod_id' => $this->_post('prod_id', ''),
  42. 'star' => $this->_post('star', ''),
  43. 'content' => $this->_post('content', '')
  44. ];
  45. $addFlag = $this->service()->AddTravel($param);
  46. if ($addFlag['flag'] == false) {
  47. return Util::returnJsEr($addFlag['msg']);
  48. }
  49. return Util::returnJsSu();
  50. }
  51. /**
  52. * Des:获取用户的行程列表
  53. * Name: actionGetTravelList
  54. * @return string
  55. * @author 倪宗锋
  56. */
  57. public function actionGetTravelList()
  58. {
  59. $params = [
  60. 'current_page' => $this->_post('current_page', 1),//分页
  61. 'page_size' => $this->_post('page_size', 10),//每页展示条数
  62. 'status_id' => $this->_post('status_id', 1),//每页展示条数
  63. 'u_id' => LoginService::$uid
  64. ];
  65. $getList = $this->service()->getTravelList($params);
  66. return Util::returnJsSu('', ['list' => $getList['data']]);
  67. }
  68. /**
  69. * Des:获取巴士定位
  70. * Name: actionGetBusPosition
  71. * @return string
  72. * @author 倪宗锋
  73. */
  74. public function actionGetBusPosition()
  75. {
  76. $param = [
  77. 'order_id' => $this->_post('order_id'),//订单ID
  78. 'travel_id' => $this->_post('travel_id'),//行程ID
  79. 'run_date' => $this->_post('run_date'),//出发时间
  80. 'action' => 'get_bus_position'
  81. ];
  82. $orderTravel = new OrderTravel();
  83. $getInfo = $orderTravel->getInfoByTravelId($param);
  84. if (empty($getInfo['cs_order_id'])) {
  85. return Util::returnJsSu('无效行程!');
  86. }
  87. $startTime = strtotime($getInfo['start_time_all']);
  88. $theTime = time();
  89. $canTel = true;
  90. if ($startTime - $theTime >= 900 || $theTime - $startTime >= 3600 * 12) {
  91. $canTel = false;
  92. }
  93. $getResult = Util::sendCs($param, '/api/wx/', 2);
  94. if ($getResult['flag'] == true) {
  95. $return = $getResult['data']['list'];
  96. $return['cantel'] = $canTel;
  97. return Util::returnJsSu('', $return);
  98. }
  99. return Util::returnJsEr($getResult['msg']);
  100. }
  101. /**
  102. * Des:发送短信通知
  103. * Name: actionSendTravelMsg
  104. * @return string
  105. * @author 倪宗锋
  106. */
  107. public function actionSendTravelMsg()
  108. {
  109. $param = [
  110. 'order_id' => $this->_post('order_id', 1013728),//订单ID
  111. 'flag' => 1,
  112. 'action' => 'wechat_click_message'
  113. ];
  114. $getResult = Util::sendCs($param, '/api/wx/', 2);
  115. if ($getResult['flag'] == true) {
  116. return Util::returnJsSu('');
  117. }
  118. return Util::returnJsEr($getResult['msg']);
  119. }
  120. /**
  121. * Des:预定短信通知
  122. * Name: actionBookTravelMsg
  123. * @return string
  124. * @author 倪宗锋
  125. */
  126. public function actionBookTravelMsg()
  127. {
  128. $param = [
  129. 'order_id' => $this->_post('order_id', 1013728),//订单ID
  130. 'flag' => 1,
  131. 'action' => 'appoint_send_message'
  132. ];
  133. $getResult = Util::sendCs($param, '/api/wx/', 2);
  134. if ($getResult['flag'] == true) {
  135. return Util::returnJsSu('');
  136. }
  137. return Util::returnJsEr($getResult['msg']);
  138. }
  139. /**
  140. * Des:选择页面初始化
  141. * Name: actionChoseSeat
  142. * @return string
  143. * @author 倪宗锋
  144. */
  145. public function actionInitChoseSeat()
  146. {
  147. $travel_id = (int)$this->_post('travel_id', '');//行程ID
  148. if (Util::checkPattern('intVal', $travel_id) == false) {
  149. return Util::returnJsEr('params error', '', 'trip_list.html');
  150. }
  151. $initChoseSeat = $this->service()->initChoseSeat($travel_id);
  152. if ($initChoseSeat['flag'] == true) {
  153. return Util::returnJsSu('', $initChoseSeat['data']);
  154. }
  155. return Util::returnJsEr($initChoseSeat['msg']);
  156. }
  157. /**
  158. * Des:选择座位
  159. * Name: actionChoseSeat
  160. * @return string
  161. * @author 倪宗锋
  162. */
  163. public function actionChoseSeat()
  164. {
  165. $travel_id = (int)$this->_post('travel_id', '');//行程ID
  166. $seq_id = trim($this->_post('seq_id', ''));//序号ID
  167. if (Util::checkPattern('intVal', $travel_id) == false) {
  168. return Util::returnJsEr('参数异常!');
  169. }
  170. if (empty($seq_id)) {
  171. return Util::returnJsEr('请选择座位!');
  172. }
  173. $choseSeat = $this->service()->choseSeat($travel_id, $seq_id);
  174. if ($choseSeat['flag'] == true) {
  175. return Util::returnJsSu('');
  176. }
  177. return Util::returnJsEr($choseSeat['msg']);
  178. }
  179. /**
  180. * Function Description:查看座位
  181. * Function Name: actionWatchSeats
  182. *
  183. * @return string
  184. *
  185. * @author 李健
  186. */
  187. public function actionWatchSeats()
  188. {
  189. $travel_id = (int)$this->_post('travel_id', '');//行程ID
  190. if (Util::checkPattern('intVal', $travel_id) == false) {
  191. return Util::returnJsEr('params error', '', '/web/zzcx/trip_list.html');
  192. }
  193. $watchSeat = $this->service()->watchSeat($travel_id);
  194. if ($watchSeat['flag'] == true) {
  195. return Util::returnJsSu('',$watchSeat['data']['data']);
  196. }
  197. return Util::returnJsEr($watchSeat['msg']);
  198. }
  199. }