|
|
@@ -322,11 +322,11 @@ class SuperballActivityService
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- // 若用户选择的号码等于当日 lucky_number,则把 superball_daily.lucky_count 累加
|
|
|
+ // 若用户选择的号码等于当日 lucky_number,则把 superball_daily.lucky_count 累加(使用原子自增,避免锁住整行)
|
|
|
$daily = DB::connection('write')
|
|
|
->table(TableName::agent() . 'superball_daily')
|
|
|
+ ->lock('with(nolock)')
|
|
|
->where('pool_date', $today)
|
|
|
- ->lockForUpdate()
|
|
|
->first();
|
|
|
|
|
|
if ($daily) {
|
|
|
@@ -342,7 +342,7 @@ class SuperballActivityService
|
|
|
->table(TableName::agent() . 'superball_daily')
|
|
|
->where('pool_date', $today)
|
|
|
->update([
|
|
|
- 'lucky_count' => (int) $daily->lucky_count + $matched,
|
|
|
+ 'lucky_count' => DB::raw("lucky_count + {$matched}"),
|
|
|
'updated_at' => now()->format('Y-m-d H:i:s'),
|
|
|
]);
|
|
|
}
|