Browse Source

Merge branch 'feat-盒易付' into develop

lcl 2 years ago
parent
commit
d806fc75c7

+ 113 - 0
AppStart/Helper/SetDepositPostService.cs

@@ -320,6 +320,24 @@ namespace MySystem
                                             db.SaveChanges();
                                         }
                                     }
+                                    else if(pos.BrandId == 11 || pos.BrandId == 12) //盒易付
+                                    {
+                                        string content = BoxFee(merchant.KqMerNo, Fee.ToString("f2"));
+                                        JsonData obj = JsonMapper.ToObject(content);
+                                        if(obj["resultCode"].ToString() == "1")
+                                        {
+                                            pos.SeoDescription = "设置成功";
+                                            SetRecordResult(db, RecordId, 1, "设置成功");
+                                            db.SaveChanges();
+                                        }
+                                        else
+                                        {
+                                            string msg = obj["errorDesc"].ToString();
+                                            pos.SeoDescription = msg;
+                                            SetRecordResult(db, RecordId, -1, msg);
+                                            db.SaveChanges();
+                                        }
+                                    }
                                 }
                             }
                         }
@@ -1120,5 +1138,100 @@ namespace MySystem
 
         #endregion
 
+        
+        #region 盒易付
+
+        //测试环境
+        // string BoxRequestUrl = "https://openapi-test.iboxpay.com/api";
+        // string BoxAppId = "8840021411446784";
+        // string BoxAppSecret = "xgwGnmYGjVy0GOWOWkQtRk8Hk8ur5tCV";
+        // string BoxPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjMQxp24mjxDTr13uPW0y+tiO1yXFGw7P/pPQ0oZKK7F6KstEaus7pLEywBZ5XRXE5jgkhR2TS7Ne7djJfbpn5yFc6pPlz3ZsOfBVeB88NEwhx6xzCGX2eqSSkO33n8w2G0xc2ss5HpYBarT00NBZWhrwOXpdRPYLOYHKVU3Rl+FA9xDw/wYfoWvrr+JSfHRGn/ENMmQFEdckAbPauKaQMrZD2kz+PRrhq56eWnCuVQPcaz/jroVT8qQEgkg2IsNy+DwfLOIqm8IySEpxnQ5wN/KvsQJc2wXDQNf9F5kvWwjoqSSP0qJS+oPRXET+zJb+WTk2y5M6AYoC9NodwsC4NwIDAQAB";
+        // string BrhCode = "039001";
+
+        //生产环境
+        string BoxRequestUrl = "https://openapi.iboxpay.com/api";
+        string BoxAppId = "AP5879017839106039808";
+        string BoxAppSecret = "DGtftIyl6R3nzwPr5YuV5fnmkfwufXRj";
+        string BoxPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjmjoQirIYZBD9Qon2HkF4j/NAINXtJ7Lzq/WXxTF7t7mg7LNARt0+ZZaeWx8caq2fv5zdsGyyoInL23cBtDI5KmFfK69iA0ygQMK0WbiKqsUB1OpPbT3+9zLuadIJAznjA223lY6CIjTpdLZhaRjImNVqc60bdkx6YsQcA+xW+3r1JH4PPHb7yBEbkKIX8OhyX7U4p0TkbDkAobbjHr5YB9gmYLoSFJMOPfTtSExkv7/Y7IVR9poZAHcr3teFoAiXW3RzxelRtnXxIkl/6AUOKoL5fhr/UTUN+Q18uzNljYWr6SwnTI3EmtzgykaewWtZvV85Xdhe/BjiQ5Xor7YbwIDAQAB";
+        string BrhCode = "039004";
+
+        public string BoxFee(string MerNo, string Fee)
+        {
+            function.WriteLog(DateTime.Now.ToString(), "设置盒易付机具费率");
+            function.WriteLog(MerNo, "设置盒易付机具费率");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            Dictionary<string, string> headdic = new Dictionary<string, string>();
+            string batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
+
+            string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            headdic.Add("appid", BoxAppId);//开发者id
+            headdic.Add("appsecret", BoxAppSecret);//开发者密码
+            headdic.Add("X-Up-AppId", BoxAppId);
+            headdic.Add("X-Timestamp", timestamp);
+            headdic.Add("X-Sign-Type", "SHA-256");
+
+            reqdic.Add("mchtNo", MerNo);//终端列表
+            reqdic.Add("brhCode", BrhCode);//机构号
+            reqdic.Add("tNDiscId", Fee == "0.6" ? "MHN10916" : "MHN10917");//费率模型
+            reqdic.Add("effectiveFlag", "1");//立即生效
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+
+            headdic.Add("X-Sign", BoxSHA256Sign(timestamp + BoxAppSecret + req));
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            function.WriteLog("请求头\n" + head, "设置盒易付机具费率");
+            function.WriteLog("请求参数\n" + req, "设置盒易付机具费率");
+            function.WriteLog("请求地址:" + BoxRequestUrl + "/inst/mcht/update_disc", "设置盒易付机具费率");
+            string result = PostWebRequest(BoxRequestUrl + "/inst/mcht/update_disc", req, headdic);
+            function.WriteLog("返回\n" + result + "\n\n", "设置盒易付机具费率");
+            return result;
+        }
+
+        public string BoxSHA256Sign(string toSignStr)
+        {
+            byte[] toSignByte = Encoding.UTF8.GetBytes(toSignStr);
+            SHA256 sha256 = SHA256.Create();
+            byte[] signByte = sha256.ComputeHash(toSignByte);
+            string sign = Convert.ToBase64String(signByte);
+            return sign;
+        }
+
+        public bool BoxVerifySign(string toSignStr, string signStr)
+        {
+            byte[] toSignByte = Encoding.Default.GetBytes(toSignStr);
+            byte[] signByte = Convert.FromBase64String(signStr);
+            var toKey = Convert.FromBase64String(BoxPublicKey);
+            var rsaroot = RSA.Create();
+            rsaroot.ImportSubjectPublicKeyInfo(toKey, out _);
+            var publicKeyParameters = rsaroot.ExportParameters(false);
+            using (var rsa = RSA.Create())
+            {
+                rsa.ImportParameters(publicKeyParameters);
+                var sha256 = SHA256.Create();
+                var hash = sha256.ComputeHash(toSignByte);
+                return rsa.VerifyHash(hash, signByte, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
+            }
+        }
+
+        public string BoxSignData(string toSignStr)
+        {
+            byte[] toSignByte = Encoding.UTF8.GetBytes(toSignStr);
+            var toKey = Convert.FromBase64String(BoxPublicKey);
+            var rsaroot = RSA.Create();
+            rsaroot.ImportSubjectPublicKeyInfo(toKey, out _);
+            var publicKeyParameters = rsaroot.ExportParameters(false);
+            using (var rsa = RSA.Create())
+            {
+                rsa.ImportParameters(publicKeyParameters);
+                var sha256 = SHA256.Create();
+                var hash = sha256.ComputeHash(toSignByte);
+                byte[] endByte = rsa.SignData(toSignByte, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
+                return Convert.ToBase64String(endByte);
+            }
+        }
+
+        #endregion
+
+
+
     }
 }

+ 1 - 11
AppStart/Helper/SetFeeFlagService.cs

@@ -37,17 +37,7 @@ namespace MySystem
                         {
                             function.WritePage("/Fee/", "check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString("HH:mm:ss"));
                             WebCMSEntities db = new WebCMSEntities();
-                            List<int> BrandIds = new List<int>();
-                            BrandIds.Add(1);
-                            BrandIds.Add(2);
-                            BrandIds.Add(3);
-                            BrandIds.Add(4);
-                            BrandIds.Add(5);
-                            BrandIds.Add(7);
-                            BrandIds.Add(8);
-                            BrandIds.Add(9);
-                            BrandIds.Add(10);
-                            BrandIds.Add(11);
+                            List<int> BrandIds = db.KqProducts.Where(m => m.Status > 0).ToList().Select(m => m.Id).ToList();
                             var date = DateTime.Now.AddDays(-118);
                             bool op = true;
                             int StartId = 0;

+ 1 - 1
AppStart/Helper/StatService.cs

@@ -1413,7 +1413,7 @@ namespace MySystem
                                 }
                             }
                         }
-                        else if(trade.ProductType == "10") //联动
+                        else if(trade.ProductType == "10" || trade.ProductType == "12") //10联动、12盒易付
                         {
                             if (trade.DigAmt > 0)
                             {

+ 9 - 1
AppStart/Helper/SycnSpServer/SycnSpMerchantService.cs

@@ -37,7 +37,6 @@ namespace MySystem
                         var tran = db.Database.BeginTransaction();
                         try
                         {
-                            // PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Mer.MerNo) ?? new PxcModels.MachineForMerNo();
                             PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == Mer.SnNo) ?? new PxcModels.PosMachinesTwo();
                             if (pos.BindingState == 1 && Mer.Field2 != "解绑")
                             {
@@ -48,6 +47,15 @@ namespace MySystem
                                     TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
                                 }
                                 int BrandId = pos.BrandId;
+                                if (BrandId == 12)
+                                {
+                                    MerchantRecord merinfo = spdb.MerchantRecord.FirstOrDefault(m => m.MerNo == Mer.MerNo);
+                                    if(merinfo != null)
+                                    {
+                                        Mer.MerIdcardNo = merinfo.LegalIdCard;
+                                        Mer.MerName = merinfo.MerName;
+                                    }
+                                }
 
                                 PxcModels.PosMerchantInfo add = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == Mer.MerNo);
                                 if (add == null)

+ 37 - 0
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -76,6 +76,26 @@ namespace MySystem
                                 spdb.SaveChanges();
                             }
                         }
+                        else if (trade.TradeType == "40" && trade.ProductType == "12") //盒易付押金获取
+                        {
+                            if (trade.TradeAmount == 99 || trade.TradeAmount == 199 || trade.TradeAmount == 299)
+                            {
+                                op = false;
+                                PxcModels.MachineForSnNo posFor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == trade.TradeSnNo) ?? new PxcModels.MachineForSnNo();
+                                PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
+                                if (pos != null)
+                                {
+                                    pos.SeoKeyword = trade.TradeAmount.ToString("f2");
+                                    db.SaveChanges();
+                                }
+                                TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
+                                if (edit != null)
+                                {
+                                    edit.Status = 2;
+                                }
+                                spdb.SaveChanges();
+                            }
+                        }
                         if (trade.DiscountRateFlag == "True")
                         {
                             op = false;
@@ -231,6 +251,18 @@ namespace MySystem
                                                 db.SaveChanges();
                                             }
                                         }
+                                        else if (pos.BrandId == 12) //盒易付
+                                        {
+                                            if (trade.BankCardType == "C")
+                                            {
+                                                BankCardType = 1;
+                                            }
+                                            else if (trade.BankCardType == "D")
+                                            {
+                                                BankCardType = 0;
+                                            }
+                                            if (trade.Field3 == "1") QrPayFlag = 1;
+                                        }
                                         int BrandId = pos.BrandId;
                                         // int BrandId = int.Parse(trade.ProductType);
                                         // if (BrandId == 1 && trade.MerNo.StartsWith("M900"))
@@ -262,6 +294,11 @@ namespace MySystem
                                         {
                                             pos.CreditTrade += SourceTradeAmount;
                                         }
+                                        //盒易付
+                                        else if(BankCardType == 1 && trade.TradeType == "0" && pos.BrandId == 12)
+                                        {
+                                            pos.CreditTrade += SourceTradeAmount;
+                                        }
                                         //金控
                                         else if((BankCardType == 1 || BankCardType == 2) && (pos.BrandId == 1 || pos.BrandId == 3))
                                         {

+ 1 - 1
AppStart/Timer/ResetSmallStoreHelper.cs

@@ -118,7 +118,7 @@ public class ResetSmallStoreHelper
             var prelist = db.PreSendStockDetail.Select(m => new { m.Id, m.BrandId, m.ToUserId, m.Status, m.ApplyFlag, m.AuthFlag }).Where(m => m.ToUserId == UserId && m.Status == 1 && m.ApplyFlag == 0 && m.AuthFlag == 1).ToList();
             foreach (var prepos in prelist)
             {
-                if (prepos.BrandId == 1 || prepos.BrandId == 2 || prepos.BrandId == 4 || prepos.BrandId == 6 || prepos.BrandId == 7 || prepos.BrandId == 8 || prepos.BrandId == 10)
+                if (prepos.BrandId == 1 || prepos.BrandId == 2 || prepos.BrandId == 4 || prepos.BrandId == 6 || prepos.BrandId == 7 || prepos.BrandId == 8 || prepos.BrandId == 10 || prepos.BrandId == 12)
                 {
                     if (ProfitAmount > 200)
                     {

+ 5 - 5
AppStart/Timer/StoreApplyHelper.cs

@@ -101,7 +101,7 @@ public class StoreApplyHelper
             usercondition = " and UserId=" + UId;
         }
         //上月出货额度
-        DataTable dt = CustomerSqlConn.dtable("select StoreId,count(Id) from StoreStockChange where Id>=528358 and CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (1,2,4,6,7,8,10) and TransType in (10,11,2) and StoreId>0" + condition + " group by StoreId", connstr);
+        DataTable dt = CustomerSqlConn.dtable("select StoreId,count(Id) from StoreStockChange where Id>=528358 and CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (1,2,4,6,7,8,10,12) and TransType in (10,11,2) and StoreId>0" + condition + " group by StoreId", connstr);
         foreach(DataRow dr in dt.Rows)
         {
             int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
@@ -176,7 +176,7 @@ public class StoreApplyHelper
             }
             decimal AmountMore = 0;
             //仓库中机具占用额度+小分仓机具占用额度
-            DataTable dtmore = CustomerSqlConn.dtable("select count(Id)*200 from PosMachinesTwo pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + " and Sort=0) and BuyUserId=0 and BrandId in (1,2,4,6,7,8,10) and `Status`>-1", connstr);
+            DataTable dtmore = CustomerSqlConn.dtable("select count(Id)*200 from PosMachinesTwo pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + " and Sort=0) and BuyUserId=0 and BrandId in (1,2,4,6,7,8,10,12) and `Status`>-1", connstr);
             if(dtmore.Rows.Count > 0)
             {
                 AmountMore += decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
@@ -187,7 +187,7 @@ public class StoreApplyHelper
                 AmountMore += decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
             }
             //除开小分仓中带“授”标记机具占用额度
-            dtmore = CustomerSqlConn.dtable("select count(Id)*200 from PreSendStockDetail pos where FromStoreId in (select Id from StoreHouse where UserId=" + UserId + " and Sort=0) and BrandId in (1,2,4,6,7,8,10) and AuthFlag=1 and ApplyFlag=0 and `Status`>-1 and `Status`<2", connstr);
+            dtmore = CustomerSqlConn.dtable("select count(Id)*200 from PreSendStockDetail pos where FromStoreId in (select Id from StoreHouse where UserId=" + UserId + " and Sort=0) and BrandId in (1,2,4,6,7,8,10,12) and AuthFlag=1 and ApplyFlag=0 and `Status`>-1 and `Status`<2", connstr);
             if(dtmore.Rows.Count > 0)
             {
                 AmountMore -= decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
@@ -304,7 +304,7 @@ public class StoreApplyHelper
                                 if(prepos.AuthFlag == 0)
                                 {
                                     PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == SnId) ?? new PosMachinesTwo();
-                                    if(pos.BrandId == 1 || pos.BrandId == 2 || pos.BrandId == 4 || pos.BrandId == 6 || pos.BrandId == 7 || pos.BrandId == 8 || pos.BrandId == 10)
+                                    if(pos.BrandId == 1 || pos.BrandId == 2 || pos.BrandId == 4 || pos.BrandId == 6 || pos.BrandId == 7 || pos.BrandId == 8 || pos.BrandId == 10 || pos.BrandId == 12)
                                     {
                                         Amount += 200;
                                     }
@@ -331,7 +331,7 @@ public class StoreApplyHelper
                         if(store != null)
                         {
                             decimal Amount = 0;
-                            if(BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6 || BrandId == 7 || BrandId == 8 || BrandId == 10)
+                            if(BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6 || BrandId == 7 || BrandId == 8 || BrandId == 10 || BrandId == 12)
                             {
                                 Amount += 200 * OpStoreNum;
                             }

+ 9 - 1
SpModels/KssMerchant.cs

@@ -5,7 +5,15 @@ namespace MySystem.SpModels
 {
     public partial class KssMerchant
     {
-        public string MerNo { get; set; }
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
         public DateTime? UpdateTime { get; set; }
         public DateTime? CreateTime { get; set; }
         public string Remark { get; set; }

+ 42 - 0
SpModels/MerchantRecord.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.SpModels
+{
+    public partial class MerchantRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string Areas { get; set; }
+        public string City { get; set; }
+        public string Province { get; set; }
+        public string LegalIdCard { get; set; }
+        public string LegalName { get; set; }
+        public string AgentNo { get; set; }
+        public string Field5 { get; set; }
+        public string Field4 { get; set; }
+        public string Field3 { get; set; }
+        public string Field2 { get; set; }
+        public string Field1 { get; set; }
+        public string ChannelSerial { get; set; }
+        public DateTime? UpdateTime { get; set; }
+        public DateTime? CreateTime { get; set; }
+        public string Remark { get; set; }
+        public string MerNewSnNo { get; set; }
+        public string ProductType { get; set; }
+        public string MerStatus { get; set; }
+        public string MerOperateType { get; set; }
+        public DateTime? MerOperateDate { get; set; }
+        public string MerSnNo { get; set; }
+        public string MerName { get; set; }
+        public string AgentName { get; set; }
+        public string MerNo { get; set; }
+    }
+}

+ 3 - 0
SpModels/TradeFluxRecord.cs

@@ -40,5 +40,8 @@ namespace MySystem.SpModels
         public string MerName { get; set; }
         public string TradeSerialNo { get; set; }
         public string MerNo { get; set; }
+        public string Field3 { get; set; }
+        public string Field2 { get; set; }
+        public string Field1 { get; set; }
     }
 }

+ 194 - 9
SpModels/WebCMSEntities.cs

@@ -31,6 +31,7 @@ namespace MySystem.SpModels
         public virtual DbSet<KssReturnDeposit> KssReturnDeposit { get; set; }
         public virtual DbSet<KssStageRwd> KssStageRwd { get; set; }
         public virtual DbSet<KssTradeFirst> KssTradeFirst { get; set; }
+        public virtual DbSet<MerchantRecord> MerchantRecord { get; set; }
         public virtual DbSet<Merchants> Merchants { get; set; }
         public virtual DbSet<ProfitRecord> ProfitRecord { get; set; }
         public virtual DbSet<RightDic> RightDic { get; set; }
@@ -185,6 +186,9 @@ namespace MySystem.SpModels
 
             modelBuilder.Entity<BindRecord>(entity =>
             {
+                entity.HasIndex(e => new { e.MerSnNo, e.MerNo })
+                    .HasName("BindRecordIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.AgentName)
@@ -1184,13 +1188,7 @@ namespace MySystem.SpModels
 
             modelBuilder.Entity<KssMerchant>(entity =>
             {
-                entity.HasKey(e => e.MerNo)
-                    .HasName("PRIMARY");
-
-                entity.Property(e => e.MerNo)
-                    .HasColumnType("varchar(32)")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
+                entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.AgentName)
                     .HasColumnType("varchar(64)")
@@ -1202,6 +1200,8 @@ namespace MySystem.SpModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
                 entity.Property(e => e.CreateTime).HasColumnType("datetime");
 
                 entity.Property(e => e.MerAuditDate).HasColumnType("datetime");
@@ -1243,11 +1243,34 @@ namespace MySystem.SpModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
                 entity.Property(e => e.Remark)
                     .HasColumnType("varchar(64)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
                 entity.Property(e => e.UpdateTime).HasColumnType("datetime");
             });
 
@@ -1452,8 +1475,152 @@ namespace MySystem.SpModels
                 entity.Property(e => e.UpdateTime).HasColumnType("datetime");
             });
 
+            modelBuilder.Entity<MerchantRecord>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AgentName)
+                    .HasColumnType("varchar(64)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.AgentNo)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Areas)
+                    .HasColumnType("varchar(30)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ChannelSerial)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.City)
+                    .HasColumnType("varchar(30)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.CreateTime).HasColumnType("datetime");
+
+                entity.Property(e => e.Field1)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Field2)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Field3)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Field4)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Field5)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.LegalIdCard)
+                    .HasColumnType("varchar(30)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.LegalName)
+                    .HasColumnType("varchar(30)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerName)
+                    .HasColumnType("varchar(32)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerNewSnNo)
+                    .HasColumnType("varchar(32)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerNo)
+                    .HasColumnType("varchar(32)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerOperateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.MerOperateType)
+                    .HasColumnType("varchar(16)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerSnNo)
+                    .HasColumnType("varchar(32)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerStatus)
+                    .HasColumnType("varchar(16)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ProductType)
+                    .HasColumnType("varchar(32)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Province)
+                    .HasColumnType("varchar(30)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(64)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.UpdateTime).HasColumnType("datetime");
+            });
+
             modelBuilder.Entity<Merchants>(entity =>
             {
+                entity.HasIndex(e => e.MerNo)
+                    .HasName("MerchantsIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.AgentName)
@@ -1831,6 +1998,21 @@ namespace MySystem.SpModels
 
                 entity.Property(e => e.FeeAmount).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.Field1)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Field2)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Field3)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.InputModel)
                     .HasColumnType("varchar(32)")
                     .HasCharSet("utf8")
@@ -1859,7 +2041,7 @@ namespace MySystem.SpModels
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
                 entity.Property(e => e.SeoDescription)
-                    .HasColumnType("varchar(500)")
+                    .HasColumnType("varchar(2000)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -1907,7 +2089,7 @@ namespace MySystem.SpModels
                     .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.TradeSerialNo)
-                    .HasColumnType("varchar(32)")
+                    .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -1931,6 +2113,9 @@ namespace MySystem.SpModels
 
             modelBuilder.Entity<TradeRecord>(entity =>
             {
+                entity.HasIndex(e => new { e.TradeSnNo, e.ProductType, e.MerNo })
+                    .HasName("TradeRecordIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.AgentNo)