using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Znyc.CloudCar.IServices.Auth; using Znyc.CloudCar.Model.Dtos.Auth; using Znyc.CloudCar.Model.ViewModels.ReportsCallBack; namespace Znyc.CloudCar.Controller { public class AuthController : ControllerBase { private readonly IAuthService _authService; public AuthController(IAuthService authService) { _authService = authService; } /// /// 百度地图获取AccessToken /// /// [HttpGet] [Authorize] [Route("api/v1/auth/baidu/accesstoken")] public ResponseOutput GetAccessTokenAsync() { return _authService.GetAccessTokenAsync(); } /// /// 获取微信access_token /// /// [HttpGet] [Authorize] [Route("api/v1/auth/weixin/accesstoken")] public WxAccessTokenOutput GetWxAccessTokenAsync() { return _authService.GetWxAccessTokenAsync(); } /// /// 获取小程序 /// /// [Authorize] [HttpGet] [Route("api/v1/auth/weixin/unlimited")] public ResponseOutput GetUnlimitedAsync() { return _authService.GetUnlimitedAsync(); } /// /// /// /// [HttpGet] [Route("api/v1/auth/weixin/{sellingPrice}")] public decimal GetCallPhoneCurrency(int sellingPrice) { if (sellingPrice < 100000) { return 10; } else { var a = sellingPrice / 100000; int b = Convert.ToInt32(sellingPrice / 100000 + 1); return b * 10; } } /// /// 获取小程序 /// /// [Authorize] [HttpGet] [Route("api/v1/auth/weixin/qrcode/{id}")] public ResponseOutput GetQrCodeAsync(long id) { return _authService.GetQrCodeAsync(id); } } }