🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
~~~ /** * 设置昵称 * @param Request $request * @return \think\response\Json */ public function setNickname(Request $request){ $data = $request->param(); $validate = app(NickNameValidate::class); $check = $validate->check($data); if($check != true){ return Response::fail($validate->getError()); } $result = app(UserService::class)->setNickname($data); if($result){ $userInfo = app(UserService::class)->findUserById($data['userId']); return Response::success($userInfo); }else{ return Response::fail('设置昵称失败'); } } ~~~