This commit is contained in:
root 2020-01-03 01:12:23 +08:00
parent b6752e3952
commit 44bd189259
3 changed files with 39 additions and 0 deletions

View File

@ -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
]);
}
}

View File

@ -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
]);
}
}

View File

@ -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')