问题描述:
返佣金额计算错误导致无法申请退款等问题
解决办法:
找到文件:app/services/agent/AgentLevelServices.php 214~247行
替换getAgentLevelBrokerage方法的代码为
public function getAgentLevelBrokerage(int $uid, $userInfo = [])
{
$one_brokerage_up = $two_brokerage_up = $spread_one_uid = $spread_two_uid = 0;
if (!$uid) {
return [$one_brokerage_up, $two_brokerage_up, $spread_one_uid, $spread_two_uid];
}
//商城分销是否开启
if (!sys_config('brokerage_func_status')) {
return [$one_brokerage_up, $two_brokerage_up, $spread_one_uid, $spread_two_uid];
}
/** @var UserServices $userServices */
$userServices = app()->make(UserServices::class);
if (!$userInfo) {
$userInfo = $userServices->getUserInfo($uid);
}
if (!$userInfo) {
return [$one_brokerage_up, $two_brokerage_up, $spread_one_uid, $spread_two_uid];
}
//获取上级uid || 开启自购返回自己uid
$spread_one_uid = $userServices->getSpreadUid($uid, $userInfo);
$one_agent_level = 0;
$two_agent_level = 0;
$spread_two_uid = 0;
if ($spread_one_uid > 0 && $one_user_info = $userServices->getUserInfo($spread_one_uid)) {
$one_agent_level = $one_user_info['agent_level'] ?? 0;
$spread_two_uid = $userServices->getSpreadUid($spread_one_uid, $one_user_info, false);
if ($spread_two_uid > 0 && $two_user_info = $userServices->getUserInfo($spread_two_uid)) {
$two_agent_level = $two_user_info['agent_level'] ?? 0;
}
}
$one_brokerage_up = $one_agent_level ? ($this->getLevelInfo($one_agent_level)['one_brokerage'] ?? 0) : 0;
$two_brokerage_up = $two_agent_level ? ($this->getLevelInfo($two_agent_level)['two_brokerage'] ?? 0) : 0;
return [$one_brokerage_up, $two_brokerage_up, $spread_one_uid, $spread_two_uid];
}
实际更改的代码如图红框所示
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}