修复(收益): 纠正累计收益统计口径为真实分成收益,排除dmepa与兑换券释放干扰
这个提交包含在:
@@ -402,12 +402,15 @@ class Agent extends Commission
|
||||
|
||||
// 2. 团队成员为目标用户贡献的累计收益与本月收益
|
||||
$monthStart = strtotime(date('Y-m-01 00:00:00'));
|
||||
$cashTypes = \addons\shopro\service\partner\PartnerConfig::cashTypes();
|
||||
$teamTotalReward = RewardModel::where('user_id', $targetUserId)
|
||||
->whereIn('buyer_id', $teamUserIds)
|
||||
->whereIn('reward_type', $cashTypes)
|
||||
->where('status', 1)
|
||||
->sum('amount');
|
||||
$teamMonthReward = RewardModel::where('user_id', $targetUserId)
|
||||
->whereIn('buyer_id', $teamUserIds)
|
||||
->whereIn('reward_type', $cashTypes)
|
||||
->where('status', 1)
|
||||
->where('createtime', '>=', $monthStart)
|
||||
->sum('amount');
|
||||
|
||||
@@ -85,7 +85,9 @@ class User extends Common
|
||||
$agent = \addons\shopro\service\partner\IdentityService::findAgent($user->id);
|
||||
$partner = \addons\shopro\service\partner\IdentityService::attachProfile($agent, null, $user);
|
||||
if (empty($partner['total_income']) || $partner['total_income'] === '0.00') {
|
||||
$cashTypes = \addons\shopro\service\partner\PartnerConfig::cashTypes();
|
||||
$userRewardCash = \app\admin\model\shopro\partner\Reward::where('user_id', $user->id)
|
||||
->whereIn('reward_type', $cashTypes)
|
||||
->where('status', 1)
|
||||
->where('amount', '>', 0)
|
||||
->sum('amount');
|
||||
|
||||
@@ -135,7 +135,7 @@ class IdentityService
|
||||
public static function formatMadow($value)
|
||||
{
|
||||
$floatVal = (float) $value;
|
||||
// 当存在小于 1 豆且大于 0 的微量dmepa时,自适应保留有效小数(最多4位),避免直接抹零显示为 0 豆
|
||||
// 当存在小于 1 枚且大于 0 的微量dmepa时,自适应保留有效小数(最多4位),避免直接抹零显示为 0 枚
|
||||
if ($floatVal > 0 && $floatVal < 1) {
|
||||
return rtrim(rtrim(number_format($floatVal, 4, '.', ''), '0'), '.');
|
||||
}
|
||||
@@ -205,7 +205,9 @@ class IdentityService
|
||||
$data = is_object($agent) ? $agent->toArray() : $agent;
|
||||
$userId = intval($data['user_id'] ?? 0);
|
||||
$agentTotalIncome = floatval($data['total_income'] ?? 0);
|
||||
$cashTypes = PartnerConfig::cashTypes();
|
||||
$rewardCash = $userId > 0 ? \app\admin\model\shopro\partner\Reward::where('user_id', $userId)
|
||||
->whereIn('reward_type', $cashTypes)
|
||||
->where('status', 1)
|
||||
->where('amount', '>', 0)
|
||||
->sum('amount') : 0;
|
||||
|
||||
@@ -305,6 +305,14 @@ class PartnerConfig
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 真正的分成现金奖励类型(排除 dmepa 和 兑换券)
|
||||
*/
|
||||
public static function cashTypes()
|
||||
{
|
||||
return array_merge(self::instantTypes(), ['venue_share', 'county_share']);
|
||||
}
|
||||
|
||||
public static function defaultRules()
|
||||
{
|
||||
return [
|
||||
|
||||
在新工单中引用
屏蔽一个用户