Files
webman-buildadmin/app/common/model/GameRecord.php
zhenhui 687257adaa 1.优化实时对局页面样式以及自动创建下一局和作废本局的记录
2.新增派彩达到game_config.jackpot_max_amount必须审核才能发放
3.新增游戏对局记录-查看游玩记录btn
3.备份MySQL数据库
2026-04-28 18:25:44 +08:00

57 lines
1.6 KiB
PHP

<?php
namespace app\common\model;
use app\common\service\GameHotDataCoordinator;
use support\think\Model;
class GameRecord extends Model
{
protected $name = 'game_record';
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'period_start_at' => 'integer',
'status' => 'integer',
'draw_mode' => 'integer',
'result_number' => 'integer',
'ai_locked_number' => 'integer',
'pending_draw_number' => 'integer',
'payout_until' => 'integer',
'platform_profit_amount' => 'string',
'winner_user_count' => 'integer',
];
public function setPeriodStartAtAttr($value, $data = [])
{
if ($value === null || $value === '') {
return 0;
}
if (is_int($value)) {
return $value;
}
if (is_string($value)) {
$t = strtotime($value);
if ($t !== false) {
return $t;
}
}
return 0;
}
public static function onAfterWrite(GameRecord $model): void
{
$id = filter_var($model->getAttr('id'), FILTER_VALIDATE_INT);
GameHotDataCoordinator::afterGameRecordCommitted($id === false ? null : $id);
}
public static function onAfterDelete(GameRecord $model): void
{
$id = filter_var($model->getAttr('id'), FILTER_VALIDATE_INT);
GameHotDataCoordinator::afterGameRecordCommitted($id === false ? null : $id);
}
}