package beilv.applogin.controller;

import beilv.applogin.domain.vo.AppAuthWeixinMiniAppLoginReqVO;
import beilv.applogin.service.IAppAuthService;
import beilv.common.core.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;


@Tag(name = "用户 APP - 认证")
@RestController
@RequestMapping("/weixin-mini-app")
@Validated
@Slf4j
public class AppAuthController {

    @Resource
    private IAppAuthService appAuthService;

    @PostMapping("/login")
    @Operation(summary = "微信小程序的一键登录")
    public AjaxResult weixinMiniAppLogin(@RequestBody @Valid AppAuthWeixinMiniAppLoginReqVO reqVO) throws Exception {
        return AjaxResult.success(appAuthService.weixinMiniAppLogin(reqVO));
    }


}
