瀏覽代碼

Merge branch 'feature-dgy-二期功能' into feature-dgy-后台测试

# Conflicts:
#	Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs
#	Areas/Api/Controllers/v1/Main2/MerchantAddInfoController.cs
#	Models/Main1/ConsumerOrders.cs
#	Models/Main2/ConsumerOrders.cs
#	Util/Base/BaseClass.cs
DuGuYang 1 年之前
父節點
當前提交
c8756c7963
共有 38 個文件被更改,包括 4291 次插入18 次删除
  1. 82 0
      AppStart/OtherApi/SendSMS.cs
  2. 4 0
      Areas/Api/Controllers/SysAdminController.cs
  3. 4 0
      Areas/Api/Controllers/SysAdminRoleController.cs
  4. 47 0
      Areas/Api/Controllers/v1/Main1/ConsumerOrdersController.cs
  5. 79 0
      Areas/Api/Controllers/v1/Main1/ConsumerProfitController.cs
  6. 77 0
      Areas/Api/Controllers/v1/Main1/ExportExcelsController.cs
  7. 125 9
      Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs
  8. 69 0
      Areas/Api/Controllers/v1/Main1/MerchantAmountSummayController.cs
  9. 1 2
      Areas/Api/Controllers/v1/Main1/MerchantDepositBackController.cs
  10. 89 0
      Areas/Api/Controllers/v1/Main1/MerchantInfoController.cs
  11. 84 0
      Areas/Api/Controllers/v1/Main1/MerchantParamSetRecordController.cs
  12. 54 0
      Areas/Api/Controllers/v1/Main1/MobileCodeCheckController.cs
  13. 97 0
      Areas/Api/Controllers/v1/Main1/PosMachinesTwoController.cs
  14. 143 0
      Areas/Api/Controllers/v1/Main1/UserSwapWhiteController.cs
  15. 167 0
      Areas/Api/Controllers/v1/Main1/UsersController.cs
  16. 47 0
      Areas/Api/Controllers/v1/Main2/ConsumerOrdersController.cs
  17. 79 0
      Areas/Api/Controllers/v1/Main2/ConsumerProfitController.cs
  18. 202 4
      Areas/Api/Controllers/v1/Main2/MerchantAddInfoController.cs
  19. 70 0
      Areas/Api/Controllers/v1/Main2/MerchantAmountSummayController.cs
  20. 92 1
      Areas/Api/Controllers/v1/Main2/MerchantInfoController.cs
  21. 87 0
      Areas/Api/Controllers/v1/Main2/MerchantParamSetRecordController.cs
  22. 27 0
      Areas/Api/Controllers/v1/Main2/PosMachinesTwoController.cs
  23. 3 2
      Models/Main1/ConsumerOrders.cs
  24. 2 0
      Models/Main2/ConsumerOrders.cs
  25. 1 0
      Models/Main2/MerchantAddInfo.cs
  26. 34 0
      Models/Main2/MerchantParamSetRecord.cs
  27. 127 0
      Models/Main2/WebCMSEntities.cs
  28. 255 0
      Service/Main1/ExportExcelsService.cs
  29. 319 0
      Service/Main1/MerchantLoginInfoService.cs
  30. 287 0
      Service/Main1/MerchantParamSetRecordService.cs
  31. 303 0
      Service/Main1/MerchantParamSetService.cs
  32. 287 0
      Service/Main1/PosMachinesTwoService.cs
  33. 239 0
      Service/Main1/UserSwapWhiteService.cs
  34. 287 0
      Service/Main2/MerchantParamSetRecordService.cs
  35. 303 0
      Service/Main2/MerchantParamSetService.cs
  36. 26 0
      Util/Main1/MerchantInfoUtil.cs
  37. 26 0
      Util/Main2/MerchantInfoUtil.cs
  38. 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=0f6eccbf0ff343029a7bffc144591fd8&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
+    }
+}

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

@@ -256,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)); //密码
@@ -294,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;

+ 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;

+ 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
+
+    }
+}

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

@@ -0,0 +1,77 @@
+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);
+            List<Dictionary<string, object>> dataList = DownloadsListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> DownloadsListDo(string value)
+        {
+            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>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = ExportExcelsService.List(relationData, condition, 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);
+            }
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 125 - 9
Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs

@@ -189,7 +189,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectQueryMerchantTradeInfo(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Other = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = DirectQueryMerchantTradeInfoDo(value, out Other);
@@ -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)
@@ -438,5 +449,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";
+            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 };
         }

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

@@ -84,5 +84,94 @@ 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
+
+
     }
 }

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

@@ -0,0 +1,84 @@
+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);
+            List<Dictionary<string, object>> dataList = DirectMerchantParamSetRecordListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> DirectMerchantParamSetRecordListDo(string value)
+        {
+            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>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = MerchantParamSetRecordService.List(relationData, condition, 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);
+            }
+            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
+
+    }
+}

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

@@ -210,7 +210,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayQueryMerchantTradeInfo(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Other = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = UnionPayQueryMerchantTradeInfoDo(value, out Other);
@@ -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)
@@ -454,5 +467,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";
+            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
+
+    }
+}

+ 92 - 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,97 @@ 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
+
+
 
     }
 }

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

@@ -0,0 +1,87 @@
+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);
+            List<Dictionary<string, object>> dataList = UnionPayMerchantParamSetRecordListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> UnionPayMerchantParamSetRecordListDo(string value)
+        {
+            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>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<Dictionary<string, object>> source = MerchantParamSetRecordService.List(relationData, condition, 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);
+            }
+            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 - 2
Models/Main1/ConsumerOrders.cs

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

+ 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)");

+ 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)
+        // {
+            
+        // }
+    }
+}

+ 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)
+        // {
+            
+        // }
+    }
+}

+ 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 = MerchantInfoService.List(relationData, " 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 = MerchantInfoService.List(relationData, " 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
+
+
+    }
+}