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.
 
 
 
 

56 lines
2.0 KiB

  1. <?php
  2. require_once __DIR__.'/../st-xm/Common/Mysql.php';
  3. require_once __DIR__.'/../st-xm/Common/sinaAPI.php';
  4. require_once __DIR__.'/../st-xm/Common/zizai_orderAPI.php';
  5. header("Access-Control-Allow-Origin:*");
  6. $pdo=conn1();
  7. $sql = " SELECT * FROM outside_submit_order WHERE supply_order_id = '-1' ";
  8. $result=$pdo->query($sql);
  9. if( false == $result ) {
  10. echo "FAILED!";exit();
  11. }
  12. $rowset=$result->fetchAll();
  13. $result->closeCursor();
  14. //for 第三方
  15. foreach( $rowset as $row_info ) {
  16. //if( !isset($run_code_array[1]) ) {
  17. //zizai
  18. $prod_id = $row_info["prod_id"];
  19. $sql = " SELECT * FROM outside_run WHERE prod_code='".$prod_id."' AND cancel_flag = 0 ";
  20. $result=$pdo->query($sql);
  21. $rowset=$result->fetchAll();
  22. $result->closeCursor();
  23. $return_data = array();
  24. if( $result == false ) {
  25. continue;
  26. }
  27. $run_code = $prod_id;
  28. $ctrip_order_no = $row_info["outside_order_no"];
  29. $ticket_num = $row_info["ticket_num"];
  30. $customer_name = $row_info["customer_name"];
  31. $customer_mobile = $row_info["customer_mobile"];
  32. $customer_id_no = $row_info["customer_id_no"];
  33. $passenger_array = explode( "/", $row_info["passenger"]);
  34. $customerlist = "";
  35. foreach( $passenger_array as $passenger_txt ) {
  36. $passenger_info = explode( "*", $passenger_txt);
  37. $customerlist .= '{'.$prod_id.'|'.$passenger_info[0].'|'.$customer_mobile.'|'.$passenger_info[1].'}';
  38. }
  39. //自在下票
  40. $setOrder = new orderService();
  41. $lock_order = $setOrder->createOrder(zizaiArgs::$USER, $prod_id."P".$ticket_num."|", $customer_name,$customer_mobile,$customer_id_no,'', 0);
  42. if ($lock_order['code']!=0) {
  43. continue;
  44. }
  45. $tradeno = $lock_order['tradeno'];
  46. $return_info = $setOrder->customer(zizaiArgs::$USER, $tradeno, $customerlist);
  47. $pdo_update2 = conn1();
  48. $sql_update = " UPDATE outside_submit_order set supply_order_id='{$tradeno}' WHERE outside_order_no='{$ctrip_order_no}'";
  49. $pdo_update2->exec($sql_update);
  50. }
  51. echo "SUCCESS!!";