fix(settle): 增强 DailySettleService ext 数组保护并完善全收益终审断言

这个提交包含在:
chen
2026-09-26 14:22:43 +08:00
父节点 1c3f77dd55
当前提交 0525265074
共有 2 个文件被更改,包括 17 次插入 和 3 次删除

查看文件

@@ -338,18 +338,20 @@ class FullOrderRewardVerification
$this->assert(!empty($agentD['last_self_order_time']), "买家 D last_self_order_time 已成功激活");
// 调用 IdentityService 检查输出的时间戳与天数
$attached = IdentityService::attachAgent($agentD);
$agentModelD = \app\admin\model\shopro\commission\Agent::where('user_id', $buyerId)->find();
$attached = IdentityService::attachAgent($agentModelD);
$this->assert($attached['active_30d'] === true, "买家 D active_30d 为 true (活跃有效)");
$this->assert($attached['active_status'] === 'active', "买家 D active_status 为 'active' (正常活跃)");
$this->assert($attached['days_remaining'] == 30, "买家 D 剩余天数满额显示 30 天 (实际: {$attached['days_remaining']})");
// 校验到期时间戳:订单支付时刻 + 30 * 86400 (方案 A 精确顺延)
$expectedExpire = intval($order->paid_time) + 30 * 86400;
$paidTimestamp = is_numeric($order->paid_time) ? intval($order->paid_time) : strtotime($order->paid_time);
$expectedExpire = $paidTimestamp + 30 * 86400;
$this->assert($attached['expire_time'] == $expectedExpire, "到期时间戳精确顺延720小时,绝无零点截断 (实际: {$attached['expire_time']}, 期望: {$expectedExpire})");
// 验证直推人 C 也获得双向保活更新
$agentC = Db::name('shopro_commission_agent')->where('user_id', $chain['c']->id)->find();
$this->assert($agentC['last_self_order_time'] >= $order->paid_time, "直推上级 C 同样被直推订单双向激活保活");
$this->assert($agentC['last_self_order_time'] >= $paidTimestamp, "直推上级 C 同样被直推订单双向激活保活");
echo "\n";
}