Quellcode durchsuchen

添加消息通知到crontab任务

zhouzhijian vor 8 Jahren
Ursprung
Commit
fcd8da8394
3 geänderte Dateien mit 15 neuen und 5 gelöschten Zeilen
  1. 5 4
      crontab/control/date.php
  2. 9 0
      crontab/control/hour.php
  3. 1 1
      data/model/user_bonus.model.php

+ 5 - 4
crontab/control/date.php

@@ -92,8 +92,8 @@ class dateControl extends BaseCronControl {
         //会员相关数据统计
         $this->_member_stat();
 
-        //红包过期通知
-        $this->bonus_expired_notify();
+        //已领取但未使用的红包过期通知
+        $this->bonus_expire_notify();
     }
 
     /**
@@ -933,8 +933,9 @@ class dateControl extends BaseCronControl {
         }
     }
 
-    private function bonus_expired_notify()
+    private function bonus_expire_notify()
     {
-        
+        require(BASE_ROOT_PATH.'/helper/notify_helper.php');
+        notify_helper::onBonusExpire(10,5);
     }
 }

+ 9 - 0
crontab/control/hour.php

@@ -249,4 +249,13 @@ class hourControl extends BaseCronControl {
         $bonus_type = Model('bonus_type');
         $bonus_type->bonus_refund();
     }
+
+    /**
+     * 定时清理已领取但未使用的红包
+     */
+    public function releaseExpiredBonusOp()
+    {
+        require(BASE_ROOT_PATH.'/helper/notify_helper.php');
+        notify_helper::bonus_expired();
+    }
 }

+ 1 - 1
data/model/user_bonus.model.php

@@ -232,7 +232,7 @@ class user_bonusModel extends Model
 
         $cond = array();
         $cond['usable_time'] = array(array('gt',$cur_time), array('elt',$cur_time + $left_warn_secs),'and');
-        $cond['notify_time'] = array(array('eq',0), array('elt',$cur_time + $period_secs),'or');
+        $cond['notify_time'] = array(array('eq',0), array('elt',$cur_time - $period_secs),'or');
         $cond['expired'] = 0;
 
         $ret = $this->getBonusList($cond,$field);