feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池
This commit is contained in:
50
app/Models/JackpotContribution.php
Normal file
50
app/Models/JackpotContribution.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/** 单注对 Jackpot 的蓄水 {@see jackpot_contributions} */
|
||||
class JackpotContribution extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'jackpot_pool_id',
|
||||
'draw_id',
|
||||
'player_id',
|
||||
'ticket_item_id',
|
||||
'contribution_amount',
|
||||
'currency_code',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'jackpot_pool_id' => 'integer',
|
||||
'draw_id' => 'integer',
|
||||
'player_id' => 'integer',
|
||||
'ticket_item_id' => 'integer',
|
||||
'contribution_amount' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function pool(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(JackpotPool::class, 'jackpot_pool_id');
|
||||
}
|
||||
|
||||
public function draw(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Draw::class);
|
||||
}
|
||||
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Player::class);
|
||||
}
|
||||
|
||||
public function ticketItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TicketItem::class, 'ticket_item_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user