LotteryPrize.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\common\model\plus\lottery;
  3. use app\common\model\BaseModel;
  4. /**
  5. * Class GiftPackage
  6. * 转盘奖项模型
  7. * @package app\common\model\plus\giftpackage
  8. */
  9. class LotteryPrize extends BaseModel
  10. {
  11. protected $name = 'lottery_prize';
  12. protected $pk = 'prize_id';
  13. /**
  14. * 追加字段
  15. * @var string[]
  16. */
  17. protected $append = ['status_text'];
  18. /**
  19. * 转盘详情
  20. */
  21. public static function detail($lottery_id)
  22. {
  23. return (new static())->where('status', '=', 10)->where('lottery_id', '=', $lottery_id)->select();
  24. }
  25. /**
  26. * 奖项下架列表
  27. */
  28. public static function getlist($data, $lottery_id)
  29. {
  30. return (new static())->where('status', '=', 20)
  31. ->where('lottery_id', '=', $lottery_id)
  32. ->paginate($data);
  33. }
  34. /**
  35. * 状态
  36. */
  37. public function getStatusTextAttr($value, $data)
  38. {
  39. $text = '';
  40. if ($value == 10) {
  41. $text = '上架';
  42. } else {
  43. $text = '下架';
  44. }
  45. return $text;
  46. }
  47. }