29 рядки
832 B

  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. foreach( $order_status_array as $order_status_token ) {
  19. $sql_log = "insert into order_status_log(order_id,new_status,change_time) VALUES ({$order_id_token},{$order_status_token},'{$current_time}') ON DUPLICATE KEY UPDATE change_time='{$current_time}' ";
  20. $pdo->exec($sql_log);
  21. }
  22. }
  23. echo "insert success";
  24. exit();