45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Dcat\Admin\Admin;
|
|
|
|
enum DrawPrizeType: int {
|
|
case None = 0;
|
|
case Goods = 1;
|
|
case Wallet = 2;
|
|
case Balance = 3;
|
|
case Point = 4;
|
|
case Money = 5;
|
|
|
|
public function label()
|
|
{
|
|
$color = match ($this) {
|
|
static::None => 'warning',
|
|
static::Goods => 'primary',
|
|
static::Wallet => 'blue1',
|
|
static::Balance => 'pink',
|
|
static::Point => 'success',
|
|
static::Money => 'danger',
|
|
};
|
|
|
|
$background = Admin::color()->get($color, $color);
|
|
|
|
$name = static::options()[$this->value] ?? '其它';
|
|
|
|
return "<span class='label' style='background: $background;'>{$name}</span>";
|
|
}
|
|
|
|
public static function options()
|
|
{
|
|
return [
|
|
self::None->value => '谢谢参与',
|
|
self::Goods->value => '实物',
|
|
self::Wallet->value => '可提',
|
|
self::Balance->value => '余额',
|
|
self::Point->value => '积分',
|
|
self::Money->value => '现金',
|
|
];
|
|
}
|
|
}
|