fix(export): 修复Excel导出zipstream库PHP8兼容性与临时文件安全流式输出
这个提交包含在:
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* 商城可用余额(money)提现全链路规格与算法模拟测试
|
||||
* 钱包可用余额(money)提现全链路规格与算法模拟测试
|
||||
* 覆盖范围:
|
||||
* 1. uniapp/pages/pay/withdraw.vue 前端商城余额提现默认绑定、全部提现与参数透传
|
||||
* 1. uniapp/pages/pay/withdraw.vue 前端钱包余额提现默认绑定、全部提现与参数透传
|
||||
* 2. addons/shopro/service/Withdraw.php 服务层 apply 余额扣除、checkApply 拦截与驳回/失败退还闭环
|
||||
* 3. application/admin/model/shopro/Withdraw.php 后台模型 is_money_withdraw 与 display 资产标识
|
||||
* 4. application/admin/model/shopro/user/WalletLog.php 钱包日志字典增加 withdraw / withdraw_error
|
||||
* 5. application/admin/view/shopro/withdraw/index.html 后台表格专属「商城余额」标签
|
||||
* 5. application/admin/view/shopro/withdraw/index.html 后台表格专属「钱包余额」标签
|
||||
* 6. 提现扣款、手续费计算、超额拦截、审核驳回原路退款守恒性算法模拟断言
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ function testAssert(condition, message) {
|
||||
}
|
||||
|
||||
console.log('========================================================');
|
||||
console.log(' 商城可用余额(money)提现全链路专项测试');
|
||||
console.log(' 钱包可用余额(money)提现全链路专项测试');
|
||||
console.log('========================================================\n');
|
||||
|
||||
// ----------------------------------------------------
|
||||
@@ -39,11 +39,11 @@ testAssert(fs.existsSync(withdrawVuePath), 'withdraw.vue 文件存在');
|
||||
if (fs.existsSync(withdrawVuePath)) {
|
||||
const content = fs.readFileSync(withdrawVuePath, 'utf-8');
|
||||
testAssert(content.includes("walletType: 'money'"), 'state.walletType 默认初始化为 money');
|
||||
testAssert(content.includes("userInfo.money || '0.00'"), '顶部主卡片绑定用户商城可用余额 userInfo.money');
|
||||
testAssert(content.includes("onWithdrawAllMoney"), '提供一键全部提现商城余额方法 onWithdrawAllMoney');
|
||||
testAssert(content.includes("userInfo.money || '0.00'"), '顶部主卡片绑定用户钱包可用余额 userInfo.money');
|
||||
testAssert(content.includes("onWithdrawAllMoney"), '提供一键全部提现钱包余额方法 onWithdrawAllMoney');
|
||||
testAssert(content.includes("onWithdrawAllCommission"), '兼容提供全部提现存量佣金方法 onWithdrawAllCommission');
|
||||
testAssert(content.includes("payload.wallet_type = 'money'"), '提交时对齐传递 wallet_type: money');
|
||||
testAssert(content.includes("Number(payload.money) > Number(userInfo.value?.money || 0)"), '严格校验提现金额不得超过商城可用余额');
|
||||
testAssert(content.includes("Number(payload.money) > Number(userInfo.value?.money || 0)"), '严格校验提现金额不得超过钱包可用余额');
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
@@ -57,7 +57,7 @@ if (fs.existsSync(withdrawServicePath)) {
|
||||
testAssert(content.includes("$walletType = $params['wallet_type'] ?? 'money';"), '提现钱包默认缺省读取为 money');
|
||||
testAssert(content.includes("$walletType = 'money';"), '支持自动升级或使用 money 提现类型');
|
||||
testAssert(content.includes("WalletService::change($this->user, 'money'"), 'apply 支持扣除用户 money 钱包');
|
||||
testAssert(content.includes("ShoproException('商城可用余额不足')"), 'checkApply 校验余额不足抛出明确中文异常');
|
||||
testAssert(content.includes("ShoproException('钱包可用余额不足')"), 'checkApply 校验余额不足抛出明确中文异常');
|
||||
testAssert(content.includes("$isMoney = (isset($info['wallet_type']) && $info['wallet_type'] === 'money')"), '识别 isMoney 提现类型');
|
||||
testAssert(content.includes("'提现驳回退还余额'"), 'handleRefuse 识别余额提现驳回并原路退回余额');
|
||||
testAssert(content.includes("'提现失败退还余额'"), 'handleFail 识别余额提现打款失败并原路退回余额');
|
||||
@@ -73,7 +73,7 @@ if (fs.existsSync(adminWithdrawModelPath)) {
|
||||
const content = fs.readFileSync(adminWithdrawModelPath, 'utf-8');
|
||||
testAssert(content.includes("'is_money_withdraw'"), '$append 追加属性包含 is_money_withdraw');
|
||||
testAssert(content.includes("public function getIsMoneyWithdrawAttr"), '提供 getIsMoneyWithdrawAttr 获取器方法');
|
||||
testAssert(content.includes("$display['提现资产'] = '商城余额'"), 'getWithdrawInfoDisplayAttr 注入 提现资产: 商城余额');
|
||||
testAssert(content.includes("$display['提现资产'] = '钱包余额'"), 'getWithdrawInfoDisplayAttr 注入 提现资产: 钱包余额');
|
||||
}
|
||||
|
||||
const adminWithdrawViewPath = path.resolve(__dirname, '../../application/admin/view/shopro/withdraw/index.html');
|
||||
@@ -81,7 +81,7 @@ testAssert(fs.existsSync(adminWithdrawViewPath), 'application/admin/view/shopro/
|
||||
if (fs.existsSync(adminWithdrawViewPath)) {
|
||||
const content = fs.readFileSync(adminWithdrawViewPath, 'utf-8');
|
||||
testAssert(content.includes("scope.row.is_money_withdraw"), '表格金额列支持判断 is_money_withdraw');
|
||||
testAssert(content.includes("商城余额"), '展示专属 商城余额 标签');
|
||||
testAssert(content.includes("钱包余额"), '展示专属 钱包余额 标签');
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
@@ -125,7 +125,7 @@ function simulateApplyWithdraw(user, amount, walletType) {
|
||||
|
||||
if (walletType === 'money') {
|
||||
if (user.money < totalDeduct) {
|
||||
throw new Error('商城可用余额不足');
|
||||
throw new Error('钱包可用余额不足');
|
||||
}
|
||||
user.money = Math.round((user.money - totalDeduct) * 100) / 100;
|
||||
} else {
|
||||
@@ -157,7 +157,7 @@ const initialMoney = userState.money;
|
||||
const withdrawRecord = simulateApplyWithdraw(userState, 1000.00, 'money');
|
||||
testAssert(withdrawRecord.amount === 1000.00, '申请提现本金 1000.00 元');
|
||||
testAssert(withdrawRecord.charge_fee === 10.00, '1% 提现手续费 10.00 元');
|
||||
testAssert(userState.money === 47592.00, '用户商城余额原子扣减 1010.00 元,剩余 47592.00 元');
|
||||
testAssert(userState.money === 47592.00, '用户钱包余额原子扣减 1010.00 元,剩余 47592.00 元');
|
||||
testAssert(userState.commission === 0.00, '佣金账户不受影响保持 0.00 元');
|
||||
|
||||
// 模拟场景 B:提现驳回退款
|
||||
@@ -181,7 +181,7 @@ try {
|
||||
} catch (e) {
|
||||
balanceError = e.message;
|
||||
}
|
||||
testAssert(balanceError === '商城可用余额不足', '余额不足提现请求被严密拦截并输出友好提示');
|
||||
testAssert(balanceError === '钱包可用余额不足', '余额不足提现请求被严密拦截并输出友好提示');
|
||||
|
||||
console.log('\n========================================================');
|
||||
console.log(`测试完成!通过: ${passCount}, 失败: ${failCount}`);
|
||||
|
||||
在新工单中引用
屏蔽一个用户