父级分红

This commit is contained in:
lingling 2025-02-16 21:20:18 +08:00
parent 1c0b6c5bf6
commit b236a8b200
1 changed files with 13 additions and 11 deletions

View File

@ -21,21 +21,21 @@ class UserRewardDao
/**
* 挂机获得的奖励
*/
public static function Onhookincome($userid,$money)
public static function Onhookincome($userid, $money)
{
self::base($userid, 6, $money, '挂机收益');
}
/**
* 加粉赏金奖励
*/
public static function bounty($userid,$money)
public static function bounty($userid, $money)
{
self::base($userid, 5, $money, '加粉赏金');
}
/**
* 公共函数
*/
public static function base($userid, $status, $money, $memo,$is_f_bounty=1)
public static function base($userid, $status, $money, $memo, $is_f_bounty = 1)
{
$UserReward = new UserReward();
$user = User::find($userid);
@ -55,19 +55,21 @@ class UserRewardDao
/**
* 父级 父父级分红
*/
public static function f_bounty($userid, $status, $money, $memo){
public static function f_bounty($userid, $status, $money, $memo)
{
//父分红
$f_dividend=floor($money*0.2);
$f_dividend = floor($money * 0.2);
//父父分红
$ff_dividend=floor($money*0.1);
$ff_dividend = floor($money * 0.1);
$user = User::find($userid);
if($user->f_id!=0&&$user->f_id!=0){
$f=User::find($user->f_id);
if ($user->f_id != 0) {
$f = User::find($user->f_id);
self::base($f->id, 5, $f_dividend, '加粉赏金');
$ff=User::find($user->ff_id);
self::base($ff->id, 5, $ff_dividend, '加粉赏金');
if ($user->ff_id != 0) {
$ff = User::find($user->ff_id);
self::base($ff->id, 5, $ff_dividend, '加粉赏金');
}
}
}
/**
* 搜索函数