diff --git a/process/Task3.php b/process/Task3.php index 35bec1a..cc6a455 100644 --- a/process/Task3.php +++ b/process/Task3.php @@ -62,14 +62,28 @@ class Task3 } //获取该用户的父级 $parent = User::find($user->f_id); - //满足则加80积分 - // UserRewardDao::base($parent->id, 5, 80, '有效用户奖励'); + //vip_id等级加1,并更新数据库 - if($value->day_score<=140){ + if($value->day_score<140){ $parent->vip_id += 1; //今天邀请人数加1 $parent->today_num += 1; - // $parent->today_team_income+=80; + $existingPhone = ActiveUsers::where('user_id', $parent->id) + ->where('phone', $value->phone) + ->first(); + //不存在,代表首次邀请 + if (!$existingPhone) { + if($value->score>=120 && $value->score<140){ + $parent->today_team_income+=80; + ActiveUsers::create([ + 'user_id' => $parent->id, + 'phone' => $value->phone, + 'income' => 80, + ]); + //满足则加80积分 + UserRewardDao::base($parent->id, 5, 80, '有效用户奖励'); + } + } $parent->save(); } //判断今天有没有数据 @@ -115,7 +129,7 @@ class Task3 ]); } //今天活跃人数加1 - if($value->day_score<=140){ + if($value->day_score<140){ $ancestor->active_figures += 1; } $ancestor->save();