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.
 
 
 
 

61 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. if( false == $rowset ) {
  15. echo "SUCCESS!!";exit();
  16. }
  17. //for 第三方
  18. foreach( $rowset as $row_info ) {
  19. //if( !isset($run_code_array[1]) ) {
  20. //zizai
  21. $prod_id = $row_info["prod_id"];
  22. $sql = " SELECT * FROM outside_run WHERE prod_code='".$prod_id."' AND cancel_flag = 0 ";
  23. $result=$pdo->query($sql);
  24. $rowset=$result->fetchAll();
  25. $result->closeCursor();
  26. $return_data = array();
  27. if( $result == false ) {
  28. continue;
  29. }
  30. $run_code = $prod_id;
  31. $ctrip_order_no = $row_info["outside_order_no"];
  32. $ticket_num = $row_info["ticket_num"];
  33. $customer_name = $row_info["customer_name"];
  34. $customer_mobile = $row_info["customer_mobile"];
  35. $customer_id_no = $row_info["customer_id_no"];
  36. $passenger_array = explode( "/", $row_info["passenger"]);
  37. $customerlist = "";
  38. foreach( $passenger_array as $passenger_txt ) {
  39. $passenger_info = explode( "*", $passenger_txt);
  40. $customerlist .= '{'.$prod_id.'|'.$passenger_info[0].'|'.$customer_mobile.'|'.$passenger_info[1].'}';
  41. }
  42. //自在下票
  43. $setOrder = new orderService();
  44. $lock_order = $setOrder->createOrder(zizaiArgs::$USER, $prod_id."P".$ticket_num."|", $customer_name,$customer_mobile,$customer_id_no,'', 0);
  45. if ($lock_order['code']!=0) {
  46. continue;
  47. }
  48. $tradeno = $lock_order['tradeno'];
  49. $return_info = $setOrder->customer(zizaiArgs::$USER, $tradeno, $customerlist);
  50. $pdo_update2 = conn1();
  51. $sql_update = " UPDATE outside_submit_order set supply_order_id='{$tradeno}' WHERE outside_order_no='{$ctrip_order_no}'";
  52. $pdo_update2->exec($sql_update);
  53. }
  54. echo "SUCCESS!!";