优惠券订单及其他脚本

red_lose_effect_push.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require_once 'DB_PDO.class.php';
  3. require_once 'confv2.class.php';
  4. require_once 'YPSM.class.php';
  5. define("ACT_PUSH_URL",'https://tbk.726p.com/api/v2/MessagePush/act_push');//push接口地址
  6. date_default_timezone_set('PRC');
  7. $etime = date("Y-m-d H:i:s",strtotime('-21 hour'));
  8. $stime = date("Y-m-d H:i:s",strtotime('-21 hour')-600);
  9. $_PDO=DB_PDO::getInstance( conf::$DB_CONF );
  10. $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";
  11. $stmt = $_PDO->prepare($sql);
  12. $stmt->execute();
  13. $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
  14. foreach($result as $k=>$v){
  15. $params = array();
  16. $params['user_id'] = $v['user_id'];
  17. $params['type'] = 4; //4 3小时过期
  18. $params['money'] = $v['red_money'];
  19. $push_res = curl_post( ACT_PUSH_URL, $params);
  20. }
  21. # curl调用接口push
  22. function curl_post($url, $params){
  23. $ch = curl_init();
  24. curl_setopt($ch, CURLOPT_URL, $url);
  25. curl_setopt($ch, CURLOPT_HEADER, 0);
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  27. curl_setopt($ch, CURLOPT_POST, 1);
  28. curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
  29. $response = curl_exec($ch);
  30. curl_close($ch);
  31. return $response;
  32. }