feat: 推广收益

This commit is contained in:
陈狼 2025-02-18 10:33:03 +08:00
parent 21e588b65a
commit 20a3c5dd50
1 changed files with 10 additions and 5 deletions

View File

@ -51,20 +51,25 @@ class Task3
echo date('Y-m-d H:i:s')."\n";
//获取今天在线时间超过6小时的用户
$today = date('Y-m-d');
$UserPhone = UserPhone::where('time', '>', 3600)::where('created_at','>=',$today)->get();
$UserPhone = UserPhone::where('time', '>=', 3600)::where('time', '<', 4200)::where('created_at','>=',$today)->get();
//判断用户绑定Whatsapp首次登录
foreach ($UserPhone as $key => $value) {
$user_id = $value->user_id;
$user = User::find($user_id);
if (!$user) {
continue;
}
//获取该用户的父级
$parent = User::find($user->f_id);
var_dump($parent);
//满足则加80积分
UserRewardDao::base($parent->username, 6, 80, '任务佣金');
UserRewardDao::base($parent->id, 5, 80, '推广收益');
//vip_id等级加1,并更新数据库
$user->vip_id += 1;
$parent->vip_id += 1;
//今天邀请人数加1
$user->today_num += 1;
$user->save();
$parent->today_num += 1;
$parent->today_team_income+=80;
$parent->save();
}
});