|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?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:*");
-
- $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.ORDER_PROD_TYPE IN (81,82) and A.CANCEL_FLAG=0 and A.RUN_DATE=DATE_ADD(current_date,INTERVAL 1 day) group by A.PARENT_ORDER_ID;";
- $result = $pdo -> query($sql);
- $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
- $result -> closeCursor();
- }
-
- $send_message_array = array();
-
- if ($rowset) {
- writeLog("check_car_travel_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);
- if($res_content == false) {continue;}
- $name = isset($res_content[0]) ? $res_content[0] : "";
- $tel = isset($res_content[1]) ? $res_content[1] : "";
- // $tel=15639834000;
- $content = isset($res_content[2]) ? $res_content[2] : "";
- writeLog("短信模板内容:【" . $content . "】");
- $response = sendTelMessage($tel, $name, $content, $order_id);
- writeLog(json_encode($response));
- $comment_type=0;
- $comment_text="";
- $send_success = (int)$response;
- $sql1 = "CALL HT_ADD_MSG_COMMENT(2,'addmsg'," . $order_id . "," . $comment_type . ",'" . $comment_text . "','" . $tel . "','" . $content . "','" . date("Y-m-d H:i:s") . "',{$send_success})";
- $result1 = $pdo -> query($sql1);
- $rowset1 = $result1 -> fetchAll(PDO::FETCH_ASSOC);
- $result1 -> closeCursor();
- writeLog("check_car_travel_remind.php HT_ADD_MSG_COMMENT()::" . $sql1);
- if( $send_success != 0 ) {
- $warning_tel = "13816608252,18652972567,13918071837,18817501483";
- $warning_txt = "以下用户出行提醒短信发送失败:{$name}({$tel}) 订单号:{$order_id}";
- sendTelMessage($warning_tel, $name, $warning_txt, $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/get-msg-info2';
- $sendInfo=array();
- $sendInfo['order_id']=$ORDER_ID;
- $sendInfo['msg_type']='ota';
- $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'] : "短信错误,联系客服!!!");
- }
|