DuGuYang 1 vuosi sitten
vanhempi
commit
279de56c46

+ 133 - 0
Areas/Api/Controllers/SysAdminController.cs

@@ -13,6 +13,7 @@ using LitJson;
 using Microsoft.AspNetCore.Authorization;
 using MySystem.Service.Bs;
 using System.Linq;
+using MySystem.Service.Main1;
 
 namespace MySystem.Areas.Api.Controllers.v1
 {
@@ -335,5 +336,137 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         #endregion
 
+
+        #region 系统管理-润观米好哒账户信息-账户余额查询
+        [Authorize]
+        public JsonResult QueryAccountBalance(string value)
+        {
+            value = PublicFunction.DesDecrypt(value); ;
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = QueryAccountBalanceDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
+        }
+        private Dictionary<string, object> QueryAccountBalanceDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            JsonData dic = JsonMapper.ToObject(HaoDaHelper.Instance.QueryAccountBalance("230817000000000278"));
+            Obj.Add("Balance", dic["data"]["total"].ToString()); //账户余额
+            Obj.Add("WithdrawalAmount", SysWithdrawalApplyRecordService.Sum(" and Status=0", "QueryCount")); //提现中金额
+            Obj.Add("WithdrawnAmount", SysWithdrawalApplyRecordService.Sum(" and Status=1", "QueryCount")); //已提现金额
+
+            return Obj;
+        }
+        #endregion
+
+
+        #region 系统管理-润观米好哒账户信息-提交提现申请
+        [Authorize]
+        public JsonResult WithdrawalApply(string value)
+        {
+            value = PublicFunction.DesDecrypt(value); ;
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = WithdrawalApplyDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson WithdrawalApplyDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string Amount = data["Amount"].ToString(); //提现金额
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var ApplyNo = "TX" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
+            JsonData dic = JsonMapper.ToObject(HaoDaHelper.Instance.ApplyWithdrawal(ApplyNo, "230817000000000278", Amount));
+            if (dic["resultCode"].ToString() == "1")
+            {
+                Dictionary<string, object> fields = new Dictionary<string, object>();
+                fields.Add("CreateMan", AppConfig.LoginSession.sysAdminName + "_" + AppConfig.LoginSession.sysRealName);
+                fields.Add("SeoTitle", Amount);
+                fields.Add("AccountNo", "230817000000000278");
+                fields.Add("ApplyNo", ApplyNo);
+                SysWithdrawalApplyRecordService.Add(fields, false);
+                return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "", Data = Obj };
+            }
+        }
+        #endregion
+
+
+        #region 系统管理-润观米好哒账户信息-查询提现订单状态
+        [Authorize]
+        public JsonResult QueryWithdrawalStatus(string value)
+        {
+            value = PublicFunction.DesDecrypt(value); ;
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = QueryWithdrawalStatusDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
+        }
+        private Dictionary<string, object> QueryWithdrawalStatusDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string ApplyNo = data["ApplyNo"].ToString(); //提现申请单号
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            JsonData dic = JsonMapper.ToObject(HaoDaHelper.Instance.QueryApplyWithdrawalStatus(ApplyNo, "230817000000000278"));
+            Obj.Add("Status", int.Parse(dic["resultCode"].ToString())); //状态(0 提现成功 1 提现中 2 提现失败)
+
+            return Obj;
+        }
+        #endregion
+
+
+        #region 系统管理-润观米好哒账户信息-提现申请记录
+        [Authorize]
+        public JsonResult WithdrawalApplyRecordList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value); ;
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = WithdrawalApplyRecordListDo(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        private List<Dictionary<string, object>> WithdrawalApplyRecordListDo(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string ApplyNo = data["ApplyNo"].ToString(); //提现申请单号
+            string CreateDate = data["CreateDate"].ToString(); //提现申请时间
+            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            string condition = "";
+            if (!string.IsNullOrEmpty(data["ApplyNo"].ToString()))
+            {
+                condition += " and ApplyNo='" + ApplyNo + "'";
+            }
+            if (!string.IsNullOrEmpty(data["CreateDate"].ToString()))
+            {
+                string[] datelist = CreateDate.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            Other = new Dictionary<string, object>();
+            int count = 0;
+            List<Dictionary<string, object>> source = SysWithdrawalApplyRecordService.List(relationData, condition, out count, pageNum, pageSize);
+            foreach (Dictionary<string, object> subdata in source)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("Id", int.Parse(subdata["Id"].ToString())); //Id
+                curData.Add("Status", int.Parse(subdata["Status"].ToString())); //状态(0 提现成功 1 提现中 2 提现失败)
+                curData.Add("ApplyNo", subdata["ApplyNo"].ToString()); //提现申请单号
+                curData.Add("Amount", decimal.Parse(subdata["SeoTitle"].ToString())); //提现金额
+                curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //提现申请时间
+                curData.Add("UpdateDate", subdata["UpdateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["UpdateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //提现到账时间
+                curData.Add("Operator", subdata["CreateMan"].ToString()); //操作人
+
+                dataList.Add(curData);
+            }
+            Other.Add("Count", count); //总数
+            return dataList;
+        }
+        #endregion
+
     }
 }

+ 2 - 0
Models/Main1/ConsumerOrders.cs

@@ -30,6 +30,8 @@ namespace MySystem.Models.Main1
         public int UserId { get; set; }
         public decimal MerchantActualAmount { get; set; }
         public string DivideLog { get; set; }
+        public string TradePayNo { get; set; }
+        public int SetRecordId { get; set; }
         public int DivideFlag { get; set; }
         public DateTime? DivideDate { get; set; }
     }

+ 24 - 0
Models/Main1/CustomQuery.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main1
+{
+    public partial class CustomQuery
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string AdminNames { get; set; }
+        public string Title { get; set; }
+        public string SqlContent { get; set; }
+    }
+}

+ 21 - 0
Models/Main1/ExportExcels.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main1
+{
+    public partial class ExportExcels
+    {
+        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 FileName { get; set; }
+        public int SysId { get; set; }
+        public string FileUrl { get; set; }
+    }
+}

+ 1 - 0
Models/Main1/MerchantAddInfo.cs

@@ -144,5 +144,6 @@ namespace MySystem.Models.Main1
         public string OutMchtNo { get; set; }
         public string AliMerchantId { get; set; }
         public string WeChatMerchantId { get; set; }
+        public string MerchantType { get; set; }
     }
 }

+ 34 - 0
Models/Main1/MerchantParamSetRecord.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main1
+{
+    public partial class MerchantParamSetRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int AfterDiviPersons { get; set; }
+        public decimal AfterDiviPercent { get; set; }
+        public int AfterProfitDays { get; set; }
+        public decimal AfterGetPercent { get; set; }
+        public decimal AfterMinPayMoney { get; set; }
+        public int AfterIsAll { get; set; }
+        public int MerchantId { get; set; }
+        public int BeforeDiviPersons { get; set; }
+        public decimal BeforeDiviPercent { get; set; }
+        public int BeforeProfitDays { get; set; }
+        public decimal BeforeGetPercent { get; set; }
+        public decimal BeforeMinPayMoney { get; set; }
+        public int BeforeIsAll { get; set; }
+    }
+}

+ 23 - 0
Models/Main1/SysWithdrawalApplyRecord.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main1
+{
+    public partial class SysWithdrawalApplyRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string AccountNo { get; set; }
+        public string ApplyNo { get; set; }
+    }
+}

+ 321 - 0
Models/Main1/WebCMSEntities.cs

@@ -48,8 +48,10 @@ namespace MySystem.Models.Main1
         public virtual DbSet<CouponAssignRecords> CouponAssignRecords { get; set; }
         public virtual DbSet<Coupons> Coupons { get; set; }
         public virtual DbSet<CouponsForUser> CouponsForUser { get; set; }
+        public virtual DbSet<CustomQuery> CustomQuery { get; set; }
         public virtual DbSet<CustomTagSet> CustomTagSet { get; set; }
         public virtual DbSet<ErpCompanys> ErpCompanys { get; set; }
+        public virtual DbSet<ExportExcels> ExportExcels { get; set; }
         public virtual DbSet<FileUpdateInfo> FileUpdateInfo { get; set; }
         public virtual DbSet<FluxProfitDetail> FluxProfitDetail { get; set; }
         public virtual DbSet<FluxProfitSummary> FluxProfitSummary { get; set; }
@@ -103,6 +105,7 @@ namespace MySystem.Models.Main1
         public virtual DbSet<MerchantInfo> MerchantInfo { get; set; }
         public virtual DbSet<MerchantLoginInfo> MerchantLoginInfo { get; set; }
         public virtual DbSet<MerchantParamSet> MerchantParamSet { get; set; }
+        public virtual DbSet<MerchantParamSetRecord> MerchantParamSetRecord { get; set; }
         public virtual DbSet<MerchantQrCode> MerchantQrCode { get; set; }
         public virtual DbSet<MerchantRebateDetail> MerchantRebateDetail { get; set; }
         public virtual DbSet<MerchantTradeSummary> MerchantTradeSummary { get; set; }
@@ -214,6 +217,7 @@ namespace MySystem.Models.Main1
         public virtual DbSet<SysAdminRole> SysAdminRole { get; set; }
         public virtual DbSet<SysLog> SysLog { get; set; }
         public virtual DbSet<SysRechargeRecord> SysRechargeRecord { get; set; }
+        public virtual DbSet<SysWithdrawalApplyRecord> SysWithdrawalApplyRecord { get; set; }
         public virtual DbSet<SystemSet> SystemSet { get; set; }
         public virtual DbSet<TeamApply> TeamApply { get; set; }
         public virtual DbSet<TeamApplyForTeamName> TeamApplyForTeamName { get; set; }
@@ -2311,6 +2315,10 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.SetRecordId)
+                    .HasColumnType("int(11)")
+                    .HasComment("活动记录Id");
+
                 entity.Property(e => e.SnNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -2320,6 +2328,12 @@ namespace MySystem.Models.Main1
 
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
+                entity.Property(e => e.TradePayNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("支付交易号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.UpdateDate).HasColumnType("datetime");
 
                 entity.Property(e => e.UpdateMan)
@@ -2741,6 +2755,82 @@ namespace MySystem.Models.Main1
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<CustomQuery>(entity =>
+            {
+                entity.HasComment("自定义查询");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AdminNames)
+                    .HasColumnType("varchar(500)")
+                    .HasComment("后台账号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                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)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.SqlContent)
+                    .HasColumnType("mediumtext")
+                    .HasComment("sql语句")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.Title)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("标题")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<CustomTagSet>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -2855,6 +2945,48 @@ namespace MySystem.Models.Main1
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<ExportExcels>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.FileName)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.FileUrl)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                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.SysId).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
             modelBuilder.Entity<FileUpdateInfo>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -5518,6 +5650,12 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.MerchantType)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("商户类型")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.MiniProgramAppid)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -6956,6 +7094,116 @@ namespace MySystem.Models.Main1
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<MerchantParamSetRecord>(entity =>
+            {
+                entity.HasComment("商户活动配置历史记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AfterDiviPercent)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("修改后最大分红比例");
+
+                entity.Property(e => e.AfterDiviPersons)
+                    .HasColumnType("int(11)")
+                    .HasComment("修改后单笔订单分红人数");
+
+                entity.Property(e => e.AfterGetPercent)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("修改后商家实收比例");
+
+                entity.Property(e => e.AfterIsAll)
+                    .HasColumnType("int(11)")
+                    .HasComment("修改后是否收全额");
+
+                entity.Property(e => e.AfterMinPayMoney)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("修改后订单参与门槛");
+
+                entity.Property(e => e.AfterProfitDays)
+                    .HasColumnType("int(11)")
+                    .HasComment("修改后分红期限(天)");
+
+                entity.Property(e => e.BeforeDiviPercent)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("修改前最大分红比例");
+
+                entity.Property(e => e.BeforeDiviPersons)
+                    .HasColumnType("int(11)")
+                    .HasComment("修改前单笔订单分红人数");
+
+                entity.Property(e => e.BeforeGetPercent)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("修改前商家实收比例");
+
+                entity.Property(e => e.BeforeIsAll)
+                    .HasColumnType("int(11)")
+                    .HasComment("修改前是否收全额");
+
+                entity.Property(e => e.BeforeMinPayMoney)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("修改前订单参与门槛");
+
+                entity.Property(e => e.BeforeProfitDays)
+                    .HasColumnType("int(11)")
+                    .HasComment("修改前分红期限(天)");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerchantId)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户Id");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                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)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<MerchantQrCode>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -14833,6 +15081,76 @@ namespace MySystem.Models.Main1
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<SysWithdrawalApplyRecord>(entity =>
+            {
+                entity.HasComment("润观米提现申请记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AccountNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("账户号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ApplyNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("申请单号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                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)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<SystemSet>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -16258,6 +16576,9 @@ namespace MySystem.Models.Main1
 
             modelBuilder.Entity<UserAmountSummary>(entity =>
             {
+                entity.HasIndex(e => new { e.UserId, e.IsAct, e.TradeMonth, e.TradeDate, e.SeoTitle })
+                    .HasName("UserAmountSummaryIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.CreateDate).HasColumnType("datetime");

+ 406 - 0
Service/HaoDa/HaoDaHelper.cs

@@ -0,0 +1,406 @@
+using System.Net.Mime;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using Library;
+using System.Net;
+using System.IO;
+using Aop.Api.Util;
+using LitJson;
+
+namespace MySystem
+{
+    /// <summary>
+    /// 好哒相关接口
+    /// </summary>
+    public class HaoDaHelper
+    {
+        public readonly static HaoDaHelper Instance = new HaoDaHelper();
+        private HaoDaHelper()
+        {
+        }
+
+        #region 盒易付
+
+        //测试环境
+        // string BoxRequestUrl = "https://openapi-test.iboxpay.com";
+        // string BoxAppId = "AT7317781468267548672";
+        // string BoxAppSecret = "OfWuHQdhQfnE8NaF4xdtgk4B9CYqnbri";
+        // string BoxPublicKey = "";
+        // string BrhCode = "001040";
+
+        //生产环境
+        string BoxRequestUrl = "https://openapi.iboxpay.com";
+        string BoxAppId = "AP7175619323825451008";
+        string BoxAppSecret = "hUfR53gdjyfiZTBR5bILanMqRD1dXD7y";
+        string BoxPublicKey = "";
+        public static string BrhCode = "030145";
+
+        /// <summary>
+        /// 分账接收方账户余额查询
+        /// </summary>
+        /// <param name="acctNo">账户号</param>
+        /// <returns></returns>
+        public string QueryAccountBalance(string acctNo)
+        {
+            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账接收方账户余额查询");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+
+            reqdic.Add("acctNo", acctNo); // 账户号	
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            LogHelper.Instance.WriteLog(req, "好哒分账接收方账户余额查询");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账接收方账户余额查询");
+            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账接收方账户余额查询");
+            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/balance/get", "好哒分账接收方账户余额查询");
+            string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/acct/balance/get", req, headdic);
+            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账接收方账户余额查询");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 分账接收方提现申请
+        /// </summary>
+        /// <param name="applyNo">申请批次号</param>
+        /// <param name="acctNo">账户号</param>
+        /// <param name="amount">提现金额(分)</param>
+        /// <returns></returns>
+        public string ApplyWithdrawal(string applyNo, string acctNo, string amount)
+        {
+            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账接收方提现申请");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+
+            reqdic.Add("applyNo", applyNo); // 申请批次号	
+            reqdic.Add("acctNo", acctNo); // 账户号	
+            reqdic.Add("amount", amount); // 提现金额(分)	
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            LogHelper.Instance.WriteLog(req, "好哒分账接收方提现申请");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账接收方提现申请");
+            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账接收方提现申请");
+            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/withdrawal/apply", "好哒分账接收方提现申请");
+            string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/acct/withdrawal/apply", req, headdic);
+            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账接收方提现申请");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 分账接收方提现结果查询
+        /// </summary>
+        /// <param name="applyNo">申请批次号</param>
+        /// <param name="acctNo">账户号</param>
+        /// <returns></returns>
+        public string QueryApplyWithdrawalStatus(string applyNo, string acctNo)
+        {
+            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒分账接收方提现结果查询");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+
+            reqdic.Add("applyNo", applyNo); // 申请批次号	
+            reqdic.Add("acctNo", acctNo); // 账户号	
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            LogHelper.Instance.WriteLog(req, "好哒分账接收方提现结果查询");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒分账接收方提现结果查询");
+            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒分账接收方提现结果查询");
+            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/part/acct/withdrawal/query", "好哒分账接收方提现结果查询");
+            string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/part/acct/withdrawal/query", req, headdic);
+            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒分账接收方提现结果查询");
+
+            return result;
+        }
+
+        public Dictionary<string, string> GetHeader(string req)
+        {
+            Dictionary<string, string> headdic = new Dictionary<string, string>();
+            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");
+            headdic.Add("X-Sign", SHA256Sign(timestamp + BoxAppSecret + req));
+            return headdic;
+        }
+
+        public string SHA256Sign(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 VerifySign(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 SignData(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);
+            }
+        }
+
+        private string PostWebRequest(string postUrl, string paramData, Dictionary<string, string> headers)
+        {
+            string ret = string.Empty;
+            try
+            {
+                LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "请求好哒API日志");
+                LogHelper.Instance.WriteLog(postUrl, "请求好哒API日志");
+                LogHelper.Instance.WriteLog(paramData, "请求好哒API日志");
+                byte[] postData = System.Text.Encoding.UTF8.GetBytes(paramData);
+                // 设置提交的相关参数 
+                System.Net.HttpWebRequest request = System.Net.WebRequest.Create(postUrl) as System.Net.HttpWebRequest;
+                System.Text.Encoding myEncoding = System.Text.Encoding.UTF8;
+                request.Method = "POST";
+                request.KeepAlive = false;
+                request.AllowAutoRedirect = true;
+                request.ContentType = "application/json";
+                foreach (string key in headers.Keys)
+                {
+                    request.Headers.Add(key, headers[key]);
+                }
+                request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR  3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)";
+
+                request.ContentLength = postData.Length;
+
+                // 提交请求数据 
+                System.IO.Stream outputStream = request.GetRequestStream();
+                outputStream.Write(postData, 0, postData.Length);
+                outputStream.Close();
+                System.Net.HttpWebResponse response;
+                System.IO.Stream responseStream;
+                System.IO.StreamReader reader;
+                string srcString;
+                response = request.GetResponse() as System.Net.HttpWebResponse;
+                responseStream = response.GetResponseStream();
+                reader = new System.IO.StreamReader(responseStream, System.Text.Encoding.UTF8);
+                srcString = reader.ReadToEnd();
+                ret = srcString;   //返回值赋值
+                reader.Close();
+                LogHelper.Instance.WriteLog(srcString, "请求好哒API日志");
+            }
+            catch (System.Net.WebException ex)
+            {
+                System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)ex.Response;
+                System.IO.Stream myResponseStream = response.GetResponseStream();
+                //获取响应内容
+                System.IO.StreamReader myStreamReader = new System.IO.StreamReader(myResponseStream);
+                ret = myStreamReader.ReadToEnd();
+                myResponseStream.Close();
+            }
+            catch (Exception ex)
+            {
+                ret = "fail";
+                LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "请求好哒API异常");
+            }
+            return ret;
+        }
+
+        /// <summary>
+        /// 获取文件令牌接口
+        /// </summary>
+        /// <param name="fileName">文件名</param>
+        /// <param name="action">操作类型 0 上传图片</param>
+        /// <returns></returns>
+        public string GetToken(string fileName, string action)
+        {
+            LogHelper.Instance.WriteLog(DateTime.Now.ToString(), "好哒获取文件令牌接口");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+
+            reqdic.Add("fileName", fileName); // 文件名	
+            reqdic.Add("action", action); // 操作类型 0 上传图片
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            LogHelper.Instance.WriteLog(req, "好哒获取文件令牌接口");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            LogHelper.Instance.WriteLog("请求头\n" + head, "好哒获取文件令牌接口");
+            LogHelper.Instance.WriteLog("请求参数\n" + req, "好哒获取文件令牌接口");
+            LogHelper.Instance.WriteLog("请求地址:" + BoxRequestUrl + "/api/auth/v1/get_file_token", "好哒获取文件令牌接口");
+            string result = PostWebRequest(BoxRequestUrl + "/api/auth/v1/get_file_token", req, headdic);
+            LogHelper.Instance.WriteLog("返回\n" + result + "\n\n", "好哒获取文件令牌接口");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 执行带文件上传的HTTP POST请求。
+        /// </summary>
+        /// <param name="url">请求地址</param>
+        /// <param name="textParams">请求文本参数</param>
+        /// <param name="fileParams">请求文件参数</param>
+        /// <param name="charset">编码字符集</param>
+        /// <returns>HTTP响应</returns>
+        public string DoPost(string url, string token, IDictionary<string, string> textParams, IDictionary<string, FileItem> fileParams, string charset = "utf-8")
+        {
+            // 如果没有文件参数,则走普通POST请求
+            if (fileParams == null || fileParams.Count == 0)
+            {
+                return "";
+            }
+
+            string boundary = DateTime.Now.Ticks.ToString("X"); // 随机分隔线
+
+            HttpWebRequest req = GetWebRequest(url, "POST");
+            req.Headers.Add("X-File-Token", token);
+            req.ContentType = "multipart/form-data;charset=" + charset + ";boundary=" + boundary;
+
+            Stream reqStream = req.GetRequestStream();
+            byte[] itemBoundaryBytes = Encoding.GetEncoding(charset).GetBytes("\r\n--" + boundary + "\r\n");
+            byte[] endBoundaryBytes = Encoding.GetEncoding(charset).GetBytes("\r\n--" + boundary + "--\r\n");
+
+            // 组装文本请求参数
+            string textTemplate = "Content-Disposition:form-data;name=\"{0}\"\r\nContent-Type:text/plain\r\n\r\n{1}";
+            IEnumerator<KeyValuePair<string, string>> textEnum = textParams.GetEnumerator();
+            while (textEnum.MoveNext())
+            {
+                string textEntry = string.Format(textTemplate, textEnum.Current.Key, textEnum.Current.Value);
+                byte[] itemBytes = Encoding.GetEncoding(charset).GetBytes(textEntry);
+                reqStream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
+                reqStream.Write(itemBytes, 0, itemBytes.Length);
+            }
+
+            // 组装文件请求参数
+            string fileTemplate = "Content-Disposition:form-data;name=\"{0}\";filename=\"{1}\"\r\nContent-Type:{2}\r\n\r\n";
+            IEnumerator<KeyValuePair<string, FileItem>> fileEnum = fileParams.GetEnumerator();
+            while (fileEnum.MoveNext())
+            {
+                string key = fileEnum.Current.Key;
+                FileItem fileItem = fileEnum.Current.Value;
+                string fileEntry = string.Format(fileTemplate, key, fileItem.GetFileName(), fileItem.GetMimeType());
+                byte[] itemBytes = Encoding.GetEncoding(charset).GetBytes(fileEntry);
+                reqStream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
+                reqStream.Write(itemBytes, 0, itemBytes.Length);
+
+                byte[] fileBytes = fileItem.GetContent();
+                reqStream.Write(fileBytes, 0, fileBytes.Length);
+            }
+
+            reqStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
+            reqStream.Close();
+
+            HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
+            Encoding encoding = Encoding.GetEncoding(rsp.CharacterSet);
+            return GetResponseAsString(rsp, encoding);
+        }
+
+        public HttpWebRequest GetWebRequest(string url, string method)
+        {
+            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
+            req.ServicePoint.Expect100Continue = false;
+            req.Method = method;
+            req.KeepAlive = true;
+            req.Timeout = 100000;
+            return req;
+        }
+
+        /// <summary>
+        /// 把响应流转换为文本。
+        /// </summary>
+        /// <param name="rsp">响应流对象</param>
+        /// <param name="encoding">编码方式</param>
+        /// <returns>响应文本</returns>
+        public string GetResponseAsString(HttpWebResponse rsp, Encoding encoding)
+        {
+            StringBuilder result = new StringBuilder();
+            Stream stream = null;
+            StreamReader reader = null;
+
+            try
+            {
+                // 以字符流的方式读取HTTP响应
+                stream = rsp.GetResponseStream();
+                reader = new StreamReader(stream, encoding);
+
+                // 按字符读取并写入字符串缓冲
+                int ch = -1;
+                while ((ch = reader.Read()) > -1)
+                {
+                    // 过滤结束符
+                    char c = (char)ch;
+                    if (c != '\0')
+                    {
+                        result.Append(c);
+                    }
+                }
+            }
+            finally
+            {
+                // 释放资源
+                if (reader != null) reader.Close();
+                if (stream != null) stream.Close();
+                if (rsp != null) rsp.Close();
+            }
+
+            return result.ToString();
+        }
+
+
+        /// <summary>
+        /// 获取好哒开放平台文件名
+        /// </summary>
+        /// <param name="token">上传图片凭证token</param>
+        /// <param name="value">图片路径</param>
+        /// <returns></returns>
+        public string ReturnFileName(string token, string value)
+        {
+            Dictionary<string, string> file = new Dictionary<string, string>();
+            file.Add("fileName", value.Substring(value.LastIndexOf("/")).Trim('/'));
+            if (string.IsNullOrEmpty(value.Split(',')[0]))
+            {
+                return "";
+            }
+            FileItem item = new FileItem(function.getPath(value.Split(',')[0]));
+            Dictionary<string, FileItem> files = new Dictionary<string, FileItem>();
+            files.Add("file", item);
+            var upLoadInfo = JsonMapper.ToObject(HaoDaHelper.Instance.DoPost(BoxRequestUrl + "/api/file/v1/upload_file", token, file, files, "utf-8"));
+            if (upLoadInfo["code"].ToString() == "1")
+            {
+                return upLoadInfo["data"]["fileName"].ToString();
+            }
+            else
+            {
+                return "false";
+            }
+        }
+
+        #endregion
+
+    }
+}

+ 79 - 0
Service/HaoDa/LogHelper.cs

@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using Library;
+using LitJson;
+using MySystem;
+
+public class LogHelper
+{
+    public readonly static LogHelper Instance = new LogHelper();
+    private LogHelper()
+    { }
+
+    string[] BlackList = { "好哒查询商户审核状态", "好哒查询实名认证状态", "好哒分账交易详情查询", "间连商户开户意愿确认(提交申请单)查询申请单状态-请求参数", "查询支付宝商家认证申请单状态", "查询支付宝商户意愿申请状态", "获取微信商户开户意愿确认状态", "获取支付宝商家认证状态" };
+
+    public void WriteLog(string Content, string FileName, string BrandId = "0")
+    {
+        if(BlackList.Contains(FileName))
+        {
+            string key = function.MD532(Content + FileName);
+            if(!string.IsNullOrEmpty(RedisDbconn.Instance.Get<string>(key)))
+            {
+                return;
+            }
+            RedisDbconn.Instance.Set(key, "1");
+            RedisDbconn.Instance.SetExpire(key, 600);
+        }
+        function.WriteLog(Content, FileName);
+        // Dictionary<string, string> dic = new Dictionary<string, string>();
+        // dic.Add("Topic", FileName);
+        // dic.Add("Content", Content);
+        // dic.Add("BrandId", BrandId);
+        // RedisDbconn.Instance.AddList("LogQueue", Newtonsoft.Json.JsonConvert.SerializeObject(dic));
+    }
+
+    public void Start()
+    {
+        Thread th = new Thread(DoWorks);
+        th.IsBackground = true;
+        th.Start();
+    }
+
+    public void DoWorks()
+    {
+        while (true)
+        {
+            string content = RedisDbconn.Instance.RPop<string>("LogQueue");
+            if (!string.IsNullOrEmpty(content))
+            {
+                try
+                {
+                    DoQueue(content);
+                }
+                catch (Exception ex)
+                {
+                    LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + content + "\n" + ex, "SLS日志异常");
+                }
+            }
+            else
+            {
+                Thread.Sleep(5000);
+            }
+        }
+    }
+
+    public void DoQueue(string content)
+    { 
+        // JsonData JsonObj = JsonMapper.ToObject(content);
+        // string Topic = JsonObj["Topic"].ToString();
+        // string Cont = JsonObj["Content"].ToString();
+        // string BrandId = JsonObj["BrandId"].ToString();
+        // SLS.WriteLog(DateTime.Now, Topic, Cont, new Dictionary<string, string>()
+        // {
+        //     {"BrandId", BrandId}
+        // });
+    }
+}

+ 368 - 0
Service/Main1/SysWithdrawalApplyRecordService.cs

@@ -0,0 +1,368 @@
+/*
+ * 润观米账户提现申请记录
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using MySystem.Models.Main1;
+using Library;
+using LitJson;
+
+namespace MySystem.Service.Main1
+{
+    public class SysWithdrawalApplyRecordService
+    {
+        static string _conn = ConfigurationManager.AppSettings["SqlConnStr1"].ToString();
+
+        /// <summary>
+        /// 查询列表(适合多表关联查询)
+        /// </summary>
+        /// <param name="relationData">关联表</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="count">总数(输出)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public static List<Dictionary<string, object>> List(List<RelationData> relationData, string condition, out int count, int page = 1, int limit = 30, string orderBy = "Sort desc,Id desc")
+        {
+            List<string> fields = new List<string>(); //要显示的列,不设置则返回全部字段
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).IndexData("SysWithdrawalApplyRecord", relationData, orderBy, page, limit, condition, fields);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            count = int.Parse(obj["count"].ToString());
+            return diclist;
+        }
+        public static List<Dictionary<string, object>> List(List<RelationData> relationData, string condition, int page = 1, int limit = 30, string orderBy = "Sort desc,Id desc")
+        {
+            List<string> fields = new List<string>(); //要显示的列,不设置则返回全部字段
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).IndexData("SysWithdrawalApplyRecord", relationData, orderBy, page, limit, condition, fields);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询列表(单表)
+        /// </summary>
+        /// <param name="fieldList">返回的字段</param>
+        /// <param name="condition">查询条件</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <param name="orderBy">排序</param>
+        /// <returns></returns>
+        public static List<Dictionary<string, object>> List(string fieldList, string condition, int page = 1, int limit = 30, string orderBy = "Sort desc,Id desc")
+        {
+            List<string> fields = fieldList.Split(',').ToList(); //要显示的列
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).IndexData("SysWithdrawalApplyRecord", new List<RelationData>(), orderBy, page, limit, condition, fields);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public static SysWithdrawalApplyRecord Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "SysWithdrawalApplyRecord", Id);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<SysWithdrawalApplyRecord>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new SysWithdrawalApplyRecord();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static SysWithdrawalApplyRecord Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "SysWithdrawalApplyRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<SysWithdrawalApplyRecord>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new SysWithdrawalApplyRecord();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="fields">返回的字段</param>
+        /// <returns></returns>
+        public static Dictionary<string, object> Query(string condition, string fields)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query(fields, "SysWithdrawalApplyRecord", condition);
+            return obj;
+        }
+
+        /// <summary>
+        /// 单字段统计
+        /// </summary>
+        /// <param name="condition"></param>
+        /// <param name="field"></param>
+        /// <returns></returns>
+        public static decimal Sum(string condition, string field)
+        {
+            decimal amount = 0;
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("Sum(" + field + ") " + field + "", "SysWithdrawalApplyRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(function.CheckNum(obj[field].ToString()));
+            }
+            return amount;
+        }
+
+        /// <summary>
+        /// 多字段统计
+        /// </summary>
+        /// <param name="field"></param>
+        /// <param name="condition"></param>
+        /// <returns></returns>
+        public static Dictionary<string, string> Sums(string field, string condition)
+        {
+            Dictionary<string, string> result = new Dictionary<string, string>();
+            string sumString = "";
+            string[] fieldlist = field.Split(',');
+            foreach (string f in fieldlist)
+            {
+                sumString += "sum(" + f + ") " + f + ",";
+            }
+            sumString = sumString.TrimEnd(',');
+            DataTable dt = CustomerSqlConn.dtable("select " + sumString + " from SysWithdrawalApplyRecord where 1=1" + condition, _conn);
+            if (dt.Rows.Count > 0)
+            {
+                foreach (string f in fieldlist)
+                {
+                    result.Add(f, function.CheckNum(dt.Rows[0][f].ToString()));
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 查询记录数
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public static int Count(string condition = "", string field = "Id")
+        {
+            int result = 0;
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("count(" + field + ") " + field + "", "SysWithdrawalApplyRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                result = int.Parse(function.CheckInt(obj[field].ToString()));
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 查询是否存在
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public static bool Exist(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("1", "SysWithdrawalApplyRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public static AppResultJson Add(Dictionary<string, object> fields, bool check = true)
+        {
+            if (check)
+            {
+                if (string.IsNullOrEmpty(fields["MerchantId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写商户" };
+                }
+                if (string.IsNullOrEmpty(fields["ConsumerId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写消费者" };
+                }
+                if (string.IsNullOrEmpty(fields["PayMode"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写支付方式" };
+                }
+                if (string.IsNullOrEmpty(fields["PayMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写支付金额" };
+                }
+                if (!function.IsNum(fields["PayMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的支付金额" };
+                }
+                if (string.IsNullOrEmpty(fields["ReturnMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写已返金额" };
+                }
+                if (!function.IsNum(fields["ReturnMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的已返金额" };
+                }
+                if (string.IsNullOrEmpty(fields["MaxDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写最大分红" };
+                }
+                if (!function.IsNum(fields["MaxDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的最大分红" };
+                }
+                if (string.IsNullOrEmpty(fields["CurDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写当前分红" };
+                }
+                if (!function.IsNum(fields["CurDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的当前分红" };
+                }
+                if (string.IsNullOrEmpty(fields["IsAct"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写是否活动" };
+                }
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("SysWithdrawalApplyRecord", fields, 0);
+            return new AppResultJson() { Status = "1", Data = Id };
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public static AppResultJson Edit(Dictionary<string, object> fields, int Id, bool check = true)
+        {
+            if (check)
+            {
+                if (string.IsNullOrEmpty(fields["MerchantId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写商户" };
+                }
+                if (string.IsNullOrEmpty(fields["ConsumerId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写消费者" };
+                }
+                if (string.IsNullOrEmpty(fields["PayMode"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写支付方式" };
+                }
+                if (string.IsNullOrEmpty(fields["PayMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写支付金额" };
+                }
+                if (!function.IsNum(fields["PayMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的支付金额" };
+                }
+                if (string.IsNullOrEmpty(fields["ReturnMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写已返金额" };
+                }
+                if (!function.IsNum(fields["ReturnMoney"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的已返金额" };
+                }
+                if (string.IsNullOrEmpty(fields["MaxDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写最大分红" };
+                }
+                if (!function.IsNum(fields["MaxDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的最大分红" };
+                }
+                if (string.IsNullOrEmpty(fields["CurDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写当前分红" };
+                }
+                if (!function.IsNum(fields["CurDivi"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的当前分红" };
+                }
+                if (string.IsNullOrEmpty(fields["IsAct"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写是否活动" };
+                }
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("SysWithdrawalApplyRecord", fields, Id);
+            return new AppResultJson() { Status = "1", Data = Id };
+        }
+
+        /// <summary>
+        /// 逻辑删除
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Remove(int Id)
+        {
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            fields.Add("Status", -1);
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("SysWithdrawalApplyRecord", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("SysWithdrawalApplyRecord", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public static void Sort(int Id, int Sort)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Sort("SysWithdrawalApplyRecord", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public static void Import(string ExcelData)
+        {
+            // WebCMSEntities db = new WebCMSEntities();
+            // JsonData list = JsonMapper.ToObject(ExcelData);
+            // for (int i = 1; i < list.Count;i++ )
+            // {
+            //     JsonData dr = list[i];
+
+            //     db.SysWithdrawalApplyRecord.Add(new SysWithdrawalApplyRecord()
+            //     {
+            //         CreateDate = DateTime.Now,
+            //         UpdateDate = DateTime.Now,
+
+            //     });
+            //     db.SaveChanges();
+            // }
+            // db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        // public static void ExportExcel(List<RelationData> relationData, string condition)
+        // {
+
+        // }
+    }
+}