Explorar o código

调整微信和支付宝进件逻辑

lcl hai 1 ano
pai
achega
0423ad4b17

+ 12 - 1
AppStart/Helper/CheckAlipaySignService.cs

@@ -59,6 +59,11 @@ namespace MySystem
                         if (merchantadd != null)
                         {
                             merchantadd.QueryCount = 1;
+                            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                            if (merchant != null)
+                            {
+                                merchant.QueryCount = 1;
+                            }
                             string confirm_url = "/static/alipay_confirm_url/";
                             string fileName = function.MD5_16(Guid.NewGuid().ToString());
                             function.CreateQRCode2(sign_url, fileName, "/" + confirm_url);
@@ -74,6 +79,12 @@ namespace MySystem
                         if (merchantadd != null)
                         {
                             merchantadd.QueryCount = 2;
+                            merchantadd.AlipayPid = dic["alipay_open_agent_order_query_response"]["merchant_pid"].ToString();
+                            MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
+                            if (merchant != null)
+                            {
+                                merchant.QueryCount = 2;
+                            }
                             db.SaveChanges();
                         }
                     }
@@ -97,7 +108,7 @@ namespace MySystem
                             MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == sign.MerchantAddInfoId);
                             if (merchant != null)
                             {
-                                merchant.Status = -1;
+                                merchant.QueryCount = -1;
                             }
                             db.SaveChanges();
                         }

+ 16 - 13
AppStart/WeChatFunction.cs

@@ -24,8 +24,9 @@ namespace MySystem
         public string AppId = "wx6e074b8e07b6577e";
         public string AppSecret = "883f9ef7831d8ca82168c3fd6dcfb750";
         public string MchId = "1613112281";
+        public string plateMchId = "1647817950";
         public string serialNo = "14E9FD7F0981BEA23F94137607521CB51C4F76EF";
-        public string platSerialNo = "31CF8918DD2C48D8E6AC645233DCE5A27FA47344";
+        public string getSerialNo = "61D99F7218B487788E35D6C4E3ED398E0979D3F6";
 
         #region 服务商平台商户进件提交申请单API
 
@@ -208,7 +209,7 @@ namespace MySystem
             // $ openssl x509 -in 1900009191_20180326_cert.pem -noout -serial
             // serial=1DDE55AD98ED71D6EDD4A4A16996DE7B47773A8C
             function.WriteLog(req, "服务商平台商户进件提交申请单API");
-            string resp = postJson("https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/", req, prikey, MchId, serialNo);
+            string resp = postJson("https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/", req);
             function.WriteLog(resp + "\n\n", "服务商平台商户进件提交申请单API");
             return resp;
         }
@@ -222,7 +223,7 @@ namespace MySystem
             Dictionary<string, object> return_result = new Dictionary<string, object>();
             try
             {
-                string result = postJson("https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/business_code/" + BusinessCode, "", prikey, MchId, serialNo, "GET");
+                string result = postJson("https://api.mch.weixin.qq.com/v3/applyment4sub/applyment/business_code/" + BusinessCode, "", "GET");
                 
                 //{\"applyment_id\":2000002247709762,\"applyment_state\":\"APPLYMENT_STATE_FINISHED\",\"applyment_state_msg\":\"商户入驻申请已完成\",\"audit_detail\":[],\"business_code\":\"0123456789\",\"sign_url\":\"https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFv7zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyUXE1czkzb3JlUjIxZHpXbTF5Y2YAAgRjbe9hAwQAjScA\",\"sub_mchid\":\"1619775262\"}
                 JsonData jsonObj = JsonMapper.ToObject(result);
@@ -303,7 +304,7 @@ namespace MySystem
             try
             {
                 function.WriteLog(req, "服务商平台申请退款API");
-                string result = postJson("https://api.mch.weixin.qq.com/v3/refund/domestic/refunds", req, prikey, MchId, serialNo);
+                string result = postJson("https://api.mch.weixin.qq.com/v3/refund/domestic/refunds", req);
                 function.WriteLog(result + "\n\n", "服务商平台申请退款API");
                 JsonData jsonObj = JsonMapper.ToObject(result);
                 return_result.Add("refund_id", jsonObj["refund_id"].ToString()); //微信支付退款单号
@@ -337,7 +338,7 @@ namespace MySystem
             result.Add("unfreeze_unsplit", true); //是否解冻剩余未分资金
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(result);
             function.WriteLog(req, "服务商平台请求分账API");
-            string resp = postJson("https://api.mch.weixin.qq.com/v3/profitsharing/orders", req, prikey, MchId, serialNo);
+            string resp = postJson("https://api.mch.weixin.qq.com/v3/profitsharing/orders", req);
             function.WriteLog(resp + "\n\n", "服务商平台请求分账API");
             return resp;
             //{"order_id":"30000104462023060249559178531","out_order_no":"2023060210583730173782834","receivers":[{"account":"1611167423","amount":3,"create_time":"2023-06-02T11:34:10+08:00","description":"服务费","detail_id":"36000104462023060269999025889","finish_time":"1970-01-01T08:00:00+08:00","result":"PENDING","type":"MERCHANT_ID"},{"account":"1645266943","amount":7,"create_time":"2023-06-02T11:34:10+08:00","description":"解冻给分账方","detail_id":"36000104462023060269999025890","finish_time":"1970-01-01T08:00:00+08:00","result":"PENDING","type":"MERCHANT_ID"}],"state":"PROCESSING","sub_mchid":"1645266943","transaction_id":"4200001833202306025522158377"}
@@ -360,7 +361,7 @@ namespace MySystem
             result.Add("relation_type", Relation); //与分账方的关系类型 STORE:门店 STAFF:员工 STORE_OWNER:店主 PARTNER:合作伙伴 HEADQUARTER:总部 BRAND:品牌方 DISTRIBUTOR:分销商 USER:用户 SUPPLIER: 供应商 CUSTOM:自定义
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(result);
             function.WriteLog(req, "服务商平台添加分账接收方API");
-            string resp = postJson("https://api.mch.weixin.qq.com/v3/profitsharing/receivers/add", req, prikey, MchId, serialNo);
+            string resp = postJson("https://api.mch.weixin.qq.com/v3/profitsharing/receivers/add", req);
             function.WriteLog(resp + "\n\n", "服务商平台添加分账接收方API");
             return resp;
             //{"account":"1611167423","name":"x+8m5jM4x2jSZLDOpN46Js9JyeNgUXkFSmGjCBN45QcSYUNPN86TOheRF64WlwDeO45E/walWPeZSksNN/LfJiB2fZRVun1CJuJ7zxePma8L7iDbKS92i+d38rvOmNTjLhKX64O8oJR4HMtFw1HryxJlUFgM5/ickJ79WGrX3GaVArWisgEzwOyxGBfGSL3ofJhi5TdTnrxHMzqYWv43DRvI9Ja5eMgFbgrGcn+JiJVKQcYj1L8tZ6xQeQCXkY6ubyDiV9wQps2nQA1Oh+UdFcS13Ex4FUSYLCczGFAl4EV8TBJQleZeC1p4ZJquJjje0uMjI2xB6S41yUBoN86gkA==","relation_type":"PARTNER","sub_mchid":"1645266943","type":"MERCHANT_ID"}
@@ -375,7 +376,7 @@ namespace MySystem
             req += "sub_mchid=" + SubMchId + "&"; //子商户号
             req += "transaction_id=" + TradeNo + "&"; //微信订单号
             function.WriteLog(req, "服务商平台查询分账结果API");
-            string resp = postJson("https://api.mch.weixin.qq.com/v3/profitsharing/orders/" + OrderNo + "?" + req, "", prikey, MchId, serialNo, "GET");
+            string resp = postJson("https://api.mch.weixin.qq.com/v3/profitsharing/orders/" + OrderNo + "?" + req, "", "GET");
             function.WriteLog(resp + "\n\n", "服务商平台查询分账结果API");
             return resp;
             //{"order_id":"30000404702023060849818491190","out_order_no":"2023060816062365164446474","receivers":[{"account":"1611167423","amount":3,"create_time":"2023-06-08T17:55:45+08:00","description":"服务费","detail_id":"36000404702023060870422622364","finish_time":"2023-06-08T17:56:16+08:00","result":"SUCCESS","type":"MERCHANT_ID"},{"account":"1646405429","amount":151,"create_time":"2023-06-08T17:55:45+08:00","description":"解冻给分账方","detail_id":"36000404702023060870422622365","finish_time":"2023-06-08T17:56:16+08:00","result":"SUCCESS","type":"MERCHANT_ID"}],"state":"FINISHED","sub_mchid":"1646405429","transaction_id":"4200001821202306083551994076"}
@@ -387,9 +388,11 @@ namespace MySystem
 
 
         #region 敏感信息加密
-
-        string pubkey = "MIIEKDCCAxCgAwIBAgIUFOn9fwmBvqI/lBN2B1IctRxPdu8wDQYJKoZIhvcNAQELBQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsTFFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3QgQ0EwHhcNMjMwNjI2MDMwNTU2W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QdVakoaSY6YN0DEBedub6wN2XvU7oMAuzjmXkknDfNkLkfmWia0Fh4YnVabytwoo3diyBDi6hrWkAhSllhQKBgQDbRXOBzFxK8Dgpt76xhSCmxLhvseBbwTpJ8tQHs/zkFhK/BNn79eJsEjZNcox7xwagMvqVoBf9QdUzTChheDEhIzujsArEp2+NrUruBZPAZT6bX7niqs/jyRgw6B7h/XsSiPxRx7eCvn/SDp6JD5I8jYN/WxkeHdhi+mn8e87e1wKBgFRg0db60KsSMtz0c/mkD9eqhJfDPreNP3AMjK0xXbO6mbrCSEjLxq+IwFA6Vx3qnw4mASjWviG/rD34jBV/nMa2d6KhOC0ky60GXRS+d12hva41f8cN5jWZYh/l/pGK6oMnqu2fUkBWRrt2FbKbACgYWJu8ZEQRQnPJjGVLq62hAoGAAt0tXQymR/RLR4A25Wqvun3nSs4v+ALWGBEr483eB7yiEgymLDxR8MdsHibY3uUCmSURUNL+fThW6IyeGmfPfHdRWBn8igUF1/vjdqhr/Z9U6gKeEu/YN0lxH3JotNryuJNBeG/7XaHPWZcHSxMA/fl7NjaiZVpOcTyEFeAoG5ECgYBimNzthVzVAK5oN8ChIV23iou7wMVaPQ3eWdKhec0GAH+Jv5V8GHGlbZeBiUiBMo62fwtTru+j3zJgMum+PlZSHz903J2bSzo6x0N2/6/TYUjVsXFLlpS7zbMvJnh//9B8wGhnhzSfW38MA523CIw7sU+VUQQHx6/2vLwT84SfsQ=="; //私钥
         public string RSAEncrypt(string text)
         {
             byte[] publicKey = Convert.FromBase64String(pubkey);
@@ -447,7 +450,7 @@ namespace MySystem
             cipher.DoFinal(plaintext, len);
             return Encoding.UTF8.GetString(plaintext);
         }
-        public string postJson(string url, string postData, string privateKey, string merchantId, string serialNo, string method = "POST")
+        public string postJson(string url, string postData, string method = "POST")
         {
             HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
             request.Method = method;
@@ -455,9 +458,9 @@ namespace MySystem
             request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36";
             request.Accept = "application/json";
 
-            string Authorization = GetAuthorization(url, method, postData, privateKey, merchantId, serialNo);
+            string Authorization = GetAuthorization(url, method, postData, prikey, MchId, serialNo);
             request.Headers.Add("Authorization", Authorization);
-            request.Headers.Add("Wechatpay-Serial", platSerialNo);
+            request.Headers.Add("Wechatpay-Serial", getSerialNo);
             if (!string.IsNullOrEmpty(postData))
             {
                 byte[] paramJsonBytes;
@@ -573,7 +576,7 @@ namespace MySystem
             var byteData3 = System.Text.Encoding.UTF8.GetBytes(campaignIDStr3);
             #endregion
 
-            string transactionsResponse = UploadImg_postJson(url, byteData1, byteData2, byteData3, metaStr, privateKey, merchantId, platSerialNo, boundary, "POST");
+            string transactionsResponse = UploadImg_postJson(url, byteData1, byteData2, byteData3, metaStr, privateKey, merchantId, serialNo, boundary, "POST");
             var result=JsonMapper.ToObject(transactionsResponse);
             return result["media_id"].ToString();
         }

+ 28 - 0
Areas/Api/Controllers/BaseController.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Linq;
+using System.Web;
+using System.Text.RegularExpressions;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers
+{
+    public class BaseController : Controller
+    {
+        public IHttpContextAccessor _accessor;
+        public readonly ILogger<BaseController> _logger;
+        public readonly IOptions<Setting> _setting;
+        public Setting AppSetting;
+
+        public BaseController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting)
+        {
+            _accessor = accessor;
+            _logger = logger;
+            _setting = setting;
+        }
+
+    }
+}

+ 53 - 0
Areas/Api/Controllers/v1/PublicMethodController.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using System.DrawingCore.Imaging;
+using System.IO;
+using Library;
+using System.Collections;
+using LitJson;
+using System.Globalization;
+using System.Web;
+
+// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
+
+namespace MySystem.Areas.Api.Controllers
+{
+    [Area("Api")]
+    [Route("Api/[controller]/[action]")]
+    public class PublicMethodController : BaseController
+    {
+        public PublicMethodController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+        }
+
+        #region 系统-上传图片
+        public JsonResult UploadPhotoByBase64(string value)
+        {
+            try
+            {
+                value = value.Replace("data:image/png;base64,", "");
+                string base64str = HttpUtility.UrlDecode(value).Replace(" ", "+");
+                string dummyData = base64str.Replace("%", "").Replace(",", "").Replace(" ", "+");
+                if (dummyData.Length % 4 > 0)
+                {
+                    dummyData = dummyData.PadRight(dummyData.Length + 4 - dummyData.Length % 4, '=');
+                }
+                string Icon = function.base64StringToImage(dummyData, "/static/upload/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/", "MT" + function.MD5_16(Guid.NewGuid().ToString()) + ".png");
+                return Json(new AppResultJson() { Status = "1", Info = "", Data = Icon });
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now + ":" + ex.ToString(), "系统上传图片异常");
+                return Json(new AppResultJson() { Status = "1", Info = "", Data = "" });
+            }
+        }
+        #endregion
+
+    }
+}

+ 18 - 18
Startup.cs

@@ -38,7 +38,7 @@ namespace MySystem
             });
             services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
             services.Configure<Setting>(Configuration.GetSection("Setting"));
-            services.AddCors(option => option.AddPolicy("cors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().SetIsOriginAllowed(_ => true)));
+            // services.AddCors(option => option.AddPolicy("cors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().SetIsOriginAllowed(_ => true)));
             services.AddMvc(options =>
             {
                 options.EnableEndpointRouting = false;
@@ -139,11 +139,11 @@ namespace MySystem
             // };
             // app.UseStatusCodePages(builder => builder.Run(handler));
             app.UseStaticFiles();
-            // app.UseStaticFiles(new StaticFileOptions
-            // {
-            //     FileProvider = new PhysicalFileProvider(AppContext.BaseDirectory + "/static"),
-            //     RequestPath = "/static"
-            // });
+            app.UseStaticFiles(new StaticFileOptions
+            {
+                FileProvider = new PhysicalFileProvider(AppContext.BaseDirectory + "/static"),
+                RequestPath = "/static"
+            });
             // app.UseStaticFiles(new StaticFileOptions
             // {
             //     FileProvider = new PhysicalFileProvider(AppContext.BaseDirectory + "/" + Configuration["Setting:Database"]),
@@ -171,18 +171,18 @@ 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(); //发放达标奖励队列
-            // ProfitHelper.Instance.StartListenTrade(); //支付宝返现队列
-            // ProfitHelper.Instance.StartListenWxTrade(); //微信返现队列
-            // ProfitShareService.Instance.Start(); //分账状态监控队列,分账完成则提交返现(微信)
-            // AlipayShareService.Instance.Start(); //分账状态监控队列,分账完成则提交返现(支付宝)
+            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(); //发放达标奖励队列
+            ProfitHelper.Instance.StartListenTrade(); //支付宝返现队列
+            ProfitHelper.Instance.StartListenWxTrade(); //微信返现队列
+            ProfitShareService.Instance.Start(); //分账状态监控队列,分账完成则提交返现(微信)
+            AlipayShareService.Instance.Start(); //分账状态监控队列,分账完成则提交返现(支付宝)
             //必须打开的
         }
     }