|
- <?php
- /*
- Author:XM
- Compeny:Spiders Travel
- */
- //巴士每天发短信提醒明天用户
- require_once __DIR__ . '/../Common/Mysql.php';
- require_once __DIR__ . '/../Common/config_api.inc';
- require_once __DIR__ . '/../Common/sinaAPI.php';
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
-
- $today = date("Y-m-d");
- $next_10days = date("Y-m-d", strtotime("+10 days"));
-
- $phones = "13816608252";
-
- $pdo = conn();
- if (is_object($pdo)) {
- $sql = "select order_count,order_list from
- (
- 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
- from order_main as a
- 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
- group by a.RUN_ID,a.RUN_DATE,a.RUN_BUS_ORDER_ID,a.CREATE_TIME
- ) as t
- where order_count >= 2";
-
-
- $result = $pdo -> query($sql);
- writeLog("search sql ::" . $sql);
- $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
- $result -> closeCursor();
- if( $rowset != false && count($rowset) > 0 ) {
- foreach( $rowset as $row_info ) {
- $order_list = explode(",", $row_info["order_list"] );
- $sql1 = " SELECT group_concat( run_bus_seat_name ) as seat_list FROM order_main WHERE parent_order_id in (".$row_info["order_list"].") ";
- $result1 = $pdo -> query($sql1);
- $rowset1 = $result1 -> fetchAll(PDO::FETCH_ASSOC);
- $result1 -> closeCursor();
- $seat_array = explode( ",", $rowset1[0]["seat_list"] );
- $seat_num1 = count($seat_array);
- $seat_unique_array = array_unique ( $seat_array );
- $seat_num2 = count($seat_unique_array);
- if( $seat_num1 > $seat_num2 ) {
- $content = "以下订单可能存在座位重复的情况,请确认,订单号:".$row_info["order_list"];
- sendTelMessage($phones, "", $content, "");
- }
- }
- }
- }
|