From 28df9dcce7bf41cc8c110c8b8d771e500b6e2a5e Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Mon, 1 Apr 2024 00:21:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E5=88=86=E4=BA=AB=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=92=8C=E7=AD=89=E7=BA=A7=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/shopro/controller/third/Wechat.php | 2 +- addons/shopro/listener/Commission.php | 6 ++++-- addons/shopro/service/CommissionScoreLog.php | 19 ++++++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/shopro/controller/third/Wechat.php b/addons/shopro/controller/third/Wechat.php index b65f3ff..387ef7a 100755 --- a/addons/shopro/controller/third/Wechat.php +++ b/addons/shopro/controller/third/Wechat.php @@ -15,7 +15,7 @@ class Wechat extends Common protected $payload = []; protected $wechat; protected $platform; - + public function _initialize() { parent::_initialize(); diff --git a/addons/shopro/listener/Commission.php b/addons/shopro/listener/Commission.php index 5063aed..5dbcb59 100755 --- a/addons/shopro/listener/Commission.php +++ b/addons/shopro/listener/Commission.php @@ -19,8 +19,10 @@ class Commission */ public function userRegisterAfter($payload) { - $shareInfo = request()->param('shareInfo/a'); - \think\Log::info('分享参数:'.urldecode(json_encode($shareInfo))); +// $shareInfo = request()->param('shareInfo/a'); + $shareInfo = request()->param('shareInfo'); + \think\Log::info('分享参数:'.$shareInfo['shareId']); + if ($shareInfo) { // 注册后添加分享信息 ShareModel::log($payload['user'], $shareInfo); diff --git a/addons/shopro/service/CommissionScoreLog.php b/addons/shopro/service/CommissionScoreLog.php index 5410e2d..4bdebb5 100644 --- a/addons/shopro/service/CommissionScoreLog.php +++ b/addons/shopro/service/CommissionScoreLog.php @@ -223,9 +223,9 @@ class CommissionScoreLog $canUpgradeLevel = $this->checkAgentUpgradeLevel($currentAgent); \think\Log::info('当前分销商升级信息=' . $canUpgradeLevel . '] ---start'.'---循环次数---'.$currentCommissionLevel); if ($canUpgradeLevel) { - $this->agent->level = $canUpgradeLevel; - LogModel::add($this->user->id, 'agent', ['type' => 'level', 'level' => LevelModel::find($canUpgradeLevel)]); - $this->agent->save(); + $currentAgent->agent->level = $canUpgradeLevel; + LogModel::add($currentAgent->user->id, 'agent', ['type' => 'level', 'level' => LevelModel::find($canUpgradeLevel)]); + $currentAgent->agent->save(); } $parentUserId = $currentAgent->getParentUserId(); if ($parentUserId) { @@ -274,11 +274,16 @@ class CommissionScoreLog $nextAgentLevel = $this->getNextAgentLevel($agent); \think\Log::info('当前分销商升级信息=' . json_encode($nextAgentLevel, true)); if (count($nextAgentLevel)) { + + $checkLevel = []; foreach ($nextAgentLevel as $level) { - $checkLevel[$level->level] = $this->isMatchUpgradeLevelRule($level, $agent); - \think\Log::info('当前等级是否可以升级=' . json_encode($checkLevel, true)); // 用户不允许越级升级 + if($level->level == self::LEVEL_2) { + break; + } + $checkLevel[$level->level] = $this->isMatchUpgradeLevelRule($level, $agent); + \think\Log::info('当前等级是否可以升级=' . json_encode($checkLevel, true)); // if (!$this->config->isUpgradeJump()) break; } $checkLevel = array_reverse($checkLevel, true); @@ -293,8 +298,8 @@ class CommissionScoreLog public function isMatchUpgradeLevelRule($level, $agent) { $is_level = false; - \think\Log::info('当前用户消费总金额=' .($agent->user->total_consume + $this->getNextTeamTotal($agent->user->id)) ); - \think\Log::info('当前等级升级'.$level->level.'金额条件=' .$level->total_consume); + \think\Log::info('当前用户消费'.$agent->user->id.'总金额=' .($agent->user->total_consume + $this->getNextTeamTotal($agent->user->id)) ); + \think\Log::info('当前等级升级'.$agent->user->id.'--'.$level->level.'金额条件=' .$level->total_consume); if (($agent->user->total_consume + $this->getNextTeamTotal($agent->user->id)) > $level->total_consume) { $is_level = true; }