feat: 添加新的错误码以支持投注功能,更新数据库填充器以增强玩法和赔率配置,扩展 API 路由以支持风险池管理
This commit is contained in:
84
app/Models/TicketItem.php
Normal file
84
app/Models/TicketItem.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/** 注项明细 {@see ticket_items} */
|
||||
class TicketItem extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'ticket_no',
|
||||
'order_id',
|
||||
'player_id',
|
||||
'draw_id',
|
||||
'original_number',
|
||||
'normalized_number',
|
||||
'play_code',
|
||||
'dimension',
|
||||
'digit_slot',
|
||||
'bet_mode',
|
||||
'unit_bet_amount',
|
||||
'total_bet_amount',
|
||||
'rebate_rate_snapshot',
|
||||
'commission_rate_snapshot',
|
||||
'actual_deduct_amount',
|
||||
'odds_snapshot_json',
|
||||
'rule_snapshot_json',
|
||||
'combination_count',
|
||||
'estimated_max_payout',
|
||||
'risk_locked_amount',
|
||||
'status',
|
||||
'fail_reason_code',
|
||||
'fail_reason_text',
|
||||
'win_amount',
|
||||
'jackpot_win_amount',
|
||||
'settled_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'order_id' => 'integer',
|
||||
'player_id' => 'integer',
|
||||
'draw_id' => 'integer',
|
||||
'dimension' => 'integer',
|
||||
'digit_slot' => 'integer',
|
||||
'unit_bet_amount' => 'integer',
|
||||
'total_bet_amount' => 'integer',
|
||||
'rebate_rate_snapshot' => 'decimal:4',
|
||||
'commission_rate_snapshot' => 'decimal:4',
|
||||
'actual_deduct_amount' => 'integer',
|
||||
'odds_snapshot_json' => 'json',
|
||||
'rule_snapshot_json' => 'json',
|
||||
'combination_count' => 'integer',
|
||||
'estimated_max_payout' => 'integer',
|
||||
'risk_locked_amount' => 'integer',
|
||||
'win_amount' => 'integer',
|
||||
'jackpot_win_amount' => 'integer',
|
||||
'settled_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function order(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TicketOrder::class, 'order_id');
|
||||
}
|
||||
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Player::class);
|
||||
}
|
||||
|
||||
public function draw(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Draw::class);
|
||||
}
|
||||
|
||||
public function combinations(): HasMany
|
||||
{
|
||||
return $this->hasMany(TicketCombination::class, 'ticket_item_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user