using LifePayment.Application; using LifePayment.Application.Contracts; using LifePayment.Domain.Shared; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using System; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.WebClientInfo; using Volo.Abp.Identity.Application.Contracts.Account; using Volo.Abp.IdentityModel; namespace LifePayment.HttpApi { [Route("api/[controller]/[action]")] [ApiController] public class AccountController : AbpController { private readonly IAccountService _accountService; private readonly OssSettings ossSettings; private readonly IWebClientInfoProvider _webClientInfoProvider; public AccountController( IAccountService accountService, IOptionsMonitor optionsMonitor, IWebClientInfoProvider webClientInfoProvider ) { _accountService = accountService; this.ossSettings = optionsMonitor.CurrentValue; _webClientInfoProvider = webClientInfoProvider; } #region life pay /// /// 获取生活缴费用户身份会话信息 /// /// 用户登录凭证 /// [HttpGet] [AllowAnonymous] public async Task GetLifePayWxIndentity(string code) { return await _accountService.GetLifePayWxIndentity(code); } /// /// life pay手机验证码登录 /// /// /// /// [HttpPost] [AllowAnonymous] [ChannelFilter] public async Task LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input) { return await _accountService.LifePayPhoneMesssageCodeLogin(input); } [HttpPost] public OssSTSReponse GetOssSTS() { OssSTSHelper ossSTSHelper = new OssSTSHelper(this.ossSettings); return ossSTSHelper.GetOssSTS(); } [HttpPost] public async Task GetTokenForWeb(AccessRequestDto accessRequestDto) { var webClientIp = _webClientInfoProvider.ClientIpAddress; return await _accountService.GetTokenForWeb(accessRequestDto, webClientIp); } #endregion } }