Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

OrdersModel.php 5.1 KiB

před 3 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 娄梦宁
  12. * PhpStorm OrdersModel.php
  13. * Create By 2016/11/29 9:44 $
  14. */
  15. namespace Order\Model;
  16. use Base\Tool\DbTable;
  17. class OrdersModel extends DbTable
  18. {
  19. public $db = 'CST';
  20. /**
  21. * Function Description:订单列表
  22. * Function Name: getList
  23. * @param $arr
  24. *
  25. * @return array
  26. *
  27. * @author 娄梦宁
  28. */
  29. public function getList($arr){
  30. $userId=$arr['userId'];
  31. if($arr['order_status']==0){
  32. $type="in(145,146,147,148)";
  33. }else{
  34. $type='='.$arr['order_status'];
  35. }
  36. $limit=$arr['limit'];
  37. $page=$arr['page'];
  38. $page=($page-1)*$limit;
  39. $sql=""."SELECT
  40. c.run_date as start_date,
  41. c.parent_order_id as order_id,
  42. c.create_time,
  43. c.order_status,
  44. c.PROD_START_STATION_res_NAME AS start_res_name,
  45. c.PROD_end_STATION_res_NAME AS end_res_name,
  46. (select FLOOR(order_price) from order_main a where a.member_id=$userId and a.order_id=c.parent_order_id and a.ORDER_PROD_TYPE != 25 ) order_price,
  47. c.PROD_START_STATION_TIME AS start_time,
  48. c.PROD_START_STATION_AREA_name AS start_area_name,
  49. c.PROD_end_STATION_AREA_name AS end_area_name,
  50. IFNULL(d.id,0) as to_from
  51. FROM
  52. order_main c
  53. LEFT JOIN opera_line b ON c.PARENT_PROD_ID = b.line_id
  54. left join to_from d on d.to_orderid=c.PARENT_ORDER_ID or d.back_orderid=c.PARENT_ORDER_ID
  55. WHERE
  56. b.cancel_flag = 0
  57. AND c.member_id = $userId
  58. AND c.ORDER_STATUS $type
  59. and c.order_prod_type <>369
  60. and c.PARENT_ORDER_ID <>0
  61. GROUP BY
  62. c.parent_order_id
  63. ORDER BY
  64. c.create_time desc
  65. LIMIT $page,$limit ";
  66. $result=$this->fetchAll($sql);
  67. return $result;
  68. }
  69. /**
  70. * Function Description:判断往返程,
  71. * Function Name: getBack
  72. * @param $order_id
  73. *
  74. * @return array
  75. *
  76. * @author 娄梦宁
  77. */
  78. public function getBack($order_id){
  79. $sql=""."select to_orderid,back_orderid from to_from where to_orderid=$order_id or back_orderid=$order_id ";
  80. $result=$this->fetchRow($sql);
  81. return $result;
  82. }
  83. /**
  84. * Function Description:获取订单详情
  85. * Function Name: getDetaile
  86. * @param $order_id
  87. *
  88. * @return array
  89. *
  90. * @author 娄梦宁
  91. */
  92. public function getDetaile($order_id){
  93. $sql=""."SELECT
  94. c.run_date as start_date,
  95. a.order_id,
  96. a.create_time,
  97. a.order_status,
  98. c.PROD_START_STATION_res_NAME AS start_res_name,
  99. c.PROD_end_STATION_res_NAME AS end_res_name,
  100. substring_index(
  101. substring_index(a.ORDER_DESCRIPTION, ',' ,- 1),
  102. '|',
  103. 1
  104. ) AS pcount,
  105. c.prod_name AS seat_type,
  106. a.customer_name,
  107. a.customer_mobile,
  108. floor(a.order_price) AS order_price,
  109. c.PROD_START_STATION_TIME AS start_time,
  110. c.PROD_end_STATION_TIME AS end_time,
  111. c.PROD_START_STATION_AREA_NAME AS start_area_name,
  112. c.PROD_END_STATION_AREA_NAME AS end_area_name,
  113. c.order_prod_type
  114. FROM
  115. order_main a
  116. LEFT JOIN order_main c ON c.PARENT_ORDER_ID = a.order_id
  117. LEFT JOIN opera_line b ON c.PARENT_PROD_ID = b.line_id
  118. WHERE
  119. a.cancel_flag = 0
  120. AND b.cancel_flag = 0
  121. AND a.order_id IN ($order_id)
  122. GROUP BY
  123. a.order_id
  124. ORDER BY
  125. a.order_id";
  126. $result=$this->fetchAll($sql);
  127. return $result;
  128. }
  129. /**
  130. * Function Description:客运班线获取出行人数组
  131. * Function Name: getCustomer
  132. * @param $order_id
  133. *
  134. * @return array
  135. *
  136. * @author 娄梦宁
  137. */
  138. public function getCustomer($order_id){
  139. $sql=''."SELECT
  140. customer_name,
  141. customer_id_no as customer_idcard
  142. FROM
  143. order_main
  144. WHERE
  145. PARENT_ORDER_ID = $order_id";
  146. $result=$this->fetchAll($sql);
  147. return $result;
  148. }
  149. }