抽奖管理 配置奖品的颜色
parent
635c09c771
commit
a6b0ad1d28
|
|
@ -197,6 +197,9 @@ class DrawActivityPrizeController extends Controller
|
|||
}
|
||||
})->ajax(admin_route('api.coupons'))->help("仅奖品类型是 ".DrawPrizeType::Coupon->label()." 可用");
|
||||
|
||||
$form->color("other.textColor", "字体颜色")->default("#FFFFFF");
|
||||
$form->color("other.bgColor", "背景色");
|
||||
|
||||
$form->saving(function (Form $form) use ($drawActivity) {
|
||||
if (! $form->isCreating()) {
|
||||
$form->deleteInput('draw_activity_id');
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class DrawActivityController extends Controller
|
|||
public function show($id, Request $request)
|
||||
{
|
||||
$drawActivity = DrawActivity::with(['prizes' => function ($builder) {
|
||||
$builder->latest('sort');
|
||||
$builder->orderBy('sort');
|
||||
}])->onlyPublished()->findOrFail($id);
|
||||
|
||||
$drawTicket = null;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class DrawActivityPrizeResource extends JsonResource
|
|||
'icon' => $this->icon,
|
||||
'type' => $this->type,
|
||||
'amount' => trim_trailing_zeros($this->amount),
|
||||
'other' => $this->other
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class DrawActivityPrize extends Model
|
|||
protected $casts = [
|
||||
'type' => DrawPrizeType::class,
|
||||
'limited' => 'bool',
|
||||
'other' => 'json'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +45,8 @@ class DrawActivityPrize extends Model
|
|||
'winnings',
|
||||
'sort',
|
||||
'auto_send',
|
||||
'price_type_id'
|
||||
'price_type_id',
|
||||
'other'
|
||||
];
|
||||
|
||||
public static function booted()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class CreateDrawActivityPrizesTable extends Migration
|
|||
$table->integer('sort')->default(0)->comment('排序');
|
||||
$table->integer('auto_send')->default(0)->comment('奖品是否自动发放');
|
||||
$table->unsignedBigInteger('price_type_id')->nullable()->comment('奖品关联记录id(例如: 奖品是优惠券, 保存 coupons.id)');
|
||||
$table->json('other')->nullable()->comment("奖品其它配置项{textColor: 字体颜色, bgColor: 背景色}");
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue