[game_type 编码, 名称]。 */ public const CATEGORIES = [ 'self:lottery' => [8, 'F1彩票'], 'self:sport' => [9, 'F1体育'], 'third:1' => [1, '真人'], 'third:2' => [2, '电子'], 'third:4' => [4, '体育'], 'third:5' => [5, '电竞'], 'third:6' => [6, '捕鱼'], 'third:7' => [7, '棋牌'], ]; protected $table = 'agent_rebate_records'; protected $hidden = ['snapshot']; protected $guarded = []; protected $appends = ['agent_username', 'category', 'category_text', 'profit_status_text']; protected $casts = [ 'settlement_date' => 'date:Y-m-d', 'agent_id' => 'integer', 'game_type' => 'integer', 'bet_count' => 'integer', 'entry_count' => 'integer', 'bet_amount' => 'decimal:4', 'valid_bet_amount' => 'decimal:4', 'win_loss' => 'decimal:4', 'profit_rate' => 'decimal:4', 'profit_commission' => 'decimal:4', 'snapshot' => 'array', 'credited_at' => 'datetime', ]; public function agent() { return $this->belongsTo(Agent::class); } public static function categoryName(string $category): string { return self::CATEGORIES[$category][1] ?? $category; } public function getAgentUsernameAttribute(): string { return (string) ($this->agent?->username ?? ''); } public function getCategoryAttribute(): string { return (string) $this->platform; } public function getCategoryTextAttribute(): string { return self::categoryName((string) $this->platform); } public function getProfitStatusTextAttribute(): string { return (string) $this->profit_status === self::STATUS_CREDITED ? '已入账' : '待入账'; } }