1.压注记录修改为游玩记录
2.测试结算并测试 3.备份数据库
This commit is contained in:
51
app/common/model/PlayRecord.php
Normal file
51
app/common/model/PlayRecord.php
Normal 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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user