| | |
| | | import com.moral.api.service.UserService; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.redis.RedisUtil; |
| | | import com.moral.util.WebUtils; |
| | | |
| | | @Slf4j |
| | | @Api(tags = {"大屏"}) |
| | |
| | | @Autowired |
| | | private GroupService groupService; |
| | | |
| | | /** |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @Auther jinpengyong |
| | | * @Description web登陆 |
| | | */ |
| | | @ApiOperation(value = "登陆", notes = "登陆") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "account", value = "账户", required = true, paramType = "path", dataType = "String"), |
| | | @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "path", dataType = "String") |
| | | @ApiImplicitParam(name = "account", value = "账户", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "query", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "login/{account}/{password}", method = RequestMethod.GET) |
| | | public ResultMessage login(@PathVariable("account") String account, @PathVariable("password") String password) { |
| | | if (account == null || password == null) { |
| | | return ResultMessage.fail("账户和密码不能为空"); |
| | | @RequestMapping(value = "login", method = RequestMethod.POST) |
| | | public ResultMessage login(HttpServletRequest request) { |
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); |
| | | if (!(parameters.containsKey("account") && parameters.containsKey("password"))) { |
| | | return ResultMessage.fail("用户名及密码不允许为空!"); |
| | | } |
| | | Map<String, Object> map = userService.login(account, password); |
| | | Map<String, Object> map = userService.login(parameters); |
| | | if (map.get("token") == null) { |
| | | return ResultMessage.fail(map.get("msg").toString()); |
| | | } |
| | | return ResultMessage.ok(map.get("token")); |
| | | return ResultMessage.ok(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "注销", notes = "注销") |