feat(dashboard): 增加CFO财务资金浮存与资产负债中枢、COO运营转化复购与合伙人断档雷达全貌分析
这个提交包含在:
@@ -66,6 +66,7 @@ class DashboardWealthTest
|
||||
$this->testChartEmptyDateFallback();
|
||||
$this->testRankingPartnerAndDailyData();
|
||||
$this->testWealthFinancialFormulaIntegrity();
|
||||
$this->testCfoAndCooOverview();
|
||||
|
||||
echo "\n--------------------------------------------------------\n";
|
||||
echo "测试执行结果: 通过 {$this->passed} 项, 失败 {$this->failed} 项\n";
|
||||
@@ -237,6 +238,58 @@ class DashboardWealthTest
|
||||
$this->assert($payoutRate == 0, "GMV 为 0 时分成拨比率恒为 0%");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 7:CFO 财务中枢与 COO 运营全貌数据结构与勾稽
|
||||
*/
|
||||
public function testCfoAndCooOverview()
|
||||
{
|
||||
$controller = new TestableDashboard();
|
||||
$controller->total();
|
||||
|
||||
$data = $controller->lastOutput['data'] ?? [];
|
||||
$finance = $data['finance_overview'] ?? null;
|
||||
$operation = $data['operation_overview'] ?? null;
|
||||
|
||||
$this->assert($finance !== null, "total() 返回完整的 finance_overview 财务全貌中枢数据");
|
||||
$this->assert($operation !== null, "total() 返回完整的 operation_overview 运营全貌中枢数据");
|
||||
|
||||
if ($finance) {
|
||||
$this->assert(isset($finance['commission_float']), "财务包含 commission_float 未提现佣金沉淀");
|
||||
$this->assert(isset($finance['total_float_funds']), "财务包含 total_float_funds 免息流动沉淀池");
|
||||
$this->assert(isset($finance['total_withdraw_paid']), "财务包含 total_withdraw_paid 累计已打款出款");
|
||||
$this->assert(isset($finance['pending_withdraw_amount']), "财务包含 pending_withdraw_amount 待审核出款风控资金");
|
||||
$this->assert(isset($finance['real_net_cash_flow']), "财务包含 real_net_cash_flow 真实净现金流");
|
||||
$this->assert(isset($finance['total_future_liability']), "财务包含 total_future_liability 未来承兑准备金");
|
||||
|
||||
$floatDiff = abs((float)$finance['total_float_funds'] - ((float)$finance['commission_float'] + (float)$finance['user_balance_float']));
|
||||
$this->assert($floatDiff < 0.01, "资金浮存勾稽: total_float_funds == commission_float + user_balance_float");
|
||||
|
||||
$liabilityDiff = abs((float)$finance['total_future_liability'] - ((float)$finance['pending_voucher_liability'] + (float)$finance['madow_market_liability'] + (float)$finance['commission_liability']));
|
||||
$this->assert($liabilityDiff < 0.01, "承兑负债勾稽: total_future_liability == pending_voucher + madow_market + commission");
|
||||
}
|
||||
|
||||
if ($operation) {
|
||||
$this->assert(isset($operation['total_registered']), "运营包含 total_registered 注册用户数");
|
||||
$this->assert(isset($operation['paid_users_count']), "运营包含 paid_users_count 付费买家数");
|
||||
$this->assert(isset($operation['pay_conversion_rate']), "运营包含 pay_conversion_rate 付费转化率");
|
||||
$this->assert(isset($operation['repeat_purchase_rate']), "运营包含 repeat_purchase_rate 复购率");
|
||||
$this->assert(isset($operation['arpu']), "运营包含 arpu 付费买家客单贡献");
|
||||
$this->assert(isset($operation['active_partners']), "运营包含 active_partners 活跃合伙人");
|
||||
$this->assert(isset($operation['warning_partners']), "运营包含 warning_partners 7天内即将断档合伙人");
|
||||
$this->assert(isset($operation['frozen_partners']), "运营包含 frozen_partners 已断档冻结合伙人");
|
||||
$this->assert(is_array($operation['warning_list']), "运营包含 warning_list 即将断档人员名单");
|
||||
$this->assert(isset($operation['low_stock_count']), "运营包含 low_stock_count 低库存告急SKU数量");
|
||||
$this->assert(is_array($operation['low_stock_list']), "运营包含 low_stock_list 低库存SKU商品列表");
|
||||
$this->assert(isset($operation['health']['score']), "运营包含经营健康度评分 score");
|
||||
$this->assert(isset($operation['health']['grade']), "运营包含经营健康度评级 grade");
|
||||
|
||||
$this->assert(
|
||||
$operation['paid_users_count'] == ($operation['single_buy_users_count'] + $operation['repeat_buy_users_count']),
|
||||
"用户转化勾稽: paid_users_count({$operation['paid_users_count']}) == single({$operation['single_buy_users_count']}) + repeat({$operation['repeat_buy_users_count']})"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (php_sapi_name() === 'cli' && basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME'])) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户