This commit is contained in:
root 2019-10-27 20:34:02 +08:00
parent f67d2fb201
commit 53a92569f5

View File

@ -21,7 +21,7 @@ class PlanController extends Controller
if ($request->input('id')) { if ($request->input('id')) {
$plan = Plan::find($request->input('id')); $plan = Plan::find($request->input('id'));
if (!$plan) { if (!$plan) {
abort(500, '套餐不存在'); abort(500, '该订阅不存在');
} }
} else { } else {
$plan = new Plan(); $plan = new Plan();
@ -66,7 +66,7 @@ class PlanController extends Controller
public function show (Request $request) { public function show (Request $request) {
$plan = Plan::find($request->input('id')); $plan = Plan::find($request->input('id'));
if (!$plan) { if (!$plan) {
abort(500, '套餐不存在'); abort(500, '该订阅不存在');
} }
$plan->show = $plan->show ? 0 : 1; $plan->show = $plan->show ? 0 : 1;
if (!$plan->save()) { if (!$plan->save()) {
@ -76,4 +76,18 @@ class PlanController extends Controller
'data' => true 'data' => true
]); ]);
} }
public function renew (Request $request) {
$plan = Plan::find($request->input('id'));
if (!$plan) {
abort(500, '该订阅不存在');
}
$plan->renew = $plan->renew ? 0 : 1;
if (!$plan->save()) {
abort(500, '更改失败');
}
return response([
'data' => true
]);
}
} }