DuGuYang 2 years ago
parent
commit
ea7758a5de

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

@@ -44,6 +44,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             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 = "";
@@ -98,6 +99,26 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             {
                 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>();
@@ -122,6 +143,26 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 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
+
+    }
+}

+ 2 - 2
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);
@@ -345,7 +345,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult ExportDirectQueryMerchantTradeInfo(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });

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

+ 2 - 2
Areas/Api/Controllers/v1/Main1/MerchantInfoController.cs

@@ -88,7 +88,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectResetLoginPwd(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });
@@ -117,7 +117,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectEditMobile(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });

+ 19 - 7
Areas/Api/Controllers/v1/Main1/MerchantParamSetRecordController.cs

@@ -27,7 +27,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectMerchantParamSetRecordList(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });
@@ -42,16 +42,28 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             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>();
-                //商户Id
-                var Id = int.Parse(subdata["MerchantId"].ToString());
-                curData.Add("Id", int.Parse(subdata["Id"].ToString())); //变更记录Id
+                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", int.Parse(subdata["Status"].ToString())); //活动状态(1 使用中 -1 已失效 0 已关闭)
-                // var merAddInfo = MerchantAddInfoService.Query(Id);
-                curData.Add("MerchantName", MerchantAddInfoService.Query(Id).CertMerchantName); //商户名称
-                curData.Add("CreateDate", subdata["AfterCreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //最后操作时间
+                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()); //分红天数

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

@@ -44,6 +44,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
             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 = "";
@@ -99,6 +100,26 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
             {
                 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>();
@@ -124,6 +145,26 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 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 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
+
+    }
+}

+ 3 - 3
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);
@@ -315,7 +315,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayEditMerchantName(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });
@@ -354,7 +354,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult ExportUnionPayQueryMerchantTradeInfo(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });

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

@@ -0,0 +1,26 @@
+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)
+        {
+        }
+
+    }
+}

+ 2 - 2
Areas/Api/Controllers/v1/Main2/MerchantInfoController.cs

@@ -81,7 +81,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayResetLoginPwd(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });
@@ -109,7 +109,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayEditMobile(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });

+ 19 - 7
Areas/Api/Controllers/v1/Main2/MerchantParamSetRecordController.cs

@@ -27,7 +27,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult DirectMerchantParamSetRecordList(string value)
         {
-            value = PublicFunction.DesDecrypt(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 });
@@ -42,16 +42,28 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
             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>();
-                //商户Id
-                var Id = int.Parse(subdata["MerchantId"].ToString());
-                curData.Add("Id", int.Parse(subdata["Id"].ToString())); //变更记录Id
+                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", int.Parse(subdata["Status"].ToString())); //活动状态(1 使用中 -1 已失效 0 已关闭)
-                // var merAddInfo = MerchantAddInfoService.Query(Id);
-                curData.Add("MerchantName", MerchantAddInfoService.Query(Id).CertMerchantName); //商户名称
-                curData.Add("CreateDate", subdata["AfterCreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //最后操作时间
+                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()); //分红天数

+ 1 - 0
Models/Main1/ConsumerOrders.cs

@@ -33,5 +33,6 @@ namespace MySystem.Models.Main1
         public int DivideFlag { get; set; }
         public DateTime? DivideDate { get; set; }
         public string TradePayNo { get; set; }
+        public int SetRecordId { get; set; }
     }
 }

+ 1 - 0
Models/Main1/MerchantAddInfo.cs

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

+ 10 - 0
Models/Main1/WebCMSEntities.cs

@@ -2312,6 +2312,10 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.SetRecordId)
+                    .HasColumnType("int(11)")
+                    .HasComment("活动记录Id");
+
                 entity.Property(e => e.SnNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -5525,6 +5529,12 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.MerchantType)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("商户类型")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.MiniProgramAppid)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")

+ 1 - 0
Models/Main2/ConsumerOrders.cs

@@ -33,5 +33,6 @@ namespace MySystem.Models.Main2
         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; }
     }
 }

+ 10 - 0
Models/Main2/WebCMSEntities.cs

@@ -2312,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")
@@ -5538,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")

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

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