using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using QYZH.InteractiveMagazine.IService;
using QYZH.InteractiveMagazine.IService.Dto;
using QYZH.InteractiveMagazine.Models.Dto;
namespace QYZH.InteractiveMagazine.WebApi.Controllers;
///
/// 微信小程序控制器
///
[Route("api/[controller]")]
[ApiController]
[AllowAnonymous]
public class WeChatController : BaseController
{
private readonly IWeChatMiniProgramService _weChatService;
public WeChatController(IWeChatMiniProgramService weChatService)
{
_weChatService = weChatService;
}
///
/// 微信登录
///
/// 微信登录凭证
/// 微信登录结果
[HttpPost("login")]
public async Task> WeChatLoginAsync([FromQuery] string code)
{
var result = await _weChatService.WeChatLoginAsync(code);
return Success(result);
}
}