ソースを参照

fix push too much

stanley-king 7 年 前
コミット
0c2c0393bc
4 ファイル変更41 行追加11 行削除
  1. 1 0
      helper/async/IAsync.php
  2. 24 7
      helper/async/order.php
  3. 8 2
      helper/async/qugc.php
  4. 8 2
      helper/async/register.php

+ 1 - 0
helper/async/IAsync.php

@@ -10,6 +10,7 @@ namespace async;
 
 abstract class IAsync
 {
+    const max_level_pushs = 50;
     abstract public function run();
 
     protected function ex_user($invitees,$user)

+ 24 - 7
helper/async/order.php

@@ -102,8 +102,13 @@ class order extends IAsync
     }
     private function nofity_paied_invitees($inviter,$invitees,$level,$goods)
     {
-        foreach ($invitees as $invitee) {
-            push_helper::invitee_order_paied($invitee,$this->user_info->member_id(),$goods);
+        $i = 0;
+        foreach ($invitees as $invitee)
+        {
+            if($i < self::max_level_pushs) {
+                push_helper::invitee_order_paied($invitee, $this->user_info->member_id(), $goods);
+            }
+            $i++;
         }
     }
 
@@ -223,13 +228,20 @@ class order extends IAsync
             $rate  = $type->bonus_rate();
             $ret = bonus_helper::make_bonus($param,$param['rate_money']);
 
-            if($ret != false) {
+            if($ret != false)
+            {
                 $type_sn = $ret['type_sn'];
                 bonus_helper::send($type_sn,$invitees);
-                foreach ($invitees as $invitee) {
+                $i = 0;
+                foreach ($invitees as $invitee)
+                {
                     $amount = $money / $num;
-                    push_helper::invitee_order_complete_bonus($invitee,$this->user_info,$amount,$rate,$type_sn);
                     $this->add_reward($invitee,$amount);
+
+                    if($i < self::max_level_pushs) {
+                        push_helper::invitee_order_complete_bonus($invitee,$this->user_info,$amount,$rate,$type_sn);
+                    }
+                    $i++;
                 }
             }
             else {
@@ -316,8 +328,13 @@ class order extends IAsync
     }
     private function nofity_evaluate_invitees($inviter,$invitees,$level,$goods)
     {
-        foreach ($invitees as $invitee) {
-            push_helper::invitee_order_evaluated($invitee,$this->user_info->member_id(),$goods);
+        $i = 0;
+        foreach ($invitees as $invitee)
+        {
+            if($i < self::max_level_pushs) {
+                push_helper::invitee_order_evaluated($invitee,$this->user_info->member_id(),$goods);
+            }
+            $i++;
         }
     }
 

+ 8 - 2
helper/async/qugc.php

@@ -46,8 +46,14 @@ class qugc extends IAsync
 
         $title = $this->special->share_title();
         $this->ex_user($follows,$this->user);
-        foreach ($follows as $follow) {
-            push_helper::nofity_ugc_pub($follow,$this->user,$this->special_id,$title);
+
+        $i = 0;
+        foreach ($follows as $follow)
+        {
+            if($i < self::max_level_pushs) {
+                push_helper::nofity_ugc_pub($follow, $this->user, $this->special_id, $title);
+            }
+            $i++;
         }
     }
 

+ 8 - 2
helper/async/register.php

@@ -120,10 +120,16 @@ class register extends IAsync
             {
                 $type_sn = $ret['type_sn'];
                 bonus_helper::send($type_sn,$invitees);
-                foreach ($invitees as $invitee) {
+
+                $i = 0;
+                foreach ($invitees as $invitee)
+                {
                     $amount = $money / $num;
-                    push_helper::invitee_bonus($inviter,$invitee,$this->cur_info,$level + 1,$amount,$rate,$type_sn);
                     $this->add_reward($invitee,$amount);
+                    if($i < self::max_level_pushs) {
+                        push_helper::invitee_bonus($inviter, $invitee, $this->cur_info, $level + 1, $amount, $rate, $type_sn);
+                    }
+                    $i++;
                 }
             } else {
                 return false;