ソースを参照

修改新注册用户发200块钱红包

stanley-king 8 年 前
コミット
d148678437
4 ファイル変更44 行追加38 行削除
  1. 2 37
      crontab/control/hour.php
  2. 1 1
      helper/account_helper.php
  3. 1 0
      helper/bonus_helper.php
  4. 40 0
      helper/notify_helper.php

+ 2 - 37
crontab/control/hour.php

@@ -34,7 +34,7 @@ class hourControl extends BaseCronControl
         $this->expired_bonus();
 
         //更新全文搜索内容
-        $this->_xs_update();
+        //$this->_xs_update();
     }
 
     /**
@@ -250,42 +250,7 @@ class hourControl extends BaseCronControl
      */
     private function release_bonus()
     {
-        $bonus_type = Model('bonus_type');
-
-        $one_hour = 60 * 60;
-        $condition = array('remain_amount' => array('gt',0),'is_refund' => 0,'send_end_date' =>array('lt',time() - $one_hour));
-        $bonus_types = $bonus_type->getTypeList($condition,'','*','',false);
-        if(empty($bonus_types) || count($bonus_types) <= 0) {
-            return;
-        }
-
-        foreach($bonus_types as $type)
-        {
-            try
-            {
-                $pred = new predeposit_helper($type['sender_id']);
-
-                Model::beginTransaction();
-                $bonus_type->edit(array('type_id' =>$type['type_id']),array('is_refund' => 1,'refund_time' => time()));
-                if ($bonus_type->affected_rows() <= 0) {
-                    Model::rollback();
-                    $sresult = implode(',',$type);
-                    Log::record("bonus refund 更新状态失败,result:{$sresult}.");
-                } else {
-                    $pred->bonus_refund($type);
-                    $condition = array('type_id' =>$type['type_id'],'bonus_status' => array('in','0,1'));
-                    Model('user_bonus')->where($condition)->delete();
-                    Model::commit();
-                }
-            }
-            catch (Exception $e)
-            {
-                Model::rollback();
-
-                $sresult = implode(',',$type);
-                Log::record('bonus refund : error:' . $e->getMessage() . " result:{$sresult}.");
-            }
-        }
+        notify_helper::release_bonus();
     }
     
     /**

+ 1 - 1
helper/account_helper.php

@@ -6,7 +6,7 @@
  * Date: 16/6/27
  * Time: 下午2:46
  */
-require_once (BASE_ROOT_PATH . '/helper/bonus/type.php');
+
 require_once (BASE_ROOT_PATH . '/helper/bonus_helper.php');
 require_once (BASE_ROOT_PATH . '/helper/model_helper.php');
 

+ 1 - 0
helper/bonus_helper.php

@@ -23,6 +23,7 @@ require_once (BASE_ROOT_PATH . '/helper/bonus/allocator.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/sender.php');
 require_once (BASE_ROOT_PATH . '/helper/bonus/witholder.php');
 
+
 class bonus_helper
 {
     const def_bless = '熊猫美妆与你分享美丽的秘密~';

+ 40 - 0
helper/notify_helper.php

@@ -75,4 +75,44 @@ class notify_helper
             $mod_bonus->edit(array('bonus_id' => array('in', $ids)),array("expired" => 1));
         }
     }
+
+    static public function release_bonus()
+    {
+        $bonus_type = Model('bonus_type');
+
+        $one_hour = 60 * 60;
+        $condition = array('remain_amount' => array('gt',0),'is_refund' => 0,'send_end_date' =>array('lt',time() - $one_hour));
+        $bonus_types = $bonus_type->getTypeList($condition,'','*','',false);
+        if(empty($bonus_types) || count($bonus_types) <= 0) {
+            return;
+        }
+
+        foreach($bonus_types as $type)
+        {
+            try
+            {
+                $pred = new predeposit_helper($type['sender_id']);
+
+                Model::beginTransaction();
+                $bonus_type->edit(array('type_id' =>$type['type_id']),array('is_refund' => 1,'refund_time' => time()));
+                if ($bonus_type->affected_rows() <= 0) {
+                    Model::rollback();
+                    $sresult = implode(',',$type);
+                    Log::record("bonus refund 更新状态失败,result:{$sresult}.");
+                } else {
+                    $pred->bonus_refund($type);
+                    $condition = array('type_id' =>$type['type_id'],'bonus_status' => array('in','0,1'));
+                    Model('user_bonus')->where($condition)->delete();
+                    Model::commit();
+                }
+            }
+            catch (Exception $e)
+            {
+                Model::rollback();
+
+                $sresult = implode(',',$type);
+                Log::record('bonus refund : error:' . $e->getMessage() . " result:{$sresult}.");
+            }
+        }
+    }
 }