Merge branch 'master' of /mnt/git/v2.tiantianxinye.365care

master
songweizong 4 months ago
commit a6a493fbec

@ -55,6 +55,8 @@ class FixOrderItemsPaidAt extends Command
$serviceDateStr = $serviceDate->format('Y-m-d');
$serviceDateEnd = $serviceDateStr . ' 23:59:59';
// 计算 service_date 所在月份的月底最后一秒
$monthEnd = $serviceDate->copy()->endOfMonth()->format('Y-m-d 23:59:59');
$isDryRun = $this->option('dry-run');
if ($isDryRun) {
@ -64,6 +66,7 @@ class FixOrderItemsPaidAt extends Command
$this->info("开始" . ($isDryRun ? "预览" : "修复") . " {$serviceDateStr} 的订单项...");
$this->info("目标时间点:{$serviceDateEnd}");
$this->info("余额计算时间点:{$monthEnd}(当月月底最后一秒)");
// 查询需要修复的记录
// 条件paid_at 的日期晚于 service_date且不在同一月份
@ -114,8 +117,8 @@ class FixOrderItemsPaidAt extends Command
continue;
}
// 计算在 service_date 时的客户余额
$balanceAtTime = $this->calculateCustomerBalanceAtTime($customerId, $serviceDateStr, $item->id);
// 计算在 service_date 所在月份月底最后一秒时的客户余额
$balanceAtTime = $this->calculateCustomerBalanceAtTime($customerId, $monthEnd, $item->id);
// 判断是否满足修复条件
if ($balanceAtTime >= $item->total) {

Loading…
Cancel
Save