- 修复非合伙股东会员(品酒师)被误判为自购考核已暂停的问题,明确赋值为免自购考核 - 分离基础会员信息与合伙股东进阶身份展示,对非合伙股东提供清晰的身份说明与免考核提示 - 纠正佣金规则提示文案为收益中心固定金额规则,收益现金统一规范为收益中心累计现金 - 列表页与详情页同步优化非合伙股东 30 日活跃状态呈现 - 增加 TDD 自动化验证测试套件 verify_agent_partner_identity_spec.js 并通过全部回归测试
55 行
3.3 KiB
JavaScript
55 行
3.3 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
let passed = 0;
|
|
let failed = 0;
|
|
|
|
function assert(condition, testName, detail = '') {
|
|
if (condition) {
|
|
console.log(` [PASS] ${testName}`);
|
|
passed++;
|
|
} else {
|
|
console.error(` [FAIL] ${testName} - ${detail}`);
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
console.log("========================================================");
|
|
console.log(" 合伙股东身份明确化 & 详情页避免误导管理员 规范测试");
|
|
console.log("========================================================\n");
|
|
|
|
// 1. 验证后端 Agent.php 控制器逻辑
|
|
const agentPhpPath = path.resolve(__dirname, '../application/admin/controller/shopro/commission/Agent.php');
|
|
assert(fs.existsSync(agentPhpPath), 'Agent.php 文件存在');
|
|
const agentPhpContent = fs.readFileSync(agentPhpPath, 'utf-8');
|
|
|
|
assert(agentPhpContent.includes("IdentityService::build($detail)"), 'Agent.php 中调用 IdentityService::build 识别会员身份');
|
|
assert(agentPhpContent.includes('免自购考核'), 'Agent.php 中对非合伙股东会员明确赋值免自购考核状态文案');
|
|
assert(agentPhpContent.includes('$detail->is_partner ='), 'Agent.php 中返回 is_partner 属性供前端区分展示');
|
|
assert(agentPhpContent.includes('income_total_cash') || agentPhpContent.includes('total_reward_cash'), 'Agent.php 中提供清晰规范的收益中心累计现金字段');
|
|
|
|
// 2. 验证前端 detail.html 视图模板
|
|
const agentDetailPath = path.resolve(__dirname, '../application/admin/view/shopro/commission/agent/detail.html');
|
|
assert(fs.existsSync(agentDetailPath), 'agent/detail.html 文件存在');
|
|
const agentDetailContent = fs.readFileSync(agentDetailPath, 'utf-8');
|
|
|
|
assert(!agentDetailContent.includes('已切换为合伙股东固定金额'), 'detail.html 移除误导性文案“已切换为合伙股东固定金额”');
|
|
assert(agentDetailContent.includes('已切换为收益中心固定金额规则'), 'detail.html 规范为“已切换为收益中心固定金额规则”');
|
|
assert(agentDetailContent.includes('state.data.is_partner'), 'detail.html 包含合伙股东进阶身份的分支条件判断 (is_partner)');
|
|
assert(agentDetailContent.includes('免自购考核'), 'detail.html 包含对非合伙股东免自购考核的清晰呈现');
|
|
assert(!agentDetailContent.includes('<el-form-item label="累计合伙股东现金:">'), 'detail.html 不再将所有会员现金收益笼统称为“累计合伙股东现金”');
|
|
assert(agentDetailContent.includes('收益中心累计现金'), 'detail.html 采用规范的“收益中心累计现金”标签');
|
|
|
|
// 3. 验证列表页 index.html 视图模板
|
|
const agentIndexPath = path.resolve(__dirname, '../application/admin/view/shopro/commission/agent/index.html');
|
|
assert(fs.existsSync(agentIndexPath), 'agent/index.html 文件存在');
|
|
const agentIndexContent = fs.readFileSync(agentIndexPath, 'utf-8');
|
|
|
|
assert(agentIndexContent.includes('is_partner') && agentIndexContent.includes('免考核'), 'agent/index.html 30日活跃列对非合伙股东显示免考核而非误报已暂停');
|
|
|
|
console.log("\n--------------------------------------------------------");
|
|
console.log(`测试执行结果: 通过 ${passed} 项, 失败 ${failed} 项`);
|
|
console.log("========================================================");
|
|
|
|
process.exit(failed === 0 ? 0 : 1);
|