Browse Source

增加支付宝进件流程

lichunlei 3 years ago
parent
commit
38d5f0298c

+ 308 - 0
AppStart/Alipay/AlipayFunction.cs

@@ -0,0 +1,308 @@
+using System;
+using System.Collections.Generic;
+using Aop.Api;
+using Library;
+using Microsoft.AspNetCore.Http;
+using Aop.Api.Request;
+using Aop.Api.Response;
+using Aop.Api.Util;
+
+namespace MySystem
+{
+    public class 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 代商家签约
+
+        //(开启事务)接口创建应用事务,返回生成代商户操作事务编号 batch_no
+        public string GetBatchNo(string AlipayAccount, string Name, string Mobile, string Email)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentCreateRequest request = new AlipayOpenAgentCreateRequest();
+            request.BizContent = "{" +
+            "\"account\":\"" + AlipayAccount + "\"," +
+            "\"contact_info\":{" +
+            "\"contact_name\":\"" + Name + "\"," +
+            "\"contact_mobile\":\"" + Mobile + "\"," +
+            "\"contact_email\":\"" + Email + "\"" +
+            "}" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentCreateResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_agent_create_response":{"code":"10000","msg":"Success","batch_no":"2022021011321326200059849","batch_status":"init"},"sign":"su+weyK1CZEXES8mdckalg16J4BELTQeVNJSpXVYg3nh5g3E7jDh/mQctkjH8HbM0RybQSahZ2j60aUTossPMXqdq2nPRkR4c/kM34toFFNU/2p7jqo9k/MbB1JotW+qFI+C/GCX/9mZQqm2tSQdYIiZlCsEtP13ZP2EQ6momEZrApyLQYUl1H54PojJgqo6zGKDXTnXuZcpi/VPP5YoWhYMx8WPFMS6+T3zr+LNPDOI94j5vDdUHQdjFAGiQMyyhfNOBcFFi18bAfWhPqlLWwblCZamTHN/QaOHo+fkBZeo9uKqrnSHPn8XW0tDAIf1qNUfY2eBzYZUIqWKbz509A=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                result = "";
+            }
+            return result;
+        }
+        //代签约产品通用接口,代商家发起签约产品申请
+        public string CommonSign(string BatchNo, string MccCode, string BusinessLicenseNo = "", string BusinessLicensePicPath = "", string SpecialLicensePicPath = "", string ShopScenePicPath = "", string ShopSignBoardPicPath = "")
+        { 
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentCommonSignRequest request = new AlipayOpenAgentCommonSignRequest();
+            request.BatchNo = BatchNo;
+            request.MccCode = MccCode; //软件系统商 D_D05_7372
+            if(string.IsNullOrEmpty(SpecialLicensePicPath)) SpecialLicensePicPath = BusinessLicensePicPath;
+            FileItem SpecialLicensePic = new FileItem(SpecialLicensePicPath);
+            request.SpecialLicensePic = SpecialLicensePic;
+            if (!string.IsNullOrEmpty(BusinessLicenseNo))
+            {
+                request.BusinessLicenseNo = BusinessLicenseNo;  //营业执照号码
+            }
+            if (!string.IsNullOrEmpty(BusinessLicensePicPath))
+            {
+                FileItem BusinessLicensePic = new FileItem(BusinessLicensePicPath);
+                request.BusinessLicensePic = BusinessLicensePic; //营业执照图片。被代创建商户运营主体为个人账户必填,企业账户无需填写
+            }
+            FileItem BusinessLicenseAuthPic = new FileItem(BusinessLicensePicPath);
+            request.BusinessLicenseAuthPic = BusinessLicenseAuthPic;
+            request.LongTerm = true;
+            request.DateLimitation = "长期";
+            if (!string.IsNullOrEmpty(ShopScenePicPath))
+            {
+                FileItem ShopScenePic = new FileItem(ShopScenePicPath);
+                request.ShopScenePic = ShopScenePic;
+            }
+            if (!string.IsNullOrEmpty(ShopSignBoardPicPath))
+            {
+                FileItem ShopSignBoardPic = new FileItem(ShopSignBoardPicPath);
+                request.ShopSignBoardPic = ShopSignBoardPic;
+            }
+            request.ProductCode = "QUICK_WAP_WAY"; //isv要代商户签约产品码,产品码是支付宝内部对产品的唯一标识
+            request.AppName = "客小爽";
+            // FileItem AppDemo = new FileItem(BusinessLicensePicPath);
+            // request.AppDemo = AppDemo;
+            List<string> WebSites = new List<string>();
+            WebSites.Add("www.kexiaoshuang.com");
+            request.WebSites = WebSites;
+            request.AlipayLifeName = "客小爽";
+            request.WechatOfficialAccountName = "客小爽";
+            // FileItem WebSitesLoa = new FileItem(BusinessLicensePicPath);
+            // request.WebSitesLoa = WebSitesLoa;
+            request.WebTestAccount = "testAccount";
+            request.WebTestAccountPassword = "testPassword";
+            FileItem WebHomeScreenshot = new FileItem(BusinessLicensePicPath);
+            request.WebHomeScreenshot = WebHomeScreenshot;
+            FileItem WebItemScreenshot = new FileItem(BusinessLicensePicPath);
+            request.WebItemScreenshot = WebItemScreenshot;
+            FileItem WebPayScreenshot = new FileItem(BusinessLicensePicPath);
+            request.WebPayScreenshot = WebPayScreenshot;
+            request.WebStatus = "已上线";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentCommonSignResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_agent_common_sign_response":{"code":"10000","msg":"Success"},"sign":"qt0DiXFXIJ7mX+W2+IX+cyYXx8ROGe8yxesXHGNltxpEv/s/zW16xzf4HQLtUlaAiWf3DiD2QV7Hj+REyoZw9AcktDAmlobcjQ28lTYufPECZoUJHpkn9VpGB932FC0hScVwCbsxQakH84MGT4cmjr1hCuSs7+XogdhlCTIKjau1e7ZglLnt7f1NqT8JnljVhmvkkE9gJTLq5H+Zq6XbFfBVptvM9w09HdjfhrsxAXJyQ4yU6JYX2tUYsRGz8ZrveDQMvXKTN9jnwKE9hh8ik6Sq49eUqfutV9GkKqhC96+Vy3nOTOTnPoECXZkco1wP5jsqHottWVsRV+NxdylnTw=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "代签约产品通用接口异常");
+                result = "";
+            }
+            return result;
+        }
+        //代商户签约,提交信息确认接口
+        public string CommonSignConfirm(string BatchNo)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentCommonsignConfirmRequest request= new AlipayOpenAgentCommonsignConfirmRequest();
+            request.BizContent="{" +
+            "\"batch_no\":\"" + BatchNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentCommonsignConfirmResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_agent_order_query_response":{"code":"10000","msg":"Success","order_no":"20220210034000100000015895929361","product_agent_status_infos":[{"product_code":"QUICK_WAP_WAY","product_name":"手机网站支付","status":"WAIT_CONFIRM"}],"order_status":"MERCHANT_CONFIRM","confirm_url":"https:\/\/openhome.alipay.com\/isv\/settling\/confirm.htm?orderNo=20220210034000100000015895929361","merchant_pid":"2088012934025363"},"sign":"mgdhauHMV9352S3FVrQmesXvHOrk633FX/EOXRYdc2ix5phCBZJ2KZRRP9MWJ566YEtWbnQlAJzHVS9X29hjgiJWOQ/wCidql4AoSAYYeqPtxiqKAZw/QEM/du5AdbWC0xBmmkQljXF9Hx8cm+IrOyPMSJXIw4Tqpm/T96YBwhsjw4Xr5dcUcvF6HX9h/i5FSdIJODxQ26PJcqQ98GQ3Y50YhTpPQkIPDFVE2QzcL6dvuhBOpwu5KbTxvgzS8Wtm3G6nMbzJ33Cv/I2lhTCIMHz90c9bvyjJpWxPWBzywO2zzv7+EZCbDkZGkdRic9l5s6qac+ZVMHkPbveaZ2wyig=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+        #region (查询申请单状态)查询签约申请的结果
+        public string QuerySignStatus(string BatchNo)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentOrderQueryRequest  request= new AlipayOpenAgentOrderQueryRequest() ;
+            request.BizContent="{" +
+            "  \"batch_no\":\"" + BatchNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentOrderQueryResponse response = client.Execute(request);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "查询签约申请的结果异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+        
+        #region 小程序支付请调用MySystemLib下的统一收单交易创建,返回交易号返给小程序请求支付my.tradePay
+        public string GetToken()
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAuthTokenAppRequest request = new AlipayOpenAuthTokenAppRequest();
+            request.BizContent = "{" +
+            "\"grant_type\":\"authorization_code\"," +
+            "\"code\":\"P16be77ee92264acc99553528b8a7103\"" +
+            "  }";
+            string result = "";
+            try
+            {
+                AlipayOpenAuthTokenAppResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_auth_token_app_response":{"code":"10000","msg":"Success","tokens":[{"app_auth_token":"202202BBd8c1365cd09b4a27a0c0f0b7f8cabX03","app_refresh_token":"202202BB539f0f5aa99f4b509aa3628b0af25X03","auth_app_id":"2021003116654736","expires_in":31536000,"re_expires_in":32140800,"user_id":"2088141704579033"}]},"sign":"VZINXguZZFvVDyhVp/iMK5BWXYnDYLvxYEMEZTZOVUl9MUy6xQesDzpwBBUclLLU+QgrKpeekaxj9zgwRXdh7cKlVot2lkVPkGdfkqcK/B9t8kxPXa13WIszcROCqIutlcBZW9pCIUAbWRjorDvzRCc5rLNfSBAjEldZDA0rGOPeWJXM/5uLi/70oTwyO6eaEbKdRyHLjUwp0qtolhXIvyf9HL1HbZMGtyY/Hzq35BmhB/jQ4XIVdcOEpFtNoC/1S/viLOsBCD2m4aNCGUY0i24lr92dRsEinZlCxAQq+FK6ILNUnDmBUjNkPTycDrJFw+w9sEC6AcZodNB6OC8XTw=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建(获取authtoken)异常");
+                result = "";
+            }
+            return result;
+        }
+
+        public string CreateTrade(string OrderNo, string Subject, string Amount, string BuyerId, string Notify_Url, string Token)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
+            request.SetNotifyUrl(Notify_Url);
+            request.BizContent = "{" +
+            "\"out_trade_no\":\"" + OrderNo + "\"," +
+            "\"total_amount\":" + Amount + "," +
+            "\"subject\":\"" + Subject + "\"," +
+            "\"buyer_id\":\"" + BuyerId + "\"," +
+            "\"timeout_express\":\"10m\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeCreateResponse response = client.Execute(request, null, Token);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建异常");
+                result = "";
+            }
+            return result;
+        }
+
+        public string QueryTrade(string OrderNo, string Token)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
+            request.BizContent = "{" +
+            "\"out_trade_no\":\"" + OrderNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeQueryResponse response = client.Execute(request, null, Token);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "统一收单线下交易查询异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+        #region 退款
+
+        public string Refund(string TradeNo, string Amount, string Token)
+        {
+            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 + "" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeRefundResponse response = client.Execute(request, null, Token);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "退款异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+        #region 分账
+        public string Settle(string OrderNo, string TradeNo, List<RoyaltyParameters> Parameters)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeOrderSettleRequest  request= new AlipayTradeOrderSettleRequest();
+            string royalty_parameters = "";
+            foreach (RoyaltyParameters Parameter in Parameters)
+            {
+                royalty_parameters += "    {" +
+                "      \"royalty_type\":\"transfer\"," +
+                "      \"trans_in_type\":\"loginName\"," +
+                "      \"trans_in\":\"" + Parameter.Account + "\"," +
+                "      \"amount\":" + Parameter.Amount + "," +
+                "      \"trans_in_name\":\"" + Parameter.Name + "\"" +
+                "    },";
+            }
+            request.BizContent = "{" +
+            "  \"out_request_no\":\"" + OrderNo + "\"," +
+            "  \"trade_no\":\"" + TradeNo + "\"," +
+            "  \"royalty_parameters\":[" +
+            royalty_parameters.TrimEnd(',') +
+            "  ]" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeOrderSettleResponse response = client.Execute(request);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "分账异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+
+    }
+}

+ 268 - 0
AppStart/Alipay/Request/AlipayOpenAgentCommonSignRequest.cs

@@ -0,0 +1,268 @@
+using System;
+using System.Collections.Generic;
+using Aop.Api.Response;
+using Aop.Api.Util;
+
+namespace Aop.Api.Request
+{
+    /// <summary>
+    /// AOP API: alipay.open.agent.common.sign
+    /// </summary>
+    public class AlipayOpenAgentCommonSignRequest : IAopUploadRequest<AlipayOpenAgentCommonSignResponse>
+    {
+        /// <summary>
+        /// 支付宝生活号(原服务窗)名称(1 app_name、app_demo;2 web_sites;3 alipay_life_name;4 wechat_official_account_name。1、2、3、4至少选择一个填写)
+        /// </summary>
+        public string AlipayLifeName { get; set; }
+
+        /// <summary>
+        /// APP demo,格式为.apk;或者应用说明文档, 格式为.doc .docx .pdf格式(1 app_name、app_demo;2 web_sites;3 alipay_life_name;4 wechat_official_account_name。1、2、3、4至少选择一个填写)
+        /// </summary>
+        public FileItem AppDemo { get; set; }
+
+        /// <summary>
+        /// 商户的APP应用名称(1 app_name、app_demo;2 web_sites;3 alipay_life_name;4 wechat_official_account_name。1、2、3、4至少选择一个填写)
+        /// </summary>
+        public string AppName { get; set; }
+
+        /// <summary>
+        /// 代商户操作事务编号,通过alipay.open.agent.create接口进行创建。
+        /// </summary>
+        public string BatchNo { get; set; }
+
+        /// <summary>
+        /// 营业执照授权函图片,个体工商户如果使用总公司或其他公司的营业执照认证需上传该授权函图片,最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg
+        /// </summary>
+        public FileItem BusinessLicenseAuthPic { get; set; }
+
+        /// <summary>
+        /// 营业执照号码
+        /// </summary>
+        public string BusinessLicenseNo { get; set; }
+
+        /// <summary>
+        /// 营业执照图片。被代创建商户运营主体为个人账户必填,企业账户无需填写。图片最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg。
+        /// </summary>
+        public FileItem BusinessLicensePic { get; set; }
+
+        /// <summary>
+        /// 营业期限
+        /// </summary>
+        public string DateLimitation { get; set; }
+
+        /// <summary>
+        /// 营业期限是否长期有效
+        /// </summary>
+        public Nullable<bool> LongTerm { get; set; }
+
+        /// <summary>
+        /// <a href="https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.59bgD2&treeId=222&articleId=105364&docType=1#s1">商家经营类目</a> 中的“经营类目编码”
+        /// </summary>
+        public string MccCode { get; set; }
+
+        /// <summary>
+        /// isv要代商户签约产品码,产品码是支付宝内部对产品的唯一标识
+        /// </summary>
+        public string ProductCode { get; set; }
+
+        /// <summary>
+        /// 店铺内景图片,最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg。
+        /// </summary>
+        public FileItem ShopScenePic { get; set; }
+
+        /// <summary>
+        /// 店铺门头照图片,最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg。
+        /// </summary>
+        public FileItem ShopSignBoardPic { get; set; }
+
+        /// <summary>
+        /// 企业特殊资质图片,可参考 <a href="https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.59bgD2&treeId=222&articleId=105364&docType=1#s1">商家经营类目</a> 中的“需要的特殊资质证书”。文件最小为 5KB,最大为5M,图片格式必须为:png、bmp、gif、jpg、jpeg。
+        /// </summary>
+        public FileItem SpecialLicensePic { get; set; }
+
+        /// <summary>
+        /// 网站首页截图,最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg
+        /// </summary>
+        public FileItem WebHomeScreenshot { get; set; }
+
+        /// <summary>
+        /// 网站商品页截图,最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg
+        /// </summary>
+        public FileItem WebItemScreenshot { get; set; }
+
+        /// <summary>
+        /// 网站支付页截图,最小5KB,最大5M,图片格式必须为:png、bmp、gif、jpg、jpeg
+        /// </summary>
+        public FileItem WebPayScreenshot { get; set; }
+
+        /// <summary>
+        /// 接入网址信息(1 app_name、app_demo;2 web_sites;3 alipay_life_name;4 wechat_official_account_name。1、2、3、4至少选择一个填写)
+        /// </summary>
+        public List<string> WebSites { get; set; }
+
+        /// <summary>
+        /// 接入网址的授权涵,格式为.doc .docx .pdf格式
+        /// </summary>
+        public FileItem WebSitesLoa { get; set; }
+
+        /// <summary>
+        /// 网站状态,枚举值为:已上线,未上线
+        /// </summary>
+        public string WebStatus { get; set; }
+
+        /// <summary>
+        /// 可以登录此网站的测试账户
+        /// </summary>
+        public string WebTestAccount { get; set; }
+
+        /// <summary>
+        /// 可以登录此网站的账户的密码。对应web_test_account的登录密码
+        /// </summary>
+        public string WebTestAccountPassword { get; set; }
+
+        /// <summary>
+        /// 微信公众号名称(1 app_name、app_demo;2 web_sites;3 alipay_life_name;4 wechat_official_account_name。1、2、3、4至少选择一个填写)
+        /// </summary>
+        public string WechatOfficialAccountName { 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 void SetApiVersion(string apiVersion){
+            this.apiVersion=apiVersion;
+        }
+
+        public string GetApiVersion(){
+            return this.apiVersion;
+        }
+
+        public string GetApiName()
+        {
+            return "alipay.open.agent.common.sign";
+        }
+
+        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("alipay_life_name", this.AlipayLifeName);
+            parameters.Add("app_name", this.AppName);
+            parameters.Add("batch_no", this.BatchNo);
+            parameters.Add("business_license_no", this.BusinessLicenseNo);
+            parameters.Add("date_limitation", this.DateLimitation);
+            parameters.Add("long_term", this.LongTerm);
+            parameters.Add("mcc_code", this.MccCode);
+            parameters.Add("product_code", this.ProductCode);
+            parameters.Add("web_sites", this.WebSites);
+            parameters.Add("web_status", this.WebStatus);
+            parameters.Add("web_test_account", this.WebTestAccount);
+            parameters.Add("web_test_account_password", this.WebTestAccountPassword);
+            parameters.Add("wechat_official_account_name", this.WechatOfficialAccountName);
+            if(udfParams != null) 
+            {
+                foreach (string key in this.udfParams.Keys)
+                {
+                    parameters.Add(key, this.udfParams[key]);
+                }
+            }
+            return parameters;
+        }
+		
+		public AopObject GetBizModel()
+        {
+            return this.bizModel;
+        }
+
+        public void SetBizModel(AopObject bizModel)
+        {
+            this.bizModel = bizModel;
+        }
+
+        #endregion
+
+        #region IAopUploadRequest Members
+
+        public IDictionary<string, FileItem> GetFileParameters()
+        {
+            IDictionary<string, FileItem> parameters = new Dictionary<string, FileItem>();
+            parameters.Add("app_demo", this.AppDemo);
+            parameters.Add("business_license_auth_pic", this.BusinessLicenseAuthPic);
+            parameters.Add("business_license_pic", this.BusinessLicensePic);
+            parameters.Add("shop_scene_pic", this.ShopScenePic);
+            parameters.Add("shop_sign_board_pic", this.ShopSignBoardPic);
+            parameters.Add("special_license_pic", this.SpecialLicensePic);
+            parameters.Add("web_home_screenshot", this.WebHomeScreenshot);
+            parameters.Add("web_item_screenshot", this.WebItemScreenshot);
+            parameters.Add("web_pay_screenshot", this.WebPayScreenshot);
+            parameters.Add("web_sites_loa", this.WebSitesLoa);
+            return parameters;
+        }
+
+        #endregion
+    }
+}

+ 126 - 0
AppStart/Alipay/Request/AlipayOpenAgentCommonsignConfirmRequest.cs

@@ -0,0 +1,126 @@
+using System;
+using Aop.Api.Domain;
+using System.Collections.Generic;
+using Aop.Api.Response;
+
+namespace Aop.Api.Request
+{
+    /// <summary>
+    /// AOP API: alipay.open.agent.commonsign.confirm
+    /// </summary>
+    public class AlipayOpenAgentCommonsignConfirmRequest : IAopRequest<AlipayOpenAgentCommonsignConfirmResponse>
+    {
+        /// <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.open.agent.commonsign.confirm";
+        }
+
+        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) 
+            {
+                foreach (string key in this.udfParams.Keys)
+                {
+                    parameters.Add(key, this.udfParams[key]);
+                }
+            }
+            return parameters;
+        }
+
+		public AopObject GetBizModel()
+        {
+            return this.bizModel;
+        }
+
+        public void SetBizModel(AopObject bizModel)
+        {
+            this.bizModel = bizModel;
+        }
+
+        #endregion
+    }
+}

+ 12 - 0
AppStart/Alipay/Response/AlipayOpenAgentCommonSignResponse.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Xml.Serialization;
+
+namespace Aop.Api.Response
+{
+    /// <summary>
+    /// AlipayOpenAgentCommonSignResponse.
+    /// </summary>
+    public class AlipayOpenAgentCommonSignResponse : AopResponse
+    {
+    }
+}

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

@@ -0,0 +1,17 @@
+using System;
+using System.Xml.Serialization;
+
+namespace Aop.Api.Response
+{
+    /// <summary>
+    /// AlipayOpenAgentCommonsignConfirmResponse.
+    /// </summary>
+    public class AlipayOpenAgentCommonsignConfirmResponse : AopResponse
+    {
+        /// <summary>
+        /// 签约单号
+        /// </summary>
+        [XmlElement("order_no")]
+        public string OrderNo { get; set; }
+    }
+}

+ 108 - 0
AppStart/Helper/CheckAlipaySignService.cs

@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.Models;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class CheckAlipaySignService
+    {
+        public readonly static CheckAlipaySignService Instance = new CheckAlipaySignService();
+        private CheckAlipaySignService()
+        { }
+
+        public void Start(JobMqMsg jobInfo)
+        {
+            try
+            {
+                WebCMSEntities db = new WebCMSEntities();
+                List<MerchantSign> deletes = new List<MerchantSign>();
+                List<MerchantSign> signs = TendisDbconn.Instance.GetList<MerchantSign>("AliaySignList", 1, 10000000);
+                foreach (MerchantSign sign in signs)
+                {
+                    string content = new AlipayFunction().CommonSignConfirm(sign.BusinessCode);
+                    JsonData dic = JsonMapper.ToObject(content);
+                    if (dic["alipay_open_agent_order_query_response"]["code"].ToString() == "10000")
+                    {
+                        if (dic["alipay_open_agent_order_query_response"]["order_status"].ToString() == "MERCHANT_CONFIRM")
+                        {
+                            string sign_url = dic["alipay_open_agent_order_query_response"]["confirm_url"].ToString();
+                            MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.QueryCount == 0);
+                            if (merchantadd != null)
+                            {
+                                merchantadd.QueryCount = 1;
+                                string SignUrlList = function.CheckNull(merchantadd.SeoKeyword);
+                                if (string.IsNullOrEmpty(SignUrlList))
+                                {
+                                    SignUrlList = "Alipay:" + sign_url + ";";
+                                }
+                                else
+                                {
+                                    SignUrlList = "Alipay:" + sign_url+ ";" + SignUrlList;
+                                }
+                                merchantadd.SeoKeyword = SignUrlList;
+                                db.SaveChanges();
+                                PxcModels.WebCMSEntities dbpxc = new PxcModels.WebCMSEntities();
+                                PxcModels.MerchantAddInfo merchantadd2 = dbpxc.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.QueryCount == 0);
+                                if (merchantadd2 != null)
+                                {
+                                    merchantadd2.QueryCount = 1;
+                                    merchantadd2.SeoKeyword = SignUrlList;
+                                    dbpxc.SaveChanges();
+                                }
+                                dbpxc.Dispose();
+                                BothdisDbconn.Instance.Set("MerchantAddInfo:" + sign.MerchantAddInfoId, merchantadd);
+                            }
+                        }
+                        else if (dic["alipay_open_agent_order_query_response"]["order_status"].ToString() == "MERCHANT_CONFIRM_SUCCESS")
+                        {
+                            MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.QueryCount == 1);
+                            if (merchantadd != null)
+                            {
+                                merchantadd.QueryCount = 2;
+                                db.SaveChanges();
+                                PxcModels.WebCMSEntities dbpxc = new PxcModels.WebCMSEntities();
+                                PxcModels.MerchantAddInfo merchantadd2 = dbpxc.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.QueryCount == 1);
+                                if (merchantadd2 != null)
+                                {
+                                    merchantadd2.QueryCount = 2;
+                                    dbpxc.SaveChanges();
+                                }
+                                dbpxc.Dispose();
+                                BothdisDbconn.Instance.Set("MerchantAddInfo:" + sign.MerchantAddInfoId, merchantadd);
+                                MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                                List<MerchantInfo> merchants = RedisDbconn.Instance.GetList<MerchantInfo>("TmpMerchantInfo:" + merchant.UserId, 1, 1000000);
+                                MerchantInfo check = merchants.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                                if (check != null)
+                                {
+                                    merchants.Remove(check);
+                                    RedisDbconn.Instance.Clear("TmpMerchantInfo:" + merchant.UserId);
+                                    RedisDbconn.Instance.AddList("TmpMerchantInfo:" + merchant.UserId, merchants.ToArray());
+                                }
+                                deletes.Add(sign);
+                            }
+                        }
+                    }
+                }
+                if (deletes.Count > 0)
+                {
+                    foreach (MerchantSign delete in deletes)
+                    {
+                        signs.Remove(delete);
+                    }
+                    TendisDbconn.Instance.Clear("AliaySignList");
+                    TendisDbconn.Instance.AddList("AliaySignList", signs.ToArray());
+                }
+                jobInfo.Status = 1;
+                jobInfo.Msg = "执行完成";
+                RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack");
+            }
+            catch (Exception ex)
+            {
+                TendisDbconn.Instance.AddList("public:merchant:signerr", DateTime.Now.ToString() + ":" + ex.ToString());
+            }
+        }
+    }
+}

+ 41 - 4
AppStart/Helper/CheckWeChatSignService.cs

@@ -23,24 +23,61 @@ namespace MySystem
                 foreach (MerchantSign sign in signs)
                 {
                     Dictionary<string, object> dic = new WeChatFunction().QueryMerchant(sign.BusinessCode);
-                    if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_CONFIRMED")
+                    if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_TO_BE_SIGNED")
                     {
                         string sign_url = dic["sign_url"].ToString();
-                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 0);
                         if (merchantadd != null)
                         {
                             merchantadd.Status = 1;
-                            merchantadd.SeoKeyword = sign_url;
+                            string SignUrlList = function.CheckNull(merchantadd.SeoKeyword);
+                            if (string.IsNullOrEmpty(SignUrlList))
+                            {
+                                SignUrlList = "WeChat:" + sign_url + ";";
+                            }
+                            else
+                            {
+                                SignUrlList += "WeChat:" + sign_url+ ";";
+                            }
+                            merchantadd.SeoKeyword = SignUrlList;
                             db.SaveChanges();
+                            PxcModels.WebCMSEntities dbpxc = new PxcModels.WebCMSEntities();
+                            PxcModels.MerchantAddInfo merchantadd2 = dbpxc.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 0);
+                            if (merchantadd2 != null)
+                            {
+                                merchantadd2.Status = 1;
+                                merchantadd2.SeoKeyword = SignUrlList;
+                                dbpxc.SaveChanges();
+                            }
+                            dbpxc.Dispose();
+                            BothdisDbconn.Instance.Set("MerchantAddInfo:" + sign.MerchantAddInfoId, merchantadd);
                         }
                     }
                     else if (dic["applyment_state"].ToString() == "APPLYMENT_STATE_FINISHED")
                     { 
-                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                        MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 1);
                         if (merchantadd != null)
                         {
                             merchantadd.Status = 2;
                             db.SaveChanges();
+                            PxcModels.WebCMSEntities dbpxc = new PxcModels.WebCMSEntities();
+                            PxcModels.MerchantAddInfo merchantadd2 = dbpxc.MerchantAddInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId && m.Status == 1);
+                            if (merchantadd2 != null)
+                            {
+                                merchantadd2.Status = 2;
+                                dbpxc.SaveChanges();
+                            }
+                            dbpxc.Dispose();
+                            BothdisDbconn.Instance.Set("MerchantAddInfo:" + sign.MerchantAddInfoId, merchantadd);
+                            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                            List<MerchantInfo> merchants = RedisDbconn.Instance.GetList<MerchantInfo>("TmpMerchantInfo:" + merchant.UserId, 1, 1000000);
+                            MerchantInfo check = merchants.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                            if (check != null)
+                            {
+                                merchants.Remove(check);
+                                RedisDbconn.Instance.Clear("TmpMerchantInfo:" + merchant.UserId);
+                                RedisDbconn.Instance.AddList("TmpMerchantInfo:" + merchant.UserId, merchants.ToArray());
+                            }
                             deletes.Add(sign);
                         }
                     }

+ 0 - 56
AppStart/Helper/CustomerService.cs

@@ -1,56 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using Library;
-using LitJson;
-
-namespace MySystem
-{
-    public class CustomerService
-    {
-        public readonly static CustomerService Instance = new CustomerService();
-        private CustomerService()
-        { }
-
-        public void Start(JobMqMsg jobInfo)
-        {
-            string content = "";
-            try
-            {
-                string OrderString = jobInfo.OrderString;
-                string Msg = "";
-                if (OrderString == "")
-                {
-                    string Table = OrderString.Split(':')[1];
-                    switch (Table)
-                    {
-                    }
-                }
-                if (!string.IsNullOrEmpty(Msg))
-                {
-                    jobInfo.Status = Msg == "success" ? 1 : 0;
-                    jobInfo.Msg = Msg == "success" ? "执行完成" : Msg;
-                    RabbitMQClient.Instance.SendMsg(Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo), "PublicBack");
-                }
-                else
-                { 
-                    TendisDbconn.Instance.AddList("MainPopWaitList", Newtonsoft.Json.JsonConvert.SerializeObject(jobInfo));
-                }
-            }
-            catch (Exception ex)
-            {
-                if (!string.IsNullOrEmpty(content))
-                {
-                    Dictionary<string, string> data = new Dictionary<string, string>();
-                    data.Add("ErrTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
-                    data.Add("ErrMsg", ex.ToString());
-                    TendisDbconn.Instance.AddList("public_err", data);
-                }
-                else
-                {
-                    TendisDbconn.Instance.AddList("public_service", DateTime.Now.ToString() + ":" + ex.ToString());
-                }
-            }
-        }
-    }
-}

+ 104 - 2
AppStart/Helper/MerchantConfirmService.cs

@@ -30,6 +30,9 @@ namespace MySystem
                         AddInfo.BusinessCode = BusinessCode;
                         db.SaveChanges();
                     }
+                    List<MerchantInfo> merchants = TendisDbconn.Instance.GetList<MerchantInfo>("MerchantList:" + merchant.UserId, 1, 10000000);
+                    
+                    //微信
                     string result = new WeChatFunction().MerchantCreate(AddInfo, merchant);
                     if (result.Contains("\"applyment_id\":"))
                     {
@@ -46,10 +49,109 @@ namespace MySystem
                             });
                         }
                         signs.Clear();
+                        if (merchants.Any(m => m.Id == merchant.Id) == false)
+                        {
+                            BothdisDbconn.Instance.AddList("MerchantList:" + merchant.UserId, merchant);
+                        }
+                    }
+                    else if (result.Contains("\"message\":"))
+                    {
+                        JsonData jsonObj = JsonMapper.ToObject(result);
+                        AddInfo.Status = -1;
+                        string Season = function.CheckNull(AddInfo.SeoDescription);
+                        if (string.IsNullOrEmpty(Season))
+                        {
+                            Season = "WeChat:" + jsonObj["message"].ToString() + ";";
+                        }
+                        else
+                        {
+                            Season += "WeChat:" + jsonObj["message"].ToString()+ ";";
+                        }
+                        AddInfo.SeoDescription = Season;
+                        db.SaveChanges();
+                        if (merchants.Any(m => m.Id == merchant.Id) == false)
+                        {
+                            BothdisDbconn.Instance.AddList("MerchantList:" + merchant.UserId, merchant);
+                        }
+                        List<MerchantSign> signs = TendisDbconn.Instance.GetList<MerchantSign>("WeChatSignList", 1, 10000000);
+                        MerchantSign sign = signs.FirstOrDefault(m => m.BusinessCode == BusinessCode);
+                        if (sign != null)
+                        {
+                            signs.Remove(sign);
+                            TendisDbconn.Instance.Clear("WeChatSignList");
+                            TendisDbconn.Instance.AddList("WeChatSignList", signs.ToArray());
+                        }
+                    }
+
+                    //支付宝
+                    bool checkAlipay = true;
+                    string content = new AlipayFunction().GetBatchNo(AddInfo.MobilePhone, AddInfo.IdCardName, AddInfo.MobilePhone, AddInfo.ContactEmail);
+                    JsonData json = JsonMapper.ToObject(content);
+                    if (json["alipay_open_agent_create_response"]["code"].ToString() == "1000")
+                    {
+                        string batch_no = json["alipay_open_agent_create_response"]["batch_no"].ToString();
+                        string Qualifications = AddInfo.Qualifications;
+                        if (!string.IsNullOrEmpty(Qualifications))
+                        {
+                            Qualifications = function.getPath("/bsserver_com" + Qualifications);
+                        }
+                        content = new AlipayFunction().CommonSign(batch_no, "D_D05_7372", AddInfo.LicenseNumber, function.getPath("/bsserver_com" + AddInfo.LicenseCopy), Qualifications);
+                        json = JsonMapper.ToObject(content);
+                        if (json["alipay_open_agent_common_sign_response"]["code"].ToString() == "1000")
+                        {
+                            List<MerchantSign> signs = TendisDbconn.Instance.GetList<MerchantSign>("MerchantSignList", 1, 10000000);
+                            bool op = signs.Any(m => m.BusinessCode == batch_no);
+                            if (!op)
+                            {
+                                TendisDbconn.Instance.AddList("AlipaySignList", new MerchantSign()
+                                {
+                                    BusinessCode = batch_no,
+                                    MerchantAddInfoId = MerchantId,
+                                    Status = ""
+                                });
+                            }
+                            signs.Clear();
+                            if (merchants.Any(m => m.Id == merchant.Id) == false)
+                            {
+                                BothdisDbconn.Instance.AddList("MerchantList:" + merchant.UserId, merchant);
+                            }
+                        }
+                        else
+                        {
+                            checkAlipay = false;
+                        }
                     }
                     else
-                    { 
-                        // TODO: 
+                    {
+                        checkAlipay = false;
+                    }
+                    if(!checkAlipay)
+                    {
+                        JsonData jsonObj = JsonMapper.ToObject(content);
+                        AddInfo.QueryCount = -1;
+                        string Season = function.CheckNull(AddInfo.SeoDescription);
+                        if (string.IsNullOrEmpty(Season))
+                        {
+                            Season = "Alipay:" + jsonObj["alipay_open_agent_create_response"]["sub_msg"].ToString() + ";";
+                        }
+                        else
+                        {
+                            Season = "Alipay:" + jsonObj["alipay_open_agent_create_response"]["sub_msg"].ToString()+ ";" + Season;
+                        }
+                        AddInfo.SeoDescription = Season;
+                        db.SaveChanges();
+                        if (merchants.Any(m => m.Id == merchant.Id) == false)
+                        {
+                            BothdisDbconn.Instance.AddList("MerchantList:" + merchant.UserId, merchant);
+                        }
+                        List<MerchantSign> signs = TendisDbconn.Instance.GetList<MerchantSign>("AliaySignList", 1, 10000000);
+                        MerchantSign sign = signs.FirstOrDefault(m => m.BusinessCode == BusinessCode);
+                        if (sign != null)
+                        {
+                            signs.Remove(sign);
+                            TendisDbconn.Instance.Clear("AliaySignList");
+                            TendisDbconn.Instance.AddList("AliaySignList", signs.ToArray());
+                        }
                     }
                 }
                 db.Dispose();

+ 5 - 0
AppStart/RabbitMQClient.cs

@@ -79,6 +79,11 @@ namespace MySystem
                     JobMqMsg job = Newtonsoft.Json.JsonConvert.DeserializeObject<JobMqMsg>(MsgContent);
                     CheckWeChatSignService.Instance.Start(job);
                 }
+                else if (QueueName == "CheckAlipaySign")
+                {
+                    JobMqMsg job = Newtonsoft.Json.JsonConvert.DeserializeObject<JobMqMsg>(MsgContent);
+                    CheckAlipaySignService.Instance.Start(job);
+                }
                 else if (QueueName == "MerchantConfirmList")
                 {
                     MerchantConfirmService.Instance.Start(MsgContent);

+ 11 - 0
AppStart/Tables/Alipay/RoyaltyParameters.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+namespace MySystem
+{
+    public class RoyaltyParameters
+    {
+        public string Account { get; set; }
+        public string Name { get; set; }
+        public string Amount { get; set; }
+    }
+}

+ 4 - 1
Controllers/HomeController.cs

@@ -58,7 +58,10 @@ namespace MySystem.Controllers
         private static object o = new object();
         public string test()
         {
-            RabbitMQClient.Instance.SendMsg("2", "MerchantConfirmList");
+            MerchantConfirmService.Instance.Start("2");
+            // WebCMSEntities db = new WebCMSEntities();
+            // MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == 2) ?? new MerchantInfo();
+            // BothdisDbconn.Instance.AddList("MerchantList:" + merchant.UserId, merchant);
             // lock (o)
             // {
             //     function.WriteLog("start:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));

+ 0 - 3
MySystem.csproj

@@ -33,9 +33,6 @@
     <Reference Include="aliyun-net-sdk-core">
       <HintPath>BLL\aliyun-net-sdk-core.dll</HintPath>
     </Reference>
-    <Reference Include="AopSdk">
-      <HintPath>..\..\MySystemLib\MySystemLib\bin\Release\netcoreapp3.0\AopSdk.dll</HintPath>
-    </Reference>
     <Reference Include="LitJSON">
       <HintPath>..\..\MySystemLib\MySystemLib\bin\Release\netcoreapp3.0\LitJSON.dll</HintPath>
     </Reference>

+ 2 - 1
Startup.cs

@@ -214,7 +214,8 @@ namespace MySystem
 
 
             // RabbitMQClient.Instance.StartReceive("MerchantConfirmList");
-            RabbitMQClient.Instance.StartReceive("CheckWeChatSign");
+            // RabbitMQClient.Instance.StartReceive("CheckWeChatSign");
+            // RabbitMQClient.Instance.StartReceive("CheckAlipaySign");
             // RabbitMQClient.Instance.StartReceive("PublicMainServer");
             // RabbitMQClient.Instance.StartReceive("SycnTableData");
 

BIN
bin/Debug/netcoreapp3.0/AopSdk.dll


+ 0 - 17
bin/Debug/netcoreapp3.0/MySystem.deps.json

@@ -41,7 +41,6 @@
           "ZKWeb.System.Drawing": "4.0.1",
           "aliyun-net-sdk-core": "2.0.0.0",
           "Aliyun.OSS": "2.9.1.0",
-          "AopSdk": "2.0.0.0",
           "LitJSON": "1.0.0.0",
           "MySystemLib": "1.0.0.0",
           "ThoughtWorks.QRCode": "1.0.3990.25764",
@@ -2082,17 +2081,6 @@
           "Aliyun.OSS.dll": {}
         }
       },
-      "AopSdk/2.0.0.0": {
-        "runtime": {
-          "AopSdk.dll": {
-            "assemblyVersion": "2.0.0.0",
-            "fileVersion": "2.0.0.0"
-          }
-        },
-        "compile": {
-          "AopSdk.dll": {}
-        }
-      },
       "LitJSON/1.0.0.0": {
         "runtime": {
           "LitJSON.dll": {
@@ -4839,11 +4827,6 @@
       "serviceable": false,
       "sha512": ""
     },
-    "AopSdk/2.0.0.0": {
-      "type": "reference",
-      "serviceable": false,
-      "sha512": ""
-    },
     "LitJSON/1.0.0.0": {
       "type": "reference",
       "serviceable": false,

BIN
bin/Debug/netcoreapp3.0/MySystem.dll


BIN
bin/Debug/netcoreapp3.0/MySystem.pdb


+ 0 - 1
obj/Debug/netcoreapp3.0/MySystem.csproj.FileListAbsolute.txt

@@ -182,7 +182,6 @@
 /Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll
 /Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/aliyun-net-sdk-core.dll
 /Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/Aliyun.OSS.dll
-/Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/AopSdk.dll
 /Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/LitJSON.dll
 /Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/MySystemLib.dll
 /Users/Shared/Previously Relocated Items/Security/MyDisk/我的/项目/myprogram_vs2019/KeXiaoShuang/MainServer/bin/Debug/netcoreapp3.0/ThoughtWorks.QRCode.dll

BIN
obj/Debug/netcoreapp3.0/MySystem.dll


BIN
obj/Debug/netcoreapp3.0/MySystem.pdb