|
- <?php
- require_once __DIR__.'/../st-xm/Common/Mysql.php';
- require_once __DIR__.'/../st-xm/Common/sinaAPI.php';
- require_once __DIR__.'/../st-xm/Common/zizai_orderAPI.php';
- header("Access-Control-Allow-Origin:*");
-
- $pdo=conn1();
- $sql = " SELECT * FROM outside_submit_order WHERE supply_order_id = '-1' ";
- $result=$pdo->query($sql);
- if( false == $result ) {
- echo "FAILED!";exit();
- }
- $rowset=$result->fetchAll();
- $result->closeCursor();
-
- if( false == $rowset ) {
- echo "SUCCESS!!";exit();
- }
-
- //for 第三方
- foreach( $rowset as $row_info ) {
- //if( !isset($run_code_array[1]) ) {
- //zizai
- $prod_id = $row_info["prod_id"];
- $sql = " SELECT * FROM outside_run WHERE prod_code='".$prod_id."' AND cancel_flag = 0 ";
- $result=$pdo->query($sql);
- $rowset=$result->fetchAll();
- $result->closeCursor();
- $return_data = array();
- if( $result == false ) {
- continue;
- }
-
- $run_code = $prod_id;
- $ctrip_order_no = $row_info["outside_order_no"];
- $ticket_num = $row_info["ticket_num"];
- $customer_name = $row_info["customer_name"];
- $customer_mobile = $row_info["customer_mobile"];
- $customer_id_no = $row_info["customer_id_no"];
- $passenger_array = explode( "/", $row_info["passenger"]);
- $customerlist = "";
-
- foreach( $passenger_array as $passenger_txt ) {
- $passenger_info = explode( "*", $passenger_txt);
- $customerlist .= '{'.$prod_id.'|'.$passenger_info[0].'|'.$customer_mobile.'|'.$passenger_info[1].'}';
- }
-
- //自在下票
- $setOrder = new orderService();
- $lock_order = $setOrder->createOrder(zizaiArgs::$USER, $prod_id."P".$ticket_num."|", $customer_name,$customer_mobile,$customer_id_no,'', 0);
- if ($lock_order['code']!=0) {
- continue;
- }
- $tradeno = $lock_order['tradeno'];
- $return_info = $setOrder->customer(zizaiArgs::$USER, $tradeno, $customerlist);
- $pdo_update2 = conn1();
- $sql_update = " UPDATE outside_submit_order set supply_order_id='{$tradeno}' WHERE outside_order_no='{$ctrip_order_no}'";
- $pdo_update2->exec($sql_update);
- }
- echo "SUCCESS!!";
|