| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Models\Agent;
- use App\Models\BaseModel;
- class AgentWithdrawal extends BaseModel
- {
- protected $table = 'agent_withdrawals';
- protected $fillable = ['order_no', 'request_key', 'agent_id', 'account_id', 'account_type', 'account_snapshot', 'amount', 'fee', 'actual_amount',
- 'usdt_amount', 'actual_usdt_amount', 'exchange_rate', 'status', 'remark', 'audit_remark', 'audit_admin_id', 'audited_at', 'paid_at',
- 'pay_no', 'pay_data', 'callback_data'];
- // 三方代付的原始返回/回调只给总后台看(列表里 makeVisible)。
- protected $hidden = ['request_key', 'pay_data', 'callback_data'];
- protected $appends = ['status_text', 'channel'];
- public const STATUS_TEXT = ['pending' => '待审核', 'approved' => '已通过', 'processing' => '代付中', 'paid' => '已打款', 'rejected' => '已驳回', 'failed' => '代付失败'];
- protected $casts = ['agent_id' => 'integer', 'amount' => 'decimal:4', 'fee' => 'decimal:4', 'actual_amount' => 'decimal:4',
- 'usdt_amount' => 'decimal:4', 'actual_usdt_amount' => 'decimal:4', 'exchange_rate' => 'decimal:4',
- 'account_snapshot' => 'array', 'audited_at' => 'datetime', 'paid_at' => 'datetime'];
- public function getStatusTextAttribute(): string
- {
- return self::STATUS_TEXT[(string) $this->status] ?? '';
- }
- /** 提现通道,同 account_type(历史数据为空时是 usdt)。 */
- public function getChannelAttribute(): string
- {
- return (string) ($this->attributes['account_type'] ?? '') ?: 'usdt';
- }
- public function agent()
- {
- return $this->belongsTo(Agent::class);
- }
- }
|