|
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 倪宗锋
- * PhpStorm JourneyController.php
- * Create By 2016/11/17 11:38 $
- */
-
- namespace WeChatUser\Controller;
-
- use Base\Tool\LoginTool;
- use Order\Model\OrderCheckTickets;
- use Model\Model\OrderMain;
- use Base\Tool\Tool;
- use Util\Controller\MvcController;
- use Order\Service\OrderService;
- use WeChatUser\Model\User;
- use Util\Util\Util;
- use WeChatUser\Service\JourneyService;
-
- class JourneyController extends MvcController
- {
- private $service;
-
- public function __construct()
- {
- parent::__construct();
- }
-
- /**
- * Function Description:获取Service
- * Function Name: getService
- *
- * @return JourneyService
- *
- * @author 张帅
- */
- public function getService(){
- if($this->service == '') {
- $this->service = new JourneyService();
- }
- return $this->service;
- }
-
- /**
- * User: wangxj
- *
- * 绑定订单
- *
- * @params
- *
- * @return string
- */
- public function bindAction(){
- $checkLogin = LoginTool::checkLogin();
- if($checkLogin['flag'] == false) {
- return json_encode($checkLogin);
- }
- $user = new User();
- $para_order_id = $this->_post('para_order_id');
- $para_tel = $this->_post('para_tel');
- //微信openid
- $para_open_id = $user->getWeChatOpenId(LoginTool::$userId);
- $result = $user->bindOrder($para_order_id, $para_tel, $para_open_id, LoginTool::$userId)
- ;
-
- return Util::returnJsSu('', $result);
- }
-
- /**
- * User: wangxj
- *
- * 获取行程列表
- *
- * @return array ['flag'=> true, 'msg'=> '信息提示', 'code'=> 3, 'data'=>[['type'=>1,'order_id'=>'113214', 'run_date'=>'2016-11-11', 'run_time'=>'08:46',
- * 'minutes'=>70, 'start_res_area_name'=>'上海',' start_res_name '=>'**集散中心',' end_res_area_name '=>'乌镇',' end_res_name '=>'西栅1号停车场',' e_ticket:'=>'9827988923',' line_name '=>'',' line_add '=>''],[...]]
- */
- public function getListAction(){
- $checkLogin = LoginTool::checkLogin();
- if($checkLogin['flag'] == false) {
- return json_encode($checkLogin);
- }
- $user = new User();
- $current_day = date("Y-m-d");
- $orderList = $user->getOrder(LoginTool::$userId, " o.order_status = 146 AND o.run_date >= '{$current_day}' ");
- return Util::returnJsSu('',$orderList);
- }
-
- /**
- * User: wangxj
- *
- * 获取电子车票二维码,根据订单号生成二维码和检票信息,返回二维码URL路径,订单信息
- *
- * @order_id
- *
- * @return string
- */
- public function getETicketAction(){
- $checkLogin = LoginTool::checkLogin();
- if($checkLogin['flag'] == false) {
- return json_encode($checkLogin);
- }
- $result = array();
- $order_id = $this->_post('order_id', '000000');
- $order = new OrderMain();
- $order = $order->getOrderDetail($order_id);
- $result['date'] = $order['RUN_DATE'];
- $result['time'] = $order['RUN_TIME'];
- $ticket = new OrderCheckTickets();
- $ticket = $ticket->getTicket($order_id);
- $result['status'] = $ticket['status']==1?true:false;
-
- if($order['RUN_DATE'] == date('Y-m-d', time())){
- $week = '今天';
- }
- else{
- $week = Tool::getWeek($order['RUN_DATE']);
- }
-
-
- $result['week'] = $week;
- $result['start_res_area_name'] = $order['PROD_START_STATION_AREA_NAME'];
- $result['start_res_name'] = $order['PROD_START_STATION_RES_NAME'];
- $result['end_res_area_name'] = $order['PROD_END_STATION_AREA_NAME'];
- $result['end_res_name'] = $order['PROD_END_STATION_RES_NAME'];
-
- $order = new OrderMain();
- $count = $order->getOrderCount($order_id);
- $result['count'] = $count;
-
- $ser = new OrderService();
- $result['eurl'] = $ser->getETicket($order_id);
-
- return Util::returnJsSu('',$result);
- }
-
- /**
- * Function Description:我要找车
- * Function Name: findCarAction
- *
- * @return string
- *
- * @author 张帅
- */
- public function findCarAction(){
- // $checkLogin = LoginTool::checkLogin();
- // if($checkLogin['flag'] == false) {
- // return json_encode($checkLogin);
- // }
- $order_id = $this->_post('order_id');//订单id
- $run_date = $this->_post('run_date');//出行日期
- if(empty($order_id) || empty($run_date)){
- return Util::returnJsEr('参数不全');
- }
- $result = $this->getService()->findCar($order_id,$run_date);
- return $result;
- }
-
- }
|