No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

52 líneas
1.9 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. //巴士每天发短信提醒明天用户
  7. require_once __DIR__ . '/../Common/Mysql.php';
  8. require_once __DIR__ . '/../Common/config_api.inc';
  9. require_once __DIR__ . '/../Common/sinaAPI.php';
  10. if (ALLOW_ORIGIN)
  11. header("Access-Control-Allow-Origin:*");
  12. $today = date("Y-m-d");
  13. $next_10days = date("Y-m-d", strtotime("+10 days"));
  14. $phones = "13816608252";
  15. $pdo = conn();
  16. if (is_object($pdo)) {
  17. $sql = "select order_count,order_list from
  18. (
  19. select count(DISTINCT a.PARENT_ORDER_ID) as order_count, group_concat(DISTINCT a.PARENT_ORDER_ID) as order_list, a.RUN_ID,a.RUN_DATE,a.RUN_BUS_ORDER_ID,a.CREATE_TIME
  20. from order_main as a
  21. where a.RUN_DATE >= \"{$today}\" and a.RUN_DATE <= \"{$next_10days}\" and a.ORDER_STATUS in (146,147) and a.RUN_ID > 0 and a.AGENT_LEVEL = 1
  22. group by a.RUN_ID,a.RUN_DATE,a.RUN_BUS_ORDER_ID,a.CREATE_TIME
  23. ) as t
  24. where order_count >= 2";
  25. $result = $pdo -> query($sql);
  26. writeLog("search sql ::" . $sql);
  27. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  28. $result -> closeCursor();
  29. if( $rowset != false && count($rowset) > 0 ) {
  30. foreach( $rowset as $row_info ) {
  31. $order_list = explode(",", $row_info["order_list"] );
  32. $sql1 = " SELECT group_concat( run_bus_seat_name ) as seat_list FROM order_main WHERE parent_order_id in (".$row_info["order_list"].") ";
  33. $result1 = $pdo -> query($sql1);
  34. $rowset1 = $result1 -> fetchAll(PDO::FETCH_ASSOC);
  35. $result1 -> closeCursor();
  36. $seat_array = explode( ",", $rowset1[0]["seat_list"] );
  37. $seat_num1 = count($seat_array);
  38. $seat_unique_array = array_unique ( $seat_array );
  39. $seat_num2 = count($seat_unique_array);
  40. if( $seat_num1 > $seat_num2 ) {
  41. $content = "以下订单可能存在座位重复的情况,请确认,订单号:".$row_info["order_list"];
  42. sendTelMessage($phones, "", $content, "");
  43. }
  44. }
  45. }
  46. }