virtual_activated_at

This commit is contained in:
邓皓元 2019-05-13 10:16:26 +08:00
parent 08e097e7ab
commit aaa969a283

View File

@ -43,10 +43,13 @@ class RefundSync extends Command
->update(['refunded_at' => $item->create_time]); ->update(['refunded_at' => $item->create_time]);
DB::table('virtual_order_cards_partition') DB::table('virtual_order_cards_partition')
->whereIn('sim', $item->sim) ->leftJoin('cards', 'cards.sim', '=', 'virtual_order_cards_partition.sim')
->where('created_at', '<=', $item->create_time) ->whereIn('virtual_order_cards_partition.sim', $item->sim)
// ->whereNull('service_start_at') ->where('virtual_order_cards_partition.created_at', '<=', $item->create_time)
->update(['refunded_at' => $item->create_time]); ->where(function ($query) use ($item) {
$query->whereNull('cards.virtual_activated_at')->orWhere('cards.virtual_activated_at', '>=', $item->create_time);
})
->update(['virtual_order_cards_partition.refunded_at' => $item->create_time]);
} }
}); });