fix(dashboard): 规范会员身份与合伙股东概念,彻底清理误导性合伙人词汇并优化自购考核雷达
这个提交包含在:
@@ -62,7 +62,7 @@ class Dashboard extends Common
|
||||
})
|
||||
];
|
||||
|
||||
// 2. 分销商/合伙人基础数据 (保持向下兼容)
|
||||
// 2. 合伙股东基础数据 (保持向下兼容)
|
||||
$agentData = [
|
||||
'total' => Agent::count(),
|
||||
'today' => Agent::whereTime('createtime', 'today')->count(),
|
||||
@@ -194,7 +194,7 @@ class Dashboard extends Common
|
||||
$activeUserIds = $activeService->activeUserIds($activeWindowStart, $now);
|
||||
$activeUserMap = array_flip($activeUserIds);
|
||||
|
||||
// 全量合伙人基础信息
|
||||
// 全量合伙股东基础信息
|
||||
$allAgents = Agent::field('user_id, level, is_venue, is_county, madow, last_self_order_time')->select();
|
||||
|
||||
// 收益明细按 (user_id + reward_type) 聚合,精确归集各角色产出收益
|
||||
@@ -408,7 +408,7 @@ class Dashboard extends Common
|
||||
'pending_voucher_quota' => number_format($pendingVoucher, 2, '.', ''),
|
||||
];
|
||||
|
||||
// 9. COO 视角:转化复购漏斗、合伙人自购续期雷达、供应链库存与实时待办看板
|
||||
// 9. COO 视角:转化复购漏斗、合伙股东自购续期雷达、供应链库存与实时待办看板
|
||||
$paidOrderUsers = Order::whereIn('status', [Order::STATUS_PAID, Order::STATUS_COMPLETED])
|
||||
->group('user_id')
|
||||
->field('user_id, count(*) as buy_count')
|
||||
@@ -428,13 +428,14 @@ class Dashboard extends Common
|
||||
$repeatPurchaseRate = $paidUsersCount > 0 ? round(($repeatBuyCount / $paidUsersCount) * 100, 1) : 0.0;
|
||||
$arpu = $paidUsersCount > 0 ? round($netGmv / $paidUsersCount, 2) : 0.0;
|
||||
|
||||
// 9.2 合伙人 30 天自购续期雷达 (客观四态分类,避免恐慌误判)
|
||||
// 9.2 合伙股东 30 天自购续期雷达 (仅统计具备合伙股东身份的会员,避免恐慌误判)
|
||||
$activePartnersCount = 0;
|
||||
$warningPartnersCount = 0;
|
||||
$pendingRenewCount = 0;
|
||||
$newNoOrderCount = 0;
|
||||
$warningList = [];
|
||||
$pendingRenewList = [];
|
||||
$partnerShareholderCount = 0;
|
||||
|
||||
$agentUserIds = array_column(collection($allAgents)->toArray(), 'user_id');
|
||||
$agentUserMap = [];
|
||||
@@ -446,12 +447,19 @@ class Dashboard extends Common
|
||||
}
|
||||
|
||||
foreach ($allAgents as $ag) {
|
||||
$identityData = IdentityService::build($ag);
|
||||
// 核心业务规范:合伙股东仅是会员体系下的专属进阶身份(创客V1~V6、酒道馆、区县代理)
|
||||
// 普通会员与品酒师属于基础会员,无需自购考核,排除在股东自购掉队雷达之外
|
||||
if (empty($identityData['is_partner'])) {
|
||||
continue;
|
||||
}
|
||||
$partnerShareholderCount++;
|
||||
|
||||
$uid = (int) $ag->user_id;
|
||||
$u = $agentUserMap[$uid] ?? null;
|
||||
$nickname = $u ? ($u->nickname ?: '用户#' . $uid) : ('用户#' . $uid);
|
||||
$mobile = ($u && $u->mobile) ? substr_replace($u->mobile, '****', 3, 4) : '-';
|
||||
$avatar = $u ? ($u->avatar ?: '') : '';
|
||||
$identityData = IdentityService::build($ag);
|
||||
$identityText = $identityData['identity_text'] ?: ('Lv.' . $ag->level);
|
||||
|
||||
$lastTime = (int) $ag->getData('last_self_order_time');
|
||||
@@ -492,12 +500,18 @@ class Dashboard extends Common
|
||||
];
|
||||
}
|
||||
} else {
|
||||
// 新成员待自购首购 (尚未下单)
|
||||
// 新晋股东待自购首购 (尚未下单)
|
||||
$newNoOrderCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 股东专属自购达标率(分子为在保合格股东,分母为合伙股东总人数)
|
||||
$partnerActiveRate = $partnerShareholderCount > 0
|
||||
? round((($activePartnersCount + $warningPartnersCount) / $partnerShareholderCount) * 100, 1)
|
||||
: 0.0;
|
||||
$partnerNetwork['active_rate'] = $partnerActiveRate;
|
||||
|
||||
// 9.3 供应链库存安全与动销商品
|
||||
$onSaleGoodsCount = (int) Goods::where('status', 'up')->count();
|
||||
$totalStock = (int) SkuPriceModel::where('status', 'up')->sum('stock');
|
||||
@@ -562,10 +576,10 @@ class Dashboard extends Common
|
||||
} elseif ($payoutRate <= 50) {
|
||||
$riskSuggestions[] = "综合拨比 {$payoutRate}%,略高于基础基准,建议提升高毛利商品动销比例。";
|
||||
} else {
|
||||
$riskSuggestions[] = "综合拨比 {$payoutRate}% 超出常规安全线,请复核极差与日结各奖项拨出参数。";
|
||||
$riskSuggestions[] = "综合拨比 {$payoutRate}% 超出常规安全线,请复核进阶与日结各奖励拨出参数。";
|
||||
}
|
||||
if ($warningPartnersCount > 0) {
|
||||
$riskSuggestions[] = "有 {$warningPartnersCount} 位合伙人进入 7 天临近到期预警期,建议及时定向提醒自购续期。";
|
||||
$riskSuggestions[] = "有 {$warningPartnersCount} 位合伙股东进入 7 天临近到期预警期,建议及时定向提醒自购续期。";
|
||||
}
|
||||
if ($pendingWithdrawCount > 0) {
|
||||
$riskSuggestions[] = "当前有 {$pendingWithdrawCount} 笔提现申请等待审核(¥{$financeOverview['pending_withdraw_amount']}),请及时处理。";
|
||||
@@ -714,11 +728,11 @@ class Dashboard extends Common
|
||||
$payoutArr = [];
|
||||
$periodMadow = 0.00000000;
|
||||
|
||||
// 四大分成板块结构
|
||||
// 四大业务板块结构
|
||||
$structureMap = [
|
||||
'push3' => [
|
||||
'key' => 'push3',
|
||||
'name' => '直推裂变(推三返一)',
|
||||
'name' => '推荐开拓奖励',
|
||||
'types' => ['push3'],
|
||||
'amount' => 0.00,
|
||||
'count' => 0,
|
||||
@@ -726,7 +740,7 @@ class Dashboard extends Common
|
||||
],
|
||||
'maker' => [
|
||||
'key' => 'maker',
|
||||
'name' => '创客团队(极差/平级/超越)',
|
||||
'name' => '创客进阶协同奖励',
|
||||
'types' => ['maker_diff', 'maker_peer', 'maker_overtaken'],
|
||||
'amount' => 0.00,
|
||||
'count' => 0,
|
||||
@@ -734,7 +748,7 @@ class Dashboard extends Common
|
||||
],
|
||||
'channel' => [
|
||||
'key' => 'channel',
|
||||
'name' => '实体渠道(馆县拆分/平级)',
|
||||
'name' => '实体统筹协同奖励',
|
||||
'types' => ['team_venue', 'team_county', 'venue_peer', 'county_peer'],
|
||||
'amount' => 0.00,
|
||||
'count' => 0,
|
||||
@@ -742,7 +756,7 @@ class Dashboard extends Common
|
||||
],
|
||||
'share' => [
|
||||
'key' => 'share',
|
||||
'name' => '全网共享(平台日结均分)',
|
||||
'name' => '全网加权贡献奖励',
|
||||
'types' => ['venue_share', 'county_share'],
|
||||
'amount' => 0.00,
|
||||
'count' => 0,
|
||||
|
||||
在新工单中引用
屏蔽一个用户