WIP
parent
47d66a5fdd
commit
25329b3246
|
|
@ -147,20 +147,6 @@ class UserInfo extends Model
|
||||||
return $this->hasMany(DistributionPreIncome::class, 'user_id', 'user_id');
|
return $this->hasMany(DistributionPreIncome::class, 'user_id', 'user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取此用户的所有父级ID
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getParentIdsAttribute(): array
|
|
||||||
{
|
|
||||||
if ($path = trim($this->path, '/')) {
|
|
||||||
return explode('/', $path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变更预收益成长值
|
* 变更预收益成长值
|
||||||
*
|
*
|
||||||
|
|
@ -178,17 +164,31 @@ class UserInfo extends Model
|
||||||
|
|
||||||
$compared = bccomp(bcadd($this->growth_value, $this->pre_growth_value, 2), '650', 2);
|
$compared = bccomp(bcadd($this->growth_value, $this->pre_growth_value, 2), '650', 2);
|
||||||
|
|
||||||
if ($this->agent_level === 1 && $compared < 0) {
|
if ($this->agent_level === static::AGENT_LEVEL_VIP && $compared < 0) {
|
||||||
$this->update([
|
$this->update([
|
||||||
'agent_level' => 0,
|
'agent_level' => static::AGENT_LEVEL_CIVILIAN,
|
||||||
]);
|
]);
|
||||||
} elseif ($this->agent_level === 0 && $compared >= 0) {
|
} elseif ($this->agent_level === static::AGENT_LEVEL_CIVILIAN && $compared >= 0) {
|
||||||
$this->update([
|
$this->update([
|
||||||
'agent_level' => 1,
|
'agent_level' => static::AGENT_LEVEL_VIP,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取此用户的所有父级ID
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getParentIdsAttribute(): array
|
||||||
|
{
|
||||||
|
if ($path = trim($this->path, '/')) {
|
||||||
|
return explode('/', $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理等级排名
|
* 代理等级排名
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue