'历史汇总', 1 => '真人', 2 => '电子', 3 => '彩票', 4 => '体育', 5 => '电竞', 6 => '捕鱼', 7 => '棋牌', ]; protected $table = 'agent_rebate_records'; protected $hidden = ['snapshot']; protected $guarded = []; protected $appends = ['agent_username', 'game_type_text', 'flow_status_text', 'profit_status_text']; protected $casts = [ 'settlement_date' => 'date', 'agent_id' => 'integer', 'game_type' => 'integer', 'bet_count' => 'integer', 'bet_amount' => 'decimal:4', 'valid_bet_amount' => 'decimal:4', 'win_loss' => 'decimal:4', 'flow_rate' => 'decimal:4', 'flow_commission' => 'decimal:4', 'profit_rate' => 'decimal:4', 'profit_commission' => 'decimal:4', 'snapshot' => 'array', 'credited_at' => 'datetime', ]; public function agent() { return $this->belongsTo(Agent::class); } public function getAgentUsernameAttribute(): string { return (string) ($this->agent?->username ?? ''); } public function getGameTypeTextAttribute(): string { return self::GAME_TYPE_NAMES[(int) $this->game_type] ?? '未知'; } public function getFlowStatusTextAttribute(): string { return $this->statusText((string) $this->flow_status); } public function getProfitStatusTextAttribute(): string { return $this->statusText((string) $this->profit_status); } private function statusText(string $status): string { return $status === self::STATUS_CREDITED ? '已返佣' : '待返佣'; } }