package com.yonge.cooleshow.auth.web.controller;

import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
import com.yonge.cooleshow.auth.service.impl.CbsQrCodeScanServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;

@RestController
@Api(tags = "扫码登陆")
@RequestMapping(value = "/open")
public class OpenQrLoginController {

	@Resource
	private CbsQrCodeScanServiceImpl cbsQrCodeScanService;

	@ApiOperation(value = "获取用户信息")
	@PostMapping(value = "/qrcode/userInfo")
	public CbsQrCodeScanWrapper.UserInfo userInfo(@RequestBody CbsQrCodeScanWrapper.QrCodeScanUserInfoReq req) {
		return cbsQrCodeScanService.userInfo(req);
	}

	@ApiOperation(value = "生成token")
	@PostMapping(value = "/qrcode/login")
	public CbsQrCodeScanWrapper.QrCodeScanToken login(@RequestBody CbsQrCodeScanWrapper.QrCodeScanReq req) {
		return cbsQrCodeScanService.login(req);
	}
}
