package com.css.txw.sso.controller.oauth2;

import com.css.txw.sso.pojo.vo.oauth2.OAuth2UserInfoRespVO;
import com.css.txw.sso.service.yhxx.YhxxService;
import com.css.ggzc.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.css.ggzc.framework.common.pojo.CommonResult.success;

@Tag(name = "OAuth2用户信息")
@RestController
@RequestMapping("/userinfo")
@Slf4j
public class OAuth2UserController {

    @Resource
    private YhxxService yhxxService;

    @PostMapping("/get")
    @Operation(summary = "获得用户信息")
    public CommonResult<OAuth2UserInfoRespVO> getUserInfo(HttpServletRequest request) {
        return success(yhxxService.getUserInfo(request));
    }


}
