11 Commity a1aee198fc ... 5e4f79e976

Autor SHA1 Wiadomość Data
  lcl 5e4f79e976 手动导数据 5 miesięcy temu
  lcl f94da8eb5b 补返现 6 miesięcy temu
  lcl 85fe4df05d 调整补分账程序 6 miesięcy temu
  lcl 45bac10999 补分账 6 miesięcy temu
  lcl 7aa419c972 集成分账通知处理 6 miesięcy temu
  lcl 0ec3a041be ftp抓取数去,后面全部手动释放 6 miesięcy temu
  lcl abc790a2ff 获取好哒FTP交易数据,方法改成静态 6 miesięcy temu
  lcl cb682c7466 获取好哒FTP交易数据,方法改成静态 6 miesięcy temu
  lcl 6509ba3a9a 获取好哒FTP交易数据,方法改成静态 6 miesięcy temu
  lcl 8f7cdc281a 获取好哒FTP交易数据,时间限制到10点后22点前 6 miesięcy temu
  lcl 39e2a14a3f 修改获取盒易付ftp数据 6 miesięcy temu

+ 74 - 354
Controllers/HomeController.cs

@@ -12,6 +12,7 @@ using MySystem.Models.Main;
 using System.Text.RegularExpressions;
 using Aop.Api.Domain;
 using MySystem.Models;
+using Microsoft.Extensions.Localization;
 
 namespace MySystem.Controllers
 {
@@ -29,384 +30,103 @@ namespace MySystem.Controllers
             return View();
         }
 
-        // public string test2(int id)
-        // {
-        //     WebCMSEntities db = new WebCMSEntities();
-        //     MerchantAddInfo AddInfo = db.MerchantAddInfo.FirstOrDefault(m => m.Id == id) ?? new MerchantAddInfo();
-        //     AddInfo.MchtNo = "";
-        //     string result = HaoDaHelper.Instance.AddNewMerchant(AddNewMerchantSetUtil.SetValue(AddInfo));
-        //     db.Dispose();
-        //     return result;
-        // }
-
-        public string test()
+        public string getHdOrder()
         {
-            // List<int> MerchantIds = new List<int>();
-            // MerchantIds.Add(5);
-            // foreach(int MerchantId in MerchantIds)
-            // {
-            //     RedisDbconn.Instance.AddList("MerchantConfirmHdQueue", "{\"MerchantId\":\"" + MerchantId + "\"}");
-            // }
-            // TianYuVoiceHelper.Instance.doSomething(DateTime.Now.ToString("yyyyMMddHHmmssfff"),"2023100701","100");
-            // MqLinksHelper.Instance.doSomething("LKB01230600250000585","100");
+            GetHaoDaFTPInfoService.Instance.GetFTPDataInfoYesterday();
+            return "ok";
+        }
 
+        public string partorder()
+        {
+            List<string> hdorders = new List<string>();
             WebCMSEntities db = new WebCMSEntities();
-            DateTime start = DateTime.Parse("2024-03-10 00:00:00");
-            List<ConsumerOrders> orders = db.ConsumerOrders.Where(m => m.Status > 0 && m.IsAct == 1 && m.CreateDate > start && m.CurDivi < m.MaxDivi && m.SettleAmount > 0).OrderBy(m => m.Id).ToList();
-            foreach(ConsumerOrders order in orders)
+            var list = db.ConsumerOrders.Select(m => new { m.Id, m.SettleAmount, m.IsAct, m.SeoTitle }).Where(m => hdorders.Contains(m.SeoTitle) && m.IsAct == 1 && m.SettleAmount == 0).OrderBy(m => m.Id).ToList();
+            foreach (var sub in list)
             {
-                bool check = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, 1, 10000).Any(m => m.Id == order.Id);
-                bool check1 = db.ConsumerProfit.Any(m => m.OrderId == order.Id);
-                if(!check && !check1)
-                {
-                    RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());
-                    ConsumerOrders edit = db.ConsumerOrders.FirstOrDefault(m => m.Id == order.Id);
-                    if(edit != null)
-                    {
-                        edit.ReturnFlag = 1;
-                        db.SaveChanges();
-                    }
-                }
-                else
+                ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == sub.Id);
+                if (order != null)
                 {
-                    if(!check)
+                    int Status = 2;
+                    MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantInfo();
+                    MerchantParamSet set = Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(order.SeoDescription);
+                    if (order.IsAct == 1 && order.PayMoney >= set.MinPayMoney)
                     {
-                        RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-                        ConsumerOrders edit = db.ConsumerOrders.FirstOrDefault(m => m.Id == order.Id);
-                        if(edit != null)
+                        MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
+                        
+                        //获取结算金额
+                        if(order.SettleAmount == 0)
                         {
-                            edit.ReturnFlag = 1;
-                            db.SaveChanges();
+                            string settleString = HaoDaHelper.Instance.QueryOrderDivideDetail(merchantAdd.OutMchtNo, order.SeoTitle);
+                            JsonData jsonData = JsonMapper.ToObject(settleString);
+                            if(jsonData["resultCode"].ToString() == "1")
+                            {
+                                string settleAmountString = jsonData["data"]["settleAmount"].ToString();
+                                order.SettleAmount = int.Parse(settleAmountString);
+                            }
                         }
-                    }
-                    else if(!check1)
-                    {
-                        ConsumerOrders edit = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, 1, 10000).FirstOrDefault(m => m.Id == order.Id);
-                        long count = RedisDbconn.Instance.DelFromList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId,edit);
-                        if(count > 0)
+
+                        //发起分账
+                        decimal fee = order.PayMoney;
+                        if (fee >= 1 && order.SettleAmount > 0)
                         {
-                            RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());
+                            string applyNo = "FZ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //批次号
+                            string mchtNo = merchantAdd.OutMchtNo; //慧掌柜商户号
+                            string orderNo = order.SeoTitle; //交易订单号(好哒平台订单号,G开头)
+                            string acctNo = AppConfig.Haoda.AcctNo; //账户号,分账接收方账户号
+                            string sacctNo = merchantAdd.MchtNo; //账户号,收款商户号
+                            string acctType = "0"; //账户类型(0:商户收款账户(大B),1:分账接收方账户(小B))
+
+                            decimal settleAmount = (decimal)order.SettleAmount / 100M;
+                            decimal divideAmt = (1 - 0.0038M) * order.PayMoney;
+                            divideAmt = decimal.Parse(divideAmt.ToString("f2"));
+                            decimal hdfee = 0.0038M * order.PayMoney * (1 - set.GetPercent / 100 - 0.01M);
+                            hdfee = decimal.Parse(hdfee.ToString("f2"));
+                            decimal servicefee = 0.01M * order.PayMoney - hdfee;
+                            servicefee = decimal.Parse(servicefee.ToString("f2"));
+                            decimal amount = order.PayMoney * (1 - 0.0038M) - servicefee;
+                            amount = decimal.Parse(amount.ToString("f2"));
+                            decimal otherAmt = settleAmount - servicefee - amount;
+                            if (otherAmt != 0)
+                            {
+                                amount += otherAmt;
+                            }
+
+                            amount = amount * 100; //金额(分)
+                            servicefee = servicefee * 100;
+                            string seviceAmount = servicefee.ToString("f0"); //服务费
+                            string amountAmount = amount.ToString("f0");
+                            string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amountAmount, seviceAmount), merchantAdd.BrandId);
+                            order.DivideLog = "请求分账日志:" + result;
+                            order.TradePayNo = applyNo;
+                            if (result.Contains("\"resultCode\":\"0\"") && (result.Contains("分账金额不足") || result.Contains("不存在")))
+                            {
+                                Status = 1;
+                            }
                         }
                     }
-                }
-                if(order.ReturnFlag == 0 && check && check1)
-                {
-                    ConsumerOrders edit = db.ConsumerOrders.FirstOrDefault(m => m.Id == order.Id);
-                    if(edit != null)
+                    order.Status = Status;
+                    if (Status == 2)
                     {
-                        edit.ReturnFlag = 1;
-                        db.SaveChanges();
+                        order.DivideFlag = 1;
+                        order.DivideDate = DateTime.Now;
                     }
                 }
             }
-
-            // Dictionary<string, decimal> ids = new Dictionary<string, decimal>();
-            // ids.Add("2023123120272680842405573", 30.08M);
-            // foreach(string orderno in ids.Keys)
-            // {
-            //     decimal cur = ids[orderno];
-            //     ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.OrderNo == orderno) ?? new ConsumerOrders();
-            //     order.CurDivi = cur;
-            //     order.SeoDescription = Regex.Replace(function.CheckNull(order.SeoDescription), "\"UpdateDate\":\".*?\"", "\"UpdateDate\":\"" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + "\"");
-            //     order.SeoDescription = Regex.Replace(function.CheckNull(order.SeoDescription), "\"ProfitDays\":.*?,", "\"ProfitDays\":90,");
-            //     RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-            // }
-
-            // string content = function.ReadInstance("/222.log");
-            // string[] contents = content.Split('\n');
-            // foreach(string sub in contents)
-            // {
-            //     // RedisDbconn.Instance.AddList("WeChatPayBackHd", sub);
-            //     RedisDbconn.Instance.AddList("PartOrderQueue", sub);
-            // }
-
-            // DataTable dt = CustomerSqlConn.dtable("select tb.Id,tb.PayMode,p.Id pId from (select Id,PayMode from ConsumerOrders where CreateDate>='2024-01-18 00:00:00' and `Status`>0) tb left join ConsumerProfit p on tb.Id=p.OrderId", AppConfig.Base.SqlConnStr);
-            // foreach(DataRow dr in dt.Rows)
-            // {
-            //     string Id = dr["Id"].ToString();
-            //     string PayMode = dr["PayMode"].ToString();
-            //     string pId = dr["pId"].ToString();
-            //     if(string.IsNullOrEmpty(pId))
-            //     {
-            //         RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + PayMode + ":List", Id);
-            //     }
-            // }
-
-            string str = "";
-            // str += "<table>";
-            // str += "<tr><td>订单号</td><td>下单时间</td><td>商家分红天数</td><td>当前分红金额</td><td>最大分红</td></tr>";
-            // List<int> orders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:2:1940", 1, 10000).Select(m => m.Id).ToList();
-            // DataTable dt = CustomerSqlConn.dtable("select OrderId,sum(GetMoney) money from ConsumerProfit where MerchantId=1940 and CreateDate>='2023-12-01 00:00:00' group by OrderId order by OrderId", AppConfig.Base.SqlConnStr);
-            // foreach(DataRow dr in dt.Rows)
-            // {
-            //     decimal cur = decimal.Parse(dr["money"].ToString());
-            //     int OrderId = int.Parse(dr["OrderId"].ToString());
-            //     if(!orders.Contains(OrderId))
-            //     {
-            //         // string orderno = dr["OrderNo"].ToString();
-            //         ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == OrderId) ?? new ConsumerOrders();
-            //         if(order.MaxDivi - cur >= 1)
-            //         {
-            //             order.CurDivi = cur;
-            //             MerchantParamSet set = Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(order.SeoDescription);
-            //             order.SeoDescription = Regex.Replace(function.CheckNull(order.SeoDescription), "\"UpdateDate\":\".*?\"", "\"UpdateDate\":\"" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + "\"");
-            //             // order.SeoDescription = Regex.Replace(function.CheckNull(order.SeoDescription), "\"ProfitDays\":.*?,", "\"ProfitDays\":365,");
-            //             str += "<tr><td>" + order.OrderNo + "</td><td>" + order.UpdateDate.Value.ToString() + "</td><td>" + set.ProfitDays + "</td><td>" + cur + "</td><td>" + order.MaxDivi + "</td></tr>";
-            //             // RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-            //             // var list = db.ConsumerProfit.Where(m => m.OrderId == order.Id).OrderBy(m => m.Id).ToList();
-            //             // foreach(var sub in list)
-            //             // {
-            //             //     if(cur >= sub.GetMoney)
-            //             //     {
-            //             //         cur -= sub.GetMoney;
-            //             //     }
-            //             //     else
-            //             //     {
-            //             //         if(cur > 0)
-            //             //         {
-            //             //             var edit = db.ConsumerProfit.FirstOrDefault(m => m.OrderId == order.Id);
-            //             //             if(edit != null)
-            //             //             {
-            //             //                 edit.GetMoney = cur;
-            //             //                 db.SaveChanges();
-            //             //             }
-            //             //         }
-            //             //         else
-            //             //         {
-            //             //             var edit = db.ConsumerProfit.FirstOrDefault(m => m.OrderId == order.Id);
-            //             //             if(edit != null)
-            //             //             {
-            //             //                 db.ConsumerProfit.Remove(edit);
-            //             //                 db.SaveChanges();
-            //             //             }
-            //             //         }
-            //             //     }
-            //             // }
-            //         }
-            //     }
-            // }
-            // str += "</table>";
-
-
-
-            // List<int> ids = new List<int>();
-            // ids.Add(4058);
-            // List<ConsumerOrders> orders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:2:1271");
-            // foreach(int oid in ids)
-            // {
-            //     function.WriteLog("oid:" + oid, "返现id");
-            //     decimal curDivi = 0;
-            //     ConsumerOrders order = orders.FirstOrDefault(m => m.Id == oid);
-            //     if(order == null)
-            //     {
-            //         order = db.ConsumerOrders.FirstOrDefault(m => m.Id == oid);
-            //         curDivi = order.MaxDivi;
-            //         function.WriteLog("出局", "返现id");
-            //     }
-            //     else
-            //     {
-            //         function.WriteLog("未出局", "返现id");
-            //         curDivi = order.CurDivi;
-            //     }
-            //     if(order != null)
-            //     {
-            //         List<ConsumerProfit> profits = db.ConsumerProfit.Where(m => m.OrderId == oid).ToList();
-            //         foreach(ConsumerProfit profit in profits)
-            //         {
-            //             if(curDivi >= profit.GetMoney)
-            //             {
-            //                 curDivi -= profit.GetMoney;
-            //             }
-            //             else
-            //             {
-            //                 function.WriteLog(profit.Id.ToString(), "返现id");
-            //             }
-            //         }
-            //     }
-            //     function.WriteLog("\n\n", "返现id");
-            // }
-
+            db.SaveChanges();
             db.Dispose();
 
-            // RedisDbconn.Instance.AddRightList("testlist", "1");
-            // RedisDbconn.Instance.AddRightList("testlist", "2");
-            // RedisDbconn.Instance.AddRightList("testlist", "3");
-            // RedisDbconn.Instance.AddRightList("testlist", "4");
-            // RedisDbconn.Instance.AddRightList("testlist", "5");
-            // RedisDbconn.Instance.AddRightList("testlist", "6");
-            // RedisDbconn.Instance.AddRightList("testlist", "7");
-            // RedisDbconn.Instance.AddRightList("testlist", "8");
-            // RedisDbconn.Instance.AddRightList("testlist", "9");
-
-            // str = RedisDbconn.Instance.RPopLPush<string>("testlist", "testlist"); 
-
-            // decimal settleAmount = b / 100M;
-            // decimal divideAmt = (1 - 0.0038M) * a;
-            // divideAmt = decimal.Parse(divideAmt.ToString("f2"));
-            // decimal hdfee = 0.0038M * a * (1 - g / 100 - 0.01M);
-            // hdfee = decimal.Parse(hdfee.ToString("f2"));
-            // decimal servicefee = 0.01M * a - hdfee;
-            // servicefee = decimal.Parse(servicefee.ToString("f2"));
-            // decimal amount = a*(1-0.0038M) - servicefee;
-            // amount = decimal.Parse(amount.ToString("f2"));
-            // decimal otherAmt = settleAmount - servicefee - amount;
-            // if(otherAmt != 0)
-            // {
-            //     amount += otherAmt;
-            // }
-
-            // amount = amount * 100; //金额(分)
-            // servicefee = servicefee * 100;
-            // string seviceAmount = servicefee.ToString("f0"); //服务费
-            // string amountAmount = amount.ToString("f0");
-
-            // return amountAmount + ":" + seviceAmount;
-
-            // List<int> ids = new List<int>();
-            // ids.Add(191);
-            // foreach(int id in ids)
-            // {
-            //     RedisDbconn.Instance.AddList("MerchantConfirmHdQueue", "{\"MerchantId\":\"" + id.ToString() + "\"}");
-            // }
-
-            // List<ConsumerOrders> orders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:2:1940", 1, 10000);
-            // int index = orders.Count;
-            // foreach(ConsumerOrders order in orders)
-            // {
-            //     index -= 1;
-            //     // decimal persent = order.CurDivi / order.MaxDivi;
-            //     // if(order.CurDivi > order.MaxDivi)
-            //     // {
-            //         // RedisDbconn.Instance.DelFromList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-            //         order.MaxDivi = order.PayMoney * 0.8M;
-            //         RedisDbconn.Instance.SetList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, index, order);
-            //     // }
-            // }
-
-            // DataTable dt = CustomerSqlConn.dtable("select DISTINCT MerchantId,PayMode from ConsumerOrders where IsAct=1 and `Status`>0 and MerchantId!=1940 order by MerchantId,PayMode", AppConfig.Base.SqlConnStr);
-            // foreach(DataRow dr in dt.Rows)
-            // {
-            //     string PayMode = dr["PayMode"].ToString();
-            //     string MerchantId = dr["MerchantId"].ToString();
-            //     List<ConsumerOrders> orders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + PayMode + ":" + MerchantId, 1, 10000);
-            //     foreach(ConsumerOrders order in orders)
-            //     {
-            //         decimal check = order.MaxDivi - order.CurDivi;
-            //         if(check < 0.01M)
-            //         {
-            //             function.WriteLog("MerchantId:" + order.MerchantId);
-            //             RedisDbconn.Instance.DelFromList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-            //         }
-            //     }
-            // }
-
-            return str;
-        }
-
-        public string bindapp(int mid)
-        {
-            // DataTable dt = CustomerSqlConn.dtable("select Id,MchtNo from MerchantAddInfo where HdStatus=3 and CreateDate>='2023-10-01 00:00:00' and MchtNo!='' and MchtNo is not null", AppConfig.Base.SqlConnStr);
-            // DataTable dt = CustomerSqlConn.dtable("select Id,MchtNo from MerchantAddInfo where Id=" + mid, AppConfig.Base.SqlConnStr);
-            // foreach(DataRow dr in dt.Rows)
-            // {
-            //     CheckWeChatSignService.Instance.StartDo(new QueryMerchantStatus()
-            //     {
-            //         MerchantId = dr["Id"].ToString(),
-            //         MerchantNo = dr["MchtNo"].ToString(),
-            //     });
-            // }
-
-            // Models.Main1.WebCMSEntities db1 = new Models.Main1.WebCMSEntities();
-            // WebCMSEntities db = new WebCMSEntities();
-            // MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == 1147);
-            // MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == 1147);
-            // string pwd = "417027";
-            // merchant.LoginPwd = function.MD532(pwd);
-            // Models.Main1.MerchantLoginInfo info = db1.MerchantLoginInfo.FirstOrDefault(m => m.LoginMobile == merchantadd.MobilePhone);
-            // if (info == null)
-            // {
-            //     info = db1.MerchantLoginInfo.Add(new Models.Main1.MerchantLoginInfo()
-            //     {
-            //         LoginMobile = merchantadd.MobilePhone,
-            //     }).Entity;
-            //     db1.SaveChanges();
-            // }
-            // info.LoginPwd = function.MD532(pwd);
-            // db1.SaveChanges();
-            // Models.Main1.MerchantAccountLinkInfo infolink = db1.MerchantAccountLinkInfo.FirstOrDefault(m => m.LoginId == info.Id && m.MerchantId == merchantadd.Id && m.Kind == 2);
-            // if (infolink == null)
-            // {
-            //     infolink = db1.MerchantAccountLinkInfo.Add(new Models.Main1.MerchantAccountLinkInfo()
-            //     {
-            //         LoginId = info.Id,
-            //         MerchantId = merchantadd.Id,
-            //         Kind = 2,
-            //     }).Entity;
-            //     db1.SaveChanges();
-            // }
-            // db1.Dispose();
-            // db.Dispose();
-
-            return "ok";
-        }
-    
-        
-        public string clearQueue(int OrderId, int MerchantId, int PayMode)
-        {
-            // List<ConsumerOrders> list = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + PayMode + ":" + MerchantId + "", 1, 100000);
-            // foreach(ConsumerOrders sub in list)
-            // {
-            //     if(sub.Id == OrderId)
-            //     {
-            //         RedisDbconn.Instance.DelFromList("ConsumerOrdersHd:Divi:2:1272", sub);
-            //     }
-            // }
-            return "ok";
-        }
-    
-    
-        //补返现
-        public string back(string no)
-        {
-            WebCMSEntities db = new WebCMSEntities();
-            ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.OrderNo == no);
-            if(order != null)
-            {
-                List<ConsumerOrders> list = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId + "", 1, 100000);
-                ConsumerOrders check = list.FirstOrDefault(m => m.Id == order.Id);
-                bool op = db.ConsumerProfit.Any(m => m.OrderId == order.Id);
-                if(check == null)
-                {
-                    if(!op)
-                    {
-                        RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());
-                    }
-                    else
-                    {
-                        RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
-                    }
-                }
-                db.Dispose();
-            }
             return "ok";
         }
 
-        public string goonback(int mid, int pm, string date)
+        public string addreturn()
         {
-            DateTime start = DateTime.Parse(date + " 00:00:00");
-            DateTime end = start.AddDays(1);
-            WebCMSEntities db = new WebCMSEntities();
-            List<ConsumerOrders> queue = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + pm + ":" + mid + "", 1, 100000);
-            List<ConsumerOrders> list = db.ConsumerOrders.Where(m => m.MerchantId == mid && m.PayMode == pm && m.Status > 0 && m.IsAct == 1 && m.CreateDate >= start && m.CreateDate < end).ToList();
-            foreach(ConsumerOrders sub in list)
+            List<int> ids = new List<int>();
+            foreach(int id in ids)
             {
-                if(!queue.Any(m => m.Id == sub.Id) && sub.CurDivi < sub.MaxDivi)
-                {
-                    RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + pm + ":" + mid, sub);
-                }
+                RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:2:List", id.ToString());
             }
-            db.Dispose();
             return "ok";
         }
+
     }
 }

+ 5 - 2
Startup.cs

@@ -142,13 +142,12 @@ namespace MySystem
             }
             if (Library.ConfigurationManager.EnvironmentFlag == 2)
             {
-                // GetHaoDaFTPInfoService.Instance.Start(); // 获取好哒FTP交易数据
-                GetTencentAddressInfoService.Instance.Start(); // 获取腾讯地图地址
                 GetStoreNoHelper.Instance.Start(); //获取商户门店号、微信支付宝商户号
                 MerchantConfirmService.Instance.Start(); //提交商户进件
                 CheckWeChatSignService.Instance.Start(); //查询商户审核状态
                 CheckWeChatBindService.Instance.Start(); //执行好哒微信绑定appid
                 ProfitShareService.Instance.Start(); //分账状态监控队列,分账完成则提交返现
+                ProfitShareService.Instance.StartCheck(); //复核头一天的分账
                 HaoDaExtHelper.Instance.StartWeChat();
                 HaoDaExtHelper.Instance.StartAlipay();
                 HaoDaExtQueryHelper.Instance.StartWeChat();
@@ -175,7 +174,11 @@ namespace MySystem
                 MerchantStandardService.Instance.Start(); //商户缴纳服务费次月活动交易额大于等于1W,奖励进件创客50元
                 MerchantStandardService.Instance.StartThree(); //商户缴纳服务费次月起连续不间断三个月,每月活动交易额大于1W,奖励进件创客100元
                 MerchantStandardService.Instance.StartActive();
+                
+                // GetHaoDaFTPInfoService.Instance.Start(); // 获取好哒FTP交易数据
+                GetTencentAddressInfoService.Instance.Start(); // 获取腾讯地图地址
             }
+            // GetHaoDaFTPInfoService.Instance.GetFTPDataInfoYesterday();
         }
 
         //初始化数据结构

+ 100 - 91
Util/HaoDa/GetHaoDaFTPInfoService.cs

@@ -35,7 +35,7 @@ namespace MySystem
             // th1.Start();
 
             //每天凌晨执行获取好哒FTP昨日交易数据
-            Thread th2 = new Thread(GetFTPDataInfoYesterday);
+            Thread th2 = new Thread(GetFTPDataInfoYesterdayReady);
             th2.IsBackground = true;
             th2.Start();
         }
@@ -44,7 +44,7 @@ namespace MySystem
         /// <summary>
         /// 没半小时获取好哒FTP今日交易数据
         /// </summary>
-        public static void GetFTPDataInfoHalfHour()
+        public void GetFTPDataInfoHalfHour()
         {
             // 47.108.253.46
             // 用户名:hdftp
@@ -165,7 +165,7 @@ namespace MySystem
         /// <summary>
         /// 获取好哒FTP今日交易数据
         /// </summary>
-        public static void GetFTPDataInfoToday()
+        public void GetFTPDataInfoToday()
         {
             // 47.108.253.46
             // 用户名:hdftp
@@ -278,7 +278,27 @@ namespace MySystem
         /// <summary>
         /// 获取好哒FTP昨日交易数据
         /// </summary>
-        public static void GetFTPDataInfoYesterday()
+        public void GetFTPDataInfoYesterdayReady()
+        {
+            while (true)
+            {
+                if (DateTime.Now.Hour > 10 && DateTime.Now.Hour < 22)
+                {
+                    string check = function.ReadInstance("/GetFTPDataInfoYesterday/check" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + ".txt");
+                    if (string.IsNullOrEmpty(check))
+                    {
+                        function.WritePage("/GetFTPDataInfoYesterday/", "check" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString());
+                        GetFTPDataInfoYesterday();
+                        Thread.Sleep(600000);
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(1800000);
+                }
+            }
+        }
+        public void GetFTPDataInfoYesterday()
         {
             // 47.108.253.46
             // 用户名:hdftp
@@ -292,103 +312,92 @@ namespace MySystem
             string ftpPassword = Base.HaoDaFtpLoginPwd;
             // 要下载的文件路径
             string filePath = "/haoda-trade/" + DateTime.Now.AddDays(-1).ToString("yyyyMMdd") + ".csv";
-
-            while (true)
+            
+            try
             {
-                string check = function.ReadInstance("/GetFTPDataInfoYesterday/check" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + ".txt");
-                if (string.IsNullOrEmpty(check))
+                // 创建FtpWebRequest对象
+                FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpServerAddress + filePath);
+                request.Method = WebRequestMethods.Ftp.DownloadFile;
+                request.Credentials = new NetworkCredential(ftpUser, ftpPassword);
+
+                // 使用WebResponse获取响应
+                FtpWebResponse response = (FtpWebResponse)request.GetResponse();
+
+                // 打开数据流
+                Stream responseStream = response.GetResponseStream();
+                StreamReader reader = new StreamReader(responseStream);
+                // 读取数据
+                string fileContents = reader.ReadToEnd();
+                if (!string.IsNullOrEmpty(fileContents))
                 {
-                    if (DateTime.Now.Hour > 11 && DateTime.Now.Hour < 24)
+                    WebCMSEntities db = new WebCMSEntities();
+                    var DataInfo = fileContents.TrimEnd('\n').Split('\n', 2);
+                    var DataList = DataInfo[1].Split('\n');
+                    foreach (var DataListItem in DataList)
                     {
-                        try
+                        var DataListInfo = DataListItem.Split(',');
+
+                        var MerchantNo = ""; // 商户号
+                        var BaseNo = ""; // 设备号
+                        var OrderNo = ""; // 订单号
+                        var PayWay = ""; // 支付方式(微信 支付宝)
+                        var TradeType = ""; // 交易类型
+                        var TradeAmount = ""; // 交易金额
+                        var TradeFee = ""; // 交易手续费
+                        var TradeDate = ""; // 交易时间
+                        var TradeCycle = ""; // 结算周期
+
+                        MerchantNo = DataListInfo[0];
+                        BaseNo = DataListInfo[1];
+                        OrderNo = DataListInfo[2];
+                        PayWay = DataListInfo[3];
+                        TradeType = DataListInfo[4];
+                        TradeAmount = DataListInfo[5];
+                        TradeFee = DataListInfo[6];
+                        TradeDate = DataListInfo[7];
+                        TradeCycle = DataListInfo[8];
+
+                        TradeDate = TradeDate.Substring(0, 4) + "-" + TradeDate.Substring(4, 2) + "-" + TradeDate.Substring(6, 2) + " " + TradeDate.Substring(8, 2) + ":" + TradeDate.Substring(10, 2) + ":" + TradeDate.Substring(12, 2);
+
+                        var PayMode = 0;
+                        if (PayWay.Contains("支付宝")) PayMode = 1;
+                        if (PayWay.Contains("微信")) PayMode = 2;
+
+                        var merchantAddInfo = db.MerchantAddInfo.FirstOrDefault(m => m.MchtNo == MerchantNo) ?? new MerchantAddInfo();
+                        if (merchantAddInfo.Id > 0)
                         {
-                            // 创建FtpWebRequest对象
-                            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpServerAddress + filePath);
-                            request.Method = WebRequestMethods.Ftp.DownloadFile;
-                            request.Credentials = new NetworkCredential(ftpUser, ftpPassword);
-
-                            // 使用WebResponse获取响应
-                            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
-
-                            // 打开数据流
-                            Stream responseStream = response.GetResponseStream();
-                            using (StreamReader reader = new StreamReader(responseStream))
+                            var merchantInfo = db.MerchantInfo.FirstOrDefault(m => m.Id == merchantAddInfo.Id) ?? new MerchantInfo();
+                            var orders = db.ConsumerOrders.FirstOrDefault(m => m.SeoTitle == OrderNo && m.OrderNo == OrderNo) ?? new ConsumerOrders();
+                            if (orders.Id == 0)
                             {
-                                WebCMSEntities db = new WebCMSEntities();
-                                // 读取数据
-                                string fileContents = reader.ReadToEnd();
-                                if (!string.IsNullOrEmpty(fileContents))
+                                var query = db.ConsumerOrders.Add(new ConsumerOrders()
                                 {
-                                    var DataInfo = fileContents.TrimEnd('\n').Split('\n', 2);
-                                    var DataList = DataInfo[1].Split('\n');
-                                    foreach (var DataListItem in DataList)
-                                    {
-                                        var DataListInfo = DataListItem.Split(',');
-
-                                        var MerchantNo = ""; // 商户号
-                                        var BaseNo = ""; // 设备号
-                                        var OrderNo = ""; // 订单号
-                                        var PayWay = ""; // 支付方式(微信 支付宝)
-                                        var TradeType = ""; // 交易类型
-                                        var TradeAmount = ""; // 交易金额
-                                        var TradeFee = ""; // 交易手续费
-                                        var TradeDate = ""; // 交易时间
-                                        var TradeCycle = ""; // 结算周期
-
-                                        MerchantNo = DataListInfo[0];
-                                        BaseNo = DataListInfo[1];
-                                        OrderNo = DataListInfo[2];
-                                        PayWay = DataListInfo[3];
-                                        TradeType = DataListInfo[4];
-                                        TradeAmount = DataListInfo[5];
-                                        TradeFee = DataListInfo[6];
-                                        TradeDate = DataListInfo[7];
-                                        TradeCycle = DataListInfo[8];
-
-                                        TradeDate = TradeDate.Substring(0, 4) + "-" + TradeDate.Substring(4, 2) + "-" + TradeDate.Substring(6, 2) + " " + TradeDate.Substring(8, 2) + ":" + TradeDate.Substring(10, 2) + ":" + TradeDate.Substring(12, 2);
-
-                                        var PayMode = 0;
-                                        if (PayWay.Contains("支付宝")) PayMode = 1;
-                                        if (PayWay.Contains("微信")) PayMode = 2;
-
-                                        var merchantAddInfo = db.MerchantAddInfo.FirstOrDefault(m => m.MchtNo == MerchantNo) ?? new MerchantAddInfo();
-                                        if (merchantAddInfo.Id > 0)
-                                        {
-                                            var merchantInfo = db.MerchantInfo.FirstOrDefault(m => m.Id == merchantAddInfo.Id) ?? new MerchantInfo();
-                                            var orders = db.ConsumerOrders.FirstOrDefault(m => m.SeoTitle == OrderNo && OrderNo == OrderNo) ?? new ConsumerOrders();
-                                            if (orders.Id == 0)
-                                            {
-                                                var query = db.ConsumerOrders.Add(new ConsumerOrders()
-                                                {
-                                                    Status = 1,
-                                                    CreateDate = DateTime.Parse(TradeDate),
-                                                    UpdateDate = DateTime.Parse(TradeDate),
-                                                    SnNo = BaseNo,
-                                                    PayMoney = decimal.Parse(TradeAmount),
-                                                    PayMode = PayMode,
-                                                    SeoTitle = OrderNo,
-                                                    OrderNo = OrderNo,
-                                                    MerchantId = merchantAddInfo.Id,
-                                                    UserId = merchantInfo.UserId
-                                                }).Entity;
-                                            }
-                                        }
-                                    }
-                                    db.SaveChanges();
-                                    db.Dispose();
-                                }
-
-                                // 关闭响应
-                                response.Close();
-                                Thread.Sleep(1800000);
+                                    Status = 1,
+                                    CreateDate = DateTime.Parse(TradeDate),
+                                    UpdateDate = DateTime.Parse(TradeDate),
+                                    SnNo = BaseNo,
+                                    PayMoney = decimal.Parse(TradeAmount),
+                                    PayMode = PayMode,
+                                    SeoTitle = OrderNo,
+                                    OrderNo = OrderNo,
+                                    MerchantId = merchantAddInfo.Id,
+                                    UserId = merchantInfo.UserId
+                                }).Entity;
                             }
                         }
-                        catch (WebException ex)
-                        {
-                            function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
-                        }
                     }
+                    db.SaveChanges();
+                    db.Dispose();
                 }
+
+                // 关闭响应
+                reader.Dispose();
+                responseStream.Dispose();
+                response.Close();
+            }
+            catch (WebException ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
             }
         }
 

+ 28 - 0
Util/HaoDa/HaoDaHelper.cs

@@ -398,6 +398,34 @@ namespace MySystem
             return result;
         }
 
+        /// <summary>
+        /// 分账交易详情查询
+        /// </summary>
+        /// <param name="mchtNo">慧掌柜商户号</param>
+        /// <param name="orderNo">交易订单号	</param>
+        /// <returns></returns>
+        public string QueryOrderDivideDetail(string mchtNo, string orderNo, int BrandId = 0)
+        {
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
+
+            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账交易详情查询");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
+            reqdic.Add("orderNo", orderNo); // 交易订单号	
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            LogHelper.Instance.WriteLog(req, "好哒分账交易详情查询");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账交易详情查询");
+            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账交易详情查询");
+            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/trade/clear/get", "好哒分账交易详情查询");
+            string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/trade/clear/get", req, headdic);
+            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账交易详情查询");
+
+            return result;
+        }
+
         /// <summary>
         /// 订单分账申请
         /// </summary>

+ 113 - 52
Util/HaoDa/ProfitShareService.cs

@@ -1,11 +1,11 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using MySystem.Models.Main;
-using Library;
-using LitJson;
 using System.Text.RegularExpressions;
 using System.Threading;
+using Library;
+using LitJson;
+using MySystem.Models.Main;
 
 namespace MySystem
 {
@@ -26,74 +26,135 @@ namespace MySystem
         {
             while (true)
             {
-                WebCMSEntities db = new WebCMSEntities();
-                DateTime checkDate = DateTime.Now.AddMinutes(-2);
-                var list = db.ConsumerOrders.Select(m => new { m.Id, m.DivideDate, m.DivideFlag, m.IsAct, m.PayMode }).Where(m => m.DivideFlag == 1 && m.IsAct == 1 && m.DivideDate < checkDate).OrderBy(m => m.Id).Take(100).ToList();
-                foreach (var sub in list)
+                // WebCMSEntities db = new WebCMSEntities();
+                // DateTime checkDate = DateTime.Now.AddMinutes(-2);
+                // var list = db.ConsumerOrders.Select(m => new { m.Id, m.DivideDate, m.DivideFlag, m.IsAct, m.PayMode }).Where(m => m.DivideFlag == 1 && m.IsAct == 1 && m.DivideDate < checkDate).OrderBy(m => m.Id).Take(100).ToList();
+                // foreach (var sub in list)
+                // {
+                //     RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + sub.PayMode + ":List", sub.Id.ToString());
+                //     ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == sub.Id);
+                //     if (order != null)
+                //     {
+                //         order.DivideFlag = 2;
+                //         db.SaveChanges();
+                //     }
+                // }
+                // db.Dispose();
+                // Thread.Sleep(5000);
+
+                string content = RedisDbconn.Instance.RPop<string>("PartOrderStatusQueue");
+                if(!string.IsNullOrEmpty(content))
                 {
-                    RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + sub.PayMode + ":List", sub.Id.ToString());
-                    ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == sub.Id);
-                    if (order != null)
-                    {
-                        order.DivideFlag = 2;
-                        db.SaveChanges();
-                    }
+                    StartExcute(content);
+                }
+                else
+                {
+                    Thread.Sleep(60000);
                 }
-                db.Dispose();
-                Thread.Sleep(5000);
             }
         }
 
-        public void StartDo(string content)
+        public void StartExcute(string content)
         {
-            try
+            JsonData jsonData = JsonMapper.ToObject(content);
+            string applyNo = jsonData["applyNo"].ToString();
+            string mchtNo = jsonData["mchtNo"].ToString();
+            string status = jsonData["status"].ToString();
+            string payTime = jsonData["payTime"].ToString();
+            string desc = jsonData["desc"].ToString();
+            WebCMSEntities db = new WebCMSEntities();
+            ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.TradePayNo == applyNo);
+            if(order != null)
             {
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                string ApplyNo = jsonObj["ApplyNo"].ToString(); //微信订单号
-                string MchtNo = jsonObj["MchtNo"].ToString(); //商户订单号
-                string OrderNo = jsonObj["OrderNo"].ToString(); //商户订单号
-                WebCMSEntities db = new WebCMSEntities();
-
-                ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.OrderNo == OrderNo && m.Status == 2);
-                MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
+                if(status == "0")
+                {
+                    order.DivideFlag = 2;
+                    order.DivideDate = DateTime.Now;
+                }
+                else
+                {
+                    order.DivideFlag = -1;
+                }
+                order.DivideLog = desc;
+                db.SaveChanges();
+                RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());
+            }
+            db.Dispose();
+        }
 
-                JsonData result = JsonMapper.ToObject(HaoDaHelper.Instance.OrderDivideAccountsQuery(ApplyNo, MchtNo, merchantAdd.BrandId));
-                string state = result["data"]["status"].ToString();
-                if (result["data"]["status"].ToString() == "0")
+        public void StartCheck()
+        {
+            Thread th = new Thread(StartCheckListen);
+            th.IsBackground = true;
+            th.Start();
+        }
+        public void StartCheckListen()
+        {
+            while (true)
+            {
+                try
                 {
-                    if (order != null)
+                    if(DateTime.Now.Hour > 0 && DateTime.Now.Hour < 20)
                     {
-                        RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());
+                        string CheckDate = DateTime.Now.ToString("yyyyMMdd");
+                        string check = function.ReadInstance("/CheckYesterdayPartOrder/" + CheckDate + ".txt");
+                        if (string.IsNullOrEmpty(check))
+                        {
+                            function.WritePage("/CheckYesterdayPartOrder/", CheckDate + ".txt", DateTime.Now.ToString());
+                            WebCMSEntities db = new WebCMSEntities();
+                            DateTime checkDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
+                            var list = db.ConsumerOrders.Select(m => new { m.Id, m.DivideDate, m.DivideFlag, m.IsAct, m.PayMode }).Where(m => m.DivideFlag < 2 && m.IsAct == 1 && m.DivideDate < checkDate).OrderBy(m => m.Id).Take(100).ToList();
+                            foreach (var sub in list)
+                            {
+                                StartCheckDo(sub.Id);
+                            }
+                            db.Dispose();
+                        }
                     }
-                    db.Dispose();
+                }
+                catch (Exception ex)
+                {
+                    LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "分账复核头天订单异常");
+                }
+                Thread.Sleep(3600000);
+            }
+        }
+
+        public void StartCheckDo(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+
+            ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == Id) ?? new ConsumerOrders();
+            MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
+
+            JsonData result = JsonMapper.ToObject(HaoDaHelper.Instance.OrderDivideAccountsQuery(order.TradePayNo, merchantAdd.OutMchtNo, merchantAdd.BrandId));
+            if(result["resultCode"].ToString() == "1")
+            {
+                string status = result["data"]["status"].ToString();
+                string desc = result["data"]["desc"].ToString();
+                if (status == "0")
+                {
+                    order.DivideFlag = 2;
+                    order.DivideDate = DateTime.Now;                        
+                    RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());
                 }
                 else
                 {
-                    RedisDbconn.Instance.AddList("ProfitShareHdQueue", content);
+                    order.DivideFlag = -1;
                 }
+                order.DivideLog = desc;
             }
-            catch (Exception ex)
+            else
             {
-                LogHelper.Instance.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "分账队列异常");
+                string errorCode = result["errorCode"].ToString();
+                string errorDesc = result["errorDesc"].ToString();
+                order.DivideFlag = -1;
+                order.DivideLog = errorCode + ":" + errorDesc;
             }
-        }
-
+            db.SaveChanges();
 
-        // public void StartListen()
-        // {
-        //     while (true)
-        //     {
-        //         string content = RedisDbconn.Instance.RPop<string>("ProfitShareHdQueue");
-        //         if (!string.IsNullOrEmpty(content))
-        //         {
-        //             StartDo(content);
-        //         }
-        //         else
-        //         {
-        //             Thread.Sleep(2000);
-        //         }
-        //     }
-        // }
+            db.Dispose();
+        }
 
         // public void StartDo(string content)
         // {

+ 1 - 0
Util/HaoDa/WeChatPayBackService.cs

@@ -218,6 +218,7 @@ namespace MySystem
                                     string amountAmount = amount.ToString("f0");
                                     string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amountAmount, seviceAmount), merchantAdd.BrandId);
                                     order.DivideLog = "请求分账日志:" + result;
+                                    order.TradePayNo = applyNo;
                                     if (result.Contains("\"resultCode\":\"0\"") && (result.Contains("分账金额不足") || result.Contains("不存在")))
                                     {
                                         Status = 1;