Collect.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Models;
  3. use App\Constants\HttpStatus;
  4. use App\Constants\Util;
  5. use Illuminate\Foundation\Auth\User as Authenticatable;
  6. use Illuminate\Notifications\Notifiable;
  7. use Laravel\Sanctum\HasApiTokens;
  8. use Illuminate\Database\Eloquent\Builder;
  9. /**
  10. * @mixin Builder
  11. * @method static Builder|static where($column, $operator = null, $value = null, $boolean = 'and')
  12. */
  13. class Collect extends Authenticatable
  14. {
  15. use HasApiTokens, Notifiable;
  16. protected $table = 'collects';
  17. protected $hidden = ['created_at', 'updated_at'];
  18. // ✅ 允许批量赋值的字段
  19. protected $fillable = [
  20. 'from_address',
  21. 'to_address',
  22. 'amount',
  23. 'coin',
  24. 'net',
  25. 'status',
  26. 'txid',
  27. 'fee',
  28. 'confirmations',
  29. 'block_number',
  30. 'remark',
  31. ];
  32. const STATUS_STAY = 0;
  33. const STATUS_START = 1;
  34. const STATUS_SUCCESS = 2;
  35. const STATUS_FAIL = 3;
  36. public static $STATUS = [
  37. 0 => '待处理',
  38. 1 => '已发起',
  39. 2 => '已确认',
  40. 3 => '失败',
  41. ];
  42. protected function getCreatedAtAttribute($value)
  43. {
  44. return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
  45. }
  46. protected function getUpdatedAtAttribute($value)
  47. {
  48. return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
  49. }
  50. }