Ver código fonte

支付宝接入

lcl 1 ano atrás
pai
commit
418401915a

BIN
.DS_Store


BIN
AppStart/.DS_Store


BIN
AppStart/Alipay/.DS_Store


+ 82 - 11
AppStart/Alipay/AlipayFunction.cs

@@ -11,13 +11,15 @@ namespace MySystem
 {
     public class AlipayFunction
     {
+        public readonly static AlipayFunction Instance = new AlipayFunction();
+        private AlipayFunction()
+        { }
+
         private string AppId = "2021003116616751";
         private string PrivateKey = "MIIEpAIBAAKCAQEA1KjMzZJIRG6QQ3+c/euVrc+8RR0xMw6A+EONSKhJq4Bg+rtxQPCfdF2bpZ4NMaSqfalSiLoxrZSYBYOZhpDP67i9LXGUoFCWdRL7ROTqJvuU6KyEeMplQ6Q3uwWbuKbh9COt0vhqn/pjlUsomTwq+DRQv10awynkZikqceXdP0EH4iGZG0hyerEP5yLHpHiggf4f7TOsovHX+fGLPmWFO1zUTHHbz7HxU4BQKn3yuje4yMhoyv5h/wZzeVwvj+Qti8Hlh351rF0f5BHwN1YMGIrWuPU5bF8OMHS/UXPxh7Bs795ZZyplYztTz26QfKfLWVVsLOng4pvgPS+OgzZydwIDAQABAoIBAEu6mMQT9Zw46zK+PP/HZxPwSBEsphqSbab7F1LqauGh4+cl3NzNU1szAnxl3jjxdK0vIO8DrzErGz/Lb16WLxS4QtXt/olgaVPjoIsWIbQkHxEEbmA9YvZFgnsdMij9dLVmBz57rCywE8pUa262GG8u4hpjY2Zggq9GtZC91J3zOeETBG828gU+FLHGcDpfz7pD1jC0noDfDRxmIImOMZvChIvvY+tm6MpySXN8lw1vxhLc0aZbKSQkuVyCyB4fIsdJJvh2dRPiY+BA0jXNK3mWwnnHzac/9JXqWFlwk6iPIIjXPUldz7Zq3EpCI+9p+UqLtIu6BAUbk1biFTt8xMECgYEA+2iIxZfdl1N1suA/aEbUdjd0kxeeOsGv7Ps0rOYn+4/q1dkUukg2V6VRy3E8BUt+9zLPTR8DmL7oBi+kDsGehjHlH7U6Pe8qKszB4ufQBDHc71yg9liqOWa4s9VoBD0VIU9CO0HtYjRor7rVuUzp+j58SLP7wIEPGEwdgjeYENECgYEA2IsYEyHiwhjy5rx7fmv3duZC5zyesIqxdAz79AuZ7gnpNEhddi5cEpcibnVmwZliCe6SoLzXZ6difEfD4VmLsYEAWqf5sqJ2PswZmHtA9F4We9WUe2zj+pFG0yCCVrcbDZXzQYaLmyuMNe/jpgyY178czohpnvQlr++bYa9DYMcCgYEAqGX6xy/UM9qpiel/T1+yTIUUxroZOI4oQvp47B82ROC/kgJYSfa4v7hys2zjoUBSiU41YRkXFac6T3p1z5SNlKGzMav4mSer/QMuE8jmowirToGjJ594Vf6iVYLqq3wmvSsT2BFu6krknGDva7FDQGW+Zgx44xcPf1zsnx6R8yECgYEAtfFA3Cp3lbBSvy4U8ScUOPHFuvbDOwB9k02pkOcCgfAP4p7+8GKJeBFGm9rG6NnQdxneV3Hz5yLL7DJ8UebkKdODEajbc41vntnsk6LT877uU0QkSwQ2FX1lLdW9zdBxyZt5VVAQEuOnHlaeRxGEhpoMQTh6zlTDKa1AN/aDvVcCgYApytvSEdTpKcQuEyPOfbQv2pXYujCacMFIRHvJW/HvX7yaZSAvSYK+lw8l53bTbJpJ3pq/1Tol6tyjY7HRsVvQ68Jn1MApARMlldn1GoAPcgDFzlJCB0JCOUAE1rBS5lA97wQ1YhI8qBRqaE7Qrtf4D5oZdEjbtq8VCeIaD9huIQ==";
         private string PublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1KjMzZJIRG6QQ3+c/euVrc+8RR0xMw6A+EONSKhJq4Bg+rtxQPCfdF2bpZ4NMaSqfalSiLoxrZSYBYOZhpDP67i9LXGUoFCWdRL7ROTqJvuU6KyEeMplQ6Q3uwWbuKbh9COt0vhqn/pjlUsomTwq+DRQv10awynkZikqceXdP0EH4iGZG0hyerEP5yLHpHiggf4f7TOsovHX+fGLPmWFO1zUTHHbz7HxU4BQKn3yuje4yMhoyv5h/wZzeVwvj+Qti8Hlh351rF0f5BHwN1YMGIrWuPU5bF8OMHS/UXPxh7Bs795ZZyplYztTz26QfKfLWVVsLOng4pvgPS+OgzZydwIDAQAB";
         private string AlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxycehrmnTl2IaIAECP+0HWc1eWGM/T6x022K7K6fdf+xoyC97TBJaG4G3Bcon4gsJX+Sad5IA9OJIQ4eN1joM35hIlwcFZ6MmCuVXx/SMAKThIjK0jsRc6aTxVQG+GVCgS7dXMKb4Sm+vK2wEM6xtDeqcfYMB0BqGZRvxbIV59a2ooPrha4FkV6nNC9DQefzC0picHXV64oYUjMM2ed4ASTQVds7HP9BZfalz//APZcWdBV08f+xv7n79Twz/gNtVAadfuTAlcjsS6aK+G/OrZtr/diuemeRPRUKlVhcr5xOQDhqBgtdIw8M9Wp6I4ULXRlthKVBWToH9j6n9vDIiwIDAQAB";
-        public AlipayFunction()
-        {
-        }
+        
 
 
         #region 代商家签约
@@ -339,18 +341,27 @@ namespace MySystem
 
         #region 退款
 
-        public string Refund(string TradeNo, string Amount, string Token)
+        public string Refund(string TradeNo, string Amount, string MerPid, string Reason = "")
         {
             IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
             AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
             request.BizContent = "{" +
             "\"trade_no\":\"" + TradeNo + "\"," +
-            "\"refund_amount\":" + Amount + "" +
+            "\"refund_amount\":" + Amount + "," +
+            "\"out_request_no\":\"" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8) + "\"," +
+            "\"refund_reason\":\"" + Reason + "\"," +
+            "\"refund_royalty_parameters\":[{" +
+            "\"royalty_type\":\"transfer\"," +
+            "\"trans_out_type\":\"userId\"," +
+            "\"trans_out\":\"" + MerPid + "\"," +
+            "\"amount\":" + Amount + "," +
+            "\"desc\":\"" + Reason + "\"" +
+            "}]" +
             "}";
             string result = "";
             try
             {
-                AlipayTradeRefundResponse response = client.Execute(request, null, Token);
+                AlipayTradeRefundResponse response = client.Execute(request, null, "202306BB117e046cfc29434c8f4acfd2a43aeX03");
                 result = response.Body;
             }
             catch (Exception ex)
@@ -372,11 +383,11 @@ namespace MySystem
             foreach (RoyaltyParameters Parameter in Parameters)
             {
                 royalty_parameters += "    {" +
-                "      \"royalty_type\":\"transfer\"," +
-                "      \"trans_in_type\":\"loginName\"," +
+                // "      \"royalty_type\":\"transfer\"," +
+                // "      \"trans_in_type\":\"loginName\"," +
                 "      \"trans_in\":\"" + Parameter.Account + "\"," +
-                "      \"amount\":" + Parameter.Amount + "," +
-                "      \"trans_in_name\":\"" + Parameter.Name + "\"" +
+                "      \"amount\":" + Parameter.Amount + "" +
+                // "      \"trans_in_name\":\"" + Parameter.Name + "\"" +
                 "    },";
             }
             request.BizContent = "{" +
@@ -389,7 +400,67 @@ namespace MySystem
             string result = "";
             try
             {
-                AlipayTradeOrderSettleResponse response = client.Execute(request);
+                AlipayTradeOrderSettleResponse response = client.Execute(request, null, "202306BB117e046cfc29434c8f4acfd2a43aeX03");
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "分账异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+        #region 绑定分账关系
+        public string BindSettleRelation(string RequestNo, string Account)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeRoyaltyRelationBindRequest request = new AlipayTradeRoyaltyRelationBindRequest();
+            request.BizContent="{" +
+            "  \"receiver_list\":[" +
+            "    {" +
+            "      \"type\":\"userId\"," +
+            "      \"account\":\"" + Account + "\"" +
+            // "      \"name\":\"测试名称\"," +
+            // "      \"memo\":\"分账给测试商户\"," +
+            // "      \"login_name\":\"test@alitest.xyz\"," +
+            // "      \"bind_login_name\":\"test@alitest.xyz\"" +
+            "    }" +
+            "  ]," +
+            "  \"out_request_no\":\"" + RequestNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeRoyaltyRelationBindResponse response = client.Execute(request, null, "202306BB117e046cfc29434c8f4acfd2a43aeX03");
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "绑定分账关系异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+        #region 查看分账
+        public string QuerySettle(string OrderNo, string TradeNo)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeOrderSettleQueryRequest request = new AlipayTradeOrderSettleQueryRequest();
+            request.BizContent="{" +
+            "  \"settle_no\":\"20210706002530020036530021395831\"," +
+            "  \"out_request_no\":\"20210727001\"," +
+            "  \"trade_no\":\"2021112611001004680 073956707\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeOrderSettleQueryResponse response = client.Execute(request, null, "202306BB117e046cfc29434c8f4acfd2a43aeX03");
                 result = response.Body;
             }
             catch (Exception ex)

+ 102 - 0
AppStart/Alipay/Base/AopDictionary.cs

@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using Aop.Api.Parser;
+using Newtonsoft.Json;
+
+namespace Aop.Api
+{
+    /// <summary>
+    /// 符合AOP习惯的纯字符串字典结构。
+    /// </summary>
+    public class AopDictionary : Dictionary<string, string>
+    {
+        private const string DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+        public AopDictionary() { }
+
+        public AopDictionary(IDictionary<string, string> dictionary)
+            : base(dictionary)
+        { }
+
+        public void AddAll(Dictionary<string, string> textParams)
+        {
+            foreach (var param in textParams)
+            {
+                this.Add(param.Key, param.Value);
+            }
+        }
+
+        /// <summary>
+        /// 添加一个新的键值对。空键或者空值的键值对将会被忽略。
+        /// </summary>
+        /// <param name="key">键名称</param>
+        /// <param name="value">键对应的值,目前支持:string, int, long, double, bool, DateTime类型</param>
+        public void Add(string key, object value)
+        {
+            string strValue;
+
+            if (value == null)
+            {
+                strValue = null;
+            }
+            else if (value is string)
+            {
+                strValue = (string)value;
+            }
+            else if (value is Nullable<DateTime>)
+            {
+                Nullable<DateTime> dateTime = value as Nullable<DateTime>;
+                strValue = dateTime.Value.ToString(DATE_TIME_FORMAT);
+            }
+            else if (value is Nullable<int>)
+            {
+                strValue = (value as Nullable<int>).Value.ToString();
+            }
+            else if (value is Nullable<long>)
+            {
+                strValue = (value as Nullable<long>).Value.ToString();
+            }
+            else if (value is Nullable<double>)
+            {
+                strValue = (value as Nullable<double>).Value.ToString();
+            }
+            else if (value is Nullable<bool>)
+            {
+                strValue = (value as Nullable<bool>).Value.ToString().ToLower();
+            }
+            else if (value is ICollection)
+            {
+                Aop.Api2.Parser.AopModelParser parser = new Aop.Api2.Parser.AopModelParser();
+                object jo = parser.serializeArrayValue(value as ICollection);
+
+                JsonSerializerSettings jsetting = new JsonSerializerSettings();
+                jsetting.NullValueHandling = NullValueHandling.Ignore;
+                strValue = JsonConvert.SerializeObject(jo, Formatting.None, jsetting);
+            }
+            else if (value is AopObject)
+            {
+                AopModelParser parser = new AopModelParser();
+                object jo = parser.serializeAopObject(value as AopObject);
+
+                JsonSerializerSettings jsetting = new JsonSerializerSettings();
+                jsetting.NullValueHandling = NullValueHandling.Ignore;
+                strValue = JsonConvert.SerializeObject(jo, Formatting.None, jsetting);
+            }
+            else
+            {
+                strValue = value.ToString();
+            }
+
+            this.Add(key, strValue);
+        }
+
+        public new void Add(string key, string value)
+        {
+            if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
+            {
+                base.Add(key, value);
+            }
+        }
+    }
+}

+ 191 - 0
AppStart/Alipay/Base/AopModelParser.cs

@@ -0,0 +1,191 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Aop.Api;
+using System.Reflection;
+using System.Collections;
+using System.Xml.Serialization;
+using Newtonsoft.Json;
+
+namespace Aop.Api2.Parser
+{
+    public class AopModelParser
+    {
+
+        /// <summary>
+        /// Json序列化AopObject对象
+        /// </summary>
+        /// <param name="res"></param>
+        /// <returns></returns>
+        public IDictionary<object, object> serializeAopObject(AopObject res)
+        {
+            PropertyInfo[] pis = res.GetType().GetProperties();
+            IDictionary<object, object> jo = new Dictionary<object, object>();
+            foreach (PropertyInfo pi in pis)
+            {
+                if (!pi.CanRead)
+                {
+                    continue;
+                }
+
+                String elementName = getElementName(pi);
+                Object value = getPiValue(res, pi);
+                if (!String.IsNullOrEmpty(elementName))
+                {
+                    Object serialized = serializeValue(value);
+                    if (serialized != null)
+                    {
+                        jo[elementName] = serialized;
+                    }
+                }
+            }
+
+            return jo;
+        }
+
+        /// <summary>
+        /// 序列化某个对象
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        private Object serializeValue(Object value)
+        {
+            if (value == null)
+            {
+                return null;
+            }
+
+            Object result = null;
+            if (value is IDictionary)
+            {
+                result = serializeDicValue((IDictionary)value);
+            }
+            else if (value is ICollection)
+            {
+                result = serializeArrayValue((ICollection)value);
+            }
+            else
+            {
+                result = serializeElementValue(value);
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 序列化一个元素
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        private Object serializeElementValue(Object value)
+        {
+            if (value == null)
+            {
+                return null;
+            }
+
+            Object result = null;
+            if (value is AopObject)
+            {
+                result = serializeAopObject((AopObject)value);
+            }
+            else
+            {
+                result = value;
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 序列化一个字典
+        /// </summary>
+        /// <param name="dic"></param>
+        /// <returns></returns>
+        private Object serializeDicValue(IDictionary dic)
+        {
+            if (dic == null)
+            {
+                return null;
+            }
+
+            IDictionary<object, object> jo = new Dictionary<object, object>();
+            foreach (String key in dic.Keys)
+            {
+                Object dicValue = dic[key];
+                Object serializedValue = serializeValue(dicValue);
+                jo[key] = serializedValue;
+            }
+            return jo;
+        }
+
+        /// <summary>
+        /// 序列化一个数组
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <returns></returns>
+        public Object serializeArrayValue(ICollection collection)
+        {
+            if (collection == null)
+            {
+                return null;
+            }
+
+            List<object> ja = new List<object>();
+            foreach (var item in collection)
+            {
+                ja.Add(serializeValue(item));
+            }
+            return ja;
+        }
+
+        /// <summary>
+        /// 获取对象的属性值
+        /// </summary>
+        /// <param name="res"></param>
+        /// <param name="pi"></param>
+        /// <returns></returns>
+        private Object getPiValue(Object res, PropertyInfo pi)
+        {
+            if (!pi.CanRead)
+            {
+                return null;
+            }
+
+            Object value = pi.GetValue(res, null);
+            return value;
+        }
+
+        /// <summary>
+        /// 获取Xml属性名
+        /// </summary>
+        /// <param name="pi"></param>
+        /// <returns></returns>
+        private String getElementName(PropertyInfo pi)
+        {
+            if (pi == null)
+            {
+                return null;
+            }
+
+            // 获取XmlElement属性
+            XmlElementAttribute[] xeas = pi.GetCustomAttributes(typeof(XmlElementAttribute), true) as XmlElementAttribute[];
+            String elementName = null;
+            if (xeas != null && xeas.Length > 0)
+            {
+                elementName = xeas[0].ElementName;
+            }
+
+            // 如果获取XmlElement属性为空,则去获取XmlArray属性
+            if (String.IsNullOrEmpty(elementName))
+            {
+                XmlArrayAttribute[] xaas = pi.GetCustomAttributes(typeof(XmlArrayAttribute), true) as XmlArrayAttribute[];
+                if (xaas != null && xaas.Length > 0)
+                {
+                    elementName = xaas[0].ElementName;
+                }
+            }
+            return elementName;
+        }
+
+    }
+}

+ 90 - 0
AppStart/Alipay/Base/RoyaltyDetail.cs

@@ -0,0 +1,90 @@
+using System;
+using System.Xml.Serialization;
+
+namespace Aop.Api.Domain
+{
+    /// <summary>
+    /// RoyaltyDetail Data Structure.
+    /// </summary>
+    [Serializable]
+    public class RoyaltyDetail : AopObject
+    {
+        /// <summary>
+        /// 分账金额
+        /// </summary>
+        [XmlElement("amount")]
+        public string Amount { get; set; }
+
+        /// <summary>
+        /// 支付宝分账明细单号,每笔分账业务执行的明细单号
+        /// </summary>
+        [XmlElement("detail_id")]
+        public string DetailId { get; set; }
+
+        /// <summary>
+        /// 分账失败错误码,只在分账失败时返回
+        /// </summary>
+        [XmlElement("error_code")]
+        public string ErrorCode { get; set; }
+
+        /// <summary>
+        /// 分账错误描述信息
+        /// </summary>
+        [XmlElement("error_desc")]
+        public string ErrorDesc { get; set; }
+
+        /// <summary>
+        /// 分账执行时间
+        /// </summary>
+        [XmlElement("execute_dt")]
+        public string ExecuteDt { get; set; }
+
+        /// <summary>
+        /// 分账操作类型。有以下几种类型: replenish(补差)、replenish_refund(退补差)、transfer(分账)、transfer_refund(退分账)
+        /// </summary>
+        [XmlElement("operation_type")]
+        public string OperationType { get; set; }
+
+        /// <summary>
+        /// 分账状态,SUCCESS成功,FAIL失败,PROCESSING处理中
+        /// </summary>
+        [XmlElement("state")]
+        public string State { get; set; }
+
+        /// <summary>
+        /// 分账转入账号,只有在operation_type为replenish_refund(退补差),transfer(分账)才返回该字段或trans_in_open_id。trans_in_open_id为分账转入方的openId,当trans_in_open_id不为空的时候,请优先使用trans_in_open_id。
+        /// </summary>
+        [XmlElement("trans_in")]
+        public string TransIn { get; set; }
+
+        /// <summary>
+        /// 分账转入方的OpenId,OpenId为用户在该应用下支付宝的唯一用户标识。
+        /// </summary>
+        [XmlElement("trans_in_open_id")]
+        public string TransInOpenId { get; set; }
+
+        /// <summary>
+        /// 分账转入账号类型,userId表示是支付宝账号对应的支付宝唯一用户号,loginName表示是支付宝登录号,secondMerchantID表示是二级商户id。 只有在operation_type为replenish_refund(退补差),transfer(分账)才返回该字段
+        /// </summary>
+        [XmlElement("trans_in_type")]
+        public string TransInType { get; set; }
+
+        /// <summary>
+        /// 分账转出账号,只有在operation_type为replenish(补差),transfer_refund(退分账)类型才返回该字段或trans_out_open_id字段。trans_out_open_id字段为分账转出方的openId,当trans_out_open_id 字段不为空时,请优先使用trans_out_open_id。
+        /// </summary>
+        [XmlElement("trans_out")]
+        public string TransOut { get; set; }
+
+        /// <summary>
+        /// 分账转出方的OpenId,OpenId为用户在该应用下支付宝内的唯一用户标识。
+        /// </summary>
+        [XmlElement("trans_out_open_id")]
+        public string TransOutOpenId { get; set; }
+
+        /// <summary>
+        /// 分账转出账号类型,userId表示是支付宝账号对应的支付宝唯一用户号,loginName表示是支付宝登录号,secondMerchantID表示是二级商户id。 只有在operation_type为replenish(补差),transfer_refund(退分账)类型才返回该字段
+        /// </summary>
+        [XmlElement("trans_out_type")]
+        public string TransOutType { get; set; }
+    }
+}

+ 123 - 0
AppStart/Alipay/Request/AlipayTradeOrderSettleQueryRequest.cs

@@ -0,0 +1,123 @@
+using System;
+using Aop.Api.Domain;
+using System.Collections.Generic;
+using Aop.Api.Response;
+
+namespace Aop.Api.Request
+{
+    /// <summary>
+    /// AOP API: alipay.trade.order.settle.query
+    /// </summary>
+    public class AlipayTradeOrderSettleQueryRequest : IAopRequest<AlipayTradeOrderSettleQueryResponse>
+    {
+        /// <summary>
+        /// 交易分账查询接口
+        /// </summary>
+        public string BizContent { get; set; }
+
+        #region IAopRequest Members
+        private bool  needEncrypt=false;
+        private string apiVersion = "1.0";
+	    private string terminalType;
+	    private string terminalInfo;
+        private string prodCode;
+	    private string notifyUrl;
+        private string returnUrl;
+	    private AopObject bizModel;
+        private Dictionary<string, string> udfParams; //add user-defined text parameters
+
+		public void SetNeedEncrypt(bool needEncrypt){
+             this.needEncrypt=needEncrypt;
+        }
+
+        public bool GetNeedEncrypt(){
+
+            return this.needEncrypt;
+        }
+
+		public void SetNotifyUrl(string notifyUrl){
+            this.notifyUrl = notifyUrl;
+        }
+
+        public string GetNotifyUrl(){
+            return this.notifyUrl;
+        }
+
+        public void SetReturnUrl(string returnUrl){
+            this.returnUrl = returnUrl;
+        }
+
+        public string GetReturnUrl(){
+            return this.returnUrl;
+        }
+
+        public void SetTerminalType(String terminalType){
+			this.terminalType=terminalType;
+		}
+
+    	public string GetTerminalType(){
+    		return this.terminalType;
+    	}
+
+    	public void SetTerminalInfo(String terminalInfo){
+    		this.terminalInfo=terminalInfo;
+    	}
+
+    	public string GetTerminalInfo(){
+    		return this.terminalInfo;
+    	}
+
+        public void SetProdCode(String prodCode){
+            this.prodCode=prodCode;
+        }
+
+        public string GetProdCode(){
+            return this.prodCode;
+        }
+
+        public string GetApiName()
+        {
+            return "alipay.trade.order.settle.query";
+        }
+
+        public void SetApiVersion(string apiVersion){
+            this.apiVersion=apiVersion;
+        }
+
+        public string GetApiVersion(){
+            return this.apiVersion;
+        }
+
+        public void PutOtherTextParam(string key, string value) 
+        {
+            if(this.udfParams == null) 
+            {
+                this.udfParams = new Dictionary<string, string>();
+            }
+            this.udfParams.Add(key, value);
+        }
+
+        public IDictionary<string, string> GetParameters()
+        {
+            AopDictionary parameters = new AopDictionary();
+            parameters.Add("biz_content", this.BizContent);
+            if(udfParams != null) 
+            {
+                parameters.AddAll(this.udfParams);
+            }
+            return parameters;
+        }
+
+		public AopObject GetBizModel()
+        {
+            return this.bizModel;
+        }
+
+        public void SetBizModel(AopObject bizModel)
+        {
+            this.bizModel = bizModel;
+        }
+
+        #endregion
+    }
+}

+ 123 - 0
AppStart/Alipay/Request/AlipayTradeRoyaltyRelationBindRequest.cs

@@ -0,0 +1,123 @@
+using System;
+using Aop.Api.Domain;
+using System.Collections.Generic;
+using Aop.Api.Response;
+
+namespace Aop.Api.Request
+{
+    /// <summary>
+    /// AOP API: alipay.trade.royalty.relation.bind
+    /// </summary>
+    public class AlipayTradeRoyaltyRelationBindRequest : IAopRequest<AlipayTradeRoyaltyRelationBindResponse>
+    {
+        /// <summary>
+        /// 分账关系绑定
+        /// </summary>
+        public string BizContent { get; set; }
+
+        #region IAopRequest Members
+        private bool  needEncrypt=false;
+        private string apiVersion = "1.0";
+	    private string terminalType;
+	    private string terminalInfo;
+        private string prodCode;
+	    private string notifyUrl;
+        private string returnUrl;
+	    private AopObject bizModel;
+        private Dictionary<string, string> udfParams; //add user-defined text parameters
+
+		public void SetNeedEncrypt(bool needEncrypt){
+             this.needEncrypt=needEncrypt;
+        }
+
+        public bool GetNeedEncrypt(){
+
+            return this.needEncrypt;
+        }
+
+		public void SetNotifyUrl(string notifyUrl){
+            this.notifyUrl = notifyUrl;
+        }
+
+        public string GetNotifyUrl(){
+            return this.notifyUrl;
+        }
+
+        public void SetReturnUrl(string returnUrl){
+            this.returnUrl = returnUrl;
+        }
+
+        public string GetReturnUrl(){
+            return this.returnUrl;
+        }
+
+        public void SetTerminalType(String terminalType){
+			this.terminalType=terminalType;
+		}
+
+    	public string GetTerminalType(){
+    		return this.terminalType;
+    	}
+
+    	public void SetTerminalInfo(String terminalInfo){
+    		this.terminalInfo=terminalInfo;
+    	}
+
+    	public string GetTerminalInfo(){
+    		return this.terminalInfo;
+    	}
+
+        public void SetProdCode(String prodCode){
+            this.prodCode=prodCode;
+        }
+
+        public string GetProdCode(){
+            return this.prodCode;
+        }
+
+        public string GetApiName()
+        {
+            return "alipay.trade.royalty.relation.bind";
+        }
+
+        public void SetApiVersion(string apiVersion){
+            this.apiVersion=apiVersion;
+        }
+
+        public string GetApiVersion(){
+            return this.apiVersion;
+        }
+
+        public void PutOtherTextParam(string key, string value) 
+        {
+            if(this.udfParams == null) 
+            {
+                this.udfParams = new Dictionary<string, string>();
+            }
+            this.udfParams.Add(key, value);
+        }
+
+        public IDictionary<string, string> GetParameters()
+        {
+            AopDictionary parameters = new AopDictionary();
+            parameters.Add("biz_content", this.BizContent);
+            if(udfParams != null) 
+            {
+                parameters.AddAll(this.udfParams);
+            }
+            return parameters;
+        }
+
+		public AopObject GetBizModel()
+        {
+            return this.bizModel;
+        }
+
+        public void SetBizModel(AopObject bizModel)
+        {
+            this.bizModel = bizModel;
+        }
+
+        #endregion
+    }
+}

+ 32 - 0
AppStart/Alipay/Response/AlipayTradeOrderSettleQueryResponse.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Xml.Serialization;
+using System.Collections.Generic;
+using Aop.Api.Domain;
+
+namespace Aop.Api.Response
+{
+    /// <summary>
+    /// AlipayTradeOrderSettleQueryResponse.
+    /// </summary>
+    public class AlipayTradeOrderSettleQueryResponse : AopResponse
+    {
+        /// <summary>
+        /// 分账受理时间
+        /// </summary>
+        [XmlElement("operation_dt")]
+        public string OperationDt { get; set; }
+
+        /// <summary>
+        /// 商户分账请求单号
+        /// </summary>
+        [XmlElement("out_request_no")]
+        public string OutRequestNo { get; set; }
+
+        /// <summary>
+        /// 分账明细
+        /// </summary>
+        [XmlArray("royalty_detail_list")]
+        [XmlArrayItem("royalty_detail")]
+        public List<RoyaltyDetail> RoyaltyDetailList { get; set; }
+    }
+}

+ 17 - 0
AppStart/Alipay/Response/AlipayTradeRoyaltyRelationBindResponse.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Xml.Serialization;
+
+namespace Aop.Api.Response
+{
+    /// <summary>
+    /// AlipayTradeRoyaltyRelationBindResponse.
+    /// </summary>
+    public class AlipayTradeRoyaltyRelationBindResponse : AopResponse
+    {
+        /// <summary>
+        /// SUCCESS:分账关系绑定成功; FAIL:分账关系绑定失败。
+        /// </summary>
+        [XmlElement("result_code")]
+        public string ResultCode { get; set; }
+    }
+}

+ 123 - 39
AppStart/Helper/AlipayPayBackService.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using MySystem.PxcModels;
 using Library;
 using LitJson;
+using System.Threading;
 
 namespace MySystem
 {
@@ -15,64 +16,147 @@ namespace MySystem
 
         public void Start()
         {
-            try
-            {
-                dosomething();
-            }
-            catch (Exception ex)
-            {
-                function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "支付回调异常");
-            }
+            Thread th = new Thread(Listen);
+            th.IsBackground = true;
+            th.Start();
         }
 
-        private void dosomething()
-        { 
+        public void Listen()
+        {
             bool op = true;
             while (op)
             {
                 string content = RedisDbconn.Instance.RPop<string>("PayCallBack");
                 if (!string.IsNullOrEmpty(content))
                 {
-                    bool pass = true;
-                    string[] datalist = content.Split(new string[] { "#cut#" }, StringSplitOptions.None);
-                    JsonData jsonObj = JsonMapper.ToObject(datalist[1]);
-                    string OrderNo = "";
-                    if(datalist[0] == "wechat")
+                    try
                     {
-                        if(jsonObj["event_type"].ToString() != "TRANSACTION.SUCCESS")
-                        {
-                            pass = false;
-                        }
-                        string ciphertext = jsonObj["resource"]["ciphertext"].ToString();
-                        
-                        OrderNo = "";
+                        dosomething(content);
+                    }
+                    catch (Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "支付宝回调异常");
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(2000);
+                }
+            }
+        }
+
+        private void dosomething(string content)
+        { 
+            //{"out_trade_no":"2023061514385419860385846","transaction_id":"2023061522001451251430691917","total_fee":"0.01","pay_mode":"1","openid":"","attach":""}
+            JsonData orderObj = JsonMapper.ToObject(content);
+            string OrderNo = orderObj["out_trade_no"].ToString();
+            string TradeNo = orderObj["transaction_id"].ToString();
+            WebCMSEntities db = new WebCMSEntities();
+            ConsumerOrderForNo forNo = db.ConsumerOrderForNo.FirstOrDefault(m => m.OrderNo == OrderNo);
+            if (forNo != null)
+            {
+                ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == forNo.OrderIds && m.Status == 0);
+                if (order != null)
+                {
+                    order.Status = 1;
+                    order.UpdateDate = DateTime.Now;
+                    order.PayMoney = order.PayMoney;
+                    order.MaxDivi = order.MaxDivi;
+                    order.SeoTitle = TradeNo;
+                    MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantInfo();
+                    order.UserId = merchant.UserId;
+                    ConsumerOrders check = db.ConsumerOrders.FirstOrDefault(m => m.Id < order.Id && m.Status > 0 && m.PayMode == order.PayMode && m.MerchantId == order.MerchantId);
+                    if(check != null)
+                    {
+                        order.QueryCount = check.QueryCount + 1;
                     }
-                    if(pass)
+                    else
                     {
-                        WebCMSEntities db = new WebCMSEntities();
-                        ConsumerOrderForNo forNo = db.ConsumerOrderForNo.FirstOrDefault(m => m.OrderNo == OrderNo);
-                        if (forNo != null)
+                        order.QueryCount = 1;
+                    }
+                    db.SaveChanges();                            
+                }
+            }
+            db.Dispose();
+        }
+
+
+
+
+
+
+        //分账队列
+        public void StartProfitShare()
+        {
+            Thread th = new Thread(StartProfitShareListen);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartProfitShareListen()
+        {
+            bool op = true;
+            while (op)
+            {
+                try
+                {
+                    WebCMSEntities db = new WebCMSEntities();
+                    DateTime checkDate = DateTime.Now.AddMinutes(-1);
+                    var list = db.ConsumerOrders.Select(m => new { m.Id, m.CreateDate, m.Status, m.IsAct, m.PayMode }).Where(m => m.Status == 1 && m.PayMode == 1 && m.IsAct == 1 && m.CreateDate < checkDate).OrderBy(m => m.Id).Take(10).ToList();
+                    foreach(var sub in list)
+                    {
+                        ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == sub.Id);
+                        if(order != null)
                         {
-                            ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == forNo.OrderIds && m.Status == 0);
-                            if (order != null)
+                            order.Status = 2;
+                            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantInfo();
+                            MerchantParamSet set = db.MerchantParamSet.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantParamSet();
+                            if(order.IsAct == 1 && order.PayMoney >= set.MinPayMoney)
                             {
-                                order.Status = 1;
-                                order.UpdateDate = DateTime.Now;
-                                order.PayMoney = order.PayMoney;
-                                order.MaxDivi = order.MaxDivi;
-                                db.SaveChanges();
-                                RedisDbconn.Instance.AddList("ConsumerOrders:Divi:1:List", order.Id.ToString());
-                                // RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:1:" + order.MerchantId, order);
-                                // ConsumerOrdersStatService.Instance.Stat(order);
+                                MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
+                                //添加分账接收方
+                                if(merchant.Sort == 0)
+                                {
+                                    string content = AlipayFunction.Instance.BindSettleRelation(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), merchantAdd.SeoTitle);
+                                    merchantAdd.Sort = 1;
+                                    db.SaveChanges();
+                                }
+                                //发起分账
+                                decimal fee = order.PayMoney * 0.99M;
+                                if(fee >= 1)
+                                {
+                                    string TradeNo = order.SeoTitle;
+                                    string OrderNo = order.OrderNo;
+                                    List<RoyaltyParameters> Parameters = new List<RoyaltyParameters>();
+                                    Parameters.Add(new RoyaltyParameters()
+                                    {
+                                        Account = merchantAdd.SeoTitle,
+                                        Amount = fee.ToString("f2"),
+                                    });
+                                    AlipayFunction.Instance.Settle(OrderNo, TradeNo, Parameters);
+
+                                    //开始监听分账状态
+                                    Dictionary<string, object> req = new Dictionary<string, object>();
+                                    req.Add("TradeNo", TradeNo); //支付宝订单号
+                                    req.Add("OrderNo", OrderNo); //商户订单号
+                                    RedisDbconn.Instance.AddList("AlipayShareQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
+                                }
+                                else
+                                {
+                                    RedisDbconn.Instance.AddList("ConsumerOrders:Divi:1:List", order.Id.ToString());
+                                    // RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:1:" + order.MerchantId, order);
+                                }
                             }
                         }
-                        db.Dispose();
                     }
+                    db.SaveChanges();
+                    db.Dispose();
                 }
-                else
+                catch (Exception ex)
                 {
-                    op = false;
+                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "支付宝分账队列异常");
                 }
+                Thread.Sleep(2000);
             }
         }
     }

+ 76 - 0
AppStart/Helper/AlipayShareService.cs

@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.PxcModels;
+using Library;
+using LitJson;
+using System.Text.RegularExpressions;
+using System.Threading;
+
+namespace MySystem
+{
+    public class AlipayShareService
+    {
+        public readonly static AlipayShareService Instance = new AlipayShareService();
+        private AlipayShareService()
+        { }
+
+        public void Start()
+        {
+            Thread th = new Thread(StartListen);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartListen()
+        {
+            while (true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("AlipayShareQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    StartDo(content);
+                }
+                else
+                {
+                    Thread.Sleep(2000);
+                }
+            }
+        }
+
+        public void StartDo(string content)
+        {
+            try
+            {
+                JsonData jsonObj = JsonMapper.ToObject(content);
+                string TradeNo = jsonObj["TradeNo"].ToString(); //支付宝订单号
+                string OrderNo = jsonObj["OrderNo"].ToString(); //商户订单号
+                string result = AlipayFunction.Instance.QuerySettle(OrderNo, TradeNo);
+                JsonData resultObj = JsonMapper.ToObject(result);
+                if(result.Contains("\"alipay_trade_order_settle_query_response\""))
+                {
+                    string code = resultObj["alipay_trade_order_settle_query_response"]["code"].ToString();
+                    if(code == "10000")
+                    {
+                        WebCMSEntities db = new WebCMSEntities();
+                        ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.OrderNo == OrderNo && m.Status == 2);
+                        if (order != null)
+                        {
+                            RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + order.PayMode + ":List", order.Id.ToString());
+                            // RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId, order);
+                        }
+                        db.Dispose();
+                    }
+                    else
+                    {
+                        RedisDbconn.Instance.AddList("AlipayShareQueue", content);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "查询分账异常");
+            }
+        }
+    }
+}

+ 1 - 1
AppStart/Helper/CheckAlipaySignService.cs

@@ -48,7 +48,7 @@ namespace MySystem
             try
             {
                 PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
-                string content = new AlipayFunction().QuerySignStatus(sign.BusinessCode);
+                string content = AlipayFunction.Instance.QuerySignStatus(sign.BusinessCode);
                 JsonData dic = JsonMapper.ToObject(content);
                 if (dic["alipay_open_agent_order_query_response"]["code"].ToString() == "10000")
                 {

+ 6 - 6
AppStart/Helper/ConsumerOrdersReturnDoService.cs

@@ -39,12 +39,12 @@ namespace MySystem
                             bool success = false;
                             if (item.QueryCount == 1)
                             {
-                                string resultString = new AlipayFunction().Refund(item.SeoTitle, item.GetMoney.ToString("f2"), "202202BB4fc8c2c03c914f2f87b6c678a77d7C03");
-                                JsonData jsonObj = JsonMapper.ToObject(resultString);
-                                if (jsonObj["alipay_trade_refund_response"]["code"].ToString() == "10000")
-                                {
-                                    success = true;
-                                }
+                                // string resultString = new AlipayFunction().Refund(item.SeoTitle, item.GetMoney.ToString("f2"), "202202BB4fc8c2c03c914f2f87b6c678a77d7C03");
+                                // JsonData jsonObj = JsonMapper.ToObject(resultString);
+                                // if (jsonObj["alipay_trade_refund_response"]["code"].ToString() == "10000")
+                                // {
+                                //     success = true;
+                                // }
                             }
                             else if (item.QueryCount == 2)
                             {

+ 5 - 5
AppStart/Helper/MerchantConfirmService.cs

@@ -137,7 +137,7 @@ namespace MySystem
                 if (Kind == 0 || Kind == 1)
                 {
                     bool checkAlipay = true;
-                    string content = new AlipayFunction().GetBatchNo(AddInfo.IdCardName, AddInfo.MobilePhone, AddInfo.ContactEmail);
+                    string content = AlipayFunction.Instance.GetBatchNo(AddInfo.IdCardName, AddInfo.MobilePhone, AddInfo.ContactEmail);
                     JsonData json = JsonMapper.ToObject(content);
                     if (json["alipay_open_agent_create_response"]["code"].ToString() == "10000")
                     {
@@ -147,11 +147,11 @@ namespace MySystem
                         {
                             Qualifications = function.getPath("/" + Qualifications);
                         }
-                        content = new AlipayFunction().CommonSign(batch_no, AddInfo.UpdateMan, AddInfo.LicenseNumber, AddInfo.LicenseCopy, AddInfo.LicenseCopy, AddInfo.StoreEntrancePic, AddInfo.IndoorPic);
+                        content = AlipayFunction.Instance.CommonSign(batch_no, AddInfo.UpdateMan, AddInfo.LicenseNumber, AddInfo.LicenseCopy, AddInfo.LicenseCopy, AddInfo.StoreEntrancePic, AddInfo.IndoorPic);
                         json = JsonMapper.ToObject(content);
                         if (json["alipay_open_agent_facetoface_sign_response"]["code"].ToString() == "10000")
                         {
-                            content = new AlipayFunction().AgentConfirm(batch_no);
+                            content = AlipayFunction.Instance.AgentConfirm(batch_no);
                             json = JsonMapper.ToObject(content);
                             if (json["alipay_open_agent_confirm_response"]["code"].ToString() == "10000")
                             {
@@ -161,9 +161,9 @@ namespace MySystem
                                     MerchantAddInfoId = MerchantId,
                                     Status = ""
                                 });
-                                // content = new AlipayFunction().QuerySignStatus(batch_no);
+                                // content = AlipayFunction.Instance.QuerySignStatus(batch_no);
 
-                                // content = new AlipayFunction().CommonSignConfirm(batch_no);
+                                // content = AlipayFunction.Instance.CommonSignConfirm(batch_no);
                                 // json = JsonMapper.ToObject(content);
                                 // if (json["alipay_open_agent_commonsign_confirm_response"]["code"].ToString() == "10000")
                                 // {

+ 8 - 1
AppStart/Helper/Profit/ProfitHelper.cs

@@ -268,7 +268,14 @@ namespace MySystem
                                                     }).Entity;
                                                     db.SaveChanges();
                                                     MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == suborder.MerchantId) ?? new MerchantAddInfo();
-                                                    Dictionary<string, string> dic = WeChatFunction.Instance.Refund(merchantAdd.SubMchid, GetMoney, suborder.PayMoney, suborder.OrderNo, DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "客小爽来客吧项目盛大来袭");
+                                                    if(order.PayMode == 1)
+                                                    {
+                                                        AlipayFunction.Instance.Refund(suborder.SeoTitle, GetMoney.ToString("f2"), merchantAdd.SeoTitle, "客小爽来客吧项目盛大来袭");
+                                                    }
+                                                    else
+                                                    {
+                                                        Dictionary<string, string> dic = WeChatFunction.Instance.Refund(merchantAdd.SubMchid, GetMoney, suborder.PayMoney, suborder.OrderNo, DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "客小爽来客吧项目盛大来袭");
+                                                    }
                                                     if (suborder.CurDivi < suborder.MaxDivi)
                                                     {
                                                         RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);

+ 2 - 2
AppStart/Helper/WeChatPayBackService.cs

@@ -135,7 +135,7 @@ namespace MySystem
                 {
                     WebCMSEntities db = new WebCMSEntities();
                     DateTime checkDate = DateTime.Now.AddMinutes(-1);
-                    var list = db.ConsumerOrders.Select(m => new { m.Id, m.CreateDate, m.Status, m.IsAct }).Where(m => m.Status == 1 && m.IsAct == 1 && m.CreateDate < checkDate).OrderBy(m => m.Id).Take(10).ToList();
+                    var list = db.ConsumerOrders.Select(m => new { m.Id, m.CreateDate, m.Status, m.IsAct, m.PayMode }).Where(m => m.Status == 1 && m.PayMode == 2 && m.IsAct == 1 && m.CreateDate < checkDate).OrderBy(m => m.Id).Take(10).ToList();
                     foreach(var sub in list)
                     {
                         ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == sub.Id);
@@ -190,7 +190,7 @@ namespace MySystem
                 }
                 catch (Exception ex)
                 {
-                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "微信支付回调异常");
+                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "微信分账队列异常");
                 }
                 Thread.Sleep(2000);
             }

+ 11 - 1
Controllers/HomeController.cs

@@ -83,7 +83,17 @@ namespace MySystem.Controllers
 
         public string testAlipay()
         {
-            string content = new AlipayFunction().QuerySignStatus("2023061317351531100060045");
+            // string content = AlipayFunction.Instance.QuerySignStatus("2023061317351531100060045");
+            // List<RoyaltyParameters> Parameters = new List<RoyaltyParameters>();
+            // Parameters.Add(new RoyaltyParameters()
+            // {
+            //     Account = "2088641405724089",
+            //     Amount = "0.60",
+            // });
+            // string content = AlipayFunction.Instance.Settle("2023061517455619986938439", "2023061522001451251430528719", Parameters);
+            // string content = AlipayFunction.Instance.BindSettleRelation(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "2088641405724089");
+            // string content = AlipayFunction.Instance.Refund("2023061522001451251430528719", "0.10", "2088641405724089", "客小爽来客吧项目盛大来袭");
+            string content = AlipayFunction.Instance.QuerySettle("2023061517455619986938439", "2023061522001451251430528719");
             return content;
         }
     

+ 2 - 0
Startup.cs

@@ -174,6 +174,8 @@ namespace MySystem
             MerchantConfirmService.Instance.Start(); //特约商户进件队列
             CheckAlipaySignService.Instance.Start(); //特约商户签约队列(支付宝)
             CheckWeChatSignService.Instance.Start(); //特约商户签约队列(微信)
+            AlipayPayBackService.Instance.Start(); //支付宝支付回调队列
+            AlipayPayBackService.Instance.StartProfitShare(); //监听已支付订单,超过1分钟的订单执行分账
             WeChatPayBackService.Instance.Start(); //微信支付回调队列
             WeChatPayBackService.Instance.StartProfitShare(); //监听已支付订单,超过1分钟的订单执行分账
             ProfitHelper.Instance.StartActive(); //发放达标奖励队列