fix(export): 修复Excel导出zipstream库PHP8兼容性与临时文件安全流式输出
这个提交包含在:
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* 收益分成直接加到商城余额专项验证测试
|
||||
* 收益分成直接加到钱包余额专项验证测试
|
||||
* 覆盖范围:
|
||||
* 1. PartnerConfig (rewardWalletType 默认 money)
|
||||
* 2. PartnerRewardService (account 走 money 入账,refund 智能回滚)
|
||||
* 3. DailySettleService (cashShare 走 money 入账,clearDaily 智能回滚)
|
||||
* 4. 后台 Reward 控制器 (add 走 money 入账,back 智能回滚)
|
||||
* 5. WalletLog 模型 (eventMap['money'] 补全收益事件,getEventTextAttr 动态解析)
|
||||
* 6. 用户端组件 account-info.vue (展示商城余额并跳转 /pages/user/wallet/money)
|
||||
* 6. 用户端组件 account-info.vue (展示钱包余额并跳转 /pages/user/wallet/money)
|
||||
* 7. 业务逻辑与回滚算法行为模拟断言
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ function assert(condition, message) {
|
||||
}
|
||||
|
||||
console.log('========================================================');
|
||||
console.log(' 收益分成直接加到商城余额专项测试');
|
||||
console.log(' 收益分成直接加到钱包余额专项测试');
|
||||
console.log('========================================================\n');
|
||||
|
||||
// ----------------------------------------------------
|
||||
@@ -39,7 +39,7 @@ assert(fs.existsSync(partnerConfigPath), 'PartnerConfig.php 文件存在');
|
||||
if (fs.existsSync(partnerConfigPath)) {
|
||||
const content = fs.readFileSync(partnerConfigPath, 'utf-8');
|
||||
assert(content.includes('public static function rewardWalletType()'), '包含 rewardWalletType() 收益入账钱包解析方法');
|
||||
assert(content.includes("self::get('partner_reward_wallet', 'money')"), '默认收益入账钱包缺省为 money (商城余额)');
|
||||
assert(content.includes("self::get('partner_reward_wallet', 'money')"), '默认收益入账钱包缺省为 money (钱包余额)');
|
||||
assert(content.includes("in_array($type, ['money', 'commission'])"), '安全限定钱包类型在合法区间');
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ assert(fs.existsSync(partnerRewardServicePath), 'PartnerRewardService.php 文件
|
||||
if (fs.existsSync(partnerRewardServicePath)) {
|
||||
const content = fs.readFileSync(partnerRewardServicePath, 'utf-8');
|
||||
assert(content.includes('$walletType = PartnerConfig::rewardWalletType();'), 'account() 动态获取收益入账钱包类型');
|
||||
assert(content.includes('Wallet::change($userId, $walletType, $amount, $type,'), 'account() 使用动态钱包入账(直接入商城余额)');
|
||||
assert(content.includes('Wallet::change($userId, $walletType, $amount, $type,'), 'account() 使用动态钱包入账(直接入钱包余额)');
|
||||
assert(content.includes("AgentModel::where('user_id', $userId)->setInc('total_income', $amount);"), '保留分销商累计收益 total_income 累加');
|
||||
assert(content.includes('$walletLog = \\app\\admin\\model\\shopro\\user\\WalletLog::where('), 'refund() 退款时查询原入账钱包记录');
|
||||
assert(content.includes("$targetWallet = ($walletLog && $walletLog->type === 'commission') ? 'commission' : PartnerConfig::rewardWalletType();"), 'refund() 智能根据原入账类型回滚对应钱包');
|
||||
@@ -68,7 +68,7 @@ assert(fs.existsSync(dailySettleServicePath), 'DailySettleService.php 文件存
|
||||
if (fs.existsSync(dailySettleServicePath)) {
|
||||
const content = fs.readFileSync(dailySettleServicePath, 'utf-8');
|
||||
assert(content.includes('$walletType = PartnerConfig::rewardWalletType();'), 'cashShare() 获取收益入账钱包类型');
|
||||
assert(content.includes('Wallet::change($userId, $walletType, $each, $type,'), 'cashShare() 日结酒道馆/区县分成直接加到商城余额');
|
||||
assert(content.includes('Wallet::change($userId, $walletType, $each, $type,'), 'cashShare() 日结酒道馆/区县分成直接加到钱包余额');
|
||||
assert(content.includes("AgentModel::where('user_id', $userId)->setInc('total_income', $each);"), 'cashShare() 累计更新 total_income');
|
||||
assert(content.includes("$targetWallet = ($walletLog && $walletLog->type === 'commission') ? 'commission' : PartnerConfig::rewardWalletType();"), 'clearDaily() 重跑日结时智能识别并回滚对应钱包');
|
||||
}
|
||||
@@ -82,7 +82,7 @@ assert(fs.existsSync(rewardCtrlPath), 'Reward.php 文件存在');
|
||||
if (fs.existsSync(rewardCtrlPath)) {
|
||||
const content = fs.readFileSync(rewardCtrlPath, 'utf-8');
|
||||
assert(content.includes('$walletType = PartnerConfig::rewardWalletType();'), 'add() 手工补发获取收益入账钱包类型');
|
||||
assert(content.includes('Wallet::change($params[\'user_id\'], $walletType, $amount, \'reward_income\''), 'add() 手工补发直接加到商城余额');
|
||||
assert(content.includes('Wallet::change($params[\'user_id\'], $walletType, $amount, \'reward_income\''), 'add() 手工补发直接加到钱包余额');
|
||||
assert(content.includes("$targetWallet = ($walletLog && $walletLog->type === 'commission') ? 'commission' : PartnerConfig::rewardWalletType();"), 'back() 手工撤销智能回滚对应钱包');
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ const accountInfoPath = path.resolve(__dirname, '../../uniapp/pages/commission/c
|
||||
assert(fs.existsSync(accountInfoPath), 'account-info.vue 文件存在');
|
||||
if (fs.existsSync(accountInfoPath)) {
|
||||
const content = fs.readFileSync(accountInfoPath, 'utf-8');
|
||||
assert(content.includes('<view class="item-title">商城余额(元)</view>'), '卡片标签已变更为「商城余额(元)」');
|
||||
assert(content.includes("userInfo?.money || '0.00'"), '读取 userInfo.money 商城余额');
|
||||
assert(content.includes("sheep.$router.go('/pages/user/wallet/money')"), '点击商城余额卡片直达 /pages/user/wallet/money');
|
||||
assert(content.includes('<view class="item-title">钱包余额(元)</view>'), '卡片标签已变更为「钱包余额(元)」');
|
||||
assert(content.includes("userInfo?.money || '0.00'"), '读取 userInfo.money 钱包余额');
|
||||
assert(content.includes("sheep.$router.go('/pages/user/wallet/money')"), '点击钱包余额卡片直达 /pages/user/wallet/money');
|
||||
assert(content.includes("sheep.$router.go('/pages/commission/rewards')"), '查看明细直达收益明细');
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ const mockUser = { id: 10, money: '100.00', commission: '0.00' };
|
||||
const mockAgent = { user_id: 10, total_income: '500.00' };
|
||||
const log1 = mockAccountReward(mockUser, mockAgent, 398.00, 'push3');
|
||||
|
||||
assert(mockUser.money === '498.00', '模拟即时奖入账:用户商城余额从 100 增至 498.00');
|
||||
assert(mockUser.money === '498.00', '模拟即时奖入账:用户钱包余额从 100 增至 498.00');
|
||||
assert(mockUser.commission === '0.00', '模拟即时奖入账:佣金钱包维持 0.00 未动');
|
||||
assert(mockAgent.total_income === '898.00', '模拟即时奖入账:分销商累计收益从 500 累加至 898.00');
|
||||
assert(log1.type === 'money' && log1.event === 'push3', '产生正确的 money 钱包变更流水');
|
||||
|
||||
在新工单中引用
屏蔽一个用户