[游戏管理]游戏实时对局

This commit is contained in:
2026-04-16 15:10:12 +08:00
parent 15fdd3ba57
commit c7149e7058
29 changed files with 1158 additions and 157 deletions

View File

@@ -2,7 +2,9 @@
namespace app\common\model;
use app\common\service\GameLiveService;
use support\think\Model;
use Throwable;
class BetOrder extends Model
{
@@ -34,9 +36,18 @@ class BetOrder extends Model
return $this->belongsTo(Channel::class, 'channel_id', 'id');
}
public function gamePeriod(): \think\model\relation\BelongsTo
protected static function onAfterInsert($model): void
{
return $this->belongsTo(GamePeriod::class, 'period_id', 'id');
try {
$periodId = isset($model['period_id']) ? (int) $model['period_id'] : null;
GameLiveService::publishSnapshot($periodId);
} catch (Throwable) {
}
}
public function gameRecord(): \think\model\relation\BelongsTo
{
return $this->belongsTo(GameRecord::class, 'period_id', 'id');
}
}