Jelajahi Sumber

Merge branch 'feature-dgy-后台测试' into DuGuYang

DuGuYang 1 tahun lalu
induk
melakukan
13994efa16
49 mengubah file dengan 6088 tambahan dan 22 penghapusan
  1. 82 0
      AppStart/OtherApi/SendSMS.cs
  2. 169 0
      Areas/Api/Controllers/SysAdminController.cs
  3. 4 0
      Areas/Api/Controllers/SysAdminRoleController.cs
  4. 157 0
      Areas/Api/Controllers/v1/Bs/PageInfoController.cs
  5. 47 0
      Areas/Api/Controllers/v1/Main1/ConsumerOrdersController.cs
  6. 79 0
      Areas/Api/Controllers/v1/Main1/ConsumerProfitController.cs
  7. 81 0
      Areas/Api/Controllers/v1/Main1/ExportExcelsController.cs
  8. 124 8
      Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs
  9. 69 0
      Areas/Api/Controllers/v1/Main1/MerchantAmountSummayController.cs
  10. 1 2
      Areas/Api/Controllers/v1/Main1/MerchantDepositBackController.cs
  11. 164 0
      Areas/Api/Controllers/v1/Main1/MerchantInfoController.cs
  12. 88 0
      Areas/Api/Controllers/v1/Main1/MerchantParamSetRecordController.cs
  13. 54 0
      Areas/Api/Controllers/v1/Main1/MobileCodeCheckController.cs
  14. 97 0
      Areas/Api/Controllers/v1/Main1/PosMachinesTwoController.cs
  15. 143 0
      Areas/Api/Controllers/v1/Main1/UserSwapWhiteController.cs
  16. 167 0
      Areas/Api/Controllers/v1/Main1/UsersController.cs
  17. 47 0
      Areas/Api/Controllers/v1/Main2/ConsumerOrdersController.cs
  18. 79 0
      Areas/Api/Controllers/v1/Main2/ConsumerProfitController.cs
  19. 209 4
      Areas/Api/Controllers/v1/Main2/MerchantAddInfoController.cs
  20. 70 0
      Areas/Api/Controllers/v1/Main2/MerchantAmountSummayController.cs
  21. 152 1
      Areas/Api/Controllers/v1/Main2/MerchantInfoController.cs
  22. 91 0
      Areas/Api/Controllers/v1/Main2/MerchantParamSetRecordController.cs
  23. 27 0
      Areas/Api/Controllers/v1/Main2/PosMachinesTwoController.cs
  24. 3 0
      Models/Main1/ConsumerOrders.cs
  25. 24 0
      Models/Main1/CustomQuery.cs
  26. 21 0
      Models/Main1/ExportExcels.cs
  27. 1 0
      Models/Main1/MerchantAddInfo.cs
  28. 34 0
      Models/Main1/MerchantParamSetRecord.cs
  29. 23 0
      Models/Main1/SysWithdrawalApplyRecord.cs
  30. 321 0
      Models/Main1/WebCMSEntities.cs
  31. 2 0
      Models/Main2/ConsumerOrders.cs
  32. 1 0
      Models/Main2/MerchantAddInfo.cs
  33. 34 0
      Models/Main2/MerchantParamSetRecord.cs
  34. 127 0
      Models/Main2/WebCMSEntities.cs
  35. 7 7
      Service/Bs/PageInfoService.cs
  36. 255 0
      Service/Main1/ExportExcelsService.cs
  37. 319 0
      Service/Main1/MerchantLoginInfoService.cs
  38. 287 0
      Service/Main1/MerchantParamSetRecordService.cs
  39. 303 0
      Service/Main1/MerchantParamSetService.cs
  40. 287 0
      Service/Main1/PosMachinesTwoService.cs
  41. 272 0
      Service/Main1/SysWithdrawalApplyRecordService.cs
  42. 239 0
      Service/Main1/UserSwapWhiteService.cs
  43. 287 0
      Service/Main2/MerchantParamSetRecordService.cs
  44. 303 0
      Service/Main2/MerchantParamSetService.cs
  45. 540 0
      Util/HaoDa/HaoDaHelper.cs
  46. 79 0
      Util/HaoDa/LogHelper.cs
  47. 26 0
      Util/Main1/MerchantInfoUtil.cs
  48. 26 0
      Util/Main2/MerchantInfoUtil.cs
  49. 66 0
      Util/MySelf/MySelfUtil.cs

+ 82 - 0
AppStart/OtherApi/SendSMS.cs

@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using Library;
+
+namespace MySystem
+{
+    public class SendSMS
+    {
+        public readonly static SendSMS Instance = new SendSMS();
+        private SendSMS()
+        {
+        }
+
+
+        #region 发送短信验证码
+
+        private string host = "https://gyytz.market.alicloudapi.com";
+        private string path = "/sms/smsSend";
+        private string method = "POST";
+        private string appcode = "8e5704921ca3422f80f0deb935a7ddc6";
+
+        public string Do(string mobile, string code)
+        {
+            String querys = "mobile=" + mobile + "&param=**code**%3A" + code + "%2C**minute**%3A5&smsSignId=8b278cf2bb2a4b3c818cc7a436307a12&templateId=908e94ccf08b4476ba6c876d13f084ad";
+            String bodys = "";
+            String url = host + path;
+            HttpWebRequest httpRequest = null;
+            HttpWebResponse httpResponse = null;
+
+            if (0 < querys.Length)
+            {
+                url = url + "?" + querys;
+            }
+
+            if (host.Contains("https://"))
+            {
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
+                httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
+            }
+            else
+            {
+                httpRequest = (HttpWebRequest)WebRequest.Create(url);
+            }
+            httpRequest.Method = method;
+            httpRequest.Headers.Add("Authorization", "APPCODE " + appcode);
+            if (0 < bodys.Length)
+            {
+                byte[] data = Encoding.UTF8.GetBytes(bodys);
+                using (Stream stream = httpRequest.GetRequestStream())
+                {
+                    stream.Write(data, 0, data.Length);
+                }
+            }
+            try
+            {
+                httpResponse = (HttpWebResponse)httpRequest.GetResponse();
+            }
+            catch (WebException ex)
+            {
+                httpResponse = (HttpWebResponse)ex.Response;
+            }
+
+            Stream st = httpResponse.GetResponseStream();
+            StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
+            string result = reader.ReadToEnd();
+            return result;
+        }
+
+        public bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
+        {
+            return true;
+        }
+
+        #endregion
+    }
+}

+ 169 - 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
 {
@@ -255,6 +256,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             string PassWord = data["PassWord"].ToString(); //密码
             string RoleId = data["RoleId"].ToString(); //角色
             Dictionary<string, object> fields = new Dictionary<string, object>();
+            var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+            fields.Add("CreateMan", sys.AdminName + "_" + sys.RealName); //操作人
             fields.Add("AdminName", AdminName); //用户名
             fields.Add("RealName", RealName); //名称
             fields.Add("Password", function.MD5_32(PassWord)); //密码
@@ -293,6 +296,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.Id == SysAdminId) ?? new SysAdmin();
             if (sysAdmin.Id > 0)
             {
+                var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+                sysAdmin.UpdateMan = sys.AdminName + "_" + sys.RealName;
                 if (!string.IsNullOrEmpty(AdminName))
                 {
                     sysAdmin.AdminName = AdminName;
@@ -335,5 +340,169 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         #endregion
 
+
+        #region 系统管理-润观米好哒账户信息-账户余额查询
+        [Authorize]
+        [Route("/v1/qrcodeplatemain/sysadmin/queryaccountbalance")]
+        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>();
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            //获取账户金额前查询未处理订单状态
+            List<Dictionary<string, object>> source = SysWithdrawalApplyRecordService.List(relationData, " and Status=0", 1, 999999);
+            foreach (Dictionary<string, object> subdata in source)
+            {
+                var Id = int.Parse(subdata["Id"].ToString()); //Id
+                var sysWithdrawalApplyRecord = main1db.SysWithdrawalApplyRecord.FirstOrDefault(m => m.Id == Id) ?? new MySystem.Models.Main1.SysWithdrawalApplyRecord();
+
+                JsonData info = JsonMapper.ToObject(HaoDaHelper.Instance.QueryApplyWithdrawalStatus(subdata["ApplyNo"].ToString(), "230817000000000278"));
+                var Status = int.Parse(info["data"]["status"].ToString()); //状态(0 提现成功 1 提现中 2 提现失败)
+                Dictionary<string, object> fields = new Dictionary<string, object>();
+                if (Status == 0)
+                {
+                    Status = 1;
+                    sysWithdrawalApplyRecord.UpdateDate = DateTime.Parse(info["data"]["updateTime"].ToString());
+                    sysWithdrawalApplyRecord.Status = Status;
+                }
+                if (Status == 2)
+                {
+                    Status = 2;
+                    sysWithdrawalApplyRecord.UpdateDate = DateTime.Parse(info["data"]["updateTime"].ToString());
+                    sysWithdrawalApplyRecord.Status = Status;
+                }
+                main1db.SaveChanges();
+            }
+            JsonData dic = JsonMapper.ToObject(HaoDaHelper.Instance.QueryAccountBalance("230817000000000278"));
+            Obj.Add("Balance", decimal.Parse(dic["data"]["total"].ToString()) / 100); //账户余额
+            Obj.Add("WithdrawalAmount", SysWithdrawalApplyRecordService.Sum(" and Status=0", "SeoTitle") / 100); //提现中金额
+            Obj.Add("WithdrawnAmount", SysWithdrawalApplyRecordService.Sum(" and Status=1", "SeoTitle") / 100); //已提现金额
+
+            return Obj;
+        }
+        #endregion
+
+
+        #region 系统管理-润观米好哒账户信息-提交提现申请
+        [Authorize]
+        [Route("/v1/qrcodeplatemain/sysadmin/withdrawalapply")]
+        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(); //提现金额
+            var amount = (decimal.Parse(Amount) * 100).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("CreateDate", DateTime.Now);
+                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]
+        [Route("/v1/qrcodeplatemain/sysadmin/querywithdrawalstatus")]
+        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]
+        [Route("/v1/qrcodeplatemain/sysadmin/withdrawalapplyrecordlist")]
+        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()) / 100); //提现金额
+                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
+
     }
 }

+ 4 - 0
Areas/Api/Controllers/SysAdminRoleController.cs

@@ -81,6 +81,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             string Details = data["Details"].ToString(); //详情
             string RightInfo = data["RightInfo"].ToString(); //权限字符串
             Dictionary<string, object> fields = new Dictionary<string, object>();
+            var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+            fields.Add("CreateMan", sys.AdminName + "_" + sys.RealName); //操作人
             fields.Add("Name", Name); //角色名称
             fields.Add("Details", Details); //详情
             fields.Add("RightInfo", RightInfo); //权限字符串
@@ -116,6 +118,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             var sysAdminRole = bsdb.SysAdminRole.FirstOrDefault(m => m.Id == SysAdminRoleId) ?? new SysAdminRole();
             if (sysAdminRole.Id > 0)
             {
+                var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+                sysAdminRole.UpdateMan = sys.AdminName + "_" + sys.RealName;
                 if (!string.IsNullOrEmpty(Name))
                 {
                     sysAdminRole.Name = Name;

+ 157 - 0
Areas/Api/Controllers/v1/Bs/PageInfoController.cs

@@ -0,0 +1,157 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Bs;
+using MySystem.Service.Bs;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Bs
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class PageInfoController : BaseController
+    {
+        public PageInfoController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 系统管理-协议管理-列表
+        [Authorize]
+        public JsonResult AgreementInfoList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = AgreementInfoListDo(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        private List<Dictionary<string, object>> AgreementInfoListDo(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string Title = data["Title"].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["Title"].ToString()))
+            {
+                condition += " and Title like '%" + Title + "%'";
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            Other = new Dictionary<string, object>();
+            int count = 0;
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = PageInfoService.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("Title", subdata["Title"].ToString()); //标题
+                curData.Add("Contents", subdata["Contents"].ToString()); //内容
+                dataList.Add(curData);
+            }
+            Other.Add("Count", count); //总数
+            return dataList;
+        }
+        #endregion
+
+
+        #region 系统管理-协议管理-添加
+        [Authorize]
+        public JsonResult AddAgreementInfo(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = AddAgreementInfoDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson AddAgreementInfoDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string Title = data["Title"].ToString(); //标题
+            string Contents = data["Contents"].ToString(); //内容
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+            fields.Add("CreateMan", sys.AdminName + "_" + sys.RealName); //操作人
+            fields.Add("Title", Title); //标题
+            fields.Add("Contents", Contents); //内容
+            var Id = int.Parse(PageInfoService.Add(fields).Data.ToString());
+            if (Id > 0)
+            {
+                return new AppResultJson() { Status = "1", Info = "成功", Data = Id };
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "失败", Data = Id };
+            }
+        }
+        #endregion
+
+
+        #region 系统管理-协议管理-编辑
+        [Authorize]
+        public JsonResult EditAgreementInfo(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = EditAgreementInfoDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson EditAgreementInfoDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //记录Id
+            string Title = data["Title"].ToString(); //标题
+            string Contents = data["Contents"].ToString(); //内容
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var pageInfo = bsdb.PageInfo.FirstOrDefault(m => m.Id == Id) ?? new PageInfo();
+            if (pageInfo.Id > 0)
+            {
+                var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+                pageInfo.UpdateMan = sys.AdminName + "_" + sys.RealName;
+                if (!string.IsNullOrEmpty(Title))
+                {
+                    pageInfo.Title = Title;
+                }
+                if (!string.IsNullOrEmpty(Contents))
+                {
+                    pageInfo.Contents = Contents;
+                }
+            }
+            bsdb.SaveChanges();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 系统管理-协议管理-删除
+        [Authorize]
+        public JsonResult DeleteAgreementInfo(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DeleteAgreementInfoDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DeleteAgreementInfoDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //记录Id
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            PageInfoService.Delete(Id);
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+    }
+}

+ 47 - 0
Areas/Api/Controllers/v1/Main1/ConsumerOrdersController.cs

@@ -43,6 +43,8 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             string IsAct = data["IsAct"].ToString(); //是否参与分账(0 否 1 是)
             string Status = data["Status"].ToString(); //交易状态(0 未支付 1 已支付)
             string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体)
+            string TradePayNo = data["TradePayNo"].ToString(); //第三方交易号
+            string DivideFlag = data["DivideFlag"].ToString(); //分账状态(-1无 0 未分账 2 分账中 1 已完成)
             int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
             int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
             string condition = "";
@@ -93,6 +95,30 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 var Ids = MerchantInfoUtil.QueryMerchantIdBySubjectType(SubjectType);
                 condition += " and MerchantId in (" + Ids + ")";
             }
+            if (!string.IsNullOrEmpty(data["TradePayNo"].ToString()))
+            {
+                condition += " and TradePayNo='" + TradePayNo + "'";
+            }
+            if (!string.IsNullOrEmpty(data["DivideFlag"].ToString()))
+            {
+                var flag = int.Parse(data["DivideFlag"].ToString());
+                if (flag == -1)
+                {
+                    condition += " and IsAct=0 and DivideFlag=0";
+                }
+                if (flag == 0)
+                {
+                    condition += " and IsAct=1 and DivideFlag=0";
+                }
+                if (flag == 2)
+                {
+                    condition += " and IsAct=1 and DivideFlag=1";
+                }
+                if (flag == 1)
+                {
+                    condition += " and IsAct=1 and DivideFlag=2";
+                }
+            }
             List<RelationData> relationData = new List<RelationData>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             Other = new Dictionary<string, object>();
@@ -116,6 +142,27 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 if (query.SubjectType == "SUBJECT_TYPE_ENTERPRISE") subjectType = 1; //企业公司
                 if (query.SubjectType == "SUBJECT_TYPE_INDIVIDUAL") subjectType = 2; //个体工商户
                 curData.Add("SubjectType", subjectType); //主体类型(1 企业 2 个体)
+                curData.Add("TradePayNo", TradePayNo); //第三方交易号
+                var divideFlag = 0;
+                var isAct = int.Parse(subdata["IsAct"].ToString());
+                var dFlag = int.Parse(subdata["DivideFlag"].ToString());
+                if (isAct == 0 && dFlag == 0)
+                {
+                    divideFlag = -1;
+                }
+                if (isAct == 1 && dFlag == 0)
+                {
+                    divideFlag = 0;
+                }
+                if (isAct == 1 && dFlag == 1)
+                {
+                    divideFlag = 2;
+                }
+                if (isAct == 1 && dFlag == 2)
+                {
+                    divideFlag = 1;
+                }
+                curData.Add("DivideFlag", divideFlag); //分账状态(-1无 0 未分账 2 分账中 1 已完成)
                 dataList.Add(curData);
             }
             Other.Add("Count", count); //总数

+ 79 - 0
Areas/Api/Controllers/v1/Main1/ConsumerProfitController.cs

@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class ConsumerProfitController : BaseController
+    {
+        public ConsumerProfitController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 交易查询-直连商户订单分账记录
+        [Authorize]
+        public JsonResult DirectOrderProfitList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = DirectOrderProfitListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> DirectOrderProfitListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string OrderId = data["OrderId"].ToString(); //订单Id
+            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            var orderId = int.Parse(OrderId);
+            var order = ConsumerOrdersService.Query(orderId);
+            var Status = 0;
+            if (order.IsAct == 0 && order.DivideFlag == 0)
+            {
+                Status = -1;
+            }
+            if (order.IsAct == 1 && order.DivideFlag == 0)
+            {
+                Status = 0;
+            }
+            if (order.IsAct == 1 && order.DivideFlag == 1)
+            {
+                Status = 2;
+            }
+            if (order.IsAct == 1 && order.DivideFlag == 2)
+            {
+                Status = 1;
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = ConsumerProfitService.List(relationData, " and OrderId=" + orderId + "", 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("OrderNo", order.OrderNo); //来源单号
+                curData.Add("Amount", decimal.Parse(subdata["GetMoney"].ToString()).ToString("f2")); //分红金额
+                curData.Add("DivideDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //分红时间
+                curData.Add("Status", Status); //分账状态(-1无 0 未分账 2 分账中 1 已完成)
+                curData.Add("SetRecordId", order.SetRecordId); //活动Id
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 81 - 0
Areas/Api/Controllers/v1/Main1/ExportExcelsController.cs

@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class ExportExcelsController : BaseController
+    {
+        public ExportExcelsController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 我的下载-我的下载
+        [Authorize]
+        public JsonResult DownloadsList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = DownloadsListDo(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        private List<Dictionary<string, object>> DownloadsListDo(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string CreateDate = data["CreateDate"].ToString(); //创建时间
+            string FileName = data["FileName"].ToString(); //文件名
+            string FileUrl = data["FileUrl"].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(CreateDate))
+            {
+                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'";
+            }
+            if (!string.IsNullOrEmpty(FileName))
+            {
+                condition += " and FileName like '%" + FileName + "%'";
+            }
+            if (!string.IsNullOrEmpty(FileUrl))
+            {
+                condition += " and FileUrl like '%" + FileUrl + "%'";
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            Other = new Dictionary<string, object>();
+            int count = 0;
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = ExportExcelsService.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", subdata["Id"].ToString()); //记录Id
+                curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //创建时间
+                curData.Add("FileName", subdata["FileName"].ToString()); //文件名
+                curData.Add("FileUrl", subdata["FileUrl"].ToString()); //文件路径
+
+                dataList.Add(curData);
+            }
+            Other.Add("Count", count); //总数
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 124 - 8
Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs

@@ -205,6 +205,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             string WeChatNo = data["WeChatNo"].ToString(); //微信商户号
             string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体)
             string IsAct = data["IsAct"].ToString(); //激活状态(0 未激活 1 已激活)
+            string ActDate = data["ActDate"].ToString(); //激活时间
             int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
             int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
             string condition = "";
@@ -242,6 +243,14 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 var Ids = MerchantInfoUtil.QueryIsActMerchantId(int.Parse(IsAct));
                 condition += " and Id in (" + Ids + ")";
             }
+            if (!string.IsNullOrEmpty(data["ActDate"].ToString()))
+            {
+                string[] datelist = ActDate.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                var Ids = MerchantInfoUtil.QueryActDateMerchantId(start, end);
+                condition += " and Id in (" + Ids + ")";
+            }
             List<RelationData> relationData = new List<RelationData>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             Other = new Dictionary<string, object>();
@@ -256,6 +265,13 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 var userInfo = UsersService.Query(merInfo.UserId);
                 curData.Add("MerchantId", subdata["Id"].ToString()); //商户Id
                 curData.Add("IsAct", merInfo.IsAct); //激活状态(0 未激活 1 已激活)
+                var actDate = "";
+                var order = MerchantDepositOrderService.Query(" and Status>0 and MerchantId=" + MerchantId + "");
+                if (order.Id > 0)
+                {
+                    actDate = order.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
+                }
+                curData.Add("ActDate", actDate); //激活时间
                 curData.Add("MerchantName", subdata["CertMerchantName"].ToString()); //商户名称
                 curData.Add("Mobile", subdata["MobilePhone"].ToString()); //手机号码
                 curData.Add("MakerCode", userInfo.MakerCode); //所属创客
@@ -304,17 +320,17 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             {
                 if (string.IsNullOrEmpty(query.AlipayPid))
                 {
-                    fields.Add("AlipayPid", AliPPID); //支付宝PID
+                    // fields.Add("AlipayPid", AliPPID); //支付宝PID
                     query.AlipayPid = AliPPID;
                 }
                 if (!string.IsNullOrEmpty(AliPayToken))
                 {
-                    fields.Add("AlipayAuthToken", AliPayToken); //支付宝token
+                    // fields.Add("AlipayAuthToken", AliPayToken); //支付宝token
                     query.AlipayAuthToken = AliPayToken;
                 }
                 if (string.IsNullOrEmpty(query.SubMchid))
                 {
-                    fields.Add("SubMchid", WeChatNo); //微信商户号
+                    // fields.Add("SubMchid", WeChatNo); //微信商户号
                     query.SubMchid = WeChatNo;
                 }
             }
@@ -325,11 +341,6 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         #endregion
 
 
-
-
-
-
-
         #region 节点操作-直联提交微信商户进件
         [Authorize]
         public JsonResult DirectWeChatMerchantAdd(string value)
@@ -448,5 +459,110 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         }
         #endregion
 
+
+
+        #region 商户管理-直连查询商户交易信息导出
+        [Authorize]
+        public JsonResult ExportDirectQueryMerchantTradeInfo(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = ExportDirectQueryMerchantTradeInfoDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson ExportDirectQueryMerchantTradeInfoDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantName = data["MerchantName"].ToString(); //商户名称
+            string Mobile = data["Mobile"].ToString(); //手机号码
+            string MakerCode = data["MakerCode"].ToString(); //所属创客
+            string AliPID = data["AliPID"].ToString(); //支付宝PID
+            string WeChatNo = data["WeChatNo"].ToString(); //微信商户号
+            string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体)
+            string IsAct = data["IsAct"].ToString(); //激活状态(0 未激活 1 已激活)
+            string ActDate = data["ActDate"].ToString(); //激活时间
+            string condition = "";
+            var merIds = MerchantInfoUtil.QueryAnyIsOkMerchantId();
+            condition = " and Id in (" + merIds + ")";
+            if (!string.IsNullOrEmpty(MerchantName))
+            {
+                condition += " and CertMerchantName like '%" + MerchantName + "%'";
+            }
+            if (!string.IsNullOrEmpty(Mobile))
+            {
+                condition += " and MobilePhone='" + Mobile + "'";
+            }
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                var Ids = MerchantInfoUtil.QueryMerchantIdByMakerCode(MakerCode);
+                condition += " and Id in (" + Ids + ")";
+            }
+            if (!string.IsNullOrEmpty(AliPID))
+            {
+                condition += " and AlipayPid='" + AliPID + "'";
+            }
+            if (!string.IsNullOrEmpty(WeChatNo))
+            {
+                condition += " and SubMchid='" + WeChatNo + "'";
+            }
+            if (!string.IsNullOrEmpty(SubjectType))
+            {
+                if (SubjectType == "1") SubjectType = "SUBJECT_TYPE_ENTERPRISE"; //企业公司
+                if (SubjectType == "2") SubjectType = "SUBJECT_TYPE_INDIVIDUAL"; //个体工商户
+                condition += " and SubjectType='" + SubjectType + "'";
+            }
+            if (!string.IsNullOrEmpty(IsAct))
+            {
+                var Ids = MerchantInfoUtil.QueryIsActMerchantId(int.Parse(IsAct));
+                condition += " and Id in (" + Ids + ")";
+            }
+            if (!string.IsNullOrEmpty(data["ActDate"].ToString()))
+            {
+                string[] datelist = ActDate.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                var Ids = MerchantInfoUtil.QueryActDateMerchantId(start, end);
+                condition += " and Id in (" + Ids + ")";
+            }
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var Sql = "SELECT a.Id '商户Id',(CASE WHEN b.IsAct=0 THEN '未激活' WHEN b.IsAct=1 THEN '已激活' ELSE '' end) '激活状态',c.UpdateDate '激活时间',a.CertMerchantName '商户名称',a.MobilePhone '手机号码',b.UserId '所属创客Id',a.AlipayPid '支付宝PID',a.AlipayAuthToken '支付宝token',a.SubMchid '微信商户号',(CASE WHEN a.SubjectType='SUBJECT_TYPE_ENTERPRISE' THEN '企业公司' WHEN a.SubjectType='SUBJECT_TYPE_INDIVIDUAL' THEN '个体工商户' ELSE '' end) SubjectType,(SELECT SUM(TradeCount) TradeCount FROM MerchantAmountSummay WHERE 1=1 AND MerchantId=a.Id) '订单总数',(SELECT SUM(TotalActual) TotalActual FROM MerchantAmountSummay WHERE 1=1 AND MerchantId=a.Id)' 实收总金额',(SELECT SUM(TradeAmount) TradeAmount FROM MerchantAmountSummay WHERE 1=1 AND MerchantId=a.Id) '营业总金额' FROM(SELECT Id,CertMerchantName,MobilePhone,SubjectType,AlipayPid,AlipayAuthToken,SubMchid FROM MerchantAddInfo WHERE 1=1 " + condition + " AND (Status=2 or QueryCount=2)) a LEFT JOIN (SELECT Id,IsAct,UserId FROM MerchantInfo WHERE 1=1 AND Status=2 or QueryCount=2) b ON a.Id=b.Id LEFT JOIN (SELECT MerchantId,UpdateDate FROM MerchantDepositOrder WHERE `Status`>0)c ON a.Id=c.MerchantId ORDER BY a.Id";
+            var FileName = "商户管理-直连查询商户交易信息" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string SendData = "{\"Operater\":\"" + AppConfig.LoginSession.sysId + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
+            RedisDbconn.Instance.AddList("ExportQueue", SendData);
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 重置交易额-直连重置商户交易额
+        [Authorize]
+        public JsonResult DirectResetMerchantAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectResetMerchantAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectResetMerchantAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["MerchantId"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "商户Id和交易时间不能为空" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"MerchantId\":\"" + MerchantId + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetMerchantStatDataQueue", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
     }
 }

+ 69 - 0
Areas/Api/Controllers/v1/Main1/MerchantAmountSummayController.cs

@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class MerchantAmountSummayController : BaseController
+    {
+        public MerchantAmountSummayController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 交易统计-直连商户交易统计
+        [Authorize]
+        public JsonResult DirectMerchantTradeSummaryList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = DirectMerchantTradeSummaryListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> DirectMerchantTradeSummaryListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantName = data["MerchantName"].ToString(); //商户名称
+            string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体)
+            string TradeDate = data["TradeDate"].ToString(); //交易日期
+            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            string condition = "";
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = MerchantAmountSummayService.List(relationData, condition, pageNum, pageSize);
+            foreach (Dictionary<string, object> subdata in source)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("", subdata[""].ToString()); //
+                curData.Add("TradeDate", ""); //交易日期
+                curData.Add("MerchantName", ""); //商户名称
+                curData.Add("TodayAmount", ""); //当日总收入
+                curData.Add("TotalAmount", ""); //营收总金额
+                curData.Add("InFactAmount", ""); //实收总金额
+                curData.Add("ActAmount", ""); //活动交易额
+                curData.Add("NonActAmount", ""); //非活动交易额
+                curData.Add("WeChatInFactAmount", ""); //微信实收
+                curData.Add("AliPayInFactAmount", ""); //支付宝实收
+                curData.Add("OrderCount", ""); //订单总数
+
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 1 - 2
Areas/Api/Controllers/v1/Main1/MerchantDepositBackController.cs

@@ -39,9 +39,8 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             string Remark = data["Remark"].ToString(); //备注
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantDepositBack query = new MerchantDepositBack();
-            int Id = int.Parse(function.CheckInt(data["id"].ToString()));
             Dictionary<string, object> fields = new Dictionary<string, object>();
-            MerchantDepositBackService.Edit(fields, Id, false);
+            // MerchantDepositBackService.Edit(fields, Id, false);
 
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
         }

+ 164 - 0
Areas/Api/Controllers/v1/Main1/MerchantInfoController.cs

@@ -84,5 +84,169 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         #endregion
 
 
+        #region 商户管理-商户管理-直连重置登录密码
+        [Authorize]
+        public JsonResult DirectResetLoginPwd(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectResetLoginPwdDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectResetLoginPwdDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var Id = int.Parse(MerchantId);
+            var query = main1db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+            var loginMobile = main1db.MerchantLoginInfo.FirstOrDefault(m => m.LoginMobile == query.Mobile) ?? new MerchantLoginInfo();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            if (query.Id > 0)
+            {
+                query.LoginPwd = function.MD532(query.Mobile.Substring(query.Mobile.Length - 6, 6)); //登录密码
+                if (loginMobile.Id > 0)
+                {
+                    loginMobile.LoginPwd = query.LoginPwd; //登录密码
+                }
+            }
+            main1db.SaveChanges();
+
+            return new AppResultJson() { Status = "1", Info = "该商户的登录密码已重置为手机号后6位", Data = Obj };
+        }
+        #endregion
+
+
+        #region 商户管理-商户管理-直连修改手机号
+        [Authorize]
+        public JsonResult DirectEditMobile(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectEditMobileDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectEditMobileDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string Mobile = data["Mobile"].ToString(); //新手机号
+            string MobileCode = data["MobileCode"].ToString(); //短信验证码
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            if (Mobile.Length != 11 || !function.IsInt(Mobile) || Mobile.Substring(0, 1) != "1")
+            {
+                return new AppResultJson() { Status = "-1", Info = "手机号不正确" };
+            }
+            var mobilecheck = RedisDbconn.Instance.Get<string>("MobileCodeCheck:" + Mobile);
+            if (mobilecheck == "")
+            {
+                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
+            }
+            if (mobilecheck != MobileCode)
+            {
+                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
+            }
+            RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
+            var Id = int.Parse(MerchantId);
+            var check = MerchantLoginInfoService.Query(" and LoginMobile=" + Mobile + "");
+            if (check.Id > 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "已存在相关登录手机号" };
+            }
+            var query = main1db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+            var loginMobile = main1db.MerchantLoginInfo.FirstOrDefault(m => m.LoginMobile == query.Mobile) ?? new MerchantLoginInfo();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            if (query.Id > 0)
+            {
+                query.Mobile = Mobile;
+                query.LoginPwd = function.MD532(Mobile.Substring(Mobile.Length - 6, 6)); //登录密码
+                if (loginMobile.Id > 0)
+                {
+                    loginMobile.LoginMobile = Mobile;
+                    loginMobile.LoginPwd = query.LoginPwd; //登录密码
+                }
+            }
+            main1db.SaveChanges();
+
+            return new AppResultJson() { Status = "1", Info = "修改成功,新密码默认为该手机号后6位", Data = Obj };
+        }
+        #endregion
+
+
+        #region 商户管理-商户管理-直连商户激活订单补全
+        [Authorize]
+        public JsonResult DirectActOrderCompletion(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectActOrderCompletionDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectActOrderCompletionDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string OutTradeNo = data["OutTradeNo"].ToString(); //外部交易号(D或U开头)
+            string TradeNo = data["TradeNo"].ToString(); //交易号(数字开头)
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            if (string.IsNullOrEmpty(OutTradeNo) || string.IsNullOrEmpty(TradeNo))
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号或交易号为空", Data = Obj };
+            }
+            if (OutTradeNo.StartsWith("D"))
+            {
+                RedisDbconn.Instance.AddList("AlipayCallBack1", "{\"out_trade_no\":\"" + OutTradeNo + "\",\"transaction_id\":\"" + TradeNo + "\",\"total_fee\":\"" + 0 + "\",\"pay_mode\":\"1\",\"openid\":\"\",\"attach\":\"\"}");
+                return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号有误", Data = Obj };
+            }
+
+        }
+        #endregion
+
+
+        #region 商户管理-商户管理-直连商户订单补全
+        [Authorize]
+        public JsonResult DirectOrderCompletion(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectOrderCompletionDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectOrderCompletionDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string OutTradeNo = data["OutTradeNo"].ToString(); //外部交易号(支付宝订单必填,否不填)
+            string TradeNo = data["TradeNo"].ToString(); //交易号(支付宝订单必填,否不填)
+            string Parameter = data["Parameter"].ToString(); //日志参数(微信订单必填,json格式,否不填)
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            if ((string.IsNullOrEmpty(OutTradeNo) && string.IsNullOrEmpty(TradeNo)) || string.IsNullOrEmpty(Parameter))
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号和交易号为空或日志参数为空", Data = Obj };
+            }
+            if (!string.IsNullOrEmpty(OutTradeNo) && !string.IsNullOrEmpty(TradeNo) && !string.IsNullOrEmpty(Parameter))
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号和交易号为空或日志参数为空", Data = Obj };
+            }
+            //支付宝
+            if (!string.IsNullOrEmpty(OutTradeNo) && !string.IsNullOrEmpty(TradeNo))
+            {
+                RedisDbconn.Instance.AddList("PayCallBack", "{\"out_trade_no\":\"" + OutTradeNo + "\",\"transaction_id\":\"" + TradeNo + "\",\"total_fee\":\"" + 0 + "\",\"pay_mode\":\"1\",\"openid\":\"\",\"attach\":\"\"}");
+            }
+            //微信
+            if (!string.IsNullOrEmpty(Parameter))
+            {
+                RedisDbconn.Instance.AddList("WeChatPayBack", Parameter);
+            }
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
     }
 }

+ 88 - 0
Areas/Api/Controllers/v1/Main1/MerchantParamSetRecordController.cs

@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class MerchantParamSetRecordController : BaseController
+    {
+        public MerchantParamSetRecordController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 商户管理-商户管理-直连商户活动变更记录
+        [Authorize]
+        public JsonResult DirectMerchantParamSetRecordList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = DirectMerchantParamSetRecordListDo(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        private List<Dictionary<string, object>> DirectMerchantParamSetRecordListDo(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            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["MerchantId"].ToString()))
+            {
+                condition += " and MerchantId='" + MerchantId + "'";
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            Other = new Dictionary<string, object>();
+            int count = 0;
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = MerchantParamSetRecordService.List(relationData, condition, out count, pageNum, pageSize);
+            var merSet = MerchantParamSetService.Query(int.Parse(MerchantId));
+            foreach (Dictionary<string, object> subdata in source)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                var Id = int.Parse(subdata["Id"].ToString()); //变更记录Id
+                curData.Add("Id", Id); //变更记录Id
+                var status = -1;
+                if (merSet.Version == Id && merSet.IsAll == 0)
+                {
+                    status = 1;
+                }
+                if (subdata["BeforeIsAll"].ToString() == "0" && subdata["AfterIsAll"].ToString() == "1")
+                {
+                    status = 0;
+                }
+                if (merSet.Version != Id && subdata["BeforeIsAll"].ToString() == "0" && subdata["AfterIsAll"].ToString() == "0")
+                {
+                    status = -1;
+                }
+                curData.Add("Status", status); //活动状态(1 使用中 -1 已失效 0 已关闭)
+                curData.Add("MerchantName", MerchantAddInfoService.Query(int.Parse(subdata["MerchantId"].ToString())).CertMerchantName); //商户名称
+                curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //最后操作时间
+                curData.Add("GetPercent", subdata["AfterGetPercent"].ToString()); //实收比例
+                curData.Add("DiviPersons", subdata["AfterDiviPersons"].ToString()); //分红人数
+                curData.Add("ProfitDays", subdata["AfterProfitDays"].ToString()); //分红天数
+                curData.Add("MinPayMoney", subdata["AfterMinPayMoney"].ToString()); //参与门槛
+                curData.Add("DiviPercent", subdata["AfterDiviPercent"].ToString()); //最大分红比例
+
+                dataList.Add(curData);
+            }
+            Other.Add("Count", count); //总数
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 54 - 0
Areas/Api/Controllers/v1/Main1/MobileCodeCheckController.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1
+{
+    [Area("Api")]
+    [Route("Api/v1/[controller]/[action]")]
+    public class MobileCodeCheckController : BaseController
+    {
+        public MobileCodeCheckController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+
+        #region 我的-发送验证码
+        // [Authorize]
+        public JsonResult SendSms(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = SendSmsDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        public AppResultJson SendSmsDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            string Mobile = data["Mobile"].ToString(); //手机号
+            string check = RedisDbconn.Instance.Get<string>("MobileCodeCheck:" + Mobile);
+            if (check == "")
+            { 
+                return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+            }
+            string CheckCode = function.get_Random(6);
+            RedisDbconn.Instance.Set("MobileCodeCheck:" + Mobile, CheckCode);
+            RedisDbconn.Instance.SetExpire("MobileCodeCheck:" + Mobile, 300);
+
+            SendSMS.Instance.Do(Mobile, CheckCode); //发送短信
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+    }
+}

+ 97 - 0
Areas/Api/Controllers/v1/Main1/PosMachinesTwoController.cs

@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class PosMachinesTwoController : BaseController
+    {
+        public PosMachinesTwoController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 重置交易额-直连重置码牌交易额
+        [Authorize]
+        public JsonResult DirectResetQrCodeAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectResetQrCodeAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectResetQrCodeAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string PosSn = data["PosSn"].ToString(); //码牌Sn
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["PosSn"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "码牌Sn和交易时间不能为空" };
+            }
+            var pos = PosMachinesTwoService.Query(" and PosSn=" + PosSn + "");
+            if (pos.Id == 0 || pos.OpId != 1)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到该码牌Sn或该码牌通道不符" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"SnNo\":\"" + PosSn + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetSnStatDataQueue", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 重置交易额-银联重置码牌交易额
+        [Authorize]
+        public JsonResult UnionPayResetQrCodeAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayResetQrCodeAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayResetQrCodeAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string PosSn = data["PosSn"].ToString(); //码牌Sn
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["PosSn"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "码牌Sn和交易时间不能为空" };
+            }
+            var pos = PosMachinesTwoService.Query(" and PosSn=" + PosSn + "");
+            if (pos.Id == 0 || pos.OpId != 2)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到该码牌Sn或该码牌通道不符" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"SnNo\":\"" + PosSn + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetSnStatDataQueue2", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+    }
+}

+ 143 - 0
Areas/Api/Controllers/v1/Main1/UserSwapWhiteController.cs

@@ -0,0 +1,143 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+using MySystem.Service.KxsMain;
+using MySystem.Service.Bs;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class UserSwapWhiteController : BaseController
+    {
+        public UserSwapWhiteController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 风险管理-风险创客列表
+        [Authorize]
+        public JsonResult RiskMakerList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = RiskMakerListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> RiskMakerListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MakerCode = data["MakerCode"].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["MakerCode"].ToString()))
+            {
+                var user = UsersService.QueryByMakerCode(MakerCode);
+                condition += " and UserId=" + user.Id + "";
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = UserSwapWhiteService.List(relationData, condition, 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
+                var userInfo = UsersService.Query(int.Parse(subdata["UserId"].ToString()));
+                curData.Add("MakerCode", userInfo.MakerCode); //风控创客编号
+                curData.Add("RealName", userInfo.RealName); //风控创客姓名
+                curData.Add("Remark", subdata["Remark"].ToString()); //备注
+                curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //操作时间
+                curData.Add("Operator", subdata["CreateMan"].ToString()); //操作人
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+        #region 风险管理-添加风险创客
+        [Authorize]
+        public JsonResult AddRiskMaker(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = AddRiskMakerDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson AddRiskMakerDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MakerCode = data["MakerCode"].ToString(); //风控创客编号
+            string RealName = data["RealName"].ToString(); //风控创客姓名
+            string Remark = data["Remark"].ToString(); //备注
+            if (string.IsNullOrEmpty(data["MakerCode"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "请输入风控创客编号" };
+            }
+            if (string.IsNullOrEmpty(data["RealName"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "请输入风控创客姓名" };
+            }
+            var user = UsersService.QueryByMakerCode(MakerCode);
+            if (user.Id == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到相关创客信息" };
+            }
+            if (user.MakerCode != MakerCode || user.RealName != RealName)
+            {
+                return new AppResultJson() { Status = "-1", Info = "输入的创客信息不匹配" };
+            }
+            var check = UserSwapWhiteService.Query(" and UserId=" + user.Id + "");
+            if (check.Id > 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "已存在该风险创客信息,请勿重复添加" };
+            }
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            var sys = SysAdminService.Query(AppConfig.LoginSession.sysId);
+            fields.Add("CreateDate", DateTime.Now); //创建时间
+            fields.Add("UserId", user.Id); //创客Id
+            fields.Add("CreateMan", sys.AdminName + "_" + sys.RealName); //操作人
+            fields.Add("Remark", Remark); //备注
+            var Id = int.Parse(UserSwapWhiteService.Add(fields).Data.ToString());
+            if (Id > 0)
+            {
+                return new AppResultJson() { Status = "1", Info = "成功", Data = Id };
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "失败", Data = Id };
+            }
+        }
+        #endregion
+
+
+        #region 风险管理-删除风险创客
+        [Authorize]
+        public JsonResult DeleteRiskMaker(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DeleteRiskMakerDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DeleteRiskMakerDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int RiskId = int.Parse(data["RiskId"].ToString()); //风控记录Id
+            UserSwapWhiteService.Delete(RiskId);
+            return new AppResultJson() { Status = "1", Info = "删除成功" };
+        }
+        #endregion
+
+    }
+}

+ 167 - 0
Areas/Api/Controllers/v1/Main1/UsersController.cs

@@ -0,0 +1,167 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main1;
+using MySystem.Service.Main1;
+using LitJson;
+using Library;
+using MySystem.Service.KxsMain;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class UsersController : BaseController
+    {
+        public UsersController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+        #region 重置交易额-直连重置创客个人交易额
+        [Authorize]
+        public JsonResult DirectResetUserPersonalAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectResetUserPersonalAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectResetUserPersonalAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MakerCode = data["MakerCode"].ToString(); //创客编号
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
+            }
+            var user = UsersService.QueryByMakerCode(MakerCode);
+            if (user.Id == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetUserSelfStatDataQueue", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 重置交易额-银联重置创客个人交易额
+        [Authorize]
+        public JsonResult UnionPayResetUserPersonalAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayResetUserPersonalAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayResetUserPersonalAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MakerCode = data["MakerCode"].ToString(); //创客编号
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
+            }
+            var user = UsersService.QueryByMakerCode(MakerCode);
+            if (user.Id == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetUserSelfStatDataQueue2", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 重置交易额-直连重置创客团队交易额
+        [Authorize]
+        public JsonResult DirectResetUserTeamAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectResetUserTeamAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectResetUserTeamAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MakerCode = data["MakerCode"].ToString(); //创客编号
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
+            }
+            var user = UsersService.QueryByMakerCode(MakerCode);
+            if (user.Id == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetUserTeamStatDataQueue", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 重置交易额-银联重置创客团队交易额
+        [Authorize]
+        public JsonResult UnionPayResetUserTeamAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayResetUserTeamAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayResetUserTeamAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MakerCode = data["MakerCode"].ToString(); //创客编号
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["MakerCode"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "创客编号和交易时间不能为空" };
+            }
+            var user = UsersService.QueryByMakerCode(MakerCode);
+            if (user.Id == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "未找到" + MakerCode + "相关信息" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"UserId\":\"" + user.Id + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetUserTeamStatDataQueue2", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+    }
+}

+ 47 - 0
Areas/Api/Controllers/v1/Main2/ConsumerOrdersController.cs

@@ -43,6 +43,8 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
             string IsAct = data["IsAct"].ToString(); //是否参与分账(0 否 1 是)
             string Status = data["Status"].ToString(); //交易状态(0 未支付 1 已支付)
             string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体 3 小微)
+            string TradePayNo = data["TradePayNo"].ToString(); //第三方交易号
+            string DivideFlag = data["DivideFlag"].ToString(); //分账状态(-1无 0 未分账 2 分账中 1 已完成)
             int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
             int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
             string condition = "";
@@ -94,6 +96,30 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 var Ids = MerchantInfoUtil.QueryMerchantIdBySubjectType(SubjectType);
                 condition += " and MerchantId in (" + Ids + ")";
             }
+            if (!string.IsNullOrEmpty(data["TradePayNo"].ToString()))
+            {
+                condition += " and TradePayNo='" + TradePayNo + "'";
+            }
+            if (!string.IsNullOrEmpty(data["DivideFlag"].ToString()))
+            {
+                var flag = int.Parse(data["DivideFlag"].ToString());
+                if (flag == -1)
+                {
+                    condition += " and IsAct=0 and DivideFlag=0";
+                }
+                if (flag == 0)
+                {
+                    condition += " and IsAct=1 and DivideFlag=0";
+                }
+                if (flag == 2)
+                {
+                    condition += " and IsAct=1 and DivideFlag=1";
+                }
+                if (flag == 1)
+                {
+                    condition += " and IsAct=1 and DivideFlag=2";
+                }
+            }
             List<RelationData> relationData = new List<RelationData>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             Other = new Dictionary<string, object>();
@@ -118,6 +144,27 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 if (query.SubjectType == "SUBJECT_TYPE_INDIVIDUAL") subjectType = 2; //个体工商户
                 if (query.SubjectType == "SUBJECT_TYPE_SMALL") subjectType = 3; //小微
                 curData.Add("SubjectType", subjectType); //主体类型(1 企业 2 个体 3 小微)
+                curData.Add("TradePayNo", TradePayNo); //第三方交易号
+                var divideFlag = 0;
+                var isAct = int.Parse(subdata["IsAct"].ToString());
+                var dFlag = int.Parse(subdata["DivideFlag"].ToString());
+                if (isAct == 0 && dFlag == 0)
+                {
+                    divideFlag = -1;
+                }
+                if (isAct == 1 && dFlag == 0)
+                {
+                    divideFlag = 0;
+                }
+                if (isAct == 1 && dFlag == 1)
+                {
+                    divideFlag = 2;
+                }
+                if (isAct == 1 && dFlag == 2)
+                {
+                    divideFlag = 1;
+                }
+                curData.Add("DivideFlag", divideFlag); //分账状态(-1无 0 未分账 2 分账中 1 已完成)
                 dataList.Add(curData);
             }
             Other.Add("Count", count); //总数

+ 79 - 0
Areas/Api/Controllers/v1/Main2/ConsumerProfitController.cs

@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main2;
+using MySystem.Service.Main2;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main2
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class ConsumerProfitController : BaseController
+    {
+        public ConsumerProfitController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 交易查询-银联商户订单分账记录
+        [Authorize]
+        public JsonResult UnionPayOrderProfitList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = UnionPayOrderProfitListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> UnionPayOrderProfitListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string OrderId = data["OrderId"].ToString(); //订单Id
+            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            var orderId = int.Parse(OrderId);
+            var order = ConsumerOrdersService.Query(orderId);
+            var Status = 0;
+            if (order.IsAct == 0 && order.DivideFlag == 0)
+            {
+                Status = -1;
+            }
+            if (order.IsAct == 1 && order.DivideFlag == 0)
+            {
+                Status = 0;
+            }
+            if (order.IsAct == 1 && order.DivideFlag == 1)
+            {
+                Status = 2;
+            }
+            if (order.IsAct == 1 && order.DivideFlag == 2)
+            {
+                Status = 1;
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = ConsumerProfitService.List(relationData, " and OrderId=" + orderId + "", 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("OrderNo", order.OrderNo); //来源单号
+                curData.Add("Amount", decimal.Parse(subdata["GetMoney"].ToString()).ToString("f2")); //分红金额
+                curData.Add("DivideDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //分红时间
+                curData.Add("Status", Status); //分账状态(-1无 0 未分账 2 分账中 1 已完成)
+                curData.Add("SetRecordId", order.SetRecordId); //活动Id
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 209 - 4
Areas/Api/Controllers/v1/Main2/MerchantAddInfoController.cs

@@ -225,6 +225,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
             string MatchNo = data["MatchNo"].ToString(); //商户号
             string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体 3 小微)
             string IsAct = data["IsAct"].ToString(); //激活状态(0 未激活 1 已激活)
+            string ActDate = data["ActDate"].ToString(); //激活时间
             int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
             int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
             string condition = "";
@@ -259,6 +260,14 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 var Ids = MerchantInfoUtil.QueryIsActMerchantId(int.Parse(IsAct));
                 condition += " and Id in (" + Ids + ")";
             }
+            if (!string.IsNullOrEmpty(data["ActDate"].ToString()))
+            {
+                string[] datelist = ActDate.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                var Ids = MerchantInfoUtil.QueryActDateMerchantId(start, end);
+                condition += " and Id in (" + Ids + ")";
+            }
             List<RelationData> relationData = new List<RelationData>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             Other = new Dictionary<string, object>();
@@ -273,6 +282,13 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 var userInfo = UsersService.Query(merInfo.UserId);
                 curData.Add("MerchantId", subdata["Id"].ToString()); //商户Id
                 curData.Add("IsAct", merInfo.IsAct); //激活状态(0 未激活 1 已激活)
+                var actDate = "";
+                var order = MerchantDepositOrderService.Query(" and Status>0 and MerchantId=" + MerchantId + "");
+                if (order.Id > 0)
+                {
+                    actDate = order.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
+                }
+                curData.Add("ActDate", actDate); //激活时间
                 curData.Add("MerchantName", subdata["CertMerchantName"].ToString()); //商户名称
                 curData.Add("Mobile", subdata["MobilePhone"].ToString()); //手机号码
                 curData.Add("MakerCode", userInfo.MakerCode); //所属创客
@@ -295,9 +311,6 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         #endregion
 
 
-
-
-
         #region 节点操作-银联提交微信开户意愿
         [Authorize]
         public JsonResult UnionWeChatMerchantOpenAccount(string value)
@@ -349,8 +362,15 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         {
             JsonData data = JsonMapper.ToObject(value);
             int id = int.Parse(function.CheckInt(data["id"].ToString()));
-            Dictionary<string, object> Obj = new Dictionary<string, object>();                        
+            Dictionary<string, object> Obj = new Dictionary<string, object>(); 
+            var merAddInfo = main2db.MerchantAddInfo.FirstOrDefault(m => m.Id == id) ?? new MerchantAddInfo();
+            var merInfo = main2db.MerchantInfo.FirstOrDefault(m => m.Id == id) ?? new MerchantInfo();
+            merAddInfo.Status = 0;
+            merAddInfo.QueryCount = 0;
+            merInfo.Status = 0;
+            merInfo.QueryCount = 0;
             RedisDbconn.Instance.AddList("MerchantConfirmHdQueue", "{\"MerchantId\":\"" + id + "\"}");
+            main2db.SaveChanges();                       
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
         }
         #endregion
@@ -454,5 +474,190 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         #endregion
 
 
+
+        #region 进件管理-银联修改商户名称
+        [Authorize]
+        public JsonResult UnionPayEditMerchantName(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayEditMerchantNameDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayEditMerchantNameDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string MerchantName = data["MerchantName"].ToString(); //新商户名称
+            string MerchantShortName = data["MerchantShortName"].ToString(); //新商户简称
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var Id = int.Parse(MerchantId);
+            var query = main2db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
+            var merInfo = main2db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+            if (query.Id > 0)
+            {
+                if (!string.IsNullOrEmpty(MerchantName))
+                {
+                    query.CertMerchantName = MerchantName;
+                    merInfo.Name = MerchantName;
+                }
+                if (!string.IsNullOrEmpty(MerchantShortName))
+                {
+                    query.MerchantShortname = MerchantShortName;
+                }
+            }
+            main2db.SaveChanges();
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 商户管理-银联查询商户交易信息导出
+        [Authorize]
+        public JsonResult ExportUnionPayQueryMerchantTradeInfo(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = ExportUnionPayQueryMerchantTradeInfoDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson ExportUnionPayQueryMerchantTradeInfoDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantName = data["MerchantName"].ToString(); //商户名称
+            string Mobile = data["Mobile"].ToString(); //手机号码
+            string MakerCode = data["MakerCode"].ToString(); //所属创客
+            string MatchNo = data["MatchNo"].ToString(); //商户号
+            string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体 3 小微)
+            string IsAct = data["IsAct"].ToString(); //激活状态(0 未激活 1 已激活)
+            string ActDate = data["ActDate"].ToString(); //激活时间
+            string condition = "";
+            var merIds = MerchantInfoUtil.QueryAnyIsOkMerchantId();
+            condition = " and Id in (" + merIds + ")";
+            if (!string.IsNullOrEmpty(MerchantName))
+            {
+                condition += " and CertMerchantName like '%" + MerchantName + "%'";
+            }
+            if (!string.IsNullOrEmpty(Mobile))
+            {
+                condition += " and MobilePhone='" + Mobile + "'";
+            }
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                var Ids = MerchantInfoUtil.QueryMerchantIdByMakerCode(MakerCode);
+                condition += " and Id in (" + Ids + ")";
+            }
+            if (!string.IsNullOrEmpty(MatchNo))
+            {
+                condition += " and MchtNo='" + MatchNo + "'";
+            }
+            if (!string.IsNullOrEmpty(SubjectType))
+            {
+                if (SubjectType == "1") SubjectType = "SUBJECT_TYPE_ENTERPRISE"; //企业公司
+                if (SubjectType == "2") SubjectType = "SUBJECT_TYPE_INDIVIDUAL"; //个体工商户
+                if (SubjectType == "3") SubjectType = "SUBJECT_TYPE_SMALL"; //小微
+                condition += " and SubjectType='" + SubjectType + "'";
+            }
+            if (!string.IsNullOrEmpty(IsAct))
+            {
+                var Ids = MerchantInfoUtil.QueryIsActMerchantId(int.Parse(IsAct));
+                condition += " and Id in (" + Ids + ")";
+            }
+            if (!string.IsNullOrEmpty(data["ActDate"].ToString()))
+            {
+                string[] datelist = ActDate.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                var Ids = MerchantInfoUtil.QueryActDateMerchantId(start, end);
+                condition += " and Id in (" + Ids + ")";
+            }
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var Sql = "SELECT a.Id '商户Id',(CASE WHEN b.IsAct=0 THEN '未激活' WHEN b.IsAct=1 THEN '已激活' ELSE '' end) '激活状态',c.UpdateDate '激活时间',a.CertMerchantName '商户名称',a.MobilePhone '手机号码',b.UserId '所属创客Id',(CASE WHEN a.SubjectType='SUBJECT_TYPE_ENTERPRISE' THEN '企业公司' WHEN a.SubjectType='SUBJECT_TYPE_INDIVIDUAL' THEN '个体工商户' WHEN a.SubjectType='SUBJECT_TYPE_SMALL' THEN '小微' ELSE '' end) '主体类型',a.MchtNo '商户号',(SELECT SUM(TradeCount) TradeCount FROM MerchantAmountSummay WHERE 1=1 AND MerchantId=a.Id) '订单总数',(SELECT SUM(TotalActual) TotalActual FROM MerchantAmountSummay WHERE 1=1 AND MerchantId=a.Id)' 实收总金额',(SELECT SUM(TradeAmount) TradeAmount FROM MerchantAmountSummay WHERE 1=1 AND MerchantId=a.Id) '营业总金额' FROM(SELECT Id,CertMerchantName,MobilePhone,MchtNo,SubjectType FROM MerchantAddInfo WHERE 1=1 " + condition + " AND (Status=2 or QueryCount=2)) a LEFT JOIN (SELECT Id,IsAct,UserId FROM MerchantInfo WHERE 1=1 AND Status=2 or QueryCount=2) b ON a.Id=b.Id LEFT JOIN (SELECT MerchantId,UpdateDate FROM MerchantDepositOrder WHERE `Status`>0)c ON a.Id=c.MerchantId ORDER BY a.Id";
+            var FileName = "商户管理-银联查询商户交易信息" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string SendData = "{\"Operater\":\"" + AppConfig.LoginSession.sysId + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
+            RedisDbconn.Instance.AddList("ExportQueue", SendData);
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+        #region 银联结算管理-银联结算记录
+        [Authorize]
+        public JsonResult UnionPaySettlementRecordList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = UnionPaySettlementRecordListDo(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        private List<Dictionary<string, object>> UnionPaySettlementRecordListDo(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantName = data["MerchantName"].ToString(); //商户名称
+            string MerchantNo = data["MerchantNo"].ToString(); //商户号
+            string SettlementDate = data["SettlementDate"].ToString(); //结算时间(必填)
+            string SettleStatus = data["SettleStatus"].ToString(); //出款状态(0 入账成功 1 入账失败 2 结算超时 3 入账受理成功 4 已提交结算请求)
+            string pageSize = data["page_size"].ToString();
+            string pageNum = data["page_num"].ToString();
+            var MerchantId = 0;
+            string StartDate = "";
+            string EndDate = "";
+            if (!string.IsNullOrEmpty(data["MerchantName"].ToString()))
+            {
+                var merAddInfo = MerchantAddInfoService.Query(" and CertMerchantName='" + MerchantName + "'");
+                MerchantId = merAddInfo.Id;
+            }
+            if (!string.IsNullOrEmpty(data["MerchantNo"].ToString()))
+            {
+                var merAddInfo = MerchantAddInfoService.Query(" and MchtNo='" + MerchantNo + "'");
+                MerchantId = merAddInfo.Id;
+            }
+            if (!string.IsNullOrEmpty(data["SettlementDate"].ToString()))
+            {
+                string[] datelist = SettlementDate.Split(new string[] { " - " }, StringSplitOptions.None);
+                StartDate = datelist[0];
+                EndDate = datelist[1];
+            }
+            Other = new Dictionary<string, object>();
+            var dataList = MySelfUtil.CardInComeRecordList(MerchantId, StartDate, EndDate, SettleStatus, pageSize, pageNum, out Other);
+            Other = Other;
+            return dataList;
+        }
+        #endregion
+
+
+        #region 重置交易额-银联重置商户交易额
+        [Authorize]
+        public JsonResult UnionPayResetMerchantAmount(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayResetMerchantAmountDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayResetMerchantAmountDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string TradeDate = data["TradeDate"].ToString(); //交易时间
+            if (string.IsNullOrEmpty(data["MerchantId"].ToString()) || string.IsNullOrEmpty(data["TradeDate"].ToString()))
+            {
+                return new AppResultJson() { Status = "-1", Info = "商户Id和交易时间不能为空" };
+            }
+            string[] datelist = TradeDate.Split(new string[] { " - " }, StringSplitOptions.None);
+            string start = DateTime.Parse(datelist[0]).ToString("yyyyMMdd");
+            string end = DateTime.Parse(datelist[1]).ToString("yyyyMMdd");
+            string info = "{\"MerchantId\":\"" + MerchantId + "\",\"StartDate\":\"" + start + "\",\"EndDate\": \"" + end + "\"}";
+            RedisDbconn.Instance.AddList("ResetMerchantStatDataQueue2", info);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+
+            return new AppResultJson() { Status = "1", Info = "成功", Data = Obj };
+        }
+        #endregion
+
+
     }
 }

+ 70 - 0
Areas/Api/Controllers/v1/Main2/MerchantAmountSummayController.cs

@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main2;
+using MySystem.Service.Main2;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main2
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class MerchantAmountSummayController : BaseController
+    {
+        public MerchantAmountSummayController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 交易统计-银联商户交易统计
+        [Authorize]
+        public JsonResult UnionPayMerchantTradeSummaryList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = UnionPayMerchantTradeSummaryListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> UnionPayMerchantTradeSummaryListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantName = data["MerchantName"].ToString(); //商户名称
+            string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体 3 小微)
+            string TradeDate = data["TradeDate"].ToString(); //交易日期
+            string MerchantNo = data["MerchantNo"].ToString(); //商户号
+            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            string condition = "";
+            List<RelationData> relationData = new List<RelationData>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = MerchantAmountSummayService.List(relationData, condition, pageNum, pageSize);
+            foreach (Dictionary<string, object> subdata in source)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("", subdata[""].ToString()); //
+                curData.Add("TradeDate", ""); //交易日期
+                curData.Add("MerchantName", ""); //商户名称
+                curData.Add("TodayAmount", ""); //当日总收入
+                curData.Add("TotalAmount", ""); //营收总金额
+                curData.Add("InFactAmount", ""); //实收总金额
+                curData.Add("ActAmount", ""); //活动交易额
+                curData.Add("NonActAmount", ""); //非活动交易额
+                curData.Add("WeChatInFactAmount", ""); //微信实收
+                curData.Add("AliPayInFactAmount", ""); //支付宝实收
+                curData.Add("OrderCount", ""); //订单总数
+
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 152 - 1
Areas/Api/Controllers/v1/Main2/MerchantInfoController.cs

@@ -21,7 +21,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         public MerchantInfoController(IHttpContextAccessor accessor) : base(accessor)
         {
         }
-        
+
         #region 商户激活-银联达标商户列表
         [Authorize]
         public JsonResult UnionPayQualifiedMerchants(string value)
@@ -77,6 +77,157 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         #endregion
 
 
+        #region 商户管理-商户管理-银联重置登录密码
+        [Authorize]
+        public JsonResult UnionPayResetLoginPwd(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayResetLoginPwdDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayResetLoginPwdDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var Id = int.Parse(MerchantId);
+            var query = main2db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+            var loginMobile = main1db.MerchantLoginInfo.FirstOrDefault(m => m.LoginMobile == query.Mobile) ?? new Models.Main1.MerchantLoginInfo();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            if (query.Id > 0)
+            {
+                query.LoginPwd = function.MD532(query.Mobile.Substring(query.Mobile.Length - 6, 6)); //登录密码
+                if (loginMobile.Id > 0)
+                {
+                    loginMobile.LoginPwd = query.LoginPwd; //登录密码
+                }
+            }
+            main2db.SaveChanges();
+            main1db.SaveChanges();
+
+            return new AppResultJson() { Status = "1", Info = "该商户的登录密码已重置为手机号后6位", Data = Obj };
+        }
+        #endregion
+
+
+        #region 商户管理-商户管理-银联修改手机号
+        [Authorize]
+        public JsonResult UnionPayEditMobile(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayEditMobileDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayEditMobileDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string Mobile = data["Mobile"].ToString(); //新手机号
+            string MobileCode = data["MobileCode"].ToString(); //短信验证码
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            if (Mobile.Length != 11 || !function.IsInt(Mobile) || Mobile.Substring(0, 1) != "1")
+            {
+                return new AppResultJson() { Status = "-1", Info = "手机号不正确" };
+            }
+            var mobilecheck = RedisDbconn.Instance.Get<string>("MobileCodeCheck:" + Mobile);
+            if (mobilecheck == "")
+            {
+                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
+            }
+            if (mobilecheck != MobileCode)
+            {
+                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
+            }
+            RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
+            var check = Service.Main1.MerchantLoginInfoService.Query(" and LoginMobile=" + Mobile + "");
+            if (check.Id > 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "已存在相关登录手机号" };
+            }
+            var Id = int.Parse(MerchantId);
+            var query = main2db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
+            var loginMobile = main1db.MerchantLoginInfo.FirstOrDefault(m => m.LoginMobile == query.Mobile) ?? new Models.Main1.MerchantLoginInfo();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            if (query.Id > 0)
+            {
+                query.Mobile = Mobile;
+                query.LoginPwd = function.MD532(Mobile.Substring(Mobile.Length - 6, 6)); //登录密码
+                if (loginMobile.Id > 0)
+                {
+                    loginMobile.LoginMobile = Mobile;
+                    loginMobile.LoginPwd = query.LoginPwd; //登录密码
+                }
+            }
+            main2db.SaveChanges();
+            main1db.SaveChanges();
+
+            return new AppResultJson() { Status = "1", Info = "修改成功,新密码默认为该手机号后6位", Data = Obj };
+        }
+        #endregion
+
+
+        #region 商户管理-商户管理-银联商户激活订单补全
+        [Authorize]
+        public JsonResult UnionPayActOrderCompletion(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayActOrderCompletionDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayActOrderCompletionDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string OutTradeNo = data["OutTradeNo"].ToString(); //外部交易号(D或U开头)
+            string TradeNo = data["TradeNo"].ToString(); //交易号(数字开头)
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            if (string.IsNullOrEmpty(OutTradeNo) || string.IsNullOrEmpty(TradeNo))
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号或交易号为空", Data = Obj };
+            }
+            if (OutTradeNo.StartsWith("U"))
+            {
+                RedisDbconn.Instance.AddList("AlipayCallBack2", "{\"out_trade_no\":\"" + OutTradeNo + "\",\"transaction_id\":\"" + TradeNo + "\",\"total_fee\":\"" + 0 + "\",\"pay_mode\":\"1\",\"openid\":\"\",\"attach\":\"\"}");
+                return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号有误", Data = Obj };
+            }
+        }
+        #endregion
+
+
+        #region 商户管理-商户管理-银联商户支付订单补全
+        [Authorize]
+        public JsonResult UnionPayOrderCompletion(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = UnionPayOrderCompletionDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson UnionPayOrderCompletionDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            string OutTradeNo = data["OutTradeNo"].ToString(); //外部交易号(G开头)
+            string TradeNo = data["TradeNo"].ToString(); //交易号(数字开头)
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            if (string.IsNullOrEmpty(OutTradeNo) || string.IsNullOrEmpty(TradeNo))
+            {
+                return new AppResultJson() { Status = "-1", Info = "外部交易号或交易号为空", Data = Obj };
+            }
+            RedisDbconn.Instance.AddList("WeChatPayBackHd", "{\"outOrderNo\":\"" + TradeNo + "\",\"orderNo\":\"" + OutTradeNo + "\"}");
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
 
     }
 }

+ 91 - 0
Areas/Api/Controllers/v1/Main2/MerchantParamSetRecordController.cs

@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main2;
+using MySystem.Service.Main2;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main2
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class MerchantParamSetRecordController : BaseController
+    {
+        public MerchantParamSetRecordController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+        #region 商户管理-商户管理-银联商户活动变更记录
+        // [Authorize]
+        public JsonResult UnionPayMerchantParamSetRecordList(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = UnionPayMerchantParamSetRecordListDo(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        private List<Dictionary<string, object>> UnionPayMerchantParamSetRecordListDo(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            string MerchantId = data["MerchantId"].ToString(); //商户Id
+            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["MerchantId"].ToString()))
+            {
+                condition += " and MerchantId='" + MerchantId + "'";
+            }
+            List<RelationData> relationData = new List<RelationData>();
+            Other = new Dictionary<string, object>();
+            int count = 0;
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = MerchantParamSetRecordService.List(relationData, condition, out count, pageNum, pageSize);
+            var merSet = MerchantParamSetService.Query(int.Parse(MerchantId));
+            foreach (Dictionary<string, object> subdata in source)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                var Id = int.Parse(subdata["Id"].ToString()); //变更记录Id
+                curData.Add("Id", Id); //变更记录Id
+                var status = -1;
+                if (merSet.Version == Id && merSet.IsAll == 0)
+                {
+                    status = 1;
+                }
+                var Version = merSet.Version;
+                var a = subdata["BeforeIsAll"].ToString();
+                var b = subdata["AfterIsAll"].ToString();
+                if (subdata["BeforeIsAll"].ToString() == "0" && subdata["AfterIsAll"].ToString() == "1")
+                {
+                    status = 0;
+                }
+                if (merSet.Version != Id && subdata["BeforeIsAll"].ToString() == "0" && subdata["AfterIsAll"].ToString() == "0")
+                {
+                    status = -1;
+                }
+                curData.Add("Status", status); //活动状态(1 使用中 -1 已失效 0 已关闭)
+                curData.Add("MerchantName", MerchantAddInfoService.Query(int.Parse(subdata["MerchantId"].ToString())).CertMerchantName); //商户名称
+                curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //最后操作时间
+                curData.Add("GetPercent", subdata["AfterGetPercent"].ToString()); //实收比例
+                curData.Add("DiviPersons", subdata["AfterDiviPersons"].ToString()); //分红人数
+                curData.Add("ProfitDays", subdata["AfterProfitDays"].ToString()); //分红天数
+                curData.Add("MinPayMoney", subdata["AfterMinPayMoney"].ToString()); //参与门槛
+                curData.Add("DiviPercent", subdata["AfterDiviPercent"].ToString()); //最大分红比例
+
+                dataList.Add(curData);
+            }
+            Other.Add("Count", count); //总数
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 27 - 0
Areas/Api/Controllers/v1/Main2/PosMachinesTwoController.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.Models.Main2;
+using MySystem.Service.Main2;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.Main2
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class PosMachinesTwoController : BaseController
+    {
+        public PosMachinesTwoController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+
+    }
+}

+ 3 - 0
Models/Main1/ConsumerOrders.cs

@@ -32,5 +32,8 @@ namespace MySystem.Models.Main1
         public string DivideLog { get; set; }
         public int DivideFlag { get; set; }
         public DateTime? DivideDate { get; set; }
+        public string TradePayNo { get; set; }
+        public int SetRecordId { 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");

+ 2 - 0
Models/Main2/ConsumerOrders.cs

@@ -32,5 +32,7 @@ namespace MySystem.Models.Main2
         public int DivideFlag { get; set; }
         public DateTime? DivideDate { get; set; }
         public string DivideLog { get; set; }
+        public string TradePayNo { get; set; }
+        public int SetRecordId { get; set; }
     }
 }

+ 1 - 0
Models/Main2/MerchantAddInfo.cs

@@ -147,5 +147,6 @@ namespace MySystem.Models.Main2
         public int HdStatus { get; set; }
         public DateTime? HdPassDate { get; set; }
         public ulong HdBindWeChat { get; set; }
+        public string MerchantType { get; set; }
     }
 }

+ 34 - 0
Models/Main2/MerchantParamSetRecord.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models.Main2
+{
+    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; }
+    }
+}

+ 127 - 0
Models/Main2/WebCMSEntities.cs

@@ -103,6 +103,7 @@ namespace MySystem.Models.Main2
         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; }
@@ -2311,6 +2312,10 @@ namespace MySystem.Models.Main2
                     .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 +2325,12 @@ namespace MySystem.Models.Main2
 
                 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)
@@ -5531,6 +5542,12 @@ namespace MySystem.Models.Main2
                     .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")
@@ -6969,6 +6986,116 @@ namespace MySystem.Models.Main2
                 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)");

+ 7 - 7
Service/Bs/PageInfoService.cs

@@ -34,7 +34,7 @@ namespace MySystem.Service.Bs
             fields.Add("Title"); //标题
             fields.Add("ColId"); //分类
 
-            Dictionary<string, object> obj = new DbService(AppConfig.Base.dbTables, _conn).IndexData("PageInfo", relationData, orderBy, page, limit, condition, fields);
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("PageInfo", 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;
@@ -48,7 +48,7 @@ namespace MySystem.Service.Bs
             fields.Add("Title"); //标题
             fields.Add("ColId"); //分类
 
-            Dictionary<string, object> obj = new DbService(AppConfig.Base.dbTables, _conn).IndexData("PageInfo", relationData, orderBy, page, limit, condition, fields);
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("PageInfo", relationData, orderBy, page, limit, condition, fields);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             return diclist;
         }
@@ -106,7 +106,7 @@ namespace MySystem.Service.Bs
             {
 
             }
-            int Id = new DbService(AppConfig.Base.dbTables, _conn).Add("PageInfo", fields, 0);
+            int Id = new DbService(AppConfig.Base.bsTables, _conn).Add("PageInfo", fields, 0);
             return new AppResultJson() { Status = "1", Data = Id };
         }
 
@@ -121,7 +121,7 @@ namespace MySystem.Service.Bs
             {
 
             }
-            new DbService(AppConfig.Base.dbTables, _conn).Edit("PageInfo", fields, Id);
+            new DbService(AppConfig.Base.bsTables, _conn).Edit("PageInfo", fields, Id);
             return new AppResultJson() { Status = "1", Data = Id };
         }
 
@@ -133,7 +133,7 @@ namespace MySystem.Service.Bs
         {
             Dictionary<string, object> fields = new Dictionary<string, object>();
             fields.Add("Status", -1);
-            new DbService(AppConfig.Base.dbTables, _conn).Edit("PageInfo", fields, Id);
+            new DbService(AppConfig.Base.bsTables, _conn).Edit("PageInfo", fields, Id);
         }
 
         /// <summary>
@@ -142,7 +142,7 @@ namespace MySystem.Service.Bs
         /// <param name="Id">主键Id</param>
         public static void Delete(int Id)
         {
-            new DbService(AppConfig.Base.dbTables, _conn).Delete("PageInfo", Id);
+            new DbService(AppConfig.Base.bsTables, _conn).Delete("PageInfo", Id);
         }
 
         /// <summary>
@@ -152,7 +152,7 @@ namespace MySystem.Service.Bs
         /// <param name="Sort">排序序号</param>
         public static void Sort(int Id, int Sort)
         {
-            new DbService(AppConfig.Base.dbTables, _conn).Sort("PageInfo", Sort, Id);
+            new DbService(AppConfig.Base.bsTables, _conn).Sort("PageInfo", Sort, Id);
         }
 
         /// <summary>

+ 255 - 0
Service/Main1/ExportExcelsService.cs

@@ -0,0 +1,255 @@
+/*
+ * excel导出数据
+ */
+
+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 ExportExcelsService
+    {
+        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("ExportExcels", 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("ExportExcels", 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("ExportExcels", 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 ExportExcels Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "ExportExcels", Id);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<ExportExcels>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new ExportExcels();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static ExportExcels Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "ExportExcels", condition);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<ExportExcels>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new ExportExcels();
+        }
+
+        /// <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, "ExportExcels", condition);
+            return obj;
+        }
+        
+        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 + "", "ExportExcels", condition);
+            if(obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(obj[field].ToString());
+            }
+            return amount;
+        }
+
+        /// <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 + "", "ExportExcels", 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", "ExportExcels", 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["FileName"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写文件名" };
+}
+if (string.IsNullOrEmpty(fields["FileUrl"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写文件路径" };
+}
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("ExportExcels", 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["FileName"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写文件名" };
+}
+if (string.IsNullOrEmpty(fields["FileUrl"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写文件路径" };
+}
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("ExportExcels", 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("ExportExcels", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("ExportExcels", 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("ExportExcels", 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.ExportExcels.Add(new ExportExcels()
+            //     {
+            //         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)
+        // {
+            
+        // }
+    }
+}

+ 319 - 0
Service/Main1/MerchantLoginInfoService.cs

@@ -0,0 +1,319 @@
+/*
+ * 商户登录
+ */
+
+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 MerchantLoginInfoService
+    {
+        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("MerchantLoginInfo", 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("MerchantLoginInfo", 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("MerchantLoginInfo", 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 MerchantLoginInfo Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantLoginInfo", Id);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantLoginInfo>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantLoginInfo();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static MerchantLoginInfo Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantLoginInfo", condition);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantLoginInfo>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantLoginInfo();
+        }
+
+        /// <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, "MerchantLoginInfo", condition);
+            return obj;
+        }
+
+        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 + "", "MerchantLoginInfo", condition);
+            if (obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(function.CheckNum(obj[field].ToString()));
+            }
+            return amount;
+        }
+
+        /// <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 + "", "MerchantLoginInfo", 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", "MerchantLoginInfo", 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["Name"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写名称" };
+                }
+                if (string.IsNullOrEmpty(fields["Mobile"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写手机号" };
+                }
+                if (string.IsNullOrEmpty(fields["ActivationStatus"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写激活状态" };
+                }
+                if (string.IsNullOrEmpty(fields["ActMaxAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写活动应返金额" };
+                }
+                if (!function.IsNum(fields["ActMaxAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的活动应返金额" };
+                }
+                if (string.IsNullOrEmpty(fields["ActCurrentAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写活动已返金额" };
+                }
+                if (!function.IsNum(fields["ActCurrentAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的活动已返金额" };
+                }
+                if (!function.IsInt(fields["IsAct"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的商户激活标记" };
+                }
+                if (!function.IsInt(fields["ExamineStatus"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的服务费考核状态" };
+                }
+                if (!function.IsInt(fields["Months"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的达标月数" };
+                }
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("MerchantLoginInfo", 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["Name"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写名称" };
+                }
+                if (string.IsNullOrEmpty(fields["Mobile"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写手机号" };
+                }
+                if (string.IsNullOrEmpty(fields["ActivationStatus"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写激活状态" };
+                }
+                if (string.IsNullOrEmpty(fields["ActMaxAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写活动应返金额" };
+                }
+                if (!function.IsNum(fields["ActMaxAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的活动应返金额" };
+                }
+                if (string.IsNullOrEmpty(fields["ActCurrentAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写活动已返金额" };
+                }
+                if (!function.IsNum(fields["ActCurrentAmount"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的活动已返金额" };
+                }
+                if (!function.IsInt(fields["IsAct"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的商户激活标记" };
+                }
+                if (!function.IsInt(fields["ExamineStatus"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的服务费考核状态" };
+                }
+                if (!function.IsInt(fields["Months"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的达标月数" };
+                }
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("MerchantLoginInfo", 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("MerchantLoginInfo", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("MerchantLoginInfo", 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("MerchantLoginInfo", 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.MerchantLoginInfo.Add(new MerchantLoginInfo()
+            //     {
+            //         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)
+        // {
+
+        // }
+    }
+}

+ 287 - 0
Service/Main1/MerchantParamSetRecordService.cs

@@ -0,0 +1,287 @@
+/*
+ * 商户活动变更记录
+ */
+
+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 MerchantParamSetRecordService
+    {
+        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("MerchantParamSetRecord", 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("MerchantParamSetRecord", 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("MerchantParamSetRecord", 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 MerchantParamSetRecord Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantParamSetRecord", Id);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSetRecord>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSetRecord();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static MerchantParamSetRecord Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantParamSetRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSetRecord>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSetRecord();
+        }
+
+        /// <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, "MerchantParamSetRecord", condition);
+            return obj;
+        }
+
+        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 + "", "MerchantParamSetRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(function.CheckNum(obj[field].ToString()));
+            }
+            return amount;
+        }
+
+        /// <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 + "", "MerchantParamSetRecord", 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", "MerchantParamSetRecord", 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 = "请填写商户Id" };
+                }
+                if (!function.IsInt(fields["MerchantId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的商户Id" };
+                }
+                if (string.IsNullOrEmpty(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写创客Id" };
+                }
+                if (!function.IsInt(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的创客Id" };
+                }
+                if (!function.IsNum(fields["ActPayPrice"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的激活支付金额" };
+                }
+                if (string.IsNullOrEmpty(fields["OrderNo"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写订单号" };
+                }
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("MerchantParamSetRecord", 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 = "请填写商户Id" };
+                }
+                if (!function.IsInt(fields["MerchantId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的商户Id" };
+                }
+                if (string.IsNullOrEmpty(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写创客Id" };
+                }
+                if (!function.IsInt(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的创客Id" };
+                }
+                if (!function.IsNum(fields["ActPayPrice"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的激活支付金额" };
+                }
+                if (string.IsNullOrEmpty(fields["OrderNo"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写订单号" };
+                }
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("MerchantParamSetRecord", 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("MerchantParamSetRecord", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("MerchantParamSetRecord", 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("MerchantParamSetRecord", 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.MerchantParamSetRecord.Add(new MerchantParamSetRecord()
+            //     {
+            //         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)
+        // {
+
+        // }
+    }
+}

+ 303 - 0
Service/Main1/MerchantParamSetService.cs

@@ -0,0 +1,303 @@
+/*
+ * 商户活动配置
+ */
+
+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 MerchantParamSetService
+    {
+        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("MerchantParamSet", 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("MerchantParamSet", 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("MerchantParamSet", 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 MerchantParamSet Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantParamSet", Id);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSet();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static MerchantParamSet Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantParamSet", condition);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSet();
+        }
+
+        /// <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, "MerchantParamSet", condition);
+            return obj;
+        }
+        
+        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 + "", "MerchantParamSet", condition);
+            if(obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(obj[field].ToString());
+            }
+            return amount;
+        }
+
+        /// <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 + "", "MerchantParamSet", 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", "MerchantParamSet", 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["IsAll"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写是否收全额" };
+}
+if (string.IsNullOrEmpty(fields["MinPayMoney"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写订单参与门槛" };
+}
+if (string.IsNullOrEmpty(fields["GetPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写商家实收比例" };
+}
+if (string.IsNullOrEmpty(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写分红期限(天)" };
+}
+if (!function.IsInt(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的分红期限(天)" };
+}
+if (string.IsNullOrEmpty(fields["DiviPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写最大分红比例" };
+}
+if (string.IsNullOrEmpty(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写单笔订单分红人数" };
+}
+if (!function.IsInt(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的单笔订单分红人数" };
+}
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("MerchantParamSet", 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["IsAll"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写是否收全额" };
+}
+if (string.IsNullOrEmpty(fields["MinPayMoney"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写订单参与门槛" };
+}
+if (string.IsNullOrEmpty(fields["GetPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写商家实收比例" };
+}
+if (string.IsNullOrEmpty(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写分红期限(天)" };
+}
+if (!function.IsInt(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的分红期限(天)" };
+}
+if (string.IsNullOrEmpty(fields["DiviPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写最大分红比例" };
+}
+if (string.IsNullOrEmpty(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写单笔订单分红人数" };
+}
+if (!function.IsInt(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的单笔订单分红人数" };
+}
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("MerchantParamSet", 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("MerchantParamSet", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("MerchantParamSet", 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("MerchantParamSet", 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.MerchantParamSet.Add(new MerchantParamSet()
+            //     {
+            //         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)
+        // {
+            
+        // }
+    }
+}

+ 287 - 0
Service/Main1/PosMachinesTwoService.cs

@@ -0,0 +1,287 @@
+/*
+ * 机具库
+ */
+
+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 PosMachinesTwoService
+    {
+        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("PosMachinesTwo", 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("PosMachinesTwo", 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("PosMachinesTwo", 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 PosMachinesTwo Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "PosMachinesTwo", Id);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<PosMachinesTwo>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new PosMachinesTwo();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static PosMachinesTwo Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "PosMachinesTwo", condition);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<PosMachinesTwo>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new PosMachinesTwo();
+        }
+
+        /// <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, "PosMachinesTwo", condition);
+            return obj;
+        }
+        
+        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 + "", "PosMachinesTwo", condition);
+            if(obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(obj[field].ToString());
+            }
+            return amount;
+        }
+
+        /// <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 + "", "PosMachinesTwo", 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", "PosMachinesTwo", 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["UserId"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写所属创客" };
+}
+if (string.IsNullOrEmpty(fields["PosSn"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写SN编号" };
+}
+if (string.IsNullOrEmpty(fields["BuyUserId"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写购买人" };
+}
+if (string.IsNullOrEmpty(fields["OpId"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写运营中心" };
+}
+if (!function.IsInt(fields["IsSupplement"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的补录标记" };
+}
+if (!function.IsInt(fields["IsOpAct"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的补激活奖标记" };
+}
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("PosMachinesTwo", 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["UserId"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写所属创客" };
+}
+if (string.IsNullOrEmpty(fields["PosSn"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写SN编号" };
+}
+if (string.IsNullOrEmpty(fields["BuyUserId"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写购买人" };
+}
+if (string.IsNullOrEmpty(fields["OpId"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写运营中心" };
+}
+if (!function.IsInt(fields["IsSupplement"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的补录标记" };
+}
+if (!function.IsInt(fields["IsOpAct"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的补激活奖标记" };
+}
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("PosMachinesTwo", 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("PosMachinesTwo", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("PosMachinesTwo", 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("PosMachinesTwo", 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.PosMachinesTwo.Add(new PosMachinesTwo()
+            //     {
+            //         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)
+        // {
+            
+        // }
+    }
+}

+ 272 - 0
Service/Main1/SysWithdrawalApplyRecordService.cs

@@ -0,0 +1,272 @@
+/*
+ * 润观米账户提现申请记录
+ */
+
+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)
+            {
+
+            }
+            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)
+            {
+
+            }
+            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)
+        // {
+
+        // }
+    }
+}

+ 239 - 0
Service/Main1/UserSwapWhiteService.cs

@@ -0,0 +1,239 @@
+/*
+ * 循环返风控白名单
+ */
+
+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 UserSwapWhiteService
+    {
+        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("UserSwapWhite", 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("UserSwapWhite", 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("UserSwapWhite", 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 UserSwapWhite Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "UserSwapWhite", Id);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<UserSwapWhite>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new UserSwapWhite();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static UserSwapWhite Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "UserSwapWhite", condition);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<UserSwapWhite>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new UserSwapWhite();
+        }
+
+        /// <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, "UserSwapWhite", condition);
+            return obj;
+        }
+        
+        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 + "", "UserSwapWhite", condition);
+            if(obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(obj[field].ToString());
+            }
+            return amount;
+        }
+
+        /// <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 + "", "UserSwapWhite", 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", "UserSwapWhite", 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)
+            {
+                
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("UserSwapWhite", 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)
+            {
+                
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("UserSwapWhite", 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("UserSwapWhite", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("UserSwapWhite", 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("UserSwapWhite", 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.UserSwapWhite.Add(new UserSwapWhite()
+            //     {
+            //         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)
+        // {
+            
+        // }
+    }
+}

+ 287 - 0
Service/Main2/MerchantParamSetRecordService.cs

@@ -0,0 +1,287 @@
+/*
+ * 商户活动变更记录
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using MySystem.Models.Main2;
+using Library;
+using LitJson;
+
+namespace MySystem.Service.Main2
+{
+    public class MerchantParamSetRecordService
+    {
+        static string _conn = ConfigurationManager.AppSettings["SqlConnStr2"].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("MerchantParamSetRecord", 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("MerchantParamSetRecord", 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("MerchantParamSetRecord", 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 MerchantParamSetRecord Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantParamSetRecord", Id);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSetRecord>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSetRecord();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static MerchantParamSetRecord Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Query("*", "MerchantParamSetRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSetRecord>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSetRecord();
+        }
+
+        /// <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, "MerchantParamSetRecord", condition);
+            return obj;
+        }
+
+        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 + "", "MerchantParamSetRecord", condition);
+            if (obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(function.CheckNum(obj[field].ToString()));
+            }
+            return amount;
+        }
+
+        /// <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 + "", "MerchantParamSetRecord", 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", "MerchantParamSetRecord", 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 = "请填写商户Id" };
+                }
+                if (!function.IsInt(fields["MerchantId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的商户Id" };
+                }
+                if (string.IsNullOrEmpty(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写创客Id" };
+                }
+                if (!function.IsInt(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的创客Id" };
+                }
+                if (!function.IsNum(fields["ActPayPrice"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的激活支付金额" };
+                }
+                if (string.IsNullOrEmpty(fields["OrderNo"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写订单号" };
+                }
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main1Tables, _conn).Add("MerchantParamSetRecord", 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 = "请填写商户Id" };
+                }
+                if (!function.IsInt(fields["MerchantId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的商户Id" };
+                }
+                if (string.IsNullOrEmpty(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写创客Id" };
+                }
+                if (!function.IsInt(fields["UserId"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的创客Id" };
+                }
+                if (!function.IsNum(fields["ActPayPrice"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写正确的激活支付金额" };
+                }
+                if (string.IsNullOrEmpty(fields["OrderNo"].ToString()))
+                {
+                    return new AppResultJson() { Status = "-1", Info = "请填写订单号" };
+                }
+
+            }
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Edit("MerchantParamSetRecord", 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("MerchantParamSetRecord", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main1Tables, _conn).Delete("MerchantParamSetRecord", 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("MerchantParamSetRecord", 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.MerchantParamSetRecord.Add(new MerchantParamSetRecord()
+            //     {
+            //         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)
+        // {
+
+        // }
+    }
+}

+ 303 - 0
Service/Main2/MerchantParamSetService.cs

@@ -0,0 +1,303 @@
+/*
+ * 商户活动配置
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using MySystem.Models.Main2;
+using Library;
+using LitJson;
+
+namespace MySystem.Service.Main2
+{
+    public class MerchantParamSetService
+    {
+        static string _conn = ConfigurationManager.AppSettings["SqlConnStr2"].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.main2Tables, _conn).IndexData("MerchantParamSet", 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.main2Tables, _conn).IndexData("MerchantParamSet", 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.main2Tables, _conn).IndexData("MerchantParamSet", 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 MerchantParamSet Query(int Id)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main2Tables, _conn).Query("*", "MerchantParamSet", Id);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSet();
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public static MerchantParamSet Query(string condition)
+        {
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main2Tables, _conn).Query("*", "MerchantParamSet", condition);
+            if(obj.Keys.Count > 0)
+            {
+                return Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
+            }
+            return new MerchantParamSet();
+        }
+
+        /// <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.main2Tables, _conn).Query(fields, "MerchantParamSet", condition);
+            return obj;
+        }
+        
+        public static decimal Sum(string condition, string field)
+        {
+            decimal amount = 0;
+            Dictionary<string, object> obj = new DbServiceNew(AppConfig.Base.main2Tables, _conn).Query("Sum(" + field + ") " + field + "", "MerchantParamSet", condition);
+            if(obj.Keys.Count > 0)
+            {
+                amount = decimal.Parse(obj[field].ToString());
+            }
+            return amount;
+        }
+
+        /// <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.main2Tables, _conn).Query("count(" + field + ") " + field + "", "MerchantParamSet", 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.main2Tables, _conn).Query("1", "MerchantParamSet", 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["IsAll"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写是否收全额" };
+}
+if (string.IsNullOrEmpty(fields["MinPayMoney"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写订单参与门槛" };
+}
+if (string.IsNullOrEmpty(fields["GetPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写商家实收比例" };
+}
+if (string.IsNullOrEmpty(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写分红期限(天)" };
+}
+if (!function.IsInt(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的分红期限(天)" };
+}
+if (string.IsNullOrEmpty(fields["DiviPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写最大分红比例" };
+}
+if (string.IsNullOrEmpty(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写单笔订单分红人数" };
+}
+if (!function.IsInt(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的单笔订单分红人数" };
+}
+
+            }
+            int Id = new DbServiceNew(AppConfig.Base.main2Tables, _conn).Add("MerchantParamSet", 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["IsAll"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写是否收全额" };
+}
+if (string.IsNullOrEmpty(fields["MinPayMoney"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写订单参与门槛" };
+}
+if (string.IsNullOrEmpty(fields["GetPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写商家实收比例" };
+}
+if (string.IsNullOrEmpty(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写分红期限(天)" };
+}
+if (!function.IsInt(fields["ProfitDays"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的分红期限(天)" };
+}
+if (string.IsNullOrEmpty(fields["DiviPercent"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写最大分红比例" };
+}
+if (string.IsNullOrEmpty(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写单笔订单分红人数" };
+}
+if (!function.IsInt(fields["DiviPersons"].ToString()))
+{
+    return new AppResultJson() { Status = "-1", Info = "请填写正确的单笔订单分红人数" };
+}
+
+            }
+            new DbServiceNew(AppConfig.Base.main2Tables, _conn).Edit("MerchantParamSet", 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.main2Tables, _conn).Edit("MerchantParamSet", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbServiceNew(AppConfig.Base.main2Tables, _conn).Delete("MerchantParamSet", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public static void Sort(int Id, int Sort)
+        {
+            new DbServiceNew(AppConfig.Base.main2Tables, _conn).Sort("MerchantParamSet", 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.MerchantParamSet.Add(new MerchantParamSet()
+            //     {
+            //         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)
+        // {
+            
+        // }
+    }
+}

+ 540 - 0
Util/HaoDa/HaoDaHelper.cs

@@ -0,0 +1,540 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Security.Cryptography;
+using System.Text;
+using Aop.Api.Util;
+using Library;
+
+namespace MySystem
+{
+    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 = "";
+        string BrhCode = "030145";
+
+        public string BoxServiceFee(string SnList, string ServiceFee)
+        {
+            function.WriteLog(DateTime.Now.ToString(), "设置盒易付机具服务费");
+            function.WriteLog(SnList, "设置盒易付机具服务费");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            string batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
+
+            reqdic.Add("snList", SnList.Split(',').ToList());//终端列表
+            if (ServiceFee != "0")
+            {
+                ServiceFee += "00";
+            }
+            reqdic.Add("depositGear", ServiceFee);//押金档位
+            reqdic.Add("modelId", "MHN10916");//费率,固定0.6
+            reqdic.Add("brhCode", BrhCode);//机构号
+            reqdic.Add("batchNo", batchNo);//批次号
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+
+            Dictionary<string, string> headdic = GetHeader(reqdic);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            function.WriteLog("请求头\n" + head, "设置盒易付机具服务费");
+            function.WriteLog("请求参数\n" + req, "设置盒易付机具服务费");
+            function.WriteLog("请求地址:" + BoxRequestUrl + "/inst/register/terms", "设置盒易付机具服务费");
+            string result = PostWebRequest(BoxRequestUrl + "/inst/register/terms", req, headdic);
+            function.WriteLog("返回\n" + result + "\n\n", "设置盒易付机具服务费");
+            return result;
+        }
+
+        #region 上传图片接口
+        /// <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();
+        }
+        #endregion
+
+        public Dictionary<string, string> GetHeader(Dictionary<string, object> reqdic)
+        {
+            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");
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            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
+            {
+                function.WriteLog(DateTime.Now.ToString(), "好哒API日志");
+                function.WriteLog(postUrl, "好哒API日志");
+                function.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();
+                function.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";
+                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "好哒API异常");
+            }
+            return ret;
+        }
+
+
+        /// <summary>
+        /// 微信公众号和小程序支付接口
+        /// </summary>
+        /// <param name="mchtNo">盒子的商户编号</param>
+        /// <param name="storeNo">盒子的门店编码</param>
+        /// <param name="outOrderNo">商户订单号</param>
+        /// <param name="transAmount">交易金额,单位:分</param>
+        /// <param name="callbackUrl">交易完成之后,商户接收交易结果通知的地址</param>
+        /// <param name="subOpenId">用户子标识</param>
+        /// <param name="confirmCode">支付确认码</param>
+        /// <param name="subAppId">公众号或者小程序appId</param>
+        /// <param name="subAppIdType">对应的类型,默认为公众号, SUBSCRIPTION: 公众号 MINI_PROGRAM: 小程序</param>
+        /// <param name="ledgerModel">分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段</param>
+        /// <returns></returns>
+        public string WeChatPay(string mchtNo, string storeNo, string outOrderNo, decimal transAmount, string callbackUrl, string subOpenId, string confirmCode, string subAppId, string subAppIdType, string ledgerModel)
+        {
+            function.WriteLog(DateTime.Now.ToString(), "好哒微信公众号和小程序支付");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            reqdic.Add("mchtNo", mchtNo); //盒子的商户编号
+            reqdic.Add("storeNo", storeNo); //盒子的门店编码	
+            reqdic.Add("outOrderNo", outOrderNo); //商户订单号
+            int payAmount = (int)(transAmount * 100);
+            reqdic.Add("transAmount", payAmount); //交易金额,单位:分
+            reqdic.Add("callbackUrl", callbackUrl); //交易完成之后,商户接收交易结果通知的地址	
+            reqdic.Add("subOpenId", subOpenId); //用户子标识
+            reqdic.Add("confirmCode", confirmCode); //支付确认码,由4位纯数字组成,每次请求时随机生成	
+            reqdic.Add("subAppId", subAppId); //公众号或者小程序appId	
+            reqdic.Add("subAppIdType", subAppIdType); //subAppId 对应的类型,默认为公众号, SUBSCRIPTION: 公众号 MINI_PROGRAM: 小程序
+            reqdic.Add("ledgerModel", ledgerModel); //分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            function.WriteLog(req, "好哒微信公众号和小程序支付");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            function.WriteLog("请求头\n" + head, "好哒微信公众号和小程序支付");
+            function.WriteLog("请求参数\n" + req, "好哒微信公众号和小程序支付");
+            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", "好哒微信公众号和小程序支付");
+            string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/wechat_js_pay", req, headdic);
+            function.WriteLog("返回\n" + result + "\n\n", "好哒微信公众号和小程序支付");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 支付宝服务窗支付接口
+        /// </summary>
+        /// <param name="mchtNo">盒子的商户编号</param>
+        /// <param name="storeNo">盒子的门店编码</param>
+        /// <param name="outOrderNo">商户订单号</param>
+        /// <param name="transAmount">交易金额,单位:分</param>
+        /// <param name="callbackUrl">交易完成之后,商户接收交易结果通知的地址</param>
+        /// <param name="subOpenId">支付宝用户标识</param>
+        /// <param name="confirmCode">支付确认码,由4位纯数字组成,每次请求时随机生成</param>
+        /// <param name="ledgerModel">分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段</param>
+        /// <returns></returns>
+        public string Alipay(string mchtNo, string storeNo, string outOrderNo, decimal transAmount, string callbackUrl, string subOpenId, string confirmCode, string ledgerModel)
+        {
+            function.WriteLog(DateTime.Now.ToString(), "好哒支付宝服务窗支付");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            reqdic.Add("mchtNo", mchtNo); //盒子的商户编号
+            reqdic.Add("storeNo", storeNo); //盒子的门店编码	
+            reqdic.Add("outOrderNo", outOrderNo); //商户订单号
+            int payAmount = (int)(transAmount * 100);
+            reqdic.Add("transAmount", payAmount); //交易金额,单位:分	
+            reqdic.Add("callbackUrl", callbackUrl); //交易完成之后,商户接收交易结果通知的地址
+            reqdic.Add("subOpenId", subOpenId); //支付宝用户标识	
+            reqdic.Add("confirmCode", confirmCode); //支付确认码,由4位纯数字组成,每次请求时随机生成
+            reqdic.Add("ledgerModel", ledgerModel); //分账类型:1不分账 2分账,注意只有开通了分账才能传这个字段
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            function.WriteLog(req, "好哒支付宝服务窗支付");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            function.WriteLog("请求头\n" + head, "好哒支付宝服务窗支付");
+            function.WriteLog("请求参数\n" + req, "好哒支付宝服务窗支付");
+            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/hzg/v2/unitedtrade/ali_js_pay", "好哒支付宝服务窗支付");
+            string result = PostWebRequest(BoxRequestUrl + "/api/hzg/v2/unitedtrade/ali_js_pay", req, headdic);
+            function.WriteLog("返回\n" + result + "\n\n", "好哒支付宝服务窗支付");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 好哒到账记录查询
+        /// </summary>
+        /// <param name="mchtNo">商户号</param>
+        /// <param name="startTime">查询开始时间(yyyy-MM-dd)</param>
+        /// <param name="endTime">查询结束时间(yyyy-MM-dd),最大查询时间区间31天</param>
+        /// <param name="tradeMchtNo">收单商户号(15位)</param>
+        /// <param name="cardNo">结算卡号</param>
+        /// <param name="settleStatus">出款状态(0:入账成功、1:入账失败、2:结算超时、3:入账受理成功、4:已提交结算请求)</param>
+        /// <param name="page">当前页数,默认1</param>
+        /// <param name="rows">每页大小,默认10,最大500</param>
+        /// <returns></returns>
+        public string CardInComeRecord(string mchtNo, string startTime, string endTime, string tradeMchtNo, string cardNo, string settleStatus, string page, string rows)
+        {
+            function.WriteLog(DateTime.Now.ToString(), "好哒到账记录查询");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            reqdic.Add("mchtNo", mchtNo); //商户号
+            reqdic.Add("startTime", startTime); //查询开始时间(yyyy-MM-dd)
+            reqdic.Add("endTime", endTime); //查询结束时间(yyyy-MM-dd),最大查询时间区间31天
+            reqdic.Add("tradeMchtNo", tradeMchtNo); //收单商户号(15位)
+            reqdic.Add("cardNo", cardNo); //结算卡号
+            reqdic.Add("settleStatus", settleStatus); //出款状态(0:入账成功、1:入账失败、2:结算超时、3:入账受理成功、4:已提交结算请求)
+            reqdic.Add("page", page); //当前页数,默认1
+            reqdic.Add("rows", rows); //每页大小,默认10,最大500
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            function.WriteLog(req, "好哒到账记录查询");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            function.WriteLog("请求头\n" + head, "好哒到账记录查询");
+            function.WriteLog("请求参数\n" + req, "好哒到账记录查询");
+            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", "好哒到账记录查询");
+            string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/accb/to_account/query", req, headdic);
+            function.WriteLog("返回\n" + result + "\n\n", "好哒到账记录查询");
+
+            return result;
+        }
+
+        /// <summary>
+        /// 好哒到账记录详情
+        /// </summary>
+        /// <param name="mchtNo">商户号</param>
+        /// <param name="id">id</param>
+        /// <returns></returns>
+        public string CardInComeDetail(string mchtNo, string id)
+        {
+            function.WriteLog(DateTime.Now.ToString(), "好哒到账记录详情");
+            Dictionary<string, object> reqdic = new Dictionary<string, object>();
+            reqdic.Add("mchtNo", mchtNo); //商户号
+            reqdic.Add("id", id); //id
+
+            string req = Newtonsoft.Json.JsonConvert.SerializeObject(reqdic);
+            function.WriteLog(req, "好哒到账记录详情");
+            Dictionary<string, string> headdic = GetHeader(req);
+            string head = Newtonsoft.Json.JsonConvert.SerializeObject(headdic);
+            function.WriteLog("请求头\n" + head, "好哒到账记录详情");
+            function.WriteLog("请求参数\n" + req, "好哒到账记录详情");
+            function.WriteLog("请求地址:" + BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", "好哒到账记录详情");
+            string result = PostWebRequest(BoxRequestUrl + "/api/v3/hzg/accb/to_account/get", req, headdic);
+            function.WriteLog("返回\n" + result + "\n\n", "好哒到账记录详情");
+
+            return result;
+        }
+
+
+        /// <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;
+        }
+
+        #endregion
+
+
+    }
+}

+ 79 - 0
Util/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}
+        // });
+    }
+}

+ 26 - 0
Util/Main1/MerchantInfoUtil.cs

@@ -139,6 +139,32 @@ namespace MySystem.Service.Main1
         }
         #endregion
 
+        #region 获取指定时间段激活商户Id
+        /// <summary>
+        /// 获取指定时间段激活商户Id
+        /// </summary>
+        /// <param name="StartDate">开始时间</param>
+        /// <param name="EndDate">结束时间</param>
+        /// <returns></returns>
+        public static string QueryActDateMerchantId(string StartDate,string EndDate)
+        {
+            var info = "";
+            List<RelationData> relationData = new List<RelationData>();
+            var merInfo = MerchantDepositOrderService.List(relationData, " and Status>0 and UpdateDate>='" + StartDate + " 00:00:00' and UpdateDate<='" + EndDate + " 23:59:59'", 1, 9999999);
+            if (merInfo.Count > 0)
+            {
+                var merIds = "";
+                foreach (Dictionary<string, object> dic in merInfo)
+                {
+                    var MerchantId = int.Parse(dic["MerchantId"].ToString());
+                    merIds += MerchantId + ",";
+                }
+                info = merIds.TrimEnd(',');
+            }
+            return info;
+        }
+        #endregion
+
         #region 主体类型
         /// <summary>
         /// 主体类型

+ 26 - 0
Util/Main2/MerchantInfoUtil.cs

@@ -138,6 +138,32 @@ namespace MySystem.Service.Main2
         }
         #endregion
 
+        #region 获取指定时间段激活商户Id
+        /// <summary>
+        /// 获取指定时间段激活商户Id
+        /// </summary>
+        /// <param name="StartDate">开始时间</param>
+        /// <param name="EndDate">结束时间</param>
+        /// <returns></returns>
+        public static string QueryActDateMerchantId(string StartDate,string EndDate)
+        {
+            var info = "";
+            List<RelationData> relationData = new List<RelationData>();
+            var merInfo = MerchantDepositOrderService.List(relationData, " and Status>0 and UpdateDate>='" + StartDate + " 00:00:00' and UpdateDate<='" + EndDate + " 23:59:59'", 1, 9999999);
+            if (merInfo.Count > 0)
+            {
+                var merIds = "";
+                foreach (Dictionary<string, object> dic in merInfo)
+                {
+                    var MerchantId = int.Parse(dic["MerchantId"].ToString());
+                    merIds += MerchantId + ",";
+                }
+                info = merIds.TrimEnd(',');
+            }
+            return info;
+        }
+        #endregion
+
         #region 主体类型
         /// <summary>
         /// 主体类型

+ 66 - 0
Util/MySelf/MySelfUtil.cs

@@ -0,0 +1,66 @@
+using MySystem.Models.Main2;
+using Library;
+using MySystem.Service.Main2;
+using System.Collections.Generic;
+using System;
+using LitJson;
+using MySystem.Areas.Api.Controllers;
+
+namespace MySystem
+{
+    /// <summary>
+    /// 我的工具类
+    /// </summary>
+    public class MySelfUtil
+    {
+        #region 到账记录列表
+        /// <summary>
+        /// 到账记录列表
+        /// </summary>
+        /// <returns></returns>
+        public static List<Dictionary<string, object>> CardInComeRecordList(int MerchantId, string StartDate, string EndDate, string SettleStatus, string pageSize, string pageNum, out Dictionary<string, object> Other)
+        {
+            var merchantInfo = MerchantAddInfoService.Query(MerchantId);
+            var SubjectType = 0;
+            if (merchantInfo.SubjectType == "SUBJECT_TYPE_ENTERPRISE") SubjectType = 1; //企业公司
+            if (merchantInfo.SubjectType == "SUBJECT_TYPE_INDIVIDUAL") SubjectType = 2; //个体工商户
+            if (merchantInfo.SubjectType == "SUBJECT_TYPE_SMALL") SubjectType = 3; //小微
+            JsonData Info = JsonMapper.ToObject(HaoDaHelper.Instance.CardInComeRecord(merchantInfo.OutMchtNo, StartDate, EndDate, merchantInfo.MchtNo, "", SettleStatus, pageNum, pageSize));
+            Other = new Dictionary<string, object>();
+            int count = 0;
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            if (Info["code"].ToString() == "0")
+            {
+                var list = Info["data"]["list"];
+                count = int.Parse(Info["data"]["totalRows"].ToString());
+                for (int i = 0; i < list.Count; i++)
+                {
+                    Dictionary<string, object> curData = new Dictionary<string, object>();
+                    var item = list[i];
+                    if (item["settleAccountName"].ToString() != "四川省润观米科技有限公司")
+                    {
+                        curData.Add("TradeNo", item["id"].ToString()); //订单Id
+                        curData.Add("SettleStatus", item["settleStatus"].ToString()); //结算状态(0: 入账成功、1: 入账失败、2: 结算超时、3: 入账受理成功、4: 已提交结算请求、5:已拆分批次、6: 初始化批次信息、7:正在提交结算请求)
+                        curData.Add("MerchantName", merchantInfo.CertMerchantName); //商户名称
+                        curData.Add("MchtNo", merchantInfo.MchtNo); //商户号
+                        curData.Add("ClearTime", item["clearTime"].ToString()); //处理时间
+                        curData.Add("RemitTime", item["remitTime"].ToString()); //到账时间
+                        curData.Add("SettleDate", item["settleDate"].ToString().Substring(item["settleDate"].ToString().Length - 5, 5)); //结算日期
+                        curData.Add("SettleAmount", (decimal.Parse(item["settleAmount"].ToString()) / 100).ToString("f2")); //结算金额
+                        curData.Add("SubjectType", SubjectType); //进件类型(1 企业 2 个体 3 小微)
+                        curData.Add("CardNo", item["cardNo"].ToString()); //结算卡号
+                        curData.Add("TradeMchtName", item["tradeMchtName"].ToString()); //收单商户名称
+                        curData.Add("BankName", item["bankName"].ToString()); //开户行名称
+                        curData.Add("Remark", item["remark"].ToString()); //备注
+                        dataList.Add(curData);
+                    }
+                }
+            }
+            Other.Add("Count", count); //总数
+            return dataList;
+        }
+        #endregion
+
+
+    }
+}