Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

AroundController.php 4.0 KiB

3 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 娄梦宁
  12. * PhpStorm AroundController.php
  13. * Create By 2016/11/10 13:23 $
  14. */
  15. namespace Around\Controller;
  16. use Around\Service\AroundService;
  17. use Base\Tool\LoginTool;
  18. use Util\Util\Util;
  19. class AroundController
  20. {
  21. private $service;
  22. public function getService(){
  23. if($this->service == '') {
  24. $this->service = new AroundService();
  25. }
  26. return $this->service;
  27. }
  28. /**
  29. * Function Description:周边游列表获取
  30. * Function Name: getListAction
  31. *传入area_id page limit
  32. * @return string
  33. *
  34. * @author 娄梦宁
  35. */
  36. public function getListAction(){
  37. if(Util::checkPattern('intVal',$_POST['cityid']) && $_POST['limit']) {
  38. $page=isset($_POST['page'])?($_POST['page']-1)*5:1;
  39. $getaround=$this->getService()->getlist($_POST['cityid'],$page,$_POST['limit']);
  40. return json_encode($getaround);
  41. }
  42. return Util::returnJsEr('参数错误');
  43. }
  44. /**
  45. * Function Description:周边游详情
  46. * Function Name: getDetaileAction
  47. *
  48. *
  49. * @author 娄梦宁
  50. */
  51. public function getDetaileAction(){
  52. if(Util::checkPattern('intVal',$_POST['pro_id'])){
  53. $result=$this->getService()->getdetaile($_POST['pro_id']);
  54. return json_encode($result);
  55. }
  56. return Util::returnJsEr('参数错误');
  57. }
  58. /**
  59. * Function Description:周边游下订单页面
  60. * Function Name: getOrderAction
  61. *
  62. * @return string
  63. *
  64. * @author 娄梦宁
  65. */
  66. public function getOrderAction(){
  67. $checkLogin = LoginTool::checkLogin();//校验用户登录状态
  68. if($checkLogin['flag'] == false) {
  69. return json_encode($checkLogin);
  70. }
  71. if(Util::checkPattern('intVal',$_POST['pro_id']) && Util::checkPattern('date',$_POST['date']) && $_POST['p_num']){
  72. if($_POST['p_num']>20){
  73. return Util::returnJsEr('库存不足,请重新选择人数');
  74. }
  75. $result=$this->getService()->getorder($_POST['pro_id'],$_POST['date'],$_POST['p_num']);
  76. return json_encode($result);
  77. }
  78. return Util::returnJsEr('参数错误');
  79. }
  80. /**
  81. * Function Description:周边游价格日期接口
  82. * Function Name: getDateAction
  83. *
  84. * @return string
  85. *
  86. * @author 娄梦宁
  87. */
  88. public function getDateAction(){
  89. if(Util::checkPattern('intVal',$_POST['pro_id'] )){
  90. $result=$this->getService()->getdate($_POST['pro_id']);
  91. return json_encode($result);
  92. }
  93. return Util::returnJsEr('参数错误');
  94. }
  95. /**
  96. * Function Description:周边游下订单接口
  97. * Function Name: getDateAction
  98. *
  99. * @return string
  100. *
  101. * @author 娄梦宁
  102. */
  103. public function makeOrderAction()
  104. {
  105. $checkLogin = LoginTool::checkLogin();//校验用户登录状态
  106. if($checkLogin['flag'] == false) {
  107. return json_encode($checkLogin);
  108. }
  109. $time = time();
  110. session_start();
  111. if (($time - $_SESSION['expire_time'] < 3)) {
  112. return Util::returnJsEr('请勿重复点击!','','','10001');
  113. } else {
  114. $_SESSION['expire_time'] = $time;
  115. session_write_close();
  116. }
  117. $user_id =LoginTool::$userId;
  118. $ticketInfo = array(
  119. 'para_user_id'=>$user_id,
  120. 'para_line_id'=>$_POST['pro_id'],
  121. 'para_start_date'=>$_POST['start_date'],
  122. 'para_count'=>$_POST['p_num'],
  123. 'para_contact'=>'{'.$_POST['customer_name'].",".$_POST['customer_moble'].'}',
  124. 'para_remark'=>$_POST['remark'],
  125. 'para_price'=>$_POST['price']/$_POST['p_num']
  126. );
  127. $result=$this->getService()->makeOrder($ticketInfo);
  128. return json_encode($result);
  129. }
  130. }