package com.microservices.wiki.contoller.sys;


import com.microservices.common.core.web.domain.AjaxResult;
import com.microservices.wiki.service.sys.UserService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping(value = "/user")
public class UserController {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    UserService userService;

    @ApiOperation(value = "获取登录信息", hidden = true)
    @RequestMapping(value = "getUserInfo", method = RequestMethod.GET)
    public AjaxResult getUserInfo(HttpServletRequest request, HttpServletResponse response){
        return AjaxResult.success(userService.getCurrentUser(request));
    }
}
