package com.cm.common.wechat.controller;

import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.result.SuccessResultData;
import com.cm.common.wechat.pojo.WechatMiniAppLoginVO;
import com.cm.common.wechat.service.IWechatMiniAppAuthService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: WechatMiniAppSignController
 * @Description: 微信小程序登录
 * @Author: WangGeng
 * @Date: 2020/5/9 18:08
 * @Version: 1.0
 **/
@Api(tags = ISystemConstant.API_TAGS_WECHAT_MINI_APP_PREFIX + "小程序认证")
@RestController
@RequestMapping(ISystemConstant.WECHAT_MINI_APP_PREFIX + "/auth")
public class WechatMiniAppAuthController {

    @Autowired
    private IWechatMiniAppAuthService wechatMiniAppAuthService;

    @PostMapping("login")
    @CheckRequestBodyAnnotation
    public SuccessResultData login(@RequestBody WechatMiniAppLoginVO wechatMiniAppLoginVO) throws Exception {
        return wechatMiniAppAuthService.login(wechatMiniAppLoginVO);
    }

}
