| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Models\Agent;
- use App\Models\BaseModel;
- class AgentRecharge extends BaseModel
- {
- public const TYPE_AUTO = 1;
- public const TYPE_HAND = 2;
- public const STATUS_STAY = 0;
- public const STATUS_SUCCESS = 1;
- public const STATUS_FAIL = 2;
- public const STATUS_IGNORE = 3;
- protected $table = 'agent_recharges';
- protected $guarded = ['id'];
- protected $hidden = [];
- protected $appends = ['status_text'];
- protected $casts = [
- 'agent_id' => 'integer', 'type' => 'integer', 'status' => 'integer', 'confirmations' => 'integer',
- 'usdt_amount' => 'decimal:4', 'exchange_rate' => 'decimal:4', 'amount' => 'decimal:4',
- 'audit_admin_id' => 'integer', 'confirmed_at' => 'datetime',
- ];
- public function agent()
- {
- return $this->belongsTo(Agent::class);
- }
- public function getStatusTextAttribute(): string
- {
- return [self::STATUS_STAY => '待确认', self::STATUS_SUCCESS => '已到账', self::STATUS_FAIL => '已驳回', self::STATUS_IGNORE => '已忽略'][(int) $this->status] ?? '';
- }
- }
|