src/ZKEACMS.Shop/Controllers/AliPayController.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using Alipay.AopSdk.AspnetCore;
using Alipay.AopSdk.Core.Domain;
using Alipay.AopSdk.Core.Request;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ZKEACMS.Shop.Payment;
using ZKEACMS.Shop.Service;
using Easy.Mvc.Extend;
using ZKEACMS.Setting;
using Easy.Extend;
using Easy.Mvc.Authorize;
using ZKEACMS.DataArchived;
using Easy.Mvc.ViewResult;

namespace ZKEACMS.Shop.Controllers
{
    public class AliPayController : Controller
    {
        private readonly IAlipayService _alipayService;
        private readonly IOrderService _orderService;
        private readonly IHostOptionProvider _hostOptionProvider;
        public AliPayController(IAlipayService alipayService,
            IOrderService orderService,
            IHostOptionProvider hostOptionProvider)
        {
            _alipayService = alipayService;
            _orderService = orderService;
            _hostOptionProvider = hostOptionProvider;
        }

        public IActionResult Pay(string orderId)
        {
            if (orderId.IsNullOrWhiteSpace())
            {
                return new HttpBadRequestResult();
            }
            var order = _orderService.Get(orderId);
            var items = order.OrderItems;
            if (!items.Any())
            {
                return new HttpBadRequestResult();
            }
            AlipayTradePagePayModel model = new AlipayTradePagePayModel
            {
                Body = string.Join(",", items.Select(m => m.Title)),
                Subject = items.First().Title,
                TotalAmount = order.Total.ToString("F2"),
                OutTradeNo = orderId,
                ProductCode = "FAST_INSTANT_TRADE_PAY"
            };
            AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
后面还有 96 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。