12 コミット 6e1e4149de ... 22b6f30350

作者 SHA1 メッセージ 日付
  DuGuYang 22b6f30350 暂时注释好哒FTP数据获取 6 ヶ月 前
  DuGuYang a6878befbb 今日获取昨日的交易 6 ヶ月 前
  DuGuYang 156c05ad95 调整获取交易数据 6 ヶ月 前
  DuGuYang dc128ebf47 完成,待测试 6 ヶ月 前
  DuGuYang 3bbcb355f1 银联好哒,BrandId=1是,好哒审核通过直接完成,结束流程 6 ヶ月 前
  DuGuYang 53fa10db18 修改机构号 6 ヶ月 前
  DuGuYang 8e5e059a0a 好哒通道添加机构号 6 ヶ月 前
  DuGuYang 35b3f5ae79 调整 6 ヶ月 前
  DuGuYang fa65c5fb24 调整 6 ヶ月 前
  DuGuYang 0990974b5d 调整参数取值 6 ヶ月 前
  DuGuYang 5c906efafd 调整参数 6 ヶ月 前
  DuGuYang 58be4bcd29 完成,待测试 6 ヶ月 前

+ 6 - 0
Config/Base.cs

@@ -12,6 +12,12 @@ namespace AppConfig
         public static string defaultImage = Library.ConfigurationManager.AppSettings["Host"].ToString() + "/skin/app/default/static/images/default.jpg";
         public static string SqlConnStr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
 
+        //好哒FTP
+        public static string HaoDaFtpHost = Library.ConfigurationManager.AppSettings["HaoDaFtpHost"].ToString();
+        public static string HaoDaFtpLoginName = Library.ConfigurationManager.AppSettings["HaoDaFtpLoginName"].ToString();
+        public static string HaoDaFtpLoginPwd = Library.ConfigurationManager.AppSettings["HaoDaFtpLoginPwd"].ToString();
+
+
 
         #region 数据库结构
         public static Dictionary<string, Dictionary<string, string>> mainTables = new Dictionary<string, Dictionary<string, string>>();

+ 1 - 1
Entity/HaoDa/AddNewMerchant.cs

@@ -39,7 +39,7 @@ namespace MySystem
         public string resserveMobile { get; set; }//银行预留手机号 channelkind为000001时必填
         public string userName { get; set; }//商户法人姓名
         public string periodValidity { get; set; }//法人身份证有效期 格式:20150101-20200101,若结束日期为长期填20150101-长期
-        // public string oprInvitedCode { get; set; }
+        public string oprInvitedCode { get; set; }
         public List<ImageItem> images { get; set; }//图片
 
     }

+ 16 - 0
Entity/HaoDa/HaodaParam.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+namespace MySystem
+{
+    /// <summary>
+    /// 好哒参数
+    /// </summary>
+    public static class HaodaParam
+    {
+        public static string BoxRequestUrl = "https://openapi.iboxpay.com";
+        public static string BoxAppId = "AP8322645764893728768";
+        public static string BoxAppSecret = "je1TElprp3jzWETsG3FcWqtmpreEHqZS";
+        public static string BoxPublicKey = "";
+        public static string BrhCode = "015001";
+    }
+}

+ 16 - 0
Entity/HaoDa/HaodaUnionParam.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+namespace MySystem
+{
+    /// <summary>
+    /// 银联参数
+    /// </summary>
+    public static class HaodaUnionParam
+    {
+        public static string BoxRequestUrl = "https://openapi.iboxpay.com";
+        public static string BoxAppId = "AP7175619323825451008";
+        public static string BoxAppSecret = "hUfR53gdjyfiZTBR5bILanMqRD1dXD7y";
+        public static string BoxPublicKey = "";
+        public static string BrhCode = "030145";
+    }
+}

+ 20 - 0
Models/Main/ChangeSettlementCardAuditRecord.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main
+{
+    public partial class ChangeSettlementCardAuditRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public int AuditStatus { get; set; }
+        public string MchtNo { get; set; }
+        public int MerchantId { get; set; }
+        public int TaskId { get; set; }
+        public string Remark { get; set; }
+    }
+}

+ 1 - 0
Models/Main/MerchantAddInfo.cs

@@ -149,5 +149,6 @@ namespace MySystem.Models.Main
         public ulong HdBindWeChat { get; set; }
         public string MerchantType { get; set; }
         public int PlaceType { get; set; }
+        public int BrandId { get; set; }
     }
 }

+ 37 - 0
Models/Main/MerchantChangeSettlementCardRecord.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main
+{
+    public partial class MerchantChangeSettlementCardRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string HoldAgentProtocol { get; set; }
+        public string AgentIdCardBack { get; set; }
+        public string AgentIdCardFront { get; set; }
+        public string AgentProtocol { get; set; }
+        public string PriLicAgreement { get; set; }
+        public string OpenAccountLicenses { get; set; }
+        public string BankCard { get; set; }
+        public int TaskId { get; set; }
+        public DateTime? AgentCardEndDate { get; set; }
+        public DateTime? AgentCardStartDate { get; set; }
+        public string IdCard { get; set; }
+        public string AcctZbankCode { get; set; }
+        public int AlterType { get; set; }
+        public string ZbankNo { get; set; }
+        public string AccountNo { get; set; }
+        public string AccountName { get; set; }
+        public string MchtNo { get; set; }
+        public string Operator { get; set; }
+        public int AccountType { get; set; }
+        public string Remark { get; set; }
+        public string MerchantName { get; set; }
+        public int MerchantId { get; set; }
+    }
+}

+ 1 - 0
Models/Main/MerchantInfo.cs

@@ -55,5 +55,6 @@ namespace MySystem.Models.Main
         public int Popularity { get; set; }
         public decimal Latitude { get; set; }
         public decimal Longitude { get; set; }
+        public int BrandId { get; set; }
     }
 }

+ 210 - 0
Models/Main/WebCMSEntities.cs

@@ -42,6 +42,7 @@ namespace MySystem.Models.Main
         public virtual DbSet<BusinessScope> BusinessScope { get; set; }
         public virtual DbSet<BusinessScopeType> BusinessScopeType { get; set; }
         public virtual DbSet<BusinessTradeSummary> BusinessTradeSummary { get; set; }
+        public virtual DbSet<ChangeSettlementCardAuditRecord> ChangeSettlementCardAuditRecord { get; set; }
         public virtual DbSet<Col> Col { get; set; }
         public virtual DbSet<ConsumerOpenIds> ConsumerOpenIds { get; set; }
         public virtual DbSet<ConsumerOrderForNo> ConsumerOrderForNo { get; set; }
@@ -92,6 +93,7 @@ namespace MySystem.Models.Main
         public virtual DbSet<MerchantAdmin> MerchantAdmin { get; set; }
         public virtual DbSet<MerchantAmountSummay> MerchantAmountSummay { get; set; }
         public virtual DbSet<MerchantAuth> MerchantAuth { get; set; }
+        public virtual DbSet<MerchantChangeSettlementCardRecord> MerchantChangeSettlementCardRecord { get; set; }
         public virtual DbSet<MerchantClass> MerchantClass { get; set; }
         public virtual DbSet<MerchantCol> MerchantCol { get; set; }
         public virtual DbSet<MerchantComment> MerchantComment { get; set; }
@@ -2290,6 +2292,57 @@ namespace MySystem.Models.Main
                 entity.Property(e => e.VipFlag).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<ChangeSettlementCardAuditRecord>(entity =>
+            {
+                entity.HasComment("商户修改结算卡审核表");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AuditStatus)
+                    .HasColumnType("int(11)")
+                    .HasComment("审核状态");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.MchtNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("收款商户号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerchantId)
+                    .HasColumnType("int(11)")
+                    .HasComment("申请商户Id");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("备注")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.TaskId)
+                    .HasColumnType("int(11)")
+                    .HasComment("申请任务Id");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("修改时间");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<Col>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -5549,6 +5602,10 @@ namespace MySystem.Models.Main
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.BrandId)
+                    .HasColumnType("int(11)")
+                    .HasComment("品牌");
+
                 entity.Property(e => e.BusinessCode)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -6353,6 +6410,155 @@ namespace MySystem.Models.Main
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<MerchantChangeSettlementCardRecord>(entity =>
+            {
+                entity.HasComment("商户修改结算卡记录表");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AccountName)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("开户名")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AccountNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("卡号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AccountType)
+                    .HasColumnType("int(11)")
+                    .HasComment("账户类型");
+
+                entity.Property(e => e.AcctZbankCode)
+                    .HasColumnName("AcctZBankCode")
+                    .HasColumnType("varchar(50)")
+                    .HasComment("开户支行地区码")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AgentCardEndDate)
+                    .HasColumnType("datetime")
+                    .HasComment("非法人身份证有效结束时间");
+
+                entity.Property(e => e.AgentCardStartDate)
+                    .HasColumnType("datetime")
+                    .HasComment("非法人身份证有效开始时间");
+
+                entity.Property(e => e.AgentIdCardBack)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("被委托人身份证国徽面")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AgentIdCardFront)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("被委托人身份证人像面")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AgentProtocol)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("委托结算授权书")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AlterType)
+                    .HasColumnType("int(11)")
+                    .HasComment("结算类型");
+
+                entity.Property(e => e.BankCard)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("银行卡正面照片")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.HoldAgentProtocol)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("法人手持委托结算授权书")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.IdCard)
+                    .HasColumnType("varchar(18)")
+                    .HasComment("非法人身份证号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MchtNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("商户号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerchantId)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户Id");
+
+                entity.Property(e => e.MerchantName)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("商户名称")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.OpenAccountLicenses)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("开户许可证")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Operator)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("操作人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.PriLicAgreement)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("企业法人对私授权书")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("审核备注")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.TaskId)
+                    .HasColumnType("int(11)")
+                    .HasComment("任务Id");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("修改时间");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+
+                entity.Property(e => e.ZbankNo)
+                    .HasColumnName("ZBankNo")
+                    .HasColumnType("varchar(50)")
+                    .HasComment("支行号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+            });
+
             modelBuilder.Entity<MerchantClass>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -6961,6 +7167,10 @@ namespace MySystem.Models.Main
 
                 entity.Property(e => e.BindStatus).HasColumnType("int(11)");
 
+                entity.Property(e => e.BrandId)
+                    .HasColumnType("int(11)")
+                    .HasComment("品牌");
+
                 entity.Property(e => e.BriefIntroduction)
                     .HasColumnType("longtext")
                     .HasComment("简介")

+ 4 - 3
Startup.cs

@@ -135,13 +135,14 @@ namespace MySystem
             });
 
             initMainServer();
-            if(Library.ConfigurationManager.EnvironmentFlag == 1)
+            if (Library.ConfigurationManager.EnvironmentFlag == 1)
             {
                 TestHaoDaService.Instance.Start(); //好哒测试
                 // MerchantStandardService.Instance.Start();
             }
-            if(Library.ConfigurationManager.EnvironmentFlag == 2)
+            if (Library.ConfigurationManager.EnvironmentFlag == 2)
             {
+                // GetHaoDaFTPInfoService.Instance.Start(); // 获取好哒FTP交易数据
                 GetTencentAddressInfoService.Instance.Start(); // 获取腾讯地图地址
                 GetStoreNoHelper.Instance.Start(); //获取商户门店号、微信支付宝商户号
                 MerchantConfirmService.Instance.Start(); //提交商户进件
@@ -170,7 +171,7 @@ namespace MySystem
                 ActiveRewardService.Instance.StartOpenReward();
                 ActiveRewardService.Instance.StartLeaderReward();
                 ActiveRewardService.Instance.StartOperateReward();
-                
+
                 MerchantStandardService.Instance.Start(); //商户缴纳服务费次月活动交易额大于等于1W,奖励进件创客50元
                 MerchantStandardService.Instance.StartThree(); //商户缴纳服务费次月起连续不间断三个月,每月活动交易额大于1W,奖励进件创客100元
                 MerchantStandardService.Instance.StartActive();

+ 23 - 21
Util/HaoDa/AddNewMerchantSetUtil.cs

@@ -19,7 +19,9 @@ namespace MySystem
         public static AddNewMerchant SetValue(MerchantAddInfo AddInfo)
         {
             AddNewMerchant addNewMerchant = new AddNewMerchant();
-            addNewMerchant.brh = HaoDaHelper.BrhCode; //机构号(正式)
+            // addNewMerchant.brh = HaoDaHelper.BrhCode; //机构号(正式)
+            if (AddInfo.BrandId == 1) addNewMerchant.brh = HaodaParam.BrhCode;
+            if (AddInfo.BrandId == 0) addNewMerchant.brh = HaodaUnionParam.BrhCode;
             if (!string.IsNullOrEmpty(AddInfo.MchtNo))
             {
                 addNewMerchant.mchtNo = AddInfo.MchtNo; //收款商户号
@@ -85,10 +87,10 @@ namespace MySystem
             //法人手持身份证正面
             if (!string.IsNullOrEmpty(AddInfo.PersonWithIdCard))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.PersonWithIdCard.Substring(AddInfo.PersonWithIdCard.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.PersonWithIdCard.Substring(AddInfo.PersonWithIdCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.PersonWithIdCard);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.PersonWithIdCard, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -101,10 +103,10 @@ namespace MySystem
             //收款人银行卡照片
             if (!string.IsNullOrEmpty(AddInfo.BankCard))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -117,10 +119,10 @@ namespace MySystem
             //身份证正面
             if (!string.IsNullOrEmpty(AddInfo.IdCardCopy))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IdCardCopy.Substring(AddInfo.IdCardCopy.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IdCardCopy.Substring(AddInfo.IdCardCopy.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IdCardCopy);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IdCardCopy, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -133,10 +135,10 @@ namespace MySystem
             //身份证反面
             if (!string.IsNullOrEmpty(AddInfo.IdCardNational))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IdCardNational.Substring(AddInfo.IdCardNational.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IdCardNational.Substring(AddInfo.IdCardNational.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IdCardNational);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IdCardNational, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -150,10 +152,10 @@ namespace MySystem
             //开户许可证(对公凭证)
             if (!string.IsNullOrEmpty(AddInfo.OpenAccountLicenses))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.OpenAccountLicenses.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.OpenAccountLicenses.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -182,10 +184,10 @@ namespace MySystem
             //营业执照
             if (!string.IsNullOrEmpty(AddInfo.LicenseCopy))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.LicenseCopy.Substring(AddInfo.LicenseCopy.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.LicenseCopy.Substring(AddInfo.LicenseCopy.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.LicenseCopy);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.LicenseCopy, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -257,10 +259,10 @@ namespace MySystem
             //门头照
             if (!string.IsNullOrEmpty(AddInfo.StoreEntrancePic))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.StoreEntrancePic.Substring(AddInfo.StoreEntrancePic.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.StoreEntrancePic.Substring(AddInfo.StoreEntrancePic.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.StoreEntrancePic);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.StoreEntrancePic, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -273,10 +275,10 @@ namespace MySystem
             //收银台
             if (!string.IsNullOrEmpty(AddInfo.CheckstandImg))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.CheckstandImg.Substring(AddInfo.CheckstandImg.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.CheckstandImg.Substring(AddInfo.CheckstandImg.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.CheckstandImg);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.CheckstandImg, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -289,10 +291,10 @@ namespace MySystem
             //店铺全景
             if (!string.IsNullOrEmpty(AddInfo.IndoorPic))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IndoorPic.Substring(AddInfo.IndoorPic.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.IndoorPic.Substring(AddInfo.IndoorPic.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IndoorPic);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.IndoorPic, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();
@@ -353,10 +355,10 @@ namespace MySystem
             //补充资料
             if (!string.IsNullOrEmpty(AddInfo.Extra1))
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.Extra1.Substring(AddInfo.Extra1.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.Extra1.Substring(AddInfo.Extra1.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.Extra1);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.Extra1, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         imageItem = new ImageItem();

+ 12 - 12
Util/HaoDa/AddOpenDivideAccountsUtil.cs

@@ -48,10 +48,10 @@ namespace MySystem
             ImageItem imageItem = new ImageItem();
             //身份证正面
             JsonData tokenInfo = new JsonData();
-            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/1.jpg".Substring("/static/upload/2023/8/14/1.jpg".LastIndexOf("/")).Trim('/'), "0"));
+            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/1.jpg".Substring("/static/upload/2023/8/14/1.jpg".LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
             if (tokenInfo["code"].ToString() == "1")
             {
-                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/1.jpg");
+                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/1.jpg", AddInfo.BrandId);
                 if (returnInfo != "false")
                 {
                     imageItem = new ImageItem();
@@ -61,10 +61,10 @@ namespace MySystem
                 }
             }
             //身份证反面
-            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/2.jpg".Substring("/static/upload/2023/8/14/2.jpg".LastIndexOf("/")).Trim('/'), "0"));
+            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/2.jpg".Substring("/static/upload/2023/8/14/2.jpg".LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
             if (tokenInfo["code"].ToString() == "1")
             {
-                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/2.jpg");
+                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/2.jpg", AddInfo.BrandId);
                 if (returnInfo != "false")
                 {
                     imageItem = new ImageItem();
@@ -74,10 +74,10 @@ namespace MySystem
                 }
             }
             //法人手持身份证正面
-            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/3.jpg".Substring("/static/upload/2023/8/14/3.jpg".LastIndexOf("/")).Trim('/'), "0"));
+            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/3.jpg".Substring("/static/upload/2023/8/14/3.jpg".LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
             if (tokenInfo["code"].ToString() == "1")
             {
-                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/3.jpg");
+                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/3.jpg", AddInfo.BrandId);
                 if (returnInfo != "false")
                 {
                     imageItem = new ImageItem();
@@ -87,10 +87,10 @@ namespace MySystem
                 }
             }
             //结算银行卡照片
-            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/00.jpg".Substring("/static/upload/2023/8/14/00.jpg".LastIndexOf("/")).Trim('/'), "0"));
+            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/00.jpg".Substring("/static/upload/2023/8/14/00.jpg".LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
             if (tokenInfo["code"].ToString() == "1")
             {
-                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/00.jpg");
+                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/00.jpg", AddInfo.BrandId);
                 if (returnInfo != "false")
                 {
                     imageItem = new ImageItem();
@@ -100,10 +100,10 @@ namespace MySystem
                 }
             }
             //营业执照
-            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/5.jpg".Substring("/static/upload/2023/8/14/5.jpg".LastIndexOf("/")).Trim('/'), "0"));
+            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/5.jpg".Substring("/static/upload/2023/8/14/5.jpg".LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
             if (tokenInfo["code"].ToString() == "1")
             {
-                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/5.jpg");
+                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/5.jpg", AddInfo.BrandId);
                 if (returnInfo != "false")
                 {
                     imageItem = new ImageItem();
@@ -113,10 +113,10 @@ namespace MySystem
                 }
             }
             //开户许可证(对公凭证)
-            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/00.jpg".Substring("/static/upload/2023/8/14/00.jpg".LastIndexOf("/")).Trim('/'), "0"));
+            tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken("/static/upload/2023/8/14/00.jpg".Substring("/static/upload/2023/8/14/00.jpg".LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
             if (tokenInfo["code"].ToString() == "1")
             {
-                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/00.jpg");
+                var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), "/static/upload/2023/8/14/00.jpg", AddInfo.BrandId);
                 if (returnInfo != "false")
                 {
                     imageItem = new ImageItem();

+ 8 - 8
Util/HaoDa/ChangeMerchantCardSetUtil.cs

@@ -50,10 +50,10 @@ namespace MySystem
             // 面照片、委托结算授权书照片、法人手持委托结算授权书
             if (alterType == "0")
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         photoItem = new PhotoItem();
@@ -67,10 +67,10 @@ namespace MySystem
             {
                 if (!string.IsNullOrEmpty(AddInfo.OpenAccountLicenses))
                 {
-                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0"));
+                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.OpenAccountLicenses.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                     if (tokenInfo["code"].ToString() == "1")
                     {
-                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses);
+                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.OpenAccountLicenses, AddInfo.BrandId);
                         if (returnInfo != "false")
                         {
                             photoItem = new PhotoItem();
@@ -82,10 +82,10 @@ namespace MySystem
                 }
                 if (!string.IsNullOrEmpty(BankCard))
                 {
-                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                     if (tokenInfo["code"].ToString() == "1")
                     {
-                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard);
+                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard, AddInfo.BrandId);
                         if (returnInfo != "false")
                         {
                             photoItem = new PhotoItem();
@@ -98,10 +98,10 @@ namespace MySystem
             }
             if (alterType == "2")
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         photoItem = new PhotoItem();

+ 3 - 3
Util/HaoDa/CheckWeChatBindService.cs

@@ -28,8 +28,8 @@ namespace MySystem
             while (true)
             {
                 string CheckDate = DateTime.Now.AddMinutes(-15).ToString("yyyy-MM-dd HH:mm:ss");
-                DataTable dt = CustomerSqlConn.dtable("select Id from MerchantAddInfo where HdStatus=3 and HdBindWeChat=0 and HdPassDate<'" + CheckDate + "' and OutMchtNo!='' and OutMchtNo is not null", AppConfig.Base.SqlConnStr);
-                foreach(DataRow dr in dt.Rows)
+                DataTable dt = CustomerSqlConn.dtable("select Id from MerchantAddInfo where HdStatus=3 and HdBindWeChat=0 and BrandId=0 and HdPassDate<'" + CheckDate + "' and OutMchtNo!='' and OutMchtNo is not null", AppConfig.Base.SqlConnStr);
+                foreach (DataRow dr in dt.Rows)
                 {
                     StartDo(int.Parse(function.CheckInt(dr["Id"].ToString())));
                 }
@@ -46,7 +46,7 @@ namespace MySystem
                 if (merchantadd != null)
                 {
                     //绑定微信appid接口
-                    JsonData bindInfo = JsonMapper.ToObject(HaoDaHelper.Instance.BindWeChatAppId(merchantadd.OutMchtNo, merchantadd.StoreNo, AppConfig.Haoda.SubAppId));
+                    JsonData bindInfo = JsonMapper.ToObject(HaoDaHelper.Instance.BindWeChatAppId(merchantadd.OutMchtNo, merchantadd.StoreNo, AppConfig.Haoda.SubAppId, merchantadd.BrandId));
                     //失败
                     if (bindInfo["resultCode"].ToString() == "0")
                     {

+ 55 - 43
Util/HaoDa/CheckWeChatSignService.cs

@@ -51,7 +51,7 @@ namespace MySystem
                 //     Thread.Sleep(2000);
                 // }
                 DataTable dt = CustomerSqlConn.dtable("select Id,MchtNo from MerchantAddInfo where Id in (select Id from MerchantInfo where Sort=1 and `Status`=0 and QueryCount=0) and MchtNo!='' and MchtNo is not null", AppConfig.Base.SqlConnStr);
-                foreach(DataRow dr in dt.Rows)
+                foreach (DataRow dr in dt.Rows)
                 {
                     StartDo(new QueryMerchantStatus()
                     {
@@ -70,62 +70,80 @@ namespace MySystem
             {
                 var mId = int.Parse(query.MerchantId);
                 WebCMSEntities db = new WebCMSEntities();
+                MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == mId);
+
+                var BrhCode = HaodaUnionParam.BrhCode;
+                if (merchantadd.BrandId == 1) BrhCode = HaodaParam.BrhCode;
+
                 //查询商户审核状态
-                var returnInfo = HaoDaHelper.Instance.QueryMerchantStatus(HaoDaHelper.BrhCode, query.MerchantNo);
+                var returnInfo = HaoDaHelper.Instance.QueryMerchantStatus(BrhCode, query.MerchantNo, merchantadd.BrandId);
                 JsonData dic = JsonMapper.ToObject(returnInfo);
                 //审核成功(1- 待审核 2 -审核中 3 -审核被拒绝 4 -审核通过 6 -待复核)
                 if (dic["data"]["code"].ToString() == "4" && !string.IsNullOrEmpty(dic["data"]["storeNo"].ToString()) && !string.IsNullOrEmpty(dic["data"]["outMchtNo"].ToString()))
                 {
                     //查询商户是否存在
-                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == mId);
                     if (merchantadd != null)
                     {
-                        // merchantadd.Status = 1;
+                        MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == mId);
                         merchantadd.StoreNo = dic["data"]["storeNo"].ToString();
                         merchantadd.HdStatus = 1; //0 待审核 1 已通过 2 已开通分账 3 已添加接收方
                         merchantadd.OutMchtNo = dic["data"]["outMchtNo"].ToString();
-                        MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == mId);
-                        if (merchant != null)
+                        if (merchantadd.BrandId == 1)
                         {
-                            merchant.Status = 1;
-                        }
-                        //商户开通分账
-                        JsonData Info = JsonMapper.ToObject(HaoDaHelper.Instance.OpenDivideAccounts(merchantadd.OutMchtNo, merchantadd.StoreNo));
-                        //开通失败
-                        if (Info["resultCode"].ToString() == "0")
-                        {
-                            merchantadd.Status = -1;
-                            merchantadd.WeChatRemark = Info["errorDesc"].ToString();
+                            merchantadd.Status = 2;
+                            merchantadd.QueryCount = 2;
+
+                            merchant.Status = 2;
+                            merchant.QueryCount = 2;
                         }
-                        //开通成功
-                        if (Info["resultCode"].ToString() == "1")
+                        else
                         {
-                            merchantadd.OpenAct = 1;//是否开通分账(1 是 0 否)
-                            merchantadd.HdStatus = 2; //0 待审核 1 已通过 2 已开通分账 3 已添加接收方
-                            //分账接收方签约
-                            JsonData Infos = JsonMapper.ToObject(HaoDaHelper.Instance.DivideAccountsSign(AppConfig.Haoda.AcctNo, merchantadd.OutMchtNo, merchantadd.StoreNo));
-                            //失败
-                            if (Infos["resultCode"].ToString() == "0")
+                            if (merchant != null)
                             {
-                                merchantadd.WeChatRemark = Infos["errorDesc"].ToString();
+                                merchant.Status = 1;
                             }
-                            //成功
-                            else
+                            //商户开通分账
+                            JsonData Info = JsonMapper.ToObject(HaoDaHelper.Instance.OpenDivideAccounts(merchantadd.OutMchtNo, merchantadd.StoreNo, merchantadd.BrandId));
+                            //开通失败
+                            if (Info["resultCode"].ToString() == "0")
                             {
-                                merchantadd.HdStatus = 3; //0 待审核 1 已通过 2 已开通分账 3 已添加接收方
-                                if (!string.IsNullOrEmpty(merchantadd.ToAcctNo))
+                                merchantadd.Status = -1;
+                                merchantadd.WeChatRemark = Info["errorDesc"].ToString();
+                            }
+                            //开通成功
+                            if (Info["resultCode"].ToString() == "1")
+                            {
+                                merchantadd.OpenAct = 1;//是否开通分账(1 是 0 否)
+                                merchantadd.HdStatus = 2; //0 待审核 1 已通过 2 已开通分账 3 已添加接收方
+                                                          //分账接收方签约
+                                JsonData Infos = JsonMapper.ToObject(HaoDaHelper.Instance.DivideAccountsSign(AppConfig.Haoda.AcctNo, merchantadd.OutMchtNo, merchantadd.StoreNo, merchantadd.BrandId));
+                                //失败
+                                if (Infos["resultCode"].ToString() == "0")
                                 {
-                                    if (!merchantadd.ToAcctNo.Contains("," + AppConfig.Haoda.AcctNo + ","))
-                                    {
-                                        merchantadd.ToAcctNo += "," + AppConfig.Haoda.AcctNo + ",";
-                                    }
+                                    merchantadd.WeChatRemark = Infos["errorDesc"].ToString();
                                 }
+                                //成功
                                 else
                                 {
-                                    merchantadd.ToAcctNo += "," + AppConfig.Haoda.AcctNo + ",";
+                                    merchantadd.HdStatus = 3; //0 待审核 1 已通过 2 已开通分账 3 已添加接收方
+                                    if (!string.IsNullOrEmpty(merchantadd.ToAcctNo))
+                                    {
+                                        if (!merchantadd.ToAcctNo.Contains("," + AppConfig.Haoda.AcctNo + ","))
+                                        {
+                                            merchantadd.ToAcctNo += "," + AppConfig.Haoda.AcctNo + ",";
+                                        }
+                                    }
+                                    else
+                                    {
+                                        merchantadd.ToAcctNo += "," + AppConfig.Haoda.AcctNo + ",";
+                                    }
+                                    merchantadd.HdPassDate = DateTime.Now;
                                 }
-                                merchantadd.HdPassDate = DateTime.Now;
                             }
+
+                            //开户意愿申请
+                            RedisDbconn.Instance.AddList("AlipayForHaoDaQueue", mId);
+                            RedisDbconn.Instance.AddList("WeChatForHaoDaQueue", mId);
                         }
                         db.SaveChanges();
 
@@ -156,29 +174,23 @@ namespace MySystem
                             db1.SaveChanges();
                         }
                         db1.Dispose();
-
-                        //开户意愿申请
-                        RedisDbconn.Instance.AddList("AlipayForHaoDaQueue", mId);
-                        RedisDbconn.Instance.AddList("WeChatForHaoDaQueue", mId);
-
                     }
                 }
                 //审核被拒绝
                 else if (dic["data"]["code"].ToString() == "3")
                 {
-                    MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == mId);
                     if (merchantadd != null)
                     {
                         string WeChatRemark = dic["data"]["option"].ToString();
-                        if(WeChatRemark.Contains("租赁协议") && WeChatRemark.Contains("水电煤") && WeChatRemark.Contains("门头合影") && WeChatRemark.Contains("下载地址"))
+                        if (WeChatRemark.Contains("租赁协议") && WeChatRemark.Contains("水电煤") && WeChatRemark.Contains("门头合影") && WeChatRemark.Contains("下载地址"))
                         {
                             WeChatRemark = "门头不一致需补充 “名称不一致说明函”";
                         }
-                        if(WeChatRemark.Contains("盒伙人在门头合影"))
+                        if (WeChatRemark.Contains("盒伙人在门头合影"))
                         {
                             WeChatRemark = "门头不一致需补充 “名称不一致说明函”";
                         }
-                        if(WeChatRemark.Contains("不支持跨商户进件"))
+                        if (WeChatRemark.Contains("不支持跨商户进件"))
                         {
                             WeChatRemark = "该商户已注册,错误指令【404】";
                         }

+ 396 - 0
Util/HaoDa/GetHaoDaFTPInfoService.cs

@@ -0,0 +1,396 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using System.Threading;
+using MySystem.Models.Main;
+using Library;
+using LitJson;
+using System.Net;
+using System.IO;
+using AppConfig;
+
+namespace MySystem
+{
+    /// <summary>
+    /// 获取好哒ftp数据
+    /// </summary>
+    public class GetHaoDaFTPInfoService
+    {
+        public readonly static GetHaoDaFTPInfoService Instance = new GetHaoDaFTPInfoService();
+        private GetHaoDaFTPInfoService()
+        { }
+
+
+        public void Start()
+        {
+            // //半小时执行获取好哒FTP交易数据
+            // Thread th = new Thread(GetFTPDataInfoHalfHour);
+            // th.IsBackground = true;
+            // th.Start();
+
+            // //每天凌晨执行获取好哒FTP今日交易数据
+            // Thread th1 = new Thread(GetFTPDataInfoToday);
+            // th1.IsBackground = true;
+            // th1.Start();
+
+            //每天凌晨执行获取好哒FTP昨日交易数据
+            Thread th2 = new Thread(GetFTPDataInfoYesterday);
+            th2.IsBackground = true;
+            th2.Start();
+        }
+
+
+        /// <summary>
+        /// 没半小时获取好哒FTP今日交易数据
+        /// </summary>
+        public static void GetFTPDataInfoHalfHour()
+        {
+            // 47.108.253.46
+            // 用户名:hdftp
+            // 密:haodatradeftp2024
+            // 目录:/haoda-trade
+
+            // FTP服务器的地址
+            string ftpServerAddress = Base.HaoDaFtpHost;
+            // FTP登录凭证
+            string ftpUser = Base.HaoDaFtpLoginName;
+            string ftpPassword = Base.HaoDaFtpLoginPwd;
+            // 要下载的文件路径
+            string filePath = "/haoda-trade/" + DateTime.Now.ToString("yyyyMMdd") + ".csv";
+
+            while (true)
+            {
+                try
+                {
+                    // 创建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))
+                    {
+                        WebCMSEntities db = new WebCMSEntities();
+                        // 读取数据
+                        string fileContents = reader.ReadToEnd();
+                        if (!string.IsNullOrEmpty(fileContents))
+                        {
+                            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);
+                    }
+                }
+                catch (WebException ex)
+                {
+                    // 如果抛出WebException,则可能是文件不存在
+                    // 根据响应状态码判断是否文件不存在
+                    if (((FtpWebResponse)ex.Response).StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString() + "文件" + filePath + "不存在", "获取好哒FTP文件数据异常"); // 文件不存在,返回false
+                    }
+                    else
+                    {
+                        // 其他错误
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
+                    }
+                }
+            }
+        }
+
+
+        /// <summary>
+        /// 获取好哒FTP今日交易数据
+        /// </summary>
+        public static void GetFTPDataInfoToday()
+        {
+            // 47.108.253.46
+            // 用户名:hdftp
+            // 密:haodatradeftp2024
+            // 目录:/haoda-trade
+
+            // FTP服务器的地址
+            string ftpServerAddress = Base.HaoDaFtpHost;
+            // FTP登录凭证
+            string ftpUser = Base.HaoDaFtpLoginName;
+            string ftpPassword = Base.HaoDaFtpLoginPwd;
+            // 要下载的文件路径
+            string filePath = "/haoda-trade/" + DateTime.Now.ToString("yyyyMMdd") + ".csv";
+
+            while (true)
+            {
+                if (DateTime.Now.Hour > 0 && DateTime.Now.Hour < 9)
+                {
+                    try
+                    {
+                        // 创建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))
+                        {
+                            WebCMSEntities db = new WebCMSEntities();
+                            // 读取数据
+                            string fileContents = reader.ReadToEnd();
+                            if (!string.IsNullOrEmpty(fileContents))
+                            {
+                                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);
+                        }
+                    }
+                    catch (WebException ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 获取好哒FTP昨日交易数据
+        /// </summary>
+        public static void GetFTPDataInfoYesterday()
+        {
+            // 47.108.253.46
+            // 用户名:hdftp
+            // 密:haodatradeftp2024
+            // 目录:/haoda-trade
+
+            // FTP服务器的地址
+            string ftpServerAddress = Base.HaoDaFtpHost;
+            // FTP登录凭证
+            string ftpUser = Base.HaoDaFtpLoginName;
+            string ftpPassword = Base.HaoDaFtpLoginPwd;
+            // 要下载的文件路径
+            string filePath = "/haoda-trade/" + DateTime.Now.AddDays(-1).ToString("yyyyMMdd") + ".csv";
+
+            while (true)
+            {
+                string check = function.ReadInstance("/GetFTPDataInfoYesterday/check" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + ".txt");
+                if (string.IsNullOrEmpty(check))
+                {
+                    if (DateTime.Now.Hour > 11 && DateTime.Now.Hour < 24)
+                    {
+                        try
+                        {
+                            // 创建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))
+                            {
+                                WebCMSEntities db = new WebCMSEntities();
+                                // 读取数据
+                                string fileContents = reader.ReadToEnd();
+                                if (!string.IsNullOrEmpty(fileContents))
+                                {
+                                    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);
+                            }
+                        }
+                        catch (WebException ex)
+                        {
+                            function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+}

+ 5 - 3
Util/HaoDa/GetStoreNoHelper.cs

@@ -55,9 +55,11 @@ namespace MySystem
                 MerchantInfo merInfo = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
                 if (string.IsNullOrEmpty(AddInfo.StoreNo) && string.IsNullOrEmpty(AddInfo.OutMchtNo))
                 {
+                    var BrhCode = HaodaUnionParam.BrhCode;
+                    if (AddInfo.BrandId == 1) BrhCode = HaodaParam.BrhCode;
 
                     //查询商户审核状态
-                    var returnInfo = HaoDaHelper.Instance.QueryMerchantStatus(HaoDaHelper.BrhCode, AddInfo.MchtNo);
+                    var returnInfo = HaoDaHelper.Instance.QueryMerchantStatus(BrhCode, AddInfo.MchtNo, AddInfo.BrandId);
                     var check = false;
                     JsonData jsonObj = JsonMapper.ToObject(returnInfo);
                     if (jsonObj["resultCode"].ToString() == "1")
@@ -73,7 +75,7 @@ namespace MySystem
                         }
 
                         //查询实名认证状态
-                        var result = HaoDaHelper.Instance.QueryAuthStatus(AddInfo.OutMchtNo, AddInfo.StoreNo);
+                        var result = HaoDaHelper.Instance.QueryAuthStatus(AddInfo.OutMchtNo, AddInfo.StoreNo, AddInfo.BrandId);
                         JsonData jsonData = JsonMapper.ToObject(result);
 
                         if (jsonData["resultCode"].ToString() == "1")
@@ -90,7 +92,7 @@ namespace MySystem
                             check = true;
                         }
                     }
-                    
+
                     if (check)
                     {
                         AddInfo.Status = 0;

+ 5 - 5
Util/HaoDa/HaoDaAuthQueryHelper.cs

@@ -29,8 +29,8 @@ public class HaoDaAuthQueryHelper
     {
         while (true)
         {
-            DataTable dt = CustomerSqlConn.dtable("select Id,OutMchtNo,StoreNo from MerchantAddInfo where HdStatus=3 and OutMchtNo is not null and StoreNo is not null and ((`Status`=1 and WeChatMerchantId is null) or (`QueryCount`=1 and AliMerchantId is null)) order by Id desc", AppConfig.Base.SqlConnStr);
-            foreach(DataRow dr in dt.Rows)
+            DataTable dt = CustomerSqlConn.dtable("select Id,OutMchtNo,StoreNo from MerchantAddInfo where HdStatus=3 and BrandId=0 and OutMchtNo is not null and StoreNo is not null and ((`Status`=1 and WeChatMerchantId is null) or (`QueryCount`=1 and AliMerchantId is null)) order by Id desc", AppConfig.Base.SqlConnStr);
+            foreach (DataRow dr in dt.Rows)
             {
                 QueryAuthStatus(dr["Id"].ToString(), dr["OutMchtNo"].ToString(), dr["StoreNo"].ToString());
                 Thread.Sleep(2000);
@@ -44,12 +44,12 @@ public class HaoDaAuthQueryHelper
         try
         {
             var Id = int.Parse(MerchantId);
-            var jsonObj = JsonMapper.ToObject(HaoDaHelper.Instance.QueryAuthStatus(MchtNo, StoreNo));
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantAddInfo info = db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
+            var jsonObj = JsonMapper.ToObject(HaoDaHelper.Instance.QueryAuthStatus(MchtNo, StoreNo, info.BrandId));
             //成功(已认证)
             if (jsonObj["resultCode"].ToString() == "1")
             {
-                WebCMSEntities db = new WebCMSEntities();
-                MerchantAddInfo info = db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
                 // MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
                 var wxcheck = jsonObj["wechatVerifyState"].ToString();
                 var alicheck = jsonObj["aliVerifyState"].ToString();

+ 2 - 2
Util/HaoDa/HaoDaExtQueryAuthHelper.cs

@@ -39,7 +39,7 @@ public class HaoDaExtQueryAuthHelper
             // {
             //     Thread.Sleep(10000);
             // }
-            DataTable dt = CustomerSqlConn.dtable("select Id from MerchantAddInfo where HdStatus=3 and `Status`=1 and WeChatMerchantId!='' and WeChatMerchantId is not null", AppConfig.Base.SqlConnStr);
+            DataTable dt = CustomerSqlConn.dtable("select Id from MerchantAddInfo where HdStatus=3 and BrandId=0 and `Status`=1 and WeChatMerchantId!='' and WeChatMerchantId is not null", AppConfig.Base.SqlConnStr);
             foreach (DataRow dr in dt.Rows)
             {
                 WeChatAddInfo(int.Parse(dr["Id"].ToString()));
@@ -114,7 +114,7 @@ public class HaoDaExtQueryAuthHelper
             // {
             //     Thread.Sleep(10000);
             // }
-            DataTable dt = CustomerSqlConn.dtable("select Id from MerchantAddInfo where HdStatus=3 and `QueryCount`=1 and AliMerchantId!='' and AliMerchantId is not null", AppConfig.Base.SqlConnStr);
+            DataTable dt = CustomerSqlConn.dtable("select Id from MerchantAddInfo where HdStatus=3 and BrandId=0 and `QueryCount`=1 and AliMerchantId!='' and AliMerchantId is not null", AppConfig.Base.SqlConnStr);
             foreach (DataRow dr in dt.Rows)
             {
                 AlipayAddInfo(int.Parse(dr["Id"].ToString()));

+ 2 - 2
Util/HaoDa/HaoDaExtQueryHelper.cs

@@ -39,7 +39,7 @@ public class HaoDaExtQueryHelper
             // {
             //     Thread.Sleep(10000);
             // }
-            DataTable dt = CustomerSqlConn.dtable("select Id,ApplymentId from MerchantAddInfo where HdStatus=3 and `Status`=0 and ApplymentId!='' and ApplymentId is not null", AppConfig.Base.SqlConnStr);
+            DataTable dt = CustomerSqlConn.dtable("select Id,ApplymentId from MerchantAddInfo where HdStatus=3 and BrandId=0 and `Status`=0 and ApplymentId!='' and ApplymentId is not null", AppConfig.Base.SqlConnStr);
             foreach (DataRow dr in dt.Rows)
             {
                 WeChatAddInfo(int.Parse(dr["Id"].ToString()), dr["ApplymentId"].ToString());
@@ -133,7 +133,7 @@ public class HaoDaExtQueryHelper
             // {
             //     Thread.Sleep(10000);
             // }
-            DataTable dt = CustomerSqlConn.dtable("select Id,SeoTitle from MerchantAddInfo where HdStatus=3 and `QueryCount`=0 and SeoTitle!='' and SeoTitle is not null", AppConfig.Base.SqlConnStr);
+            DataTable dt = CustomerSqlConn.dtable("select Id,SeoTitle from MerchantAddInfo where HdStatus=3 and BrandId=0 and `QueryCount`=0 and SeoTitle!='' and SeoTitle is not null", AppConfig.Base.SqlConnStr);
             foreach (DataRow dr in dt.Rows)
             {
                 AlipayAddInfo(int.Parse(dr["Id"].ToString()), dr["SeoTitle"].ToString());

+ 136 - 53
Util/HaoDa/HaoDaHelper.cs

@@ -32,11 +32,11 @@ namespace MySystem
         // string BrhCode = "001040";
 
         //生产环境
-        string BoxRequestUrl = "https://openapi.iboxpay.com";
-        string BoxAppId = "AP7175619323825451008";
-        string BoxAppSecret = "hUfR53gdjyfiZTBR5bILanMqRD1dXD7y";
-        string BoxPublicKey = "";
-        public static string BrhCode = "030145";
+        // string BoxRequestUrl = "https://openapi.iboxpay.com";
+        // string BoxAppId = "AP7175619323825451008";
+        // string BoxAppSecret = "hUfR53gdjyfiZTBR5bILanMqRD1dXD7y";
+        // string BoxPublicKey = "";
+        // public static string BrhCode = "030145";
 
         // string BoxRequestUrl = "https://openapi.iboxpay.com";
         // string BoxAppId = "AP8322645764893728768";
@@ -50,15 +50,21 @@ namespace MySystem
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public string AddNewMerchant(AddNewMerchant request)
+        public string AddNewMerchant(AddNewMerchant request, int BrandId = 0)
         {
-            request.brh = BrhCode;
-            // request.oprInvitedCode = "T1715836";
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1)
+            {
+                BoxRequestUrl = HaodaParam.BoxRequestUrl;
+                request.oprInvitedCode = "T1715836";
+            }
+
+            // request.brh = BrhCode;
             LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒新创建商户");
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
             LogHelper.Instance.WriteLog(req, "好哒新创建商户");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒新创建商户");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒新创建商户");
@@ -75,8 +81,11 @@ namespace MySystem
         /// <param name="instId">机构编号</param>
         /// <param name="mchtNo">收款商户号</param>
         /// <returns></returns>
-        public string QueryMerchantStatus(string instId, string mchtNo)
+        public string QueryMerchantStatus(string instId, string mchtNo, 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("instId", instId);
@@ -84,7 +93,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒查询商户审核状态");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询商户审核状态");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询商户审核状态");
@@ -101,15 +110,18 @@ namespace MySystem
         /// <param name="mchtNo">慧掌柜商户号</param>
         /// <param name="storeNo">慧掌柜门店号</param>
         /// <returns></returns>
-        public string QueryAuthStatus(string mchtNo, string storeNo)
+        public string QueryAuthStatus(string mchtNo, string storeNo, 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("storeNo", storeNo); // 慧掌柜门店号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒查询实名认证状态");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询实名认证状态");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询实名认证状态");
@@ -126,15 +138,18 @@ namespace MySystem
         /// <param name="mchtNo">慧掌柜商户号</param>
         /// <param name="storeNo">慧掌柜门店号</param>
         /// <returns></returns>
-        public string QueryAuthQRcode(string mchtNo, string storeNo)
+        public string QueryAuthQRcode(string mchtNo, string storeNo, 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("storeNo", storeNo); // 慧掌柜门店号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒查询实名认证二维码");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询实名认证二维码");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询实名认证二维码");
@@ -159,8 +174,11 @@ namespace MySystem
         /// <param name="subAppIdType">对应的类型,默认为公众号, SUBSCRIPTION: 公众号 MINI_PROGRAM: 小程序</param>
         /// <param name="ledgerModel">分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段</param>
         /// <returns></returns>
-        public string WeChatPay(string mchtNo, string storeNo, string outOrderNo, string transAmount, string callbackUrl, string subOpenId, string confirmCode, string subAppId, string subAppIdType, string ledgerModel)
+        public string WeChatPay(string mchtNo, string storeNo, string outOrderNo, string transAmount, string callbackUrl, string subOpenId, string confirmCode, string subAppId, string subAppIdType, string ledgerModel, 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); //盒子的商户编号
@@ -176,7 +194,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒微信公众号和小程序支付");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒微信公众号和小程序支付");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒微信公众号和小程序支付");
@@ -198,8 +216,11 @@ namespace MySystem
         /// <param name="subOpenId">支付宝用户标识</param>
         /// <param name="confirmCode">支付确认码,由4位纯数字组成,每次请求时随机生成</param>
         /// <returns></returns>
-        public string Alipay(string mchtNo, string storeNo, string outOrderNo, string transAmount, string callbackUrl, string subOpenId, string confirmCode)
+        public string Alipay(string mchtNo, string storeNo, string outOrderNo, string transAmount, string callbackUrl, string subOpenId, string confirmCode, 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); //盒子的商户编号
@@ -212,7 +233,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒支付宝服务窗支付");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒支付宝服务窗支付");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒支付宝服务窗支付");
@@ -232,8 +253,11 @@ namespace MySystem
         /// <param name="outOrderNo">商户支付订单号</param>
         /// <param name="refundAmount">退款金额,单位:分</param>
         /// <returns></returns>
-        public string AggregatedPayRefund(string mchtNo, string storeNo, string outRefundNo, string outOrderNo, string refundAmount)
+        public string AggregatedPayRefund(string mchtNo, string storeNo, string outRefundNo, string outOrderNo, string refundAmount, 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>();
 
@@ -246,7 +270,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒聚合支付退款");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒聚合支付退款");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒聚合支付退款");
@@ -263,8 +287,11 @@ namespace MySystem
         /// <param name="mchtNo">慧掌柜商户号(进件接口返回的outMchtNo字段)</param>
         /// <param name="storeNo">慧掌柜门店号</param>
         /// <returns></returns>
-        public string OpenDivideAccounts(string mchtNo, string storeNo)
+        public string OpenDivideAccounts(string mchtNo, string storeNo, 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>();
 
@@ -273,7 +300,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒开通分账");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒开通分账");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒开通分账");
@@ -291,8 +318,11 @@ namespace MySystem
         /// <param name="mchtNo">慧掌柜商户号</param>
         /// <param name="storeNo">慧掌柜门店号</param>
         /// <returns></returns>
-        public string DivideAccountsSign(string acctNo, string mchtNo, string storeNo)
+        public string DivideAccountsSign(string acctNo, string mchtNo, string storeNo, 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("acctNo", acctNo); // 账户号	
@@ -300,7 +330,7 @@ namespace MySystem
             reqdic.Add("storeNo", storeNo); // 慧掌柜门店号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒分账接收方签约");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账接收方签约");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账接收方签约");
@@ -316,13 +346,16 @@ namespace MySystem
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public string AddOpenDivideAccounts(AddOpenDivideAccounts request)
+        public string AddOpenDivideAccounts(AddOpenDivideAccounts request, int BrandId = 0)
         {
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
+
             LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒添加分账接收方账户");
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
             LogHelper.Instance.WriteLog(req, "好哒添加分账接收方账户");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒添加分账接收方账户");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒添加分账接收方账户");
@@ -339,15 +372,18 @@ namespace MySystem
         /// <param name="mchtNo">慧掌柜商户号</param>
         /// <param name="orderNo">交易订单号	</param>
         /// <returns></returns>
-        public string QueryOrderDivideAccounts(string mchtNo, string orderNo)
+        public string QueryOrderDivideAccounts(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);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账交易详情查询");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账交易详情查询");
@@ -364,13 +400,16 @@ namespace MySystem
         /// <param name="request"></param>
         /// <returns></returns>
         /// 
-        public string OrderDivideAccounts(OrderDivideAccounts request)
+        public string OrderDivideAccounts(OrderDivideAccounts request, int BrandId = 0)
         {
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
+
             LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒订单分账申请");
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
             LogHelper.Instance.WriteLog(req, "好哒订单分账申请");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒订单分账申请");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒订单分账申请");
@@ -387,15 +426,18 @@ namespace MySystem
         /// <param name="applyNo">分账批次号</param>
         /// <param name="mchtNo">慧掌柜商户号</param>
         /// <returns></returns>
-        public string OrderDivideAccountsQuery(string applyNo, string mchtNo)
+        public string OrderDivideAccountsQuery(string applyNo, string mchtNo, 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("applyNo", applyNo); // 账户号	
             reqdic.Add("mchtNo", mchtNo); // 慧掌柜商户号
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒订单分账结果查询");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒订单分账结果查询");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒订单分账结果查询");
@@ -411,13 +453,16 @@ namespace MySystem
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public string ChangeMerchantCard(ChangeMerchantCard request)
+        public string ChangeMerchantCard(ChangeMerchantCard request, int BrandId = 0)
         {
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
+
             LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒商户修改银行卡");
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(request);
             LogHelper.Instance.WriteLog(req, "好哒商户修改银行卡");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒商户修改银行卡");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒商户修改银行卡");
@@ -434,8 +479,11 @@ namespace MySystem
         /// <param name="mchtNo">收款商户号</param>
         /// <param name="taskId">任务id</param>
         /// <returns></returns>
-        public string QueryChangeCardStatus(string mchtNo, string taskId)
+        public string QueryChangeCardStatus(string mchtNo, string taskId, 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);
@@ -443,7 +491,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒查询修改银行卡任务审核状态");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒查询修改银行卡任务审核状态");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒查询修改银行卡任务审核状态");
@@ -462,8 +510,11 @@ namespace MySystem
         /// <param name="storeNo">盒子的门店编号</param>
         /// <param name="subAppId">公众号appid或者小程序appid</param>
         /// <returns></returns>
-        public string BindWeChatAppId(string mchtNo, string storeNo, string subAppId)
+        public string BindWeChatAppId(string mchtNo, string storeNo, string subAppId, int BrandId = 0)
         {
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
+
             LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒绑定微信appid接口");
             Dictionary<string, object> reqdic = new Dictionary<string, object>();
 
@@ -473,7 +524,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒绑定微信appid接口");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒绑定微信appid接口");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒绑定微信appid接口");
@@ -496,8 +547,11 @@ namespace MySystem
         /// <param name="page">当前页数,默认1</param>
         /// <param name="rows">每页大小,默认10,最大500</param>
         /// <returns></returns>
-        public string QueryAccountList(string mchtNo, string startTime, string endTime, string tradeMchtNo, string cardNo, string settleStatus, string page = "1", string rows = "10")
+        public string QueryAccountList(string mchtNo, string startTime, string endTime, string tradeMchtNo, string cardNo, string settleStatus, string page = "1", string rows = "10", 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>();
 
@@ -512,7 +566,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒到账记录查询");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒到账记录查询");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒到账记录查询");
@@ -529,8 +583,11 @@ namespace MySystem
         /// <param name="mchtNo">商户号</param>
         /// <param name="id"></param>
         /// <returns></returns>
-        public string QueryAccountDetail(string mchtNo, string id)
+        public string QueryAccountDetail(string mchtNo, string id, 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>();
 
@@ -539,7 +596,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒到账记录详情");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒到账记录详情");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒到账记录详情");
@@ -556,8 +613,11 @@ namespace MySystem
         /// <param name="mchtNo">商户号</param>
         /// <param name="outOrderNo">商户订单号</param>
         /// <returns></returns>
-        public string QueryTradeDetail(string mchtNo, string outOrderNo)
+        public string QueryTradeDetail(string mchtNo, string outOrderNo, 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>();
 
@@ -566,7 +626,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒聚合支付查询");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒聚合支付查询");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒聚合支付查询");
@@ -584,8 +644,11 @@ namespace MySystem
         /// <param name="storeNo">门店编号</param>
         /// <param name="outRefundNo">退款订单号</param>
         /// <returns></returns>
-        public string QueryRefundDetail(string mchtNo, string storeNo, string outRefundNo)
+        public string QueryRefundDetail(string mchtNo, string storeNo, string outRefundNo, 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>();
 
@@ -595,7 +658,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒退款查询");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒退款查询");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒退款查询");
@@ -606,8 +669,16 @@ namespace MySystem
             return result;
         }
 
-        public Dictionary<string, string> GetHeader(string req)
+        public Dictionary<string, string> GetHeader(string req, int BrandId = 0)
         {
+            var BoxAppId = HaodaUnionParam.BoxAppId;
+            var BoxAppSecret = HaodaUnionParam.BoxAppSecret;
+            if (BrandId == 1)
+            {
+                BoxAppId = HaodaParam.BoxAppId;
+                BoxAppSecret = HaodaParam.BoxAppSecret;
+            }
+
             Dictionary<string, string> headdic = new Dictionary<string, string>();
             string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             // headdic.Add("appid", BoxAppId);//开发者id
@@ -628,8 +699,11 @@ namespace MySystem
             return sign;
         }
 
-        public bool VerifySign(string toSignStr, string signStr)
+        public bool VerifySign(string toSignStr, string signStr, int BrandId = 0)
         {
+            var BoxPublicKey = HaodaUnionParam.BoxPublicKey;
+            if (BrandId == 1) BoxPublicKey = HaodaParam.BoxPublicKey;
+
             byte[] toSignByte = Encoding.Default.GetBytes(toSignStr);
             byte[] signByte = Convert.FromBase64String(signStr);
             var toKey = Convert.FromBase64String(BoxPublicKey);
@@ -645,8 +719,11 @@ namespace MySystem
             }
         }
 
-        public string SignData(string toSignStr)
+        public string SignData(string toSignStr, int BrandId = 0)
         {
+            var BoxPublicKey = HaodaUnionParam.BoxPublicKey;
+            if (BrandId == 1) BoxPublicKey = HaodaParam.BoxPublicKey;
+
             byte[] toSignByte = Encoding.UTF8.GetBytes(toSignStr);
             var toKey = Convert.FromBase64String(BoxPublicKey);
             var rsaroot = RSA.Create();
@@ -725,8 +802,11 @@ namespace MySystem
         /// <param name="fileName">文件名</param>
         /// <param name="action">操作类型 0 上传图片</param>
         /// <returns></returns>
-        public string GetToken(string fileName, string action)
+        public string GetToken(string fileName, string action, 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>();
 
@@ -735,7 +815,7 @@ namespace MySystem
 
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒获取文件令牌接口");
-            Dictionary<string, string> headdic = GetHeader(req);
+            Dictionary<string, string> headdic = GetHeader(req, BrandId);
             string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
             LogHelper.Instance.WriteLog("请求头\n" + head, "好哒获取文件令牌接口");
             LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒获取文件令牌接口");
@@ -865,8 +945,11 @@ namespace MySystem
         /// <param name="token">上传图片凭证token</param>
         /// <param name="value">图片路径</param>
         /// <returns></returns>
-        public string ReturnFileName(string token, string value)
+        public string ReturnFileName(string token, string value, int BrandId = 0)
         {
+            var BoxRequestUrl = HaodaUnionParam.BoxRequestUrl;
+            if (BrandId == 1) BoxRequestUrl = HaodaParam.BoxRequestUrl;
+
             Dictionary<string, string> file = new Dictionary<string, string>();
             file.Add("fileName", value.Substring(value.LastIndexOf("/")).Trim('/'));
             if (string.IsNullOrEmpty(value.Split(',')[0]))

+ 2 - 2
Util/HaoDa/MerchantConfirmService.cs

@@ -104,7 +104,7 @@ namespace MySystem
                     if (AddInfo.Status <= 0)
                     {
                         //好哒新建商户
-                        string result = HaoDaHelper.Instance.AddNewMerchant(AddNewMerchantSetUtil.SetValue(AddInfo));
+                        string result = HaoDaHelper.Instance.AddNewMerchant(AddNewMerchantSetUtil.SetValue(AddInfo), AddInfo.BrandId);
                         JsonData jsonObj = JsonMapper.ToObject(result);
                         //创建成功
                         if (jsonObj["resultCode"].ToString() == "1")
@@ -129,7 +129,7 @@ namespace MySystem
                             AddInfo.Status = -1;
                             merchant.Status = -1;
                             string errorDesc = jsonObj["errorDesc"].ToString();
-                            if(errorDesc.Contains("租赁协议") && errorDesc.Contains("水电煤") && errorDesc.Contains("门头合影") && errorDesc.Contains("下载地址"))
+                            if (errorDesc.Contains("租赁协议") && errorDesc.Contains("水电煤") && errorDesc.Contains("门头合影") && errorDesc.Contains("下载地址"))
                             {
                                 errorDesc = "门头不一致,需上传名称不一致说明函";
                             }

+ 30 - 30
Util/HaoDa/ProfitHelper.cs

@@ -154,20 +154,20 @@ namespace MySystem
                                                 if (GetMoney > minProfit)
                                                 {
                                                     MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == suborder.MerchantId) ?? new MerchantAddInfo();
-                                                    
+
                                                     //聚合支付退款
                                                     bool BackStatus = false;
 
                                                     //拆单算法
                                                     string MerchantList = function.CheckNull(RedisDbconn.Instance.Get<string>("SplitOrderMerchants"));
                                                     string SplitOrderStatus = function.CheckNull(RedisDbconn.Instance.Get<string>("SplitOrderStatus"));
-                                                    if(MerchantList.Contains("," + suborder.MerchantId + ",") || SplitOrderStatus == "1")
+                                                    if (MerchantList.Contains("," + suborder.MerchantId + ",") || SplitOrderStatus == "1")
                                                     {
-                                                        CheckTime = SplitOrder(suborder.PayMoney,subset.MinPayMoney);
+                                                        CheckTime = SplitOrder(suborder.PayMoney, subset.MinPayMoney);
                                                         function.WriteLog("CheckTime:" + CheckTime, "返现逻辑日志");
-                                                        if(CheckTime > 0)
+                                                        if (CheckTime > 0)
                                                         {
-                                                            if(set.DiviPersons - DiviTimes < CheckTime)
+                                                            if (set.DiviPersons - DiviTimes < CheckTime)
                                                             {
                                                                 CheckTime = set.DiviPersons - DiviTimes;
                                                             }
@@ -175,7 +175,7 @@ namespace MySystem
                                                             GetMoney = GetMoney * CheckTime;
                                                             db.SaveChanges();
                                                             function.WriteLog("CurDiviPersons1:" + CurDiviPersons, "返现逻辑日志");
-                                                            if(RedisDbconn.Instance.Count("ConsumerOrdersHd:Divi:" + PayMode + ":" + MerchantId) >= set.DiviPersons)
+                                                            if (RedisDbconn.Instance.Count("ConsumerOrdersHd:Divi:" + PayMode + ":" + MerchantId) >= set.DiviPersons)
                                                             {
                                                                 CurDiviPersons -= CheckTime - 1;
                                                             }
@@ -191,12 +191,12 @@ namespace MySystem
 
                                                     decimal RefundAmount = GetMoney * 100;
                                                     RefundAmount = PublicFunction.NumberFormat(RefundAmount, 0);
-                                                    if(!orderids.Contains(suborder.Id) && DiviTimes < set.DiviPersons)
+                                                    if (!orderids.Contains(suborder.Id) && DiviTimes < set.DiviPersons)
                                                     {
                                                         function.WriteLog("请求退款接口", "返现逻辑日志");
                                                         string RefundNo = "HDTK" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                                                        var info = HaoDaHelper.Instance.AggregatedPayRefund(merchantAdd.OutMchtNo, merchantAdd.StoreNo, RefundNo, suborder.OrderNo, RefundAmount.ToString("f0"));
-                                                        if(info.Contains("\"resultCode\":\"1\"") && info.Contains("\"tradeStatus\":\"2\""))
+                                                        var info = HaoDaHelper.Instance.AggregatedPayRefund(merchantAdd.OutMchtNo, merchantAdd.StoreNo, RefundNo, suborder.OrderNo, RefundAmount.ToString("f0"), merchantAdd.BrandId);
+                                                        if (info.Contains("\"resultCode\":\"1\"") && info.Contains("\"tradeStatus\":\"2\""))
                                                         {
                                                             db.ConsumerProfit.Add(new ConsumerProfit()
                                                             {
@@ -219,7 +219,7 @@ namespace MySystem
                                                         DiviTimes += CheckTime;
                                                     }
 
-                                                    if(BackStatus)
+                                                    if (BackStatus)
                                                     {
                                                         merchant.ActCurrentAmount += Math.Round(GetMoney, 2); //活动已返金额
                                                         db.SaveChanges();
@@ -301,16 +301,16 @@ namespace MySystem
                     RedisDbconn.Instance.AddList("ConsumerProfitCheck", orderidstring);
                 }
             }
-            db.Dispose();            
+            db.Dispose();
             function.WriteLog("结束返现:" + orderidstring + "\n\n\n", "返现逻辑日志");
         }
 
         //拆单算法
         private int SplitOrder(decimal OrderAmt, decimal MinMoney)
         {
-            decimal percenter = OrderAmt/MinMoney;
+            decimal percenter = OrderAmt / MinMoney;
             int Times = int.Parse(percenter.ToString().Split('.')[0]);
-            if(Times < 1) Times = 1;
+            if (Times < 1) Times = 1;
             return Times;
         }
         #endregion
@@ -330,15 +330,15 @@ namespace MySystem
 
         public void StartListenProfitDo()
         {
-            while(true)
+            while (true)
             {
-                if(DateTime.Now.Day < 10 && DateTime.Now.Hour > 2 && DateTime.Now.Hour < 23)
+                if (DateTime.Now.Day < 10 && DateTime.Now.Hour > 2 && DateTime.Now.Hour < 23)
                 {
                     try
                     {
                         DoProfit();
                     }
-                    catch(Exception ex)
+                    catch (Exception ex)
                     {
                         LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "来客吧分润异常");
                     }
@@ -356,7 +356,7 @@ namespace MySystem
         {
             string TradeMonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
             string check = function.ReadInstance("/ProfitFlag/" + TradeMonth + ".txt");
-            if(!string.IsNullOrEmpty(check))
+            if (!string.IsNullOrEmpty(check))
             {
                 return;
             }
@@ -364,7 +364,7 @@ namespace MySystem
             Models.KxsMain.WebCMSEntities kxsdb = new Models.KxsMain.WebCMSEntities();
             WebCMSEntities dbnew = new WebCMSEntities();
             DataTable dt = CustomerSqlConn.dtable("select IsAct,UserId,sum(TotalAmount) from UserAmountSummary where TradeMonth='" + TradeMonth + "' and SeoTitle='self' group by IsAct,UserId", AppConfig.Base.SqlConnStr);
-            foreach(DataRow dr in dt.Rows)
+            foreach (DataRow dr in dt.Rows)
             {
                 int UserId = int.Parse(dr["UserId"].ToString());
                 bool IsActive = dr["IsAct"].ToString() == "1";
@@ -379,7 +379,7 @@ namespace MySystem
                     {
                         uidstring = us.ParentNav.Trim(',').Replace(",,", ",") + "," + uidstring;
                         string[] parents = us.ParentNav.Trim(',').Replace(",,", ",").Split(',');
-                        if(parents.Length > 1)
+                        if (parents.Length > 1)
                         {
                             TopUserId = int.Parse(function.CheckInt(parents[1]));
                         }
@@ -411,7 +411,7 @@ namespace MySystem
                 Models.KxsMain.Users topUser = kxsdb.Users.FirstOrDefault(a => a.Id == TopUserId) ?? new Models.KxsMain.Users();
                 LogHelper.Instance.WriteLog("---UserId:" + UserId + ";TotalAmount:" + TotalAmount + ";", "来客吧分润日志");
                 List<ProfitResult> list = new List<ProfitResult>();
-                list = StartProft(TotalAmount, 1, users, IsActive);                
+                list = StartProft(TotalAmount, 1, users, IsActive);
                 LogHelper.Instance.WriteLog("---list:" + list.Count + ";", "来客吧分润日志");
                 try
                 {
@@ -446,7 +446,7 @@ namespace MySystem
                             editprofitrecord.RecordNo = RecordNo;
                             dbnew.SaveChanges();
                         }
-                        if(IsActive)
+                        if (IsActive)
                         {
                             editprofitrecord.CreditTradeAmt += TotalAmount;
                             editprofitrecord.CreditTradeProfit += sub.Money;
@@ -461,7 +461,7 @@ namespace MySystem
                     dbnew.SaveChanges();
                 }
                 catch (Exception ex)
-                { 
+                {
                     LogHelper.Instance.WriteLog(ex.ToString(), "分润异常");
                 }
             }
@@ -547,7 +547,7 @@ namespace MySystem
                             }
                         }
                     }
-                    if(curLevel < UserLevel)
+                    if (curLevel < UserLevel)
                     {
                         curLevel = UserLevel;
                     }
@@ -561,7 +561,7 @@ namespace MySystem
         {
             SubUser user = new SubUser();
             DataTable dt = GetDataTable("select * from Users" + Month + " where Id=" + UserId);
-            if(dt.Rows.Count > 0)
+            if (dt.Rows.Count > 0)
             {
                 user.Id = int.Parse(dt.Rows[0]["Id"].ToString());
                 user.ParentUserId = int.Parse(dt.Rows[0]["ParentUserId"].ToString());
@@ -577,9 +577,9 @@ namespace MySystem
         public int GetUserLevel(SubUser user)
         {
             int level = user.UserLevel;
-            if(user.PreUserLevel > level) level = user.PreUserLevel;
-            if(user.PreLeaderLevel > level) level = user.PreLeaderLevel;
-            if(user.PreOpLevel > level) level = user.PreOpLevel;
+            if (user.PreUserLevel > level) level = user.PreUserLevel;
+            if (user.PreLeaderLevel > level) level = user.PreLeaderLevel;
+            if (user.PreOpLevel > level) level = user.PreOpLevel;
             return level;
         }
 
@@ -616,7 +616,7 @@ namespace MySystem
         }
 
         public void SetDivi(string content)
-        { 
+        {
             try
             {
                 JsonData jsonObj = JsonMapper.ToObject(content);
@@ -624,14 +624,14 @@ namespace MySystem
                 decimal diviAmt = decimal.Parse(function.CheckNum(jsonObj["DiviAmt"].ToString()));
                 WebCMSEntities db = new WebCMSEntities();
                 ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == orderId);
-                if(order != null)
+                if (order != null)
                 {
                     order.CurDivi = diviAmt;
                     db.SaveChanges();
                 }
                 db.Dispose();
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
                 function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "设置订单当前返现金额异常");
             }

+ 6 - 3
Util/HaoDa/ProfitShareService.cs

@@ -52,12 +52,15 @@ namespace MySystem
                 string ApplyNo = jsonObj["ApplyNo"].ToString(); //微信订单号
                 string MchtNo = jsonObj["MchtNo"].ToString(); //商户订单号
                 string OrderNo = jsonObj["OrderNo"].ToString(); //商户订单号
-                JsonData result = JsonMapper.ToObject(HaoDaHelper.Instance.OrderDivideAccountsQuery(ApplyNo, MchtNo));
+                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();
+
+                JsonData result = JsonMapper.ToObject(HaoDaHelper.Instance.OrderDivideAccountsQuery(ApplyNo, MchtNo, merchantAdd.BrandId));
                 string state = result["data"]["status"].ToString();
                 if (result["data"]["status"].ToString() == "0")
                 {
-                    WebCMSEntities db = new WebCMSEntities();
-                    ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.OrderNo == OrderNo && m.Status == 2);
                     if (order != null)
                     {
                         RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + order.PayMode + ":List", order.Id.ToString());

+ 8 - 8
Util/HaoDa/TestChangeMerchantCardSetUtil.cs

@@ -59,10 +59,10 @@ namespace MySystem
             // 面照片、委托结算授权书照片、法人手持委托结算授权书
             if (changeMerchantCard.alterType == "0")
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         photoItem = new PhotoItem();
@@ -77,10 +77,10 @@ namespace MySystem
                 var info = "/static/upload/2023/8/14/dd.jpg";
                 if (!string.IsNullOrEmpty(info))
                 {
-                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(info.Substring(info.LastIndexOf("/")).Trim('/'), "0"));
+                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(info.Substring(info.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                     if (tokenInfo["code"].ToString() == "1")
                     {
-                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), info);
+                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), info, AddInfo.BrandId);
                         if (returnInfo != "false")
                         {
                             photoItem = new PhotoItem();
@@ -92,10 +92,10 @@ namespace MySystem
                 }
                 if (!string.IsNullOrEmpty(BankCard))
                 {
-                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                    var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(BankCard.Substring(BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                     if (tokenInfo["code"].ToString() == "1")
                     {
-                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard);
+                        var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), BankCard, AddInfo.BrandId);
                         if (returnInfo != "false")
                         {
                             photoItem = new PhotoItem();
@@ -108,10 +108,10 @@ namespace MySystem
             }
             if (changeMerchantCard.alterType == "2")
             {
-                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0"));
+                var tokenInfo = JsonMapper.ToObject(HaoDaHelper.Instance.GetToken(AddInfo.BankCard.Substring(AddInfo.BankCard.LastIndexOf("/")).Trim('/'), "0", AddInfo.BrandId));
                 if (tokenInfo["code"].ToString() == "1")
                 {
-                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard);
+                    var returnInfo = HaoDaHelper.Instance.ReturnFileName(tokenInfo["token"].ToString(), AddInfo.BankCard, AddInfo.BrandId);
                     if (returnInfo != "false")
                     {
                         photoItem = new PhotoItem();

+ 1 - 1
Util/HaoDa/TestHaoDaHelper.cs

@@ -109,7 +109,7 @@ namespace MySystem
             lists.Add("acctType", "0");
             lists.Add("amount", "9862");
             list.Add(lists);
-            
+
             reqdic.Add("detail", list);
             string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
             LogHelper.Instance.WriteLog(req, "好哒订单分账申请");

+ 168 - 1
Util/HaoDa/TestHaoDaService.cs

@@ -6,6 +6,8 @@ using MySystem.Models.Main;
 using Library;
 using LitJson;
 using System.Threading;
+using System.Net;
+using System.IO;
 
 namespace MySystem
 {
@@ -27,6 +29,8 @@ namespace MySystem
 
         public void StartListen()
         {
+            // GetFTPListInfo(); // 获取好哒FTPInfo
+            GetFTPDataInfo(); //获取好哒FTPDataInfo
             //开户意愿申请
             // RedisDbconn.Instance.AddList("AlipayForHaoDaQueue",824);
             // RedisDbconn.Instance.AddList("WeChatForHaoDaQueue",824);
@@ -158,6 +162,166 @@ namespace MySystem
             // db.Dispose();
         }
 
+        /// <summary>
+        /// 从ftp服务器上获得文件列表
+        /// </summary>
+        /// <param name="RequedstPath">服务器下的相对路径</param>
+        /// <returns></returns>
+        public static List<string> GetFTPListInfo(string RequedstPath = "/haoda-trade")
+        {
+            // 47.108.253.46
+            // 用户名:hdftp
+            // 密:haodatradeftp2024
+            // 目录:/haoda-trade
+            List<string> strs = new List<string>();
+            try
+            {
+                string uri = "ftp://47.108.253.46" + RequedstPath;   //目标路径 path为服务器地址        ②
+                FtpWebRequest reqFTP = (FtpWebRequest)WebRequest.Create(new Uri(uri));
+                // ftp用户名和密码
+                reqFTP.Credentials = new NetworkCredential("hdftp", "haodatradeftp2024");
+                reqFTP.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
+                WebResponse response = reqFTP.GetResponse();
+                StreamReader reader = new StreamReader(response.GetResponseStream());//中文文件名
+
+                string line = reader.ReadLine();
+                while (line != null)
+                {
+                    if (!line.Contains("<DIR>"))
+                    {
+                        string msg = line.Substring(0).Trim();
+                        msg = msg.Substring(msg.Length - 24, 24);
+                        strs.Add(msg);
+                    }
+                    line = reader.ReadLine();
+                }
+                reader.Close();
+                response.Close();
+                return strs;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
+            }
+            return strs;
+        }
+
+        public static void GetFTPDataInfo()
+        {
+            // 47.108.253.46
+            // 用户名:hdftp
+            // 密:haodatradeftp2024
+            // 目录:/haoda-trade
+
+            // FTP服务器的地址
+            string ftpServerAddress = "ftp://47.108.253.46";
+            // FTP登录凭证
+            string ftpUser = "hdftp";
+            string ftpPassword = "haodatradeftp2024";
+            // 要下载的文件路径
+            string filePath = "/haoda-trade/20240513.csv";
+
+            try
+            {
+                // 创建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))
+                {
+                    WebCMSEntities db = new WebCMSEntities();
+                    // 读取数据
+                    string fileContents = reader.ReadToEnd();
+                    if (!string.IsNullOrEmpty(fileContents))
+                    {
+                        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();
+                }
+
+                // 关闭响应
+                response.Close();
+            }
+            catch (WebException ex)
+            {
+                // 如果抛出WebException,则可能是文件不存在
+                // 根据响应状态码判断是否文件不存在
+                if (((FtpWebResponse)ex.Response).StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString() + "文件" + filePath + "不存在", "获取好哒FTP文件数据异常"); // 文件不存在,返回false
+                }
+                else
+                {
+                    // 其他错误
+                    function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "获取好哒FTP文件数据异常");
+                }
+            }
+        }
+
         public void StartProfitShareListen()
         {
             bool op = true;
@@ -209,7 +373,10 @@ namespace MySystem
         {
             WebCMSEntities db = new WebCMSEntities();
             MerchantAddInfo AddInfo = db.MerchantAddInfo.FirstOrDefault(m => m.Id == MerchantId);
-            var returnInfo = HaoDaHelper.Instance.QueryMerchantStatus(HaoDaHelper.BrhCode, AddInfo.MchtNo);
+
+            var BrhCode = HaodaUnionParam.BrhCode;
+            if (AddInfo.BrandId == 1) BrhCode = HaodaParam.BrhCode;
+            var returnInfo = HaoDaHelper.Instance.QueryMerchantStatus(BrhCode, AddInfo.MchtNo);
             // string result = HaoDaHelper.Instance.AddNewMerchant(AddNewMerchantSetUtil.SetValue(AddInfo));
             db.Dispose();
         }

+ 2 - 2
Util/HaoDa/WeChatPayBackService.cs

@@ -206,7 +206,7 @@ namespace MySystem
                                     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));
+                                    string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amountAmount, seviceAmount), merchantAdd.BrandId);
                                     order.DivideLog = "请求分账日志:" + result;
                                     if (result.Contains("\"resultCode\":\"0\"") && (result.Contains("分账金额不足") || result.Contains("不存在")))
                                     {
@@ -306,7 +306,7 @@ namespace MySystem
                                 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));
+                                string result = HaoDaHelper.Instance.OrderDivideAccounts(OrderDivideAccountsUtil.AddValue(applyNo, mchtNo, orderNo, acctNo, sacctNo, acctType, amountAmount, seviceAmount), merchantAdd.BrandId);
                                 order.DivideLog = "请求分账日志:" + result;
                                 db.SaveChanges();
                             }

+ 6 - 3
appsettings.Development.json

@@ -22,10 +22,13 @@
     "OSSSecret": "Q6P2vSNEY2LBNdygO8gUCkBZQpiswZ",
     "OSSEndpoint": "oss-cn-hangzhou.aliyuncs.com",
     "OSSBucketName": "yunmuit",
-    "TencentKey":"GU3BZ-JYL6Q-ETG5Y-BGPXM-QFQV6-PZBLW",
+    "TencentKey": "GU3BZ-JYL6Q-ETG5Y-BGPXM-QFQV6-PZBLW",
     "AppSource": "/skin/app/default/",
     "JwtSecret": "JvDHuowbOnWiyxMIFc9gG5rw1LSSc0xx68L31oRfxS0",
     "JwtIss": "TpAdminServer",
-    "JwtAud": "api"
+    "JwtAud": "api",
+    "HaoDaFtpHost": "ftp://47.108.253.46",
+    "HaoDaFtpLoginName": "hdftp",
+    "HaoDaFtpLoginPwd": "haodatradeftp2024"
   }
-}
+}