|
- <?php
- /*
- Author:XM
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
-
- $method = isset($_GET['method']) ? (empty($_GET['method']) ? '' : $_GET['method']) : '';
-
- $user_id = getUserId();
- if ($user_id == false) {
- echo json_encode(array("code" => 1, "info" => "用户未登录"));
- exit ;
- }
- $order_id = isset($_GET['order_id']) ? $_GET['order_id'] : '';
- if ($order_id == "") {
- $data['code'] = "-1";
- $data['info'] = "缺少参数";
- echo json_encode($data);
- exit();
- }
- $pdo = conn();
- switch($method) {
- case "getOrderDetail" :
- $sql = "CALL HT_GET_ORDER_DETAIL(" . $user_id . "," . $order_id . ")";
- if (is_object($pdo)) {
- $result = $pdo -> query($sql);
- $re_da = array();
- do {
- $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
- // if ($rowset) {
- $re_da[] = $rowset;
- // }
- } while($result->nextRowset());
- $data['code'] = "0";
- $data['info'] = "";
- if (!$re_da) {
- $data['code'] = "-1";
- $data['info'] = "没有查询到结果";
- if (is_array($data)) {
- echo json_encode($data);
- exit();
- }
- }
- if (empty($re_da[0])) {
- $re_da[0] = array();
- $data['order_detail'] = $re_da[0];
- } else {
- $data['order_detail'] = $re_da[0];
- //"千岛湖润和建国度假酒店 豪华湖景大床房,2016-06-01,2|双床房,2016-06-02,3"
- $desc_date = $re_da[0][0]['order_desc'];
- $first_arr = explode("|", $desc_date);
- $final = "";
- $start = $first_arr[0];
- $arr_len = count($first_arr);
- if ($arr_len > 0) {
- $start = explode(",", $first_arr[0]);
- $end = explode(",", $first_arr[$arr_len - 1]);
- $final = $start[1] . " - " . $end[1];
- }
- $data['order_detail'][0]['all_day'] = (string)count($re_da[1]);
- $data['order_detail'][0]['check_in_date'] = $final;
- $data['order_detail'][0]['start_date'] = $start[1];
- $data['order_detail'][0]['end_date'] = $end[1];
- }
- if(isset($re_da[1])){
- $data['detail_date_arr'] = $re_da[1];
- }else{
- $data['detail_date_arr']=array();
- }
- if(isset($re_da[2])){
- $data['order_status'] = $re_da[2];
- }else{
- $data['order_status']=array();
- }
- }
- // $data['detail_date_arr'][0]['base_price_balance']=(string)$re_da[1][0]['base_price'];
- break;
- case "getOrderRemark" :
- $sql = "CALL HT_GET_ORDER_COMMENT(" . $user_id . "," . $order_id . ")";
- writeLog("fuhc----ht_get_order_detail_method=getOrderRemark" . $sql);
- if (is_object($pdo)) {
- $result = $pdo -> query($sql);
- $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
- $data['code'] = "0";
- $data['info'] = "";
- $data['order_remark_arr'] = $rowset;
- }
- break;
- case "getOrderSendMessage" :
- $sql = "CALL HT_GET_ORDER_SEND_MESSAGE(" . $user_id . "," . $order_id . ")";
- if (is_object($pdo)) {
- $result = $pdo -> query($sql);
- $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
- if (!$rowset) {
- $data['code'] = "-1";
- $data['info'] = "没有查询到结果";
- if (is_array($data)) {
- echo json_encode($data);
- exit();
- }
- }
- $data['code'] = "0";
- $data['info'] = "";
- $data['order_send_message_arr'] = $rowset;
- }
- break;
- case "getOrderRefund" :
- //订单退单的信息
- $sql = "select
- A.ORDER_ID as order_id,
- A.REFUND_AMOUNT as refund_amount,
- A.ORG_BACK as org_back,
- A.REASON as reason,
- A.CREATE_TIME as pay_time,
- C.PAY_TYPE_ID_1 as pay_type_id_1,
- D.TYPE_NAME as type_name
- from order_ht_apply_bounce as A inner join order_pay_main as B on B.ORDER_ID=A.ORDER_ID
- inner join order_pay_detail as C on C.PAY_MAIN_ID=B.ID
- inner join dict_type as D on D.ID=C.PAY_TYPE_ID_1
- where A.order_id=" . $order_id . " and A.CANCEL_FLAG=0 group by A.ORDER_ID order by A.CREATE_TIME desc
- ;";
- if (is_object($pdo)) {
- $result = $pdo -> query($sql);
- $rowset = $result -> fetchAll(PdO::FETCH_ASSOC);
- if (!$rowset) {
- $data['code'] = "-1";
- $data['info'] = "没有查询到结果";
- if (is_array($data)) {
- echo json_encode($data);
- exit();
- }
- }
- $data['code'] = "0";
- $data['info'] = "";
- $data['order_refund'] = $rowset;
- }
- break;
- default :
- $data['code'] = "-1";
- $data['info'] = "缺少method参数";
- break;
- }
- if (is_array($data)) {
- echo json_encode($data);
- }
-
- exit();
- ?>
|