1.压注记录修改为游玩记录

2.测试结算并测试
3.备份数据库
This commit is contained in:
2026-04-23 17:21:02 +08:00
parent 1531115a26
commit f2b4dab54f
20 changed files with 2130 additions and 94 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace app\common\model;
use app\common\service\GameLiveService;
use support\think\Model;
use Throwable;
class PlayRecord extends Model
{
protected $name = 'game_play_record';
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'pick_numbers' => 'json',
'total_amount' => 'string',
'win_amount' => 'string',
'jackpot_extra_amount' => 'string',
'status' => 'integer',
'streak_at_bet' => 'integer',
'is_auto' => 'integer',
];
public function user(): \think\model\relation\BelongsTo
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
public function channel(): \think\model\relation\BelongsTo
{
return $this->belongsTo(Channel::class, 'channel_id', 'id');
}
protected static function onAfterInsert($model): void
{
try {
$periodId = isset($model['period_id']) ? intval($model['period_id']) : null;
GameLiveService::publishSnapshot($periodId);
} catch (Throwable) {
}
}
public function gameRecord(): \think\model\relation\BelongsTo
{
return $this->belongsTo(GameRecord::class, 'period_id', 'id');
}
}