|
|
@@ -17,20 +17,21 @@ class CommonLogic
|
|
|
{
|
|
|
|
|
|
// 升级
|
|
|
- public static function setIsUpLevel(int $user_id, int $team_level_id, int $address_level): bool
|
|
|
+ public static function setIsUpLevel(int $user_id, int $team_level_id): bool
|
|
|
{
|
|
|
$config = config('team_level_where');
|
|
|
if($team_level_id == count($config)) return false;
|
|
|
$result = false;
|
|
|
+ //组合套数
|
|
|
+ $groupCount = UserPledge::getPledgeCount($user_id) + 1;
|
|
|
if($team_level_id == 0){
|
|
|
- if($address_level >= $config[$team_level_id]['direct']) {
|
|
|
+ if($groupCount >= $config[$team_level_id]['num']) {
|
|
|
$result = true;
|
|
|
$team_level_id += 1;
|
|
|
self::setIsUpLevelParent($user_id, $config);
|
|
|
}
|
|
|
}else{
|
|
|
- //组合套数
|
|
|
- $groupCount = UserPledge::getPledgeCount($user_id) + 1;
|
|
|
+
|
|
|
//直推
|
|
|
$teamCount = UserModel::where('parent_id', $user_id)->where('team_level_id','>=', $team_level_id)->count();
|
|
|
if($teamCount >= $config[$team_level_id]['direct'] && $groupCount >= $config[$team_level_id]['num']){
|
|
|
@@ -51,7 +52,7 @@ class CommonLogic
|
|
|
foreach ($pathId as $item)
|
|
|
{
|
|
|
$parent = $userModel::where('id', $item)->find();
|
|
|
- if($parent->team_level_id > 0 && $parent->team_level_id < 5){
|
|
|
+ if($parent->team_level_id > 0 && $parent->team_level_id < 3){
|
|
|
//推广人数
|
|
|
$teamCount = $userModel::where('parent_id', $item)->where('team_level_id', '>=',$parent->team_level_id)->count() +1;
|
|
|
//组合套数
|
|
|
@@ -66,13 +67,13 @@ class CommonLogic
|
|
|
|
|
|
|
|
|
//降级
|
|
|
- public static function setIsOuLevelSave($user_id, $team_level_id, $address_level)
|
|
|
+ public static function setIsOuLevelSave($user_id, $team_level_id)
|
|
|
{
|
|
|
$config = config('team_level_where');
|
|
|
$result = false;
|
|
|
//组合套数
|
|
|
$groupCount = UserPledge::getPledgeCount($user_id) -1;
|
|
|
- if($team_level_id == 1 && ($groupCount == 0 || $address_level < $config[0]['direct'])){
|
|
|
+ if($team_level_id == 1 && $groupCount < $config[0]['num']){
|
|
|
$result = true;
|
|
|
$team_level_id = 0;
|
|
|
self::setIsOuLevelParent($user_id, $config);
|
|
|
@@ -127,15 +128,11 @@ class CommonLogic
|
|
|
//分享 1 个拿 3 层,分享 2 个拿 7 层
|
|
|
foreach ($parents_info as $parent){
|
|
|
$send_user_id = 0; //需要发放的会员ID列表
|
|
|
- if($parent['team_level_id'] >= 1 && $parent['distance'] <= 3){
|
|
|
- $send_user_id = $parent['id'];
|
|
|
- }else if($parent['team_level_id'] >= 2 && $parent['distance'] <= 7){
|
|
|
- $send_user_id = $parent['id'];
|
|
|
- }else if($parent['team_level_id'] >= 3 && $parent['distance'] <= 13){
|
|
|
+ if($parent['team_level_id'] >= 1 && $parent['distance'] <= 1){
|
|
|
$send_user_id = $parent['id'];
|
|
|
- }else if($parent['team_level_id'] >= 4 && $parent['distance'] <= 21){
|
|
|
+ }else if($parent['team_level_id'] >= 2 && $parent['distance'] <= 2){
|
|
|
$send_user_id = $parent['id'];
|
|
|
- }else if($parent['team_level_id'] >= 5 && $parent['distance'] <= 31){
|
|
|
+ }else if($parent['team_level_id'] >= 3 && $parent['distance'] <= 3){
|
|
|
$send_user_id = $parent['id'];
|
|
|
}
|
|
|
if($send_user_id > 0) Loader::model('LedgerWalletModel')->changeWalletAccount($send_user_id, $asset, $income, $action, $user_id);
|