ActivityUser.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. * @property $betting_amount
  18. *
  19. */
  20. class ActivityUser extends BaseModel
  21. {
  22. protected $table = 'activity_user';
  23. protected $fillable = ['activity_id',
  24. 'finish_time', 'member_id', 'title', 'status', 'sub_title', 'detail_image',
  25. 'start_time', 'end_time', 'part_in_time',
  26. 'effective_betting_amount', 'gift_amount',
  27. ];
  28. const STATUS_APPLY = 0;
  29. const STATUS_IN_PROGRESS = 1;
  30. const STATUS_COMPLETE = 2;
  31. protected function getDetailImageAttribute($value)
  32. {
  33. return Util::ensureUrl($value);
  34. }
  35. protected function getPartInTimeAttribute($value): string
  36. {
  37. return date('Y-m-d H:i:s', $value);
  38. }
  39. protected function getFinishTimeAttribute($value): string
  40. {
  41. if ($value > 1) {
  42. return date('Y-m-d H:i:s', $value);
  43. }
  44. return "";
  45. }
  46. protected function getStartTimeAttribute($value): string
  47. {
  48. return date('Y-m-d', $value);
  49. }
  50. protected function getEndTimeAttribute($value): string
  51. {
  52. return date('Y-m-d', $value);
  53. }
  54. }