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