Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MyTripController.php 3.2 KiB

3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 娄梦宁
  12. * PhpStorm MyTripController.php
  13. * Create By 2016/11/29 9:17 $
  14. */
  15. namespace MyTrip\Controller;
  16. use Base\Tool\LoginTool;
  17. use MyTrip\Service\MyTripService;
  18. use Util\Controller\MvcController;
  19. class MyTripController extends MvcController
  20. {
  21. private $service;
  22. public function getService(){
  23. if($this->service == '') {
  24. $this->service = new MyTripService();
  25. }
  26. return $this->service;
  27. }
  28. /**
  29. * Function Description:我的行程列表页
  30. * Function Name: indexAction
  31. *
  32. * @return string
  33. *
  34. * @author 娄梦宁
  35. */
  36. public function indexAction(){
  37. $checkLogin = LoginTool::checkLogin();//校验用户登录状态
  38. if($checkLogin['flag'] == false) {
  39. return json_encode($checkLogin);
  40. }
  41. $userId = LoginTool::$userId;
  42. $limit=empty($_POST['page_size']) ? 10 :$_POST['page_size'];
  43. $arr=array(
  44. 'userId'=>$userId,
  45. 'page'=>$_POST['current_page'],
  46. 'limit'=>$limit,
  47. 'type'=>$_POST['type']
  48. );
  49. $result=$this->getService()->indexList($arr);
  50. if($result['flag']==false && $result['msg']!='参数错误'){
  51. $result['data']=array(
  52. 'list'=>array(),
  53. 'page'=>array(
  54. 'current_page'=>$_POST['current_page'],
  55. 'page_size'=>$limit
  56. )
  57. );
  58. $result['flag']='true';
  59. }
  60. return json_encode($result);
  61. }
  62. /**
  63. * Function Description:获取电子票
  64. * Function Name: eticketAction
  65. *
  66. * @return string
  67. *
  68. * @author 娄梦宁
  69. */
  70. public function eticketAction(){
  71. $checkLogin = LoginTool::checkLogin();//校验用户登录状态
  72. if($checkLogin['flag'] == false) {
  73. return json_encode($checkLogin);
  74. }
  75. $userId = LoginTool::$userId;
  76. $arr=array(
  77. 'userId'=>$userId,
  78. 'order_id'=>$_POST['order_id']
  79. );
  80. $result=$this->getService()->getEticket($arr);
  81. return json_encode($result);
  82. }
  83. /**
  84. * Function Description:绑定行程
  85. * Function Name: tripBindAction
  86. *
  87. * @return string
  88. *
  89. * @author 娄梦宁
  90. */
  91. public function tripbindAction(){
  92. $checkLogin = LoginTool::checkLogin();//校验用户登录状态
  93. if($checkLogin['flag'] == false) {
  94. return json_encode($checkLogin);
  95. }
  96. $userId = LoginTool::$userId;
  97. $arr=array(
  98. 'userId'=>$userId,
  99. 'tel'=>$_POST['phone']
  100. );
  101. $result=$this->getService()->tripBind($arr);
  102. return json_encode($result);
  103. }
  104. }