|
- <?php
- /**
- * Created by PhpStorm.
- * User: luocj
- * Date: 2016/8/29
- * Time: 13:48
- */
- require_once __DIR__.'/common.php';
- class OrderInfo extends virtifyUsers
- {
- function getOrderInfo($userId)
- {
- $pdo = conn();
- //查询订单信息
- $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}'";
- $result = $pdo->query($sql);
- $price_info = $result->fetchAll(PDO::FETCH_ASSOC);
- foreach ($price_info as $k => $v) {
- $list_order_id[] = $v['ORDER_ID'];
- $res2[$v['ORDER_ID']] = $v;
- //$res_name[$v['order_id']] = $v['order_description'];
- }
- $list_orderid = implode($list_order_id, ',');
- $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
- FROM ORDER_MAIN WHERE cancel_flag = 0 AND parent_order_id in (" . $list_orderid . ") ";
- $result = $pdo->query($sql);
- $ticket_info = $result->fetchAll(PDO::FETCH_ASSOC);
- echo "<pre>";
- $children_info = array();
- foreach ($ticket_info as $v) {
- $children_info[$v['PARENT_ORDER_ID']] = $v;
- }
- $list = array();
- foreach ($list_order_id as $v) {
- $list[] = array(
- 'ORDER_ID' => $children_info[$v]['PARENT_ORDER_ID'],
- 'ORDER_STATUS' => $children_info[$v]['ORDER_STATUS'],
- 'PROD_START_STATION_RES_NAME' => $children_info[$v]['PROD_START_STATION_RES_NAME'],
- 'PROD_START_STATION_AREA_NAME' => $children_info[$v]['PROD_START_STATION_AREA_NAME'],
- 'PROD_END_STATION_RES_NAME' => $children_info[$v]['PROD_END_STATION_RES_NAME'],
- 'PROD_END_STATION_AREA_NAME' => $children_info[$v]['PROD_END_STATION_AREA_NAME'],
- 'RUN_DATE' => $children_info[$v]['RUN_DATE'],
- 'RUN_TIME' => $children_info[$v]['RUN_TIME'],
- 'ORDER_PRICE' => $res2[$v]['ORDER_PRICE'],
- 'ORDER_DESCRIPTION' => commonUtils::fomatStr($res2[$v]['ORDER_DESCRIPTION']), //order_description:普通座票(往返),2016-08-14,1|,如果需要觉得话,可以不用fomatStr处理即可
- 'CUSTOMER_NAME' => $res2[$v]['CUSTOMER_NAME'],
- 'CUSTOMER_MOBILE' => $res2[$v]['CUSTOMER_MOBILE'],
- // 'CREATE_TIME' => $res2[$v]['CREATE_TIME'], //获取下单的时间
- 'TIME_DIFF' => $children_info[$v]['ORDER_STATUS']==145?(strtotime( $res2[$v]['CREATE_TIME'] )-strtotime(date("Y-m-d H:i:s",time()))):''
- );
-
- }
- // return $list;
- return json_encode($list);
- }
-
-
- }
-
- $userId = isset($_POST['userID']) ? $_POST['userID'] : 46; //此处为测定userID,需要换成正式的
- if (!$userId) {
- return false;
- }
- $orderInfo = new OrderInfo();
- $res = $orderInfo->getOrderInfo($userId);
- //print_r($res);
-
-
-
-
-
-
-
|