On this page
修改会员等级状态
控制器 app/controller/admin/UserLevel.php
php
public function updateStatus()
{
$rule = $this->request->Model;
$rule->status = $this->request->param('status');
return showSuccess($rule->save());
}
验证器 app/validate/admin/UserLevel.php
php
// 验证规则
protected $rule = [
...
'id'=>'require|integer|>:0|isExist:Skus',
'status'=>'require|integer|in:0,1'
...
];
protected $scene = [
...
'updateStatus'=>['id','status'],
];
路由 router/admin.php
php
Route::post('user_level/:id/update_status','admin.UserLevel/updateStatus');