ActivityUser.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace App\Models;
  3. use App\Constants\Util;
  4. /**
  5. * @property string $activity_id
  6. * @property string $finish_time
  7. * @property string member_id
  8. * @property string title
  9. * @property string status
  10. * @property string sub_title
  11. * @property string detail_image
  12. * @property string start_time
  13. * @property string end_time
  14. * @property string part_in_time
  15. * @property $effective_betting_amount
  16. * @property $gift_amount
  17. *
  18. */
  19. class ActivityUser extends BaseModel
  20. {
  21. protected $table = 'activity_user';
  22. protected $fillable = ['activity_id',
  23. 'finish_time', 'member_id', 'title', 'status', 'sub_title', 'detail_image',
  24. 'start_time', 'end_time', 'part_in_time',
  25. 'effective_betting_amount', 'gift_amount',
  26. ];
  27. const STATUS_APPLY = 0;
  28. const STATUS_IN_PROGRESS = 1;
  29. const STATUS_COMPLETE = 2;
  30. protected function getDetailImageAttribute($value)
  31. {
  32. return Util::ensureUrl($value);
  33. }
  34. protected function getPartInTimeAttribute($value): string
  35. {
  36. return date('Y-m-d H:i:s', $value);
  37. }
  38. protected function getFinishTimeAttribute($value): string
  39. {
  40. if ($value > 1) {
  41. return date('Y-m-d H:i:s', $value);
  42. }
  43. return "";
  44. }
  45. protected function getStartTimeAttribute($value): string
  46. {
  47. return date('Y-m-d', $value);
  48. }
  49. protected function getEndTimeAttribute($value): string
  50. {
  51. return date('Y-m-d', $value);
  52. }
  53. }