|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 倪宗锋
- * PhpStorm TravelController.php
- * Create By 2017/6/28 11:18 $
- */
-
- namespace zzcx\controllers\user;
-
- use common\Controller\ZzcxController;
- use common\models\OrderTravel;
- use common\service\login\LoginService;
- use common\util\Util;
- use zzcx\service\user\Travel;
-
- class TravelController extends ZzcxController
- {
-
- public $service = null;
-
- public function service()
- {
- if ($this->service == null) {
- $this->service = new Travel();
- }
- return $this->service;
- }
-
- /**
- * Des:添加评论
- * Name: actionAddTravel
- * @return string
- * @author 孙彤
- */
- public function actionAddTravel()
- {
- $param = [
- 'travel_id' => $this->_post('travel_id', ''),
- 'prod_id' => $this->_post('prod_id', ''),
- 'star' => $this->_post('star', ''),
- 'content' => $this->_post('content', '')
- ];
- $addFlag = $this->service()->AddTravel($param);
- if ($addFlag['flag'] == false) {
- return Util::returnJsEr($addFlag['msg']);
- }
- return Util::returnJsSu();
- }
-
- /**
- * Des:获取用户的行程列表
- * Name: actionGetTravelList
- * @return string
- * @author 倪宗锋
- */
- public function actionGetTravelList()
- {
- $params = [
- 'current_page' => $this->_post('current_page', 1),//分页
- 'page_size' => $this->_post('page_size', 10),//每页展示条数
- 'status_id' => $this->_post('status_id', 1),//每页展示条数
- 'u_id' => LoginService::$uid
- ];
- $getList = $this->service()->getTravelList($params);
- return Util::returnJsSu('', ['list' => $getList['data']]);
- }
-
- /**
- * Des:获取巴士定位
- * Name: actionGetBusPosition
- * @return string
- * @author 倪宗锋
- */
- public function actionGetBusPosition()
- {
- $param = [
- 'order_id' => $this->_post('order_id'),//订单ID
- 'travel_id' => $this->_post('travel_id'),//行程ID
- 'run_date' => $this->_post('run_date'),//出发时间
- 'action' => 'get_bus_position'
- ];
- $orderTravel = new OrderTravel();
- $getInfo = $orderTravel->getInfoByTravelId($param);
- if (empty($getInfo['cs_order_id'])) {
- return Util::returnJsSu('无效行程!');
- }
- $startTime = strtotime($getInfo['start_time_all']);
- $theTime = time();
- $canTel = true;
- if ($startTime - $theTime >= 900 || $theTime - $startTime >= 3600 * 12) {
- $canTel = false;
- }
- $getResult = Util::sendCs($param, '/api/wx/', 2);
- if ($getResult['flag'] == true) {
- $return = $getResult['data']['list'];
- $return['cantel'] = $canTel;
- return Util::returnJsSu('', $return);
- }
- return Util::returnJsEr($getResult['msg']);
- }
-
- /**
- * Des:发送短信通知
- * Name: actionSendTravelMsg
- * @return string
- * @author 倪宗锋
- */
- public function actionSendTravelMsg()
- {
- $param = [
- 'order_id' => $this->_post('order_id', 1013728),//订单ID
- 'flag' => 1,
- 'action' => 'wechat_click_message'
- ];
- $getResult = Util::sendCs($param, '/api/wx/', 2);
- if ($getResult['flag'] == true) {
- return Util::returnJsSu('');
- }
- return Util::returnJsEr($getResult['msg']);
- }
-
- /**
- * Des:预定短信通知
- * Name: actionBookTravelMsg
- * @return string
- * @author 倪宗锋
- */
- public function actionBookTravelMsg()
- {
- $param = [
- 'order_id' => $this->_post('order_id', 1013728),//订单ID
- 'flag' => 1,
- 'action' => 'appoint_send_message'
- ];
- $getResult = Util::sendCs($param, '/api/wx/', 2);
- if ($getResult['flag'] == true) {
- return Util::returnJsSu('');
- }
- return Util::returnJsEr($getResult['msg']);
- }
-
- /**
- * Des:选择页面初始化
- * Name: actionChoseSeat
- * @return string
- * @author 倪宗锋
- */
- public function actionInitChoseSeat()
- {
- $travel_id = (int)$this->_post('travel_id', '');//行程ID
- if (Util::checkPattern('intVal', $travel_id) == false) {
- return Util::returnJsEr('params error', '', 'trip_list.html');
- }
- $initChoseSeat = $this->service()->initChoseSeat($travel_id);
- if ($initChoseSeat['flag'] == true) {
- return Util::returnJsSu('', $initChoseSeat['data']);
- }
- return Util::returnJsEr($initChoseSeat['msg']);
- }
-
- /**
- * Des:选择座位
- * Name: actionChoseSeat
- * @return string
- * @author 倪宗锋
- */
- public function actionChoseSeat()
- {
- $travel_id = (int)$this->_post('travel_id', '');//行程ID
- $seq_id = trim($this->_post('seq_id', ''));//序号ID
- if (Util::checkPattern('intVal', $travel_id) == false) {
- return Util::returnJsEr('参数异常!');
- }
- if (empty($seq_id)) {
- return Util::returnJsEr('请选择座位!');
- }
- $choseSeat = $this->service()->choseSeat($travel_id, $seq_id);
- if ($choseSeat['flag'] == true) {
- return Util::returnJsSu('');
- }
- return Util::returnJsEr($choseSeat['msg']);
- }
-
- /**
- * Function Description:查看座位
- * Function Name: actionWatchSeats
- *
- * @return string
- *
- * @author 李健
- */
- public function actionWatchSeats()
- {
- $travel_id = (int)$this->_post('travel_id', '');//行程ID
- if (Util::checkPattern('intVal', $travel_id) == false) {
- return Util::returnJsEr('params error', '', '/web/zzcx/trip_list.html');
- }
- $watchSeat = $this->service()->watchSeat($travel_id);
- if ($watchSeat['flag'] == true) {
- return Util::returnJsSu('',$watchSeat['data']['data']);
- }
- return Util::returnJsEr($watchSeat['msg']);
- }
- }
|