update: add coupon and notice switch

This commit is contained in:
tokumeikoi
2022-01-22 02:30:05 +08:00
parent 94a7ab412c
commit 1790de63f6
8 changed files with 55 additions and 4 deletions

View File

@ -30,6 +30,25 @@ class CouponController extends Controller
]);
}
public function show(Request $request)
{
if (empty($request->input('id'))) {
abort(500, '参数有误');
}
$coupon = Coupon::find($request->input('id'));
if (!$coupon) {
abort(500, '优惠券不存在');
}
$coupon->show = $coupon->show ? 0 : 1;
if (!$coupon->save()) {
abort(500, '保存失败');
}
return response([
'data' => true
]);
}
public function generate(CouponGenerate $request)
{
if ($request->input('generate_count')) {