1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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('-21 hour'));
- $stime = date("Y-m-d H:i:s",strtotime('-21 hour')-600);
- $_PDO=DB_PDO::getInstance( conf::$DB_CONF );
- $sql = "select user_id,red_money from red_user_info where add_time <='{$etime}' and add_time>'{$stime}' and type=1 and order_status>0 and red_money>red_open_money";
- $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'] = 4; //4 3小时过期
- $params['money'] = $v['red_money'];
- $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;
- }
|