36 lines
1005 B
C#
36 lines
1005 B
C#
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;
|
|
|
|
/// <summary>
|
|
/// 微信小程序控制器
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
[AllowAnonymous]
|
|
public class WeChatController : BaseController
|
|
{
|
|
private readonly IWeChatMiniProgramService _weChatService;
|
|
|
|
public WeChatController(IWeChatMiniProgramService weChatService)
|
|
{
|
|
_weChatService = weChatService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 微信登录
|
|
/// </summary>
|
|
/// <param name="code">微信登录凭证</param>
|
|
/// <returns>微信登录结果</returns>
|
|
[HttpPost("login")]
|
|
public async Task<BaseResponse<WeChatLoginOutput>> WeChatLoginAsync([FromQuery] string code)
|
|
{
|
|
var result = await _weChatService.WeChatLoginAsync(code);
|
|
return Success(result);
|
|
}
|
|
}
|