mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update
This commit is contained in:
parent
b6752e3952
commit
44bd189259
@ -41,4 +41,21 @@ class CouponController extends Controller
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function drop (Request $request) {
|
||||
if (empty($request->input('id'))) {
|
||||
abort(500, '参数有误');
|
||||
}
|
||||
$coupon = Coupon::find($request->input('id'));
|
||||
if (!$coupon) {
|
||||
abort(500, '优惠券不存在');
|
||||
}
|
||||
if (!$coupon->delete()) {
|
||||
abort(500, '删除失败');
|
||||
}
|
||||
|
||||
return response([
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
}
|
@ -43,6 +43,9 @@ class TutorialController extends Controller
|
||||
abort(500, '参数有误');
|
||||
}
|
||||
$tutorial = Tutorial::find($request->input('id'));
|
||||
if (!$tutorial) {
|
||||
abort(500, '教程不存在');
|
||||
}
|
||||
$tutorial->show = $tutorial->show ? 0 : 1;
|
||||
if (!$tutorial->save()) {
|
||||
abort(500, '保存失败');
|
||||
@ -52,4 +55,21 @@ class TutorialController extends Controller
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function drop (Request $request) {
|
||||
if (empty($request->input('id'))) {
|
||||
abort(500, '参数有误');
|
||||
}
|
||||
$tutorial = Tutorial::find($request->input('id'));
|
||||
if (!$tutorial) {
|
||||
abort(500, '教程不存在');
|
||||
}
|
||||
if (!$tutorial->delete()) {
|
||||
abort(500, '删除失败');
|
||||
}
|
||||
|
||||
return response([
|
||||
'data' => true
|
||||
]);
|
||||
}
|
||||
}
|
@ -59,10 +59,12 @@ Route::prefix('v1')
|
||||
// Coupon
|
||||
Route::get ('coupon/fetch', 'Admin\\CouponController@fetch');
|
||||
Route::post('coupon/save', 'Admin\\CouponController@save');
|
||||
Route::post('coupon/drop', 'Admin\\CouponController@drop');
|
||||
// Tutorial
|
||||
Route::get ('tutorial/fetch', 'Admin\\TutorialController@fetch');
|
||||
Route::post('tutorial/save', 'Admin\\TutorialController@save');
|
||||
Route::post('tutorial/show', 'Admin\\TutorialController@show');
|
||||
Route::post('tutorial/drop', 'Admin\\TutorialController@drop');
|
||||
});
|
||||
// User
|
||||
Route::prefix('user')
|
||||
|
Loading…
Reference in New Issue
Block a user