|
|
@@ -228,6 +228,20 @@ class SharingBetFactsTest extends TestCase
|
|
|
$this->assertSame(['2026-10-01'], json_decode(DB::table('share_system_state')->where('key', 'facts_dirty_dates')->value('value'), true));
|
|
|
}
|
|
|
|
|
|
+ public function test_legacy_lottery_orders_without_child_bets_are_skipped_and_cursor_advances(): void
|
|
|
+ {
|
|
|
+ $time = Carbon::parse('2026-05-01 10:00:00', 'Asia/Shanghai')->timestamp;
|
|
|
+ DB::table('lhc_order')->insert(['id' => 5, 'member_id' => '10001', 'ordernum' => 'legacy-lottery', 'type' => 5,
|
|
|
+ 'lottery_status' => 2, 'amount' => 100, 'created_at' => $time, 'updated_at' => $time]);
|
|
|
+ $this->lottery();
|
|
|
+ $sync = new BetFactSynchronizer();
|
|
|
+ $this->assertSame('Lottery order has no identifiable child bets', $sync->sync()['errors'][0]['reason']);
|
|
|
+ app('config')->set('sharing.lottery_legacy_max_id', 5);
|
|
|
+ $result = $sync->sync(null, null, true);
|
|
|
+ $this->assertSame([], $result['errors']); $this->assertSame(1, $result['scanned']); $this->assertSame(2, $result['created']);
|
|
|
+ $this->assertNotNull(DB::table('share_system_state')->where('key', 'facts_cursor:lhc_order')->value('value'));
|
|
|
+ }
|
|
|
+
|
|
|
public function test_second_child_failure_rolls_back_all_facts_dirty_dates_and_source_cursor(): void
|
|
|
{
|
|
|
$this->lottery();
|