123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- require_once 'DB_PDO.class.php';
- require_once 'confv2.class.php';
- require_once 'YPSM.class.php';
- define("ACT_PUSH_URL",'https://tbk.726p.com/api/v2/MessagePush/act_push');//push接口地址
- date_default_timezone_set('PRC');
- $etime = date("Y-m-d H:i:s",strtotime('-1 day'));
- $stime = date("Y-m-d H:i:s",strtotime('-2 day'));
- $_PDO=DB_PDO::getInstance( conf::$DB_CONF );
- $sql = "select rui.user_id from red_user_info as rui left join user_weixin as uw on uw.user_id=rui.user_id where rui.type=2 and uw.is_login=1 and rui.add_time>='{$stime}' and rui.add_time<'{$etime}' and rui.user_id not in(select distinct user_id from `order` where order_create_at>'{$stime}' and status>0 and user_id>0)";
- $stmt = $_PDO->prepare($sql);
- $stmt->execute();
- $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
- foreach($result as $k=>$v){
- $params = array();
- $params['user_id'] = $v['user_id'];
- $params['type'] = 5; //5 提醒新用户下单
- $push_res = curl_post( ACT_PUSH_URL, $params);
- }
- # curl调用接口push
- function curl_post($url, $params){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
- $response = curl_exec($ch);
- curl_close($ch);
- return $response;
- }
|