You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

90 lines
2.7 KiB

  1. <?php
  2. /**
  3. *上门接
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm ShuttleController.php
  13. * Create By 2017/7/3 15:03 $
  14. */
  15. namespace zzcx\controllers\home;
  16. use common\util\Util;
  17. use yii\web\Controller;
  18. use zzcx\service\home\Shuttle;
  19. class ShuttleController extends Controller
  20. {
  21. public $service = null;
  22. public function service()
  23. {
  24. if ($this->service == null) {
  25. $this->service = new Shuttle();
  26. }
  27. return $this->service;
  28. }
  29. /**
  30. * Des:获取行程信息及坐标
  31. * Name: actionGetInfo
  32. * @return string
  33. * @author 倪宗锋
  34. */
  35. public function actionGetInfo()
  36. {
  37. $params = [
  38. 'travel_id' => $this->_post('travel_id', '')//行程ID
  39. ];
  40. $getInfo = $this->service()->getTravelInfo($params);//获取行程信息及坐标
  41. if ($getInfo['flag'] == false) {
  42. return Util::returnJsEr($getInfo['msg']);
  43. }
  44. return Util::returnJsSu('', $getInfo['data']);
  45. }
  46. /**
  47. * Des:获取价格
  48. * Name: actionGetPrice
  49. * @return string
  50. * @author 倪宗锋
  51. */
  52. public function actionGetPrice()
  53. {
  54. $params = [
  55. 'start_longitude' => $this->_post('start_longitude', ''),//上车点经度
  56. 'start_latitude' => $this->_post('start_latitude', ''),//上车点纬度
  57. 'end_longitude' => $this->_post('end_longitude', ''),//下车点经度
  58. 'end_latitude' => $this->_post('end_latitude', '')//下车点纬度
  59. ];
  60. $getPrice = $this->service()->getPrice($params);
  61. return json_encode($getPrice);
  62. }
  63. /**
  64. * Des:下单
  65. * Name: actionMakeOrder
  66. * @return string
  67. * @author 倪宗锋
  68. */
  69. public function actionMakeOrder()
  70. {
  71. $params = [
  72. 'start_longitude' => $this->_post('start_longitude', ''),//上车点经度
  73. 'start_latitude' => $this->_post('start_latitude', ''),//上车点纬度
  74. 'travel_id' => $this->_post('travel_id', ''),//行程ID
  75. 'start_area' => $this->_post('start_area', ''),//起始地点
  76. 'cnt' => $this->_post('cnt', 1),//默认一人乘车
  77. ];
  78. $makeOrder = $this->service()->makeOrder($params);
  79. return json_encode($makeOrder);
  80. }
  81. }