using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Text; using Znyc.CloudCar.IServices.Auth; using Znyc.CloudCar.Model.ViewModels.ReportsCallBack; namespace Znyc.CloudCar.Controller { public class WxPayController : ControllerBase { private readonly IAuthService _authService; public WxPayController(IAuthService authService) { _authService = authService; } /// /// 微信小程序支付 /// /// 商品Id /// 1充值,2优惠卡 /// [HttpGet] [Authorize] [Route("api/v1/wxpay/{productId}/{type}")] public Task WxPay(long productId, int type) { return _authService.WxPay(productId, type); } /// /// 微信小程序支付回调 /// /// [HttpPost] [Route("api/v1/wxpay/notify")] public async Task NotifyUrl() { using var reader = new StreamReader(Request.Body, Encoding.UTF8); string content = await reader.ReadToEndAsync(); return await _authService.NotifyUrl(content); } } }