fix(export): 修复Excel导出zipstream库PHP8兼容性与临时文件安全流式输出
这个提交包含在:
@@ -36,7 +36,7 @@ const withdrawServicePath = path.resolve(__dirname, '../../addons/shopro/service
|
||||
testAssert(fs.existsSync(withdrawServicePath), 'Withdraw.php 服务文件存在');
|
||||
if (fs.existsSync(withdrawServicePath)) {
|
||||
const content = fs.readFileSync(withdrawServicePath, 'utf-8');
|
||||
testAssert(content.includes("WalletService::change($this->user, 'money', -$money, 'withdraw'"), 'apply 提现申请仅从商城余额扣除本金 -$money(内扣模式)');
|
||||
testAssert(content.includes("WalletService::change($this->user, 'money', -$money, 'withdraw'"), 'apply 提现申请仅从钱包余额扣除本金 -$money(内扣模式)');
|
||||
testAssert(content.includes("bccomp((string)($this->user->money ?? 0), (string)$money, 2) < 0"), 'checkApply 校验余额只需大于等于提现本金 money(无需累加手续费)');
|
||||
testAssert(content.includes("ShoproException('扣除手续费后实际到账金额必须大于0元')"), 'checkApply 严格拦截扣除手续费后实际到账小于等于0的请求');
|
||||
testAssert(content.includes("$withdraw->paid_fee = bcsub((string)$withdraw->amount, (string)$withdraw->charge_fee, 2);"), 'handleWithdraw 实际打款金额为 (amount - charge_fee)');
|
||||
@@ -80,7 +80,7 @@ const userA = {
|
||||
|
||||
function applyWithdrawInternal(user, amount) {
|
||||
if (user.money < amount) {
|
||||
throw new Error('商城可用余额不足');
|
||||
throw new Error('钱包可用余额不足');
|
||||
}
|
||||
const charge = Math.round(amount * chargeRate * 100) / 100;
|
||||
const realPaid = Math.round((amount - charge) * 100) / 100;
|
||||
@@ -113,16 +113,16 @@ testAssert(userA.commission === 500.00, '佣金钱包完全不受影响保持 50
|
||||
|
||||
// 场景 B:审核驳回
|
||||
refuseWithdrawInternal(userA, orderA);
|
||||
testAssert(userA.money === 1000.00, '审核驳回后商城余额原路全额退还至 1000.00 元');
|
||||
testAssert(userA.money === 1000.00, '审核驳回后钱包余额原路全额退还至 1000.00 元');
|
||||
|
||||
// 场景 C:超额提现拦截
|
||||
let hasIntercept = false;
|
||||
try {
|
||||
applyWithdrawInternal(userA, 1500.00);
|
||||
} catch (e) {
|
||||
hasIntercept = (e.message === '商城可用余额不足');
|
||||
hasIntercept = (e.message === '钱包可用余额不足');
|
||||
}
|
||||
testAssert(hasIntercept, '超额提现精准拦截并抛出【商城可用余额不足】');
|
||||
testAssert(hasIntercept, '超额提现精准拦截并抛出【钱包可用余额不足】');
|
||||
|
||||
console.log(`\n========================================================`);
|
||||
console.log(` 测试结果: 通过 ${passCount} 项, 失败 ${failCount} 项`);
|
||||
|
||||
在新工单中引用
屏蔽一个用户