/** * 奖项名称全局规范重命名专项验证测试套件 * * 验证目标: * 1. 区县统筹奖 -> 区县管理奖 * 2. 区县加权奖励 -> 区县加权奖 * 3. 酒道馆加权奖励 -> 酒道馆加权奖 * 4. 酒道馆运营奖 -> 酒道馆管理奖 * 5. 酒道馆协同奖 -> 酒道馆平级奖(区县代为区县代平级奖) * 6. 推荐开拓奖 -> 推荐提成 */ const fs = require('fs'); const path = require('path'); let passCount = 0; let failCount = 0; function assert(condition, message) { if (condition) { console.log(` \x1b[32m[PASS]\x1b[0m ${message}`); passCount++; } else { console.error(` \x1b[31m[FAIL]\x1b[0m ${message}`); failCount++; } } const rootDir = path.resolve(__dirname, '../../'); console.log('========================================================'); console.log(' 奖项名称全局规范重命名专项验证'); console.log('========================================================\n'); // 1. PartnerConfig.php 验证 console.log('--- 1. PartnerConfig.php 核心映射与提示文案验证 ---'); const partnerConfigPath = path.join(rootDir, 'addons/shopro/service/partner/PartnerConfig.php'); assert(fs.existsSync(partnerConfigPath), 'PartnerConfig.php 文件存在'); const partnerConfigContent = fs.readFileSync(partnerConfigPath, 'utf8'); assert(partnerConfigContent.includes("'push3' => '推荐提成'"), 'rewardTypeMap 包含 push3: 推荐提成'); assert(partnerConfigContent.includes("$venue . '管理奖'"), 'rewardTypeMap 包含 team_venue: 酒道馆管理奖'); assert(partnerConfigContent.includes("$countyShort . '管理奖'"), 'rewardTypeMap 包含 team_county: 区县管理奖'); assert(partnerConfigContent.includes("$venue . '平级奖'"), 'rewardTypeMap 包含 venue_peer: 酒道馆平级奖'); assert(partnerConfigContent.includes("$countyAgentShort . '平级奖'"), 'rewardTypeMap 包含 county_peer: 区县代平级奖'); assert(partnerConfigContent.includes("$venue . '加权奖'"), 'rewardTypeMap 包含 venue_share: 酒道馆加权奖'); assert(partnerConfigContent.includes("$countyShort . '加权奖'"), 'rewardTypeMap 包含 county_share: 区县加权奖'); assert(partnerConfigContent.includes("'no_parent' => '暂无推荐人,不计提推荐提成'"), 'skipReasonText 包含不计提推荐提成'); assert(partnerConfigContent.includes("'self_buy' => '本人下单不计提推荐提成'"), 'skipReasonText 包含本人下单不计提推荐提成'); // 2. 结算服务公式文案验证 console.log('\n--- 2. 核心结算服务公式与提示文案验证 ---'); const push3ServicePath = path.join(rootDir, 'addons/shopro/service/partner/Push3Reward.php'); assert(fs.existsSync(push3ServicePath), 'Push3Reward.php 文件存在'); const push3ServiceContent = fs.readFileSync(push3ServicePath, 'utf8'); assert(push3ServiceContent.includes('不计提推荐提成'), 'Push3Reward 跳过提示更新为推荐提成'); assert(push3ServiceContent.includes('推荐提成第{$seq}单'), 'Push3Reward 收益公式更新为推荐提成'); const teamSplitPath = path.join(rootDir, 'addons/shopro/service/partner/TeamSplitReward.php'); assert(fs.existsSync(teamSplitPath), 'TeamSplitReward.php 文件存在'); const teamSplitContent = fs.readFileSync(teamSplitPath, 'utf8'); assert(teamSplitContent.includes('酒道馆管理奖 {$venueSplit}'), 'TeamSplitReward 包含酒道馆管理奖公式'); assert(teamSplitContent.includes('区县管理奖 {$amount}'), 'TeamSplitReward 包含区县管理奖公式'); const peerSharePath = path.join(rootDir, 'addons/shopro/service/partner/PeerShareReward.php'); assert(fs.existsSync(peerSharePath), 'PeerShareReward.php 文件存在'); const peerShareContent = fs.readFileSync(peerSharePath, 'utf8'); assert(peerShareContent.includes('{$label}平级(第{$gen}代)'), 'PeerShareReward 包含平级公式'); assert(peerShareContent.includes('{$label}平级(第{$gen}代) 30 日无自购'), 'PeerShareReward 包含平级跳过提示'); // 3. WalletLog 模型字典映射验证 console.log('\n--- 3. WalletLog 模型事件字典映射验证 ---'); const walletLogPath = path.join(rootDir, 'application/admin/model/shopro/user/WalletLog.php'); assert(fs.existsSync(walletLogPath), 'WalletLog.php 文件存在'); const walletLogContent = fs.readFileSync(walletLogPath, 'utf8'); assert(walletLogContent.includes("'push3' => '推荐提成'"), 'WalletLog 包含推荐提成'); assert(walletLogContent.includes("'team_venue' => '酒道馆管理奖'"), 'WalletLog 包含酒道馆管理奖'); assert(walletLogContent.includes("'team_county' => '区县管理奖'"), 'WalletLog 包含区县管理奖'); assert(walletLogContent.includes("'venue_peer' => '酒道馆平级奖'"), 'WalletLog 包含酒道馆平级奖'); assert(walletLogContent.includes("'county_peer' => '区县代平级奖'"), 'WalletLog 包含区县代平级奖'); assert(walletLogContent.includes("'venue_share' => '酒道馆加权奖'"), 'WalletLog 包含酒道馆加权奖'); assert(walletLogContent.includes("'county_share' => '区县加权奖'"), 'WalletLog 包含区县加权奖'); // 4. 后台视图与筛选菜单验证 console.log('\n--- 4. 后台管理视图与筛选菜单验证 ---'); const rewardJsPath = path.join(rootDir, 'public/assets/js/backend/shopro/partner/reward.js'); assert(fs.existsSync(rewardJsPath), 'reward.js 文件存在'); const rewardJsContent = fs.readFileSync(rewardJsPath, 'utf8'); assert(rewardJsContent.includes("{ label: '推荐提成', value: 'push3' }"), 'reward.js 筛选包含推荐提成'); assert(rewardJsContent.includes("{ label: '酒道馆管理奖', value: 'team_venue' }"), 'reward.js 筛选包含酒道馆管理奖'); assert(rewardJsContent.includes("{ label: '区县管理奖', value: 'team_county' }"), 'reward.js 筛选包含区县管理奖'); assert(rewardJsContent.includes("{ label: '酒道馆平级奖', value: 'venue_peer' }"), 'reward.js 筛选包含酒道馆平级奖'); assert(rewardJsContent.includes("{ label: '区县代平级奖', value: 'county_peer' }"), 'reward.js 筛选包含区县代平级奖'); assert(rewardJsContent.includes("{ label: '酒道馆加权奖', value: 'venue_share' }"), 'reward.js 筛选包含酒道馆加权奖'); assert(rewardJsContent.includes("{ label: '区县加权奖', value: 'county_share' }"), 'reward.js 筛选包含区县加权奖'); const configViewPath = path.join(rootDir, 'application/admin/view/shopro/config/index.html'); assert(fs.existsSync(configViewPath), 'config/index.html 文件存在'); const configViewContent = fs.readFileSync(configViewPath, 'utf8'); assert(configViewContent.includes('