You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

76 lines
2.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. $not_send_array = array(
  13. 451874,451875,451868,451869
  14. );
  15. $next_hour = date("Y-m-d H:i", strtotime("+1 hours"));
  16. $next_2hour = date("Y-m-d H:i", strtotime("+2 hours"));
  17. $pdo = conn();
  18. if (is_object($pdo)) {
  19. $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;";
  20. $result = $pdo -> query($sql);
  21. writeLog("search sql ::" . $sql);
  22. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  23. $result -> closeCursor();
  24. // $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;";
  25. // $result = $pdo -> query($sql);
  26. // $rowset2 = $result -> fetchAll(PDO::FETCH_ASSOC);
  27. // $result -> closeCursor();
  28. // $order_id_array = array();
  29. // foreach( $rowset as $v ) {
  30. // $order_id_array[] = $v['ORDER_ID'];
  31. // }
  32. // foreach( $rowset2 as $v ) {
  33. // if( !in_array( $v['ORDER_ID'],$order_id_array ) ) {
  34. // $rowset[] = $v;
  35. // }
  36. // }
  37. }
  38. $send_message_array = array();
  39. $current_time = date("Y-m-d H:i:s");
  40. if ($rowset) {
  41. writeLog("check_car_select_remind.php ::" . json_encode($rowset));
  42. if (SEND_MESSAGE == true) {
  43. foreach ($rowset as $v) {
  44. $order_id = $v['ORDER_ID'];
  45. $send_message_array[] = $order_id;
  46. $res_content = get_msg_info($order_id);
  47. }
  48. }
  49. }
  50. $order_id_list = implode( ",", $send_message_array );
  51. $post_data['order_id'] = "{$order_id_list}";
  52. $post_data['order_status'] = "455";
  53. send_post("http://". CS_DOMAIN. "/st-xm/Api/add_order_status_log.php",$post_data);
  54. function get_msg_info($ORDER_ID) {
  55. $url='http://'. CS1_DOMAIN. '/api/msg/group-order-send-msg';
  56. $sendInfo=array();
  57. $sendInfo['order_id']=$ORDER_ID;
  58. $sendInfo['msg_type']='five';
  59. $sendInfo['template_type']='five';
  60. $res_content = httpRequest($url,$sendInfo);
  61. $result_array = json_decode($res_content,true);
  62. if( $result_array["code"] != 0 ) {
  63. return false;
  64. }
  65. return array(isset($result_array['name']) ? $result_array['name'] : "", isset($result_array['mobile']) ? $result_array['mobile'] : "", isset($result_array['content']) ? $result_array['content'] : "短信错误,联系客服!!!");
  66. }