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.
 
 
 
 
 
 

75 lines
3.0 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: luocj
  5. * Date: 2016/8/29
  6. * Time: 13:48
  7. */
  8. require_once __DIR__.'/common.php';
  9. class OrderInfo extends virtifyUsers
  10. {
  11. function getOrderInfo($userId)
  12. {
  13. $pdo = conn();
  14. //查询订单信息
  15. $sql = "select ORDER_ID,ORDER_PRICE,ORDER_DESCRIPTION,CREATE_TIME,CUSTOMER_NAME,CUSTOMER_MOBILE from ORDER_MAIN where CANCEL_FLAG = 0 AND PARENT_ORDER_ID = 0 and CREATE_USER_ID = '{$userId}'";
  16. $result = $pdo->query($sql);
  17. $price_info = $result->fetchAll(PDO::FETCH_ASSOC);
  18. foreach ($price_info as $k => $v) {
  19. $list_order_id[] = $v['ORDER_ID'];
  20. $res2[$v['ORDER_ID']] = $v;
  21. //$res_name[$v['order_id']] = $v['order_description'];
  22. }
  23. $list_orderid = implode($list_order_id, ',');
  24. $sql = "select DISTINCT ORDER_STATUS,PROD_START_STATION_RES_NAME,PROD_START_STATION_AREA_NAME,PROD_END_STATION_RES_NAME,PROD_END_STATION_AREA_NAME,RUN_DATE,RUN_TIME,PARENT_ORDER_ID
  25. FROM ORDER_MAIN WHERE cancel_flag = 0 AND parent_order_id in (" . $list_orderid . ") ";
  26. $result = $pdo->query($sql);
  27. $ticket_info = $result->fetchAll(PDO::FETCH_ASSOC);
  28. echo "<pre>";
  29. $children_info = array();
  30. foreach ($ticket_info as $v) {
  31. $children_info[$v['PARENT_ORDER_ID']] = $v;
  32. }
  33. $list = array();
  34. foreach ($list_order_id as $v) {
  35. $list[] = array(
  36. 'ORDER_ID' => $children_info[$v]['PARENT_ORDER_ID'],
  37. 'ORDER_STATUS' => $children_info[$v]['ORDER_STATUS'],
  38. 'PROD_START_STATION_RES_NAME' => $children_info[$v]['PROD_START_STATION_RES_NAME'],
  39. 'PROD_START_STATION_AREA_NAME' => $children_info[$v]['PROD_START_STATION_AREA_NAME'],
  40. 'PROD_END_STATION_RES_NAME' => $children_info[$v]['PROD_END_STATION_RES_NAME'],
  41. 'PROD_END_STATION_AREA_NAME' => $children_info[$v]['PROD_END_STATION_AREA_NAME'],
  42. 'RUN_DATE' => $children_info[$v]['RUN_DATE'],
  43. 'RUN_TIME' => $children_info[$v]['RUN_TIME'],
  44. 'ORDER_PRICE' => $res2[$v]['ORDER_PRICE'],
  45. 'ORDER_DESCRIPTION' => commonUtils::fomatStr($res2[$v]['ORDER_DESCRIPTION']), //order_description:普通座票(往返),2016-08-14,1|,如果需要觉得话,可以不用fomatStr处理即可
  46. 'CUSTOMER_NAME' => $res2[$v]['CUSTOMER_NAME'],
  47. 'CUSTOMER_MOBILE' => $res2[$v]['CUSTOMER_MOBILE'],
  48. // 'CREATE_TIME' => $res2[$v]['CREATE_TIME'], //获取下单的时间
  49. 'TIME_DIFF' => $children_info[$v]['ORDER_STATUS']==145?(strtotime( $res2[$v]['CREATE_TIME'] )-strtotime(date("Y-m-d H:i:s",time()))):''
  50. );
  51. }
  52. // return $list;
  53. return json_encode($list);
  54. }
  55. }
  56. $userId = isset($_POST['userID']) ? $_POST['userID'] : 46; //此处为测定userID,需要换成正式的
  57. if (!$userId) {
  58. return false;
  59. }
  60. $orderInfo = new OrderInfo();
  61. $res = $orderInfo->getOrderInfo($userId);
  62. //print_r($res);