|
- <?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:*");
-
- $not_send_array = array(
- 451874,451875,451868,451869
- );
-
- $next_hour = date("Y-m-d H:i", strtotime("+1 hours"));
- $next_2hour = date("Y-m-d H:i", strtotime("+2 hours"));
-
-
- $pdo = conn();
- if (is_object($pdo)) {
- $sql = "select A.PARENT_ORDER_ID as ORDER_ID from order_main as A where A.ORDER_STATUS<>148 and A.PROD_ID <> 380001 and A.PARENT_PROD_ID NOT IN (".implode( ",", $not_send_array ).") and A.ORDER_PROD_TYPE IN (81,82) and A.CANCEL_FLAG=0 and A.RUN_DATE=DATE_ADD(current_date,INTERVAL 1 day) AND A.AGENT_LEVEL=1 group by A.PARENT_ORDER_ID;";
-
- $result = $pdo -> query($sql);
- writeLog("search sql ::" . $sql);
- $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
- $result -> closeCursor();
-
- // $sql = "select A.PARENT_ORDER_ID as ORDER_ID from order_main as A where A.ORDER_STATUS<>148 and A.PROD_ID <> 380001 and A.PARENT_PROD_ID NOT IN (".implode( ",", $not_send_array ).") and A.ORDER_PROD_TYPE IN (81,82) and A.CANCEL_FLAG=0 and A.RUN_DATE=DATE_ADD(current_date,INTERVAL 1 day) AND A.AGENT_LEVEL=1 AND A.OUTSIDE_SALE_ORG_ID in ( 164,147 ) group by A.PARENT_ORDER_ID;";
- // $result = $pdo -> query($sql);
- // $rowset2 = $result -> fetchAll(PDO::FETCH_ASSOC);
- // $result -> closeCursor();
- // $order_id_array = array();
- // foreach( $rowset as $v ) {
- // $order_id_array[] = $v['ORDER_ID'];
- // }
- // foreach( $rowset2 as $v ) {
- // if( !in_array( $v['ORDER_ID'],$order_id_array ) ) {
- // $rowset[] = $v;
- // }
- // }
- }
-
- $send_message_array = array();
- $current_time = date("Y-m-d H:i:s");
- if ($rowset) {
- writeLog("check_car_select_remind.php ::" . json_encode($rowset));
- if (SEND_MESSAGE == true) {
- foreach ($rowset as $v) {
- $order_id = $v['ORDER_ID'];
- $send_message_array[] = $order_id;
- $res_content = get_msg_info($order_id);
- }
- }
- }
-
- $order_id_list = implode( ",", $send_message_array );
- $post_data['order_id'] = "{$order_id_list}";
- $post_data['order_status'] = "455";
- send_post("http://". CS_DOMAIN. "/st-xm/Api/add_order_status_log.php",$post_data);
-
- function get_msg_info($ORDER_ID) {
- $url='http://'. CS1_DOMAIN. '/api/msg/group-order-send-msg';
- $sendInfo=array();
- $sendInfo['order_id']=$ORDER_ID;
- $sendInfo['msg_type']='five';
- $sendInfo['template_type']='five';
- $res_content = httpRequest($url,$sendInfo);
- $result_array = json_decode($res_content,true);
- if( $result_array["code"] != 0 ) {
- return false;
- }
- return array(isset($result_array['name']) ? $result_array['name'] : "", isset($result_array['mobile']) ? $result_array['mobile'] : "", isset($result_array['content']) ? $result_array['content'] : "短信错误,联系客服!!!");
- }
|