|
- <?php
- /**
- *上门接
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 倪宗锋
- * PhpStorm ShuttleController.php
- * Create By 2017/7/3 15:03 $
- */
-
- namespace zzcx\controllers\home;
-
-
- use common\util\Util;
- use yii\web\Controller;
- use zzcx\service\home\Shuttle;
-
- class ShuttleController extends Controller
- {
- public $service = null;
-
- public function service()
- {
- if ($this->service == null) {
- $this->service = new Shuttle();
- }
- return $this->service;
- }
-
- /**
- * Des:获取行程信息及坐标
- * Name: actionGetInfo
- * @return string
- * @author 倪宗锋
- */
- public function actionGetInfo()
- {
- $params = [
- 'travel_id' => $this->_post('travel_id', '')//行程ID
- ];
- $getInfo = $this->service()->getTravelInfo($params);//获取行程信息及坐标
- if ($getInfo['flag'] == false) {
- return Util::returnJsEr($getInfo['msg']);
- }
- return Util::returnJsSu('', $getInfo['data']);
- }
-
- /**
- * Des:获取价格
- * Name: actionGetPrice
- * @return string
- * @author 倪宗锋
- */
- public function actionGetPrice()
- {
- $params = [
- 'start_longitude' => $this->_post('start_longitude', ''),//上车点经度
- 'start_latitude' => $this->_post('start_latitude', ''),//上车点纬度
- 'end_longitude' => $this->_post('end_longitude', ''),//下车点经度
- 'end_latitude' => $this->_post('end_latitude', '')//下车点纬度
- ];
- $getPrice = $this->service()->getPrice($params);
- return json_encode($getPrice);
- }
-
- /**
- * Des:下单
- * Name: actionMakeOrder
- * @return string
- * @author 倪宗锋
- */
- public function actionMakeOrder()
- {
- $params = [
- 'start_longitude' => $this->_post('start_longitude', ''),//上车点经度
- 'start_latitude' => $this->_post('start_latitude', ''),//上车点纬度
- 'travel_id' => $this->_post('travel_id', ''),//行程ID
- 'start_area' => $this->_post('start_area', ''),//起始地点
- 'cnt' => $this->_post('cnt', 1),//默认一人乘车
- ];
- $makeOrder = $this->service()->makeOrder($params);
- return json_encode($makeOrder);
- }
-
- }
|