| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | } |
| | | @ApiOperation(value = "删除用户信息") |
| | | @GetMapping("deleteUser") |
| | | public Response deleteUser(@RequestParam int uid){ |
| | | return service.delUser(uid); |
| | | public Response deleteUser(@RequestParam String uname){ |
| | | return service.delUser(uname); |
| | | } |
| | | |
| | | @ApiOperation(value = "将用户添加至100~1000管理员") |
| | |
| | | return service.updateUinf(uinf); |
| | | } |
| | | |
| | | @GetMapping("searchUKeyToUName") |
| | | @ApiOperation(value = "根据Ukey查询用户") |
| | | public Response searchUKeyToUName(@RequestParam String ukeyId){ |
| | | UserInf userInf = service.getUserByUKeyId(ukeyId); |
| | | Response response = new Response(); |
| | | if (userInf!=null){ |
| | | response.setII(1,true,userInf,"UKey有绑定用户"); |
| | | }else{ |
| | | response.set(1,false,"Ukey没有绑定用户"); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | @GetMapping("searchUNameToUKey") |
| | | @ApiOperation(value = "根据用户名查绑定的Ukey") |
| | | public Response searchUNameToUKey(@RequestParam String uname){ |
| | | UserInf userInf = service.getUserByUserName(uname); |
| | | Response response = new Response(); |
| | | if (userInf!=null){ |
| | | if (StringUtils.isEmpty(userInf.getUkeyId())){ |
| | | response.set(-1,false,"该用户没有绑定Ukey"); |
| | | }else { |
| | | response.setII(1,true,userInf,"该用户有绑定Ukey"); |
| | | } |
| | | }else{ |
| | | response.set(0,false,"该用户不存在"); |
| | | } |
| | | return response; |
| | | } |
| | | @PostMapping("bindUkey") |
| | | @ApiOperation(value = "绑定uKey") |
| | | public Response bindUkey(@RequestBody UserInf userInf){ |
| | | boolean b = service.bindUkey(userInf); |
| | | if (b){ |
| | | return new Response().set(1,true,"绑定成功"); |
| | | }else { |
| | | return new Response().set(1,false,"绑定失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |