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); } }