AgentRecharge.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Models\Agent;
  3. use App\Models\BaseModel;
  4. class AgentRecharge extends BaseModel
  5. {
  6. public const TYPE_AUTO = 1;
  7. public const TYPE_HAND = 2;
  8. public const STATUS_STAY = 0;
  9. public const STATUS_SUCCESS = 1;
  10. public const STATUS_FAIL = 2;
  11. public const STATUS_IGNORE = 3;
  12. protected $table = 'agent_recharges';
  13. protected $guarded = ['id'];
  14. protected $hidden = [];
  15. protected $appends = ['status_text'];
  16. protected $casts = [
  17. 'agent_id' => 'integer', 'type' => 'integer', 'status' => 'integer', 'confirmations' => 'integer',
  18. 'usdt_amount' => 'decimal:4', 'exchange_rate' => 'decimal:4', 'amount' => 'decimal:4',
  19. 'audit_admin_id' => 'integer', 'confirmed_at' => 'datetime',
  20. ];
  21. public function agent()
  22. {
  23. return $this->belongsTo(Agent::class);
  24. }
  25. public function getStatusTextAttribute(): string
  26. {
  27. return [self::STATUS_STAY => '待确认', self::STATUS_SUCCESS => '已到账', self::STATUS_FAIL => '已驳回', self::STATUS_IGNORE => '已忽略'][(int) $this->status] ?? '';
  28. }
  29. }