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.
 
 
 
 

44 rivejä
1.4 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. $pdo=conn();
  8. $order_id = isset($_POST["order_id"]) ? $_POST["order_id"] : false;
  9. $order_status = isset($_POST["order_status"]) ? $_POST["order_status"] : false;
  10. if( $order_id == false || $order_status == false ) {
  11. echo "insert failed";
  12. exit();
  13. }
  14. $order_id_array = explode(",", $order_id);
  15. $order_status_array = explode(",", $order_status);
  16. $current_time = date("Y-m-d H:i:s");
  17. foreach( $order_id_array as $order_id_token ) {
  18. //add by qius on 20170531 for main coporation
  19. $pdo1 = conn();
  20. $sql_order = " SELECT SALE_PATH FROM order_main where order_id = {$order_id_token}";
  21. $result=$pdo1->query($sql_order);
  22. $add_order_array = array($order_id_token);
  23. if( $result != false ) {
  24. $result_array = $result->fetchAll();
  25. $result->closeCursor();
  26. if( $result_array != false && count($result_array) > 0 ) {
  27. $add_order_array = strlen($result_array[0]["SALE_PATH"]) > 0 ? explode(",", $result_array[0]["SALE_PATH"]) : array($order_id_token);
  28. }
  29. }
  30. foreach( $order_status_array as $order_status_token ) {
  31. foreach( $add_order_array as $add_order_id ) {
  32. $sql_log = "insert into order_status_log(order_id,new_status,change_time) VALUES ({$add_order_id},{$order_status_token},'{$current_time}') ON DUPLICATE KEY UPDATE change_time='{$current_time}' ";
  33. $pdo->exec($sql_log);
  34. }
  35. }
  36. }
  37. echo "insert success";
  38. exit();