[游戏管理]游戏实时对局
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user