Переглянути джерело

Merge branch 'DuGuYang' into release

lcl 1 рік тому
батько
коміт
934b5c4be4
62 змінених файлів з 3544 додано та 360 видалено
  1. BIN
      .DS_Store
  2. 2 1
      .gitignore
  3. 20 0
      .vscode/launch.json
  4. BIN
      AppStart/Alipay/.DS_Store
  5. 6 65
      AppStart/Alipay/AlipayFunction.cs
  6. BIN
      AppStart/Alipay/Request/.DS_Store
  7. 24 0
      AppStart/Alipay/Request/AlipayOpenMiniVersionAuditedCancelModel.cs
  8. 30 0
      AppStart/Alipay/Request/AlipayOpenMiniVersionOnlineModel.cs
  9. 16 3
      AppStart/PublicFunction.cs
  10. 19 19
      AppStart/Redis/Mysql/PosMachinesDbconn.cs
  11. 7 0
      AppStart/Redis/RedisDbconn.cs
  12. 39 2
      Areas/Api/Controllers/AlipayController.cs
  13. 8 8
      Areas/Api/Controllers/v1/MainServer/ActiveRewardController.cs
  14. 1 1
      Areas/Api/Controllers/v1/MainServer/BusinessController.cs
  15. 87 14
      Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs
  16. 7 0
      Areas/Api/Controllers/v1/MainServer/KqProductsController.cs
  17. 32 32
      Areas/Api/Controllers/v1/MainServer/MerchantAddInfoController.cs
  18. 72 0
      Areas/Api/Controllers/v1/MainServer/MerchantAmountSummayController.cs
  19. 129 0
      Areas/Api/Controllers/v1/MainServer/MerchantDepositBackController.cs
  20. 163 0
      Areas/Api/Controllers/v1/MainServer/MerchantDepositOrderController.cs
  21. 149 45
      Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs
  22. 25 2
      Areas/Api/Controllers/v1/MainServer/MerchantParamSetController.cs
  23. 92 51
      Areas/Api/Controllers/v1/MainServer/MerchantQrCodeController.cs
  24. 73 8
      Areas/Api/Controllers/v1/MainServer/PosMachinesController.cs
  25. 55 0
      Areas/Api/Controllers/v1/MainServer/UserSwapWhiteController.cs
  26. 19 0
      Config/LKBAliPayInfo.cs
  27. 6 0
      MainModels/ConsumerOrders.cs
  28. 24 0
      MainModels/CustomQuery.cs
  29. 21 0
      MainModels/ExportExcels.cs
  30. 1 0
      MainModels/MerchantAddInfo.cs
  31. 29 0
      MainModels/MerchantDepositBack.cs
  32. 25 0
      MainModels/MerchantDepositOrder.cs
  33. 10 0
      MainModels/MerchantInfo.cs
  34. 34 0
      MainModels/MerchantParamSetRecord.cs
  35. 23 0
      MainModels/SysWithdrawalApplyRecord.cs
  36. 560 0
      MainModels/WebCMSEntities.cs
  37. 7 0
      MainModels2/ConsumerOrders.cs
  38. 4 0
      MainModels2/MerchantAddInfo.cs
  39. 29 0
      MainModels2/MerchantDepositBack.cs
  40. 25 0
      MainModels2/MerchantDepositOrder.cs
  41. 12 0
      MainModels2/MerchantInfo.cs
  42. 34 0
      MainModels2/MerchantParamSetRecord.cs
  43. 2 2
      MainModels2/MerchantTradeSummary.cs
  44. 392 1
      MainModels2/WebCMSEntities.cs
  45. 1 1
      Program.cs
  46. 1 1
      Properties/launchSettings.json
  47. 14 6
      Services/MerchantAccountLinkInfoService.cs
  48. 21 21
      Services/MerchantAddInfoService.cs
  49. 43 21
      Services/MerchantAmountSummayService.cs
  50. 162 0
      Services/MerchantDepositBackService.cs
  51. 238 0
      Services/MerchantDepositOrderService.cs
  52. 117 0
      Services/UserSwapWhiteService.cs
  53. 11 10
      Startup.cs
  54. 8 2
      Util/BusinessUtil.cs
  55. 441 0
      Util/Kxs/AlipayFunctionForKxs.cs
  56. 80 0
      Util/MerchantAmountSummayUtil.cs
  57. 52 0
      Util/MerchantDepositBackUtil.cs
  58. 35 0
      Util/MerchantDepositOrderUtil.cs
  59. 1 1
      Views/Home/Index.cshtml
  60. 1 1
      appsettings.Development.json
  61. 0 42
      appsettings.json
  62. 5 0
      global.json

+ 2 - 1
.gitignore

@@ -1,3 +1,4 @@
 /bin
 /publish
-/obj
+/obj
+/appsettings.json

+ 20 - 0
.vscode/launch.json

@@ -23,6 +23,26 @@
                 "/Views": "${workspaceFolder}/Views"
             }
         },
+        {
+            "name": ".NET Core Launch (pro)",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build",
+            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/MySystem.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "stopAtEntry": false,
+            "serverReadyAction": {
+                "action": "openExternally",
+                "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
+            },
+            "env": {
+                "ASPNETCORE_ENVIRONMENT": "Production"
+            },
+            "sourceFileMap": {
+                "/Views": "${workspaceFolder}/Views"
+            }
+        },
         {
             "name": ".NET Core Attach",
             "type": "coreclr",

BIN
AppStart/Alipay/.DS_Store


Різницю між файлами не показано, бо вона завелика
+ 6 - 65
AppStart/Alipay/AlipayFunction.cs


BIN
AppStart/Alipay/Request/.DS_Store


+ 24 - 0
AppStart/Alipay/Request/AlipayOpenMiniVersionAuditedCancelModel.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Xml.Serialization;
+
+namespace Aop.Api.Request
+{
+    /// <summary>
+    /// AlipayOpenMiniVersionAuditedCancelModel Data Structure.
+    /// </summary>
+    [Serializable]
+    public class AlipayOpenMiniVersionAuditedCancelModel : AopObject
+    {
+        /// <summary>
+        /// 商家小程序版本号。可将已过审、审核被驳回的小程序版本退回到开发中的状态。
+        /// </summary>
+        [XmlElement("app_version")]
+        public string AppVersion { get; set; }
+
+        /// <summary>
+        /// 小程序投放的端参数,例如投放到支付宝钱包是支付宝端。默认支付宝端。支持: com.alipay.alipaywallet:支付宝端; com.alipay.iot.xpaas:支付宝IoT端。
+        /// </summary>
+        [XmlElement("bundle_id")]
+        public string BundleId { get; set; }
+    }
+}

+ 30 - 0
AppStart/Alipay/Request/AlipayOpenMiniVersionOnlineModel.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Xml.Serialization;
+
+namespace Aop.Api.Request
+{
+    /// <summary>
+    /// AlipayOpenMiniVersionOnlineModel Data Structure.
+    /// </summary>
+    [Serializable]
+    public class AlipayOpenMiniVersionOnlineModel : AopObject
+    {
+        /// <summary>
+        /// 商家小程序版本号,需为审核通过状态或灰度中版本。
+        /// </summary>
+        [XmlElement("app_version")]
+        public string AppVersion { get; set; }
+
+        /// <summary>
+        /// 小程序投放的端参数,例如投放到支付宝钱包是支付宝端。默认支付宝端。支持: com.alipay.alipaywallet:支付宝端; com.alipay.iot.xpaas:支付宝IoT端。
+        /// </summary>
+        [XmlElement("bundle_id")]
+        public string BundleId { get; set; }
+
+        /// <summary>
+        /// true - 性能优先; false - 覆盖优先(默认)
+        /// </summary>
+        [XmlElement("downgrade")]
+        public bool Downgrade { get; set; }
+    }
+}

+ 16 - 3
AppStart/PublicFunction.cs

@@ -114,9 +114,22 @@ namespace MySystem
 
         public static void BindUserMachineData(WebCMSEntities db, int UserId, int BrandId, int Count, string PosSn)
         {
-            PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn) ?? new PosMachinesTwo();
-            pos.BindingState = 1;
-            pos.BindingTime = DateTime.Now;
+            if(BrandId == 1)
+            {
+                PosMachines pos = db.PosMachines.FirstOrDefault(m => m.PosSn == PosSn) ?? new PosMachines();
+                pos.BindingState = 1;
+                pos.BuyUserId = UserId;
+                pos.UserId = UserId;
+                pos.BindingTime = DateTime.Now;
+            }
+            else
+            {
+                PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn) ?? new PosMachinesTwo();
+                pos.BindingState = 1;
+                pos.BuyUserId = UserId;
+                pos.UserId = UserId;
+                pos.BindingTime = DateTime.Now;
+            }
             string IdBrand = UserId + "_" + BrandId;
             UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
             if (MachineData == null)

+ 19 - 19
AppStart/Redis/Mysql/PosMachinesDbconn.cs

@@ -56,34 +56,34 @@ namespace MySystem
         #region 获取列表
         public List<int> GetList(int MerchantId, int pageNum = 1, int pageSize = 10)
         {
-            string key = "PosMachineList:" + MerchantId;
-            List<int> list = new List<int>();
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                list = RedisDbconn.Instance.GetList<int>(key, pageNum, pageSize);
-                if (list.Count > 0)
-                {
-                    return list;
-                }
-            }
+            // string key = "PosMachineList:" + MerchantId;
+            // List<int> list = new List<int>();
+            // if (RedisDbconn.Instance.Exists(key))
+            // {
+            //     list = RedisDbconn.Instance.GetList<int>(key, pageNum, pageSize);
+            //     if (list.Count > 0)
+            //     {
+            //         return list;
+            //     }
+            // }
+            List<int> newlist = new List<int>();
             WebCMSEntities db = new WebCMSEntities();
-            var mysqllist = db.PosMachines.Select(m => new { m.Id, m.BindMerchantId }).Where(m => m.BindMerchantId == MerchantId).OrderByDescending(m => m.Id).ToList();
+            var mysqllist = db.PosMachines.Select(m => new { m.Id, m.BindMerchantId, m.DeviceKind }).Where(m => m.BindMerchantId == MerchantId && m.DeviceKind == "1").OrderByDescending(m => m.Id).ToList();
             if (mysqllist.Count > 0)
             {
-                List<int> newlist = new List<int>();
                 foreach (var sub in mysqllist)
                 {
                     newlist.Add(sub.Id);
                 }
-                RedisDbconn.Instance.Clear(key);
-                foreach (int sub in newlist)
-                {
-                    RedisDbconn.Instance.AddRightList(key, sub);
-                }
-                RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
+                // RedisDbconn.Instance.Clear(key);
+                // foreach (int sub in newlist)
+                // {
+                //     RedisDbconn.Instance.AddRightList(key, sub);
+                // }
+                // RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(30, 60));
             }
             db.Dispose();
-            return list;
+            return newlist;
         }
         #endregion
     }

+ 7 - 0
AppStart/Redis/RedisDbconn.cs

@@ -157,6 +157,13 @@ namespace MySystem
         }
         #endregion
 
+        #region 移除列表
+        public long RemoveFromList(string key, object value, int count = 1)
+        {            
+            return csredis.LRem(key, count, value);
+        }
+        #endregion
+
         #region 添加排序列表对象
         public long AddSort(string key, object value, decimal score)
         {

+ 39 - 2
Areas/Api/Controllers/AlipayController.cs

@@ -24,8 +24,6 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
 
 
-
-
         #region 支付宝服务平台支付回调
         public string Notice()
         {
@@ -106,5 +104,44 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         #endregion
         
+
+        #region 提交审核小程序
+
+        public string MiniProgramApply(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            string Detail = data["Detail"].ToString();
+            string Version = data["Version"].ToString();
+            return new AlipayFunction().MiniProgramApply(Version, Detail);
+        }
+
+        #endregion
+
+        #region 小程序上线
+
+        public string MiniProgramOnline(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            string Version = data["Version"].ToString();
+            return new AlipayFunction().MiniProgramOnline(Version);
+        }
+
+        #endregion
+
+        #region 小程序退回开发状态
+
+        public string MiniProgramCancel(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            string Version = data["Version"].ToString();
+            return new AlipayFunction().MiniProgramCancel(Version);
+        }
+
+        #endregion
+
+
     }
 }

+ 8 - 8
Areas/Api/Controllers/v1/MainServer/ActiveRewardController.cs

@@ -37,17 +37,17 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
         {
             JsonData data = JsonMapper.ToObject(value);
             int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString();
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
             string Date = Kind == 1 ? "%Y%m%d" : "%Y%m";
             string TradeMonthCondi = "";
-            if(Kind == 2)
+            if(Kind == 1)
             {
-                string StartTradeMonth = TradeMonth + "-01 00:00:00";
+                string TradeMonth = data["TradeMonth"].ToString();
+                string StartTradeMonth = TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00";
                 string EndTradeMonth = DateTime.Parse(StartTradeMonth).AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss");
-                TradeMonthCondi = " and CreateDate>='" + StartTradeMonth + "' and CreateDate>='" + EndTradeMonth + "'";
+                TradeMonthCondi = " and CreateDate>='" + StartTradeMonth + "' and CreateDate<'" + EndTradeMonth + "'";
             }
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             string PageCondition = PageSize.ToString();
@@ -96,8 +96,8 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(ActDate + " 00:00:00");
-            DateTime end = DateTime.Parse(ActDate + " 23:59:59");
+            DateTime start = DateTime.Parse(ActDate.Substring(0, 4) + "-" + ActDate.Substring(4, 2) + "-" + ActDate.Substring(6, 2) + " 00:00:00");
+            DateTime end = DateTime.Parse(ActDate.Substring(0, 4) + "-" + ActDate.Substring(4, 2) + "-" + ActDate.Substring(6, 2) + " 23:59:59");
             IQueryable<ActiveReward> query = maindb.ActiveReward.Where(m => m.UserId == UserId && m.CreateDate >= start && m.CreateDate <= end);
             if (PageNum == 1)
             {
@@ -111,9 +111,9 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
             foreach (var subdata in query.ToList())
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();
-                PosMerchantInfo merchant = PosMerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new PosMerchantInfo();
+                MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new MerchantInfo();
                 curData.Add("SnNo", subdata.KqSnNo);
-                curData.Add("MerchantName", merchant.MerchantName); //商户名称
+                curData.Add("MerchantName", merchant.Name); //商户名称
                 curData.Add("RewardAmount", subdata.RewardAmount); //奖励金额
                 dataList.Add(curData);
             }

+ 1 - 1
Areas/Api/Controllers/v1/MainServer/BusinessController.cs

@@ -113,7 +113,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> dataList = OrderDetailDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
         }
-        private Dictionary<string, object> OrderDetailDo(string value)
+        public Dictionary<string, object> OrderDetailDo(string value)
         {
             JsonData data = JsonMapper.ToObject(value);
             int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id

+ 87 - 14
Areas/Api/Controllers/v1/MainServer/ConsumerOrdersController.cs

@@ -135,7 +135,7 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
-        
+
 
 
 
@@ -243,16 +243,16 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             string SnNo = data["Sn"].ToString(); //码牌SN
             // string Machine = data["Machine"].ToString();
-            if(SnNo.Length > 20)
+            if (SnNo.Length > 20)
             {
                 SnNo = System.Web.HttpUtility.UrlDecode(SnNo);
-                if(!SnNo.EndsWith("="))
+                if (!SnNo.EndsWith("="))
                 {
                     SnNo += "=";
                 }
                 SnNo = dbconn.Decrypt3DES(SnNo, "l2k0b2#3");
                 SnNo = SnNo.TrimEnd('\0');
-                SnNo = SnNo.Substring(0, SnNo.Length - 8);
+                SnNo = SnNo.Substring(0, 20);
             }
             int PayMode = int.Parse(function.CheckInt(data["PayMode"].ToString())); //支付方式
             decimal PayMoney = decimal.Parse(function.CheckNum(data["PayMoney"].ToString())); //支付金额
@@ -274,14 +274,19 @@ namespace MySystem.Areas.Api.Controllers.v1
             PosMachinesTwo pos = PosMachinesTwoDbconn.Instance.Get(SnNo) ?? new PosMachinesTwo();
             // PosMachines machine = PosMachinesDbconn.Instance.Get(qrcode.SnId) ?? new PosMachines();
             // if (machine.BindMerchantId == 0) machine.BindMerchantId = 1; // TODO: 需要绑定二维码
-            if(pos.OpId == 1)
+            if (pos.OpId == 1)
             {
                 MerchantInfo merchant = MerchantInfoDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantInfo();
+                //商户未激活也能支付(365服务费)
+                // if (merchant.IsAct == 0)
+                // {
+                //     return Json(new AppResultJson() { Status = "-1", Info = "支付失败,商户尚未激活,请前往来客吧商户版激活后使用" });
+                // }
                 MerchantAddInfo merchantAdd = MerchantAddInfoDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantAddInfo();
                 MerchantParamSet merchantset = MerchantParamSetDbconn.Instance.Get(qrcode.MerchantId) ?? new MerchantParamSet();
                 string openid = "";
                 if (PayMode == 1)
-                { 
+                {
                     openid = new AlipayFunction(_accessor.HttpContext).GetAlipayUserId(Code);
                     if (openid.Contains("|"))
                     {
@@ -321,7 +326,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 maindb.SaveChanges();
                 string OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
                 bool ActFlag = merchantset.IsAll == 1 ? false : true;
-                if(PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
+                if (PayMoney < merchantset.MinPayMoney) //支付金额小于活动最小金额,则不分账
                 {
                     ActFlag = false;
                 }
@@ -340,6 +345,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     IsAct = ActFlag ? 1u : 0u,
                     MerchantActualAmount = ActFlag ? PayMoney * merchantset.GetPercent / 100 : PayMoney,
                     SeoDescription = Newtonsoft.Json.JsonConvert.SerializeObject(merchantset),
+                    SetRecordId = merchantset.Version, //活动参记录数Id
                 }).Entity;
                 maindb.SaveChanges();
                 maindb.ConsumerOrderForNo.Add(new ConsumerOrderForNo()
@@ -349,7 +355,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 });
                 maindb.SaveChanges();
                 if (PayMode == 1)
-                { 
+                {
                     string backString = new AlipayFunction(_accessor.HttpContext).CreateTrade(OrderNo, merchant.Name, PayMoney, openid, merchantAdd.AlipayAuthToken, SpHost + "/api/alipay/notice");
                     JsonData obj = JsonMapper.ToObject(backString);
                     if (obj["alipay_trade_create_response"]["code"].ToString() == "10000")
@@ -359,7 +365,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                         Obj.Add("tradeNo", tradeNo);
                     }
                     else
-                    { 
+                    {
                         Obj.Add("respCode", obj["alipay_trade_create_response"]["code"].ToString());
                         Obj.Add("tradeNo", "");
                         return new AppResultJson() { Status = "-1", Info = obj["alipay_trade_create_response"]["sub_msg"].ToString(), Data = Obj };
@@ -393,16 +399,83 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
-
-        public string test()
+        #region 经营数据-统计数据-经营详情-取消返现
+        [Authorize]
+        public JsonResult CancelDivi(string value)
         {
-            return new WeChatFunction(_accessor.HttpContext).GetPlatCert();
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = CancelDiviDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
         }
+        private AppResultJson CancelDiviDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            int Id = int.Parse(function.CheckInt(data["id"].ToString()));
+            ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
+            if (order != null)
+            {
+                List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId);
+                if (suborders.Count > 0)
+                {
+                    ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
+                    if (suborder != null)
+                    {
+                        order.CurDivi = suborder.CurDivi;
+                        maindb.SaveChanges();
+                        RedisDbconn.Instance.RemoveFromList("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId, suborder);
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + Id + "\r\n\r\n", "直连订单取消返现");
+                        order.ReturnFlag = 0;
+                        maindb.SaveChanges();
+                        return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+                    }
+                }
+            }
+            return new AppResultJson() { Status = "-1", Info = "取消失败", Data = Obj };
+        }
+        #endregion
 
-        public string test2()
+        #region 经营数据-统计数据-经营详情-恢复返现
+        [Authorize]
+        public JsonResult RestoreDivi(string value)
         {
-            return new WeChatFunction(_accessor.HttpContext).GetPublicKey();
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = RestoreDiviDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
         }
+        private AppResultJson RestoreDiviDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            int Id = int.Parse(function.CheckInt(data["id"].ToString()));
+            ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
+            if (order != null)
+            {
+                JsonData ProfitInfo = JsonMapper.ToObject(order.SeoDescription);
+                int ProfitDays = int.Parse(function.CheckInt(ProfitInfo["ProfitDays"].ToString())); //活动有效时间
+                if (order.IsAct == 0) return new AppResultJson() { Status = "-1", Info = "恢复失败,非活动订单不能进行该操作", Data = Obj };
+                if (DateTime.Parse(order.UpdateDate.ToString()).AddMinutes(10) >= DateTime.Now) return new AppResultJson() { Status = "-1", Info = "恢复失败,订单完成支付10分钟内不能进行该操作", Data = Obj };
+                if (order.MaxDivi == order.CurDivi) return new AppResultJson() { Status = "-1", Info = "恢复失败,订单已完成所有返现", Data = Obj };
+                if (DateTime.Parse(order.UpdateDate.ToString()).AddDays(ProfitDays) < DateTime.Now) return new AppResultJson() { Status = "-1", Info = "恢复失败,非活动订单不能进行该操作", Data = Obj };
+                List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId);
+                if (suborders.Count > 0)
+                {
+                    ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
+                    if (suborder == null)
+                    {
+                        RedisDbconn.Instance.AddRightList("ConsumerOrders:Divi:" + order.PayMode + ":" + order.MerchantId, order);
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + Id + "\r\n\r\n", "直连订单恢复返现");
+                        order.ReturnFlag = 1;
+                        maindb.SaveChanges();
+                    }
+                    return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+                }
+            }
+            return new AppResultJson() { Status = "-1", Info = "恢复失败", Data = Obj };
+        }
+        #endregion
 
 
 

+ 7 - 0
Areas/Api/Controllers/v1/MainServer/KqProductsController.cs

@@ -71,12 +71,19 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
 
             UserMachineData MachineData = UserMachineDataDbconn.Instance.Get(UserId + "_0") ?? new UserMachineData();
+            UserMachineData MachineData2 = UserMachineDataDbconn.Instance.Get(UserId + "_1") ?? new UserMachineData();
             Dictionary<string, object> Machine = new Dictionary<string, object>();
+            Dictionary<string, object> Machine2 = new Dictionary<string, object>();
             Machine.Add("TotalMachineCount", MachineData.TotalMachineCount);  //总机具数
             Machine.Add("UnBindCount", MachineData.UnBindCount); //未绑定机具数
             Machine.Add("BindCount", MachineData.BindCount); //已绑定机具数
             Obj.Add("Machine", Machine); //机具管理数据
 
+            Machine2.Add("TotalMachineCount2", MachineData2.TotalMachineCount);  //总机具数
+            Machine2.Add("UnBindCount2", MachineData2.UnBindCount); //未绑定机具数
+            Machine2.Add("BindCount2", MachineData2.BindCount); //已绑定机具数
+            Obj.Add("Machine2", Machine2); //机具管理数据
+
             Dictionary<string, object> Profit = new Dictionary<string, object>();
             Profit.Add("TradeProfit", MachineData.TradeProfit); //交易分润
             Profit.Add("ActProfit", MachineData.ActProfit); //激活奖励

+ 32 - 32
Areas/Api/Controllers/v1/MainServer/MerchantAddInfoController.cs

@@ -101,8 +101,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             }
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantAddInfo query = maindb.MerchantAddInfo.FirstOrDefault(m => m.CertMerchantName == CertMerchantName);
-            if(query == null)
-            {                
+            if (query == null)
+            {
                 query = maindb.MerchantAddInfo.Add(new MerchantAddInfo()
                 {
                     CreateDate = DateTime.Now,
@@ -150,7 +150,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             query.CreateMan = AlipayAccount;
             query.UpdateMan = AlipayMccCode;
             MerchantInfo merchant = maindb.MerchantInfo.FirstOrDefault(m => m.Id == query.Id);
-            if(merchant == null)
+            if (merchant == null)
             {
                 merchant = maindb.MerchantInfo.Add(new MerchantInfo()
                 {
@@ -207,7 +207,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Obj.Add("SubjectTypeName", Subjects[function.CheckNull(query.SubjectType)]);
             }
             else
-            { 
+            {
                 Obj.Add("SubjectTypeName", "");
             }
             Obj.Add("LicenseCopy", query.LicenseCopy); //营业执照照片
@@ -267,7 +267,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Obj.Add("QualificationTypeName", item.ptext + "," + item.text);
             }
             else
-            { 
+            {
                 Obj.Add("QualificationTypeName", "");
             }
             Obj.Add("Qualifications", query.Qualifications); //特殊资质图片
@@ -279,7 +279,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Obj.Add("BankAccountTypeName", AccountTypes[function.CheckNull(query.BankAccountType)]);
             }
             else
-            { 
+            {
                 Obj.Add("BankAccountTypeName", "");
             }
             Obj.Add("AccountName", query.AccountName); //开户名称
@@ -326,12 +326,12 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             if (Kind == "2")
-            { 
+            {
                 dataList = GetPersonSettles();
             }
             else if (Kind == "21")
-            { 
-                dataList = GetBusinessSettles();                
+            {
+                dataList = GetBusinessSettles();
             }
             else
             {
@@ -377,7 +377,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
 
         public List<SettleData> GetPersonSettleItems()
-        { 
+        {
             List<SettleData> dic = new List<SettleData>();
             dic.Add(new SettleData() { ptext = "食品生鲜", text = "肉、禽、蛋及水产品等", value = "719", code = "A0002_B0202" });
             dic.Add(new SettleData() { ptext = "健身运动服务", text = "健身房", value = "719", code = "A0004_B0064" });
@@ -445,7 +445,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 bigDic.Add("value", i.ToString());
                 bigDic.Add("text", sub);
                 List<Dictionary<string, object>> children = new List<Dictionary<string, object>>();
-                foreach (SettleData ssub in dic.Where(m=>m.ptext == sub).ToList())
+                foreach (SettleData ssub in dic.Where(m => m.ptext == sub).ToList())
                 {
                     Dictionary<string, object> smallDic = new Dictionary<string, object>();
                     smallDic.Add("value", ssub.value + "_" + ssub.code);
@@ -462,25 +462,25 @@ namespace MySystem.Areas.Api.Controllers.v1
         public List<SettleData> GetBusinessSettleItems()
         {
             List<SettleData> dic = new List<SettleData>();
-            dic.Add(new SettleData() { ptext = "餐饮", text = "餐饮", value="716", code="A0001_B0001"});
-            dic.Add(new SettleData() { ptext = "食品生鲜", text = "肉、禽、蛋及水产品等", value="716", code="A0002_B0202"});
-            dic.Add(new SettleData() { ptext = "健身运动服务", text = "健身房", value="716", code="A0004_B0064"});
-            dic.Add(new SettleData() { ptext = "健身运动服务", text = "体育场馆", value="716", code="A0004_B0068"});
-            dic.Add(new SettleData() { ptext = "城市公共交通", text = "公共交通", value="716", code="A0006_B0088"});
-            dic.Add(new SettleData() { ptext = "景区/酒店", text = "旅行住宿", value="716", code="A0010_B0157"});
-            dic.Add(new SettleData() { ptext = "居民生活服务", text = "生活服务", value="716", code="A0003_B0116"});
-            dic.Add(new SettleData() { ptext = "零售", text = "百货商城", value="716", code="A0002_B0017"});
-            dic.Add(new SettleData() { ptext = "服饰鞋包", text = "服饰鞋包", value="716", code="A0002_B0026"});
-            dic.Add(new SettleData() { ptext = "零售", text = "家居家纺建材", value="716", code="A0002_B0216"});
-            dic.Add(new SettleData() { ptext = "零售", text = "母婴玩具", value="716", code="A0002_B0032"});
-            dic.Add(new SettleData() { ptext = "零售", text = "数码家电", value="716", code="A0003_B0051"});
-            dic.Add(new SettleData() { ptext = "零售", text = "图书音像", value="716", code="A0002_B0031"});
-            dic.Add(new SettleData() { ptext = "居民生活服务", text = "文化玩乐宠物", value="716", code="A0004_B0070"});
-            dic.Add(new SettleData() { ptext = "咨询/娱乐票务", text = "娱乐票务", value="716", code="A0004_B0065"});
-            dic.Add(new SettleData() { ptext = "零售", text = "办公用品", value="716", code="A0002_B0203"});
-            dic.Add(new SettleData() { ptext = "零售", text = "工业产品", value="716", code="A0002_B0042"});
-            dic.Add(new SettleData() { ptext = "婚介平台/就业信息平台/其他信息服务平台", text = "婚介服务", value="720", code="A0003_B0053"});
-            dic.Add(new SettleData() { ptext = "零售", text = "其它类别", value="716", code="A0002_B0043"});
+            dic.Add(new SettleData() { ptext = "餐饮", text = "餐饮", value = "716", code = "A0001_B0001" });
+            dic.Add(new SettleData() { ptext = "食品生鲜", text = "肉、禽、蛋及水产品等", value = "716", code = "A0002_B0202" });
+            dic.Add(new SettleData() { ptext = "健身运动服务", text = "健身房", value = "716", code = "A0004_B0064" });
+            dic.Add(new SettleData() { ptext = "健身运动服务", text = "体育场馆", value = "716", code = "A0004_B0068" });
+            dic.Add(new SettleData() { ptext = "城市公共交通", text = "公共交通", value = "716", code = "A0006_B0088" });
+            dic.Add(new SettleData() { ptext = "景区/酒店", text = "旅行住宿", value = "716", code = "A0010_B0157" });
+            dic.Add(new SettleData() { ptext = "居民生活服务", text = "生活服务", value = "716", code = "A0003_B0116" });
+            dic.Add(new SettleData() { ptext = "零售", text = "百货商城", value = "716", code = "A0002_B0017" });
+            dic.Add(new SettleData() { ptext = "服饰鞋包", text = "服饰鞋包", value = "716", code = "A0002_B0026" });
+            dic.Add(new SettleData() { ptext = "零售", text = "家居家纺建材", value = "716", code = "A0002_B0216" });
+            dic.Add(new SettleData() { ptext = "零售", text = "母婴玩具", value = "716", code = "A0002_B0032" });
+            dic.Add(new SettleData() { ptext = "零售", text = "数码家电", value = "716", code = "A0003_B0051" });
+            dic.Add(new SettleData() { ptext = "零售", text = "图书音像", value = "716", code = "A0002_B0031" });
+            dic.Add(new SettleData() { ptext = "居民生活服务", text = "文化玩乐宠物", value = "716", code = "A0004_B0070" });
+            dic.Add(new SettleData() { ptext = "咨询/娱乐票务", text = "娱乐票务", value = "716", code = "A0004_B0065" });
+            dic.Add(new SettleData() { ptext = "零售", text = "办公用品", value = "716", code = "A0002_B0203" });
+            dic.Add(new SettleData() { ptext = "零售", text = "工业产品", value = "716", code = "A0002_B0042" });
+            dic.Add(new SettleData() { ptext = "婚介平台/就业信息平台/其他信息服务平台", text = "婚介服务", value = "720", code = "A0003_B0053" });
+            dic.Add(new SettleData() { ptext = "零售", text = "其它类别", value = "716", code = "A0002_B0043" });
 
 
             // dic.Add(new SettleData() { ptext = "餐饮", text = "餐饮", code = "C_C05_5814", value = "716", special = 0});
@@ -532,7 +532,7 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         public List<Dictionary<string, object>> GetBusinessSettles()
         {
-            List<SettleData> dic = GetBusinessSettleItems();            
+            List<SettleData> dic = GetBusinessSettleItems();
 
             int i = 0;
             List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
@@ -543,7 +543,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 bigDic.Add("value", i.ToString());
                 bigDic.Add("text", sub);
                 List<Dictionary<string, object>> children = new List<Dictionary<string, object>>();
-                foreach (SettleData ssub in dic.Where(m=>m.ptext == sub).ToList())
+                foreach (SettleData ssub in dic.Where(m => m.ptext == sub).ToList())
                 {
                     Dictionary<string, object> smallDic = new Dictionary<string, object>();
                     smallDic.Add("value", ssub.value + "_" + ssub.code);

+ 72 - 0
Areas/Api/Controllers/v1/MainServer/MerchantAmountSummayController.cs

@@ -0,0 +1,72 @@
+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 MySystem.MainModels;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1
+{
+    [Area("Api")]
+    [Route("/v1/qrcodeplatemain/[controller]/[action]")]
+    public class MerchantAmountSummayController : BaseController
+    {
+        public MerchantAmountSummayController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+        }
+
+
+
+
+        #region 已激活商户-达标信息列表
+        [Authorize]
+        public JsonResult List(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = ListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> ListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
+            int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            dataList = MerchantAmountSummayUtil.ListDo(MerchantId, pageSize, pageNum);
+            return dataList;
+        }
+        #endregion
+
+
+
+        #region 检查签名是否合法,合法返回1,不合法返回提示信息
+
+        /// <summary>
+        /// 检查签名是否合法,合法返回1,不合法返回提示信息
+        /// </summary>
+        /// <param name="value">请求的参数(json字符串)</param>
+        /// <param name="signField">要签名的字段</param>
+        /// <returns></returns>
+        private string CheckSign(string value, string[] signField)
+        {
+            JsonData json = JsonMapper.ToObject(value);
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            for (int i = 0; i < signField.Length; i++)
+            {
+                dic.Add(signField[i], json[signField[i]].ToString());
+            }
+            string sign = json["sign"].ToString(); //客户端签名字符串
+            return new Sign().sign(dic, sign);
+        }
+
+        #endregion
+
+    }
+}

+ 129 - 0
Areas/Api/Controllers/v1/MainServer/MerchantDepositBackController.cs

@@ -0,0 +1,129 @@
+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 MySystem.MainModels;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1
+{
+    [Area("Api")]
+    [Route("/v1/qrcodeplatemain/[controller]/[action]")]
+    public class MerchantDepositBackController : BaseController
+    {
+        public MerchantDepositBackController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+        }
+
+
+
+
+        #region 商户激活-商户服务费退还
+        [Authorize]
+        public JsonResult AddMerchantDepositBack(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = AddMerchantDepositBackDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson AddMerchantDepositBackDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            int ReturnWay = int.Parse(function.CheckInt(data["ReturnWay"].ToString())); //退还方式
+            string MobileCode = data["MobileCode"].ToString(); //短信验证码
+            string ReturnNo = data["ReturnNo"].ToString(); //退还账号
+            var info = MerchantDepositBackUtil.AddMerchantDepositBackDo(MerchantId, ReturnWay, MobileCode, ReturnNo);
+            if (info == "success")
+            {
+                return new AppResultJson() { Status = "1", Info = info, Data = info };
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = info, Data = info };
+            }
+        }
+        #endregion
+
+
+         #region 商户激活-银行选项名称
+        [Authorize]
+        public JsonResult Options(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = OptionsDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        private List<Dictionary<string, object>> OptionsDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int PageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
+            int PageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            var query = GetBanks();
+            foreach (string key in query.Keys)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("text", query[key]); //文本
+                curData.Add("value", key); //值
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+        private Dictionary<string, string> GetBanks()
+        {
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            dic.Add("工商银行", "工商银行");
+            dic.Add("农业银行", "农业银行");
+            dic.Add("邮储银行", "邮储银行");
+            dic.Add("建设银行", "建设银行");
+            dic.Add("招商银行", "招商银行");
+            dic.Add("中国银行", "中国银行");
+            dic.Add("交通银行", "交通银行");
+            dic.Add("浦发银行", "浦发银行");
+            dic.Add("广发银行", "广发银行");
+            dic.Add("民生银行", "民生银行");
+            dic.Add("平安银行", "平安银行");
+            dic.Add("光大银行", "光大银行");
+            dic.Add("兴业银行", "兴业银行");
+            dic.Add("中信银行", "中信银行");
+            dic.Add("上海银行", "上海银行");
+            dic.Add("其他银行", "其他银行");
+            return dic;
+        }
+
+
+
+        #region 检查签名是否合法,合法返回1,不合法返回提示信息
+
+        /// <summary>
+        /// 检查签名是否合法,合法返回1,不合法返回提示信息
+        /// </summary>
+        /// <param name="value">请求的参数(json字符串)</param>
+        /// <param name="signField">要签名的字段</param>
+        /// <returns></returns>
+        private string CheckSign(string value, string[] signField)
+        {
+            JsonData json = JsonMapper.ToObject(value);
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            for (int i = 0; i < signField.Length; i++)
+            {
+                dic.Add(signField[i], json[signField[i]].ToString());
+            }
+            string sign = json["sign"].ToString(); //客户端签名字符串
+            return new Sign().sign(dic, sign);
+        }
+
+        #endregion
+
+    }
+}

+ 163 - 0
Areas/Api/Controllers/v1/MainServer/MerchantDepositOrderController.cs

@@ -0,0 +1,163 @@
+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 MySystem.MainModels;
+using LitJson;
+using Library;
+using MySystem.Service.Main;
+using LKBAAlipayConfig;
+
+namespace MySystem.Areas.Api.Controllers.v1
+{
+    [Area("Api")]
+    [Route("/v1/qrcodeplatemain/[controller]/[action]")]
+    public class MerchantDepositOrderController : BaseController
+    {
+        public MerchantDepositOrderController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+        }
+
+        #region 商户激活-确认支付
+        [Authorize]
+        public JsonResult Pay(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = PayDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson PayDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int PayMode = int.Parse(function.CheckInt(data["PayMode"].ToString())); //支付方式(1 支付宝)
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //订单记录Id
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var query = new MerchantDepositOrderService().QueryById(Id);
+            if (query.Id > 0)
+            {
+                Dictionary<string, object> fields = new Dictionary<string, object>();
+                fields.Add("Sort", PayMode); //支付方式(1 支付宝)
+                MerchantDepositOrderService.Edit(fields, Id, false);
+                string PayData = "";
+                if (PayMode == 1)
+                {
+                    string TotalPrice = query.ActPayPrice.ToString();
+                    function.WriteLog(query.OrderNo, "支付宝支付日志");
+                    function.WriteLog(TotalPrice.ToString(), "支付宝支付日志");
+                    function.WriteLog("商户激活—确认订单", "支付宝支付日志");
+                    string ProductName = "商户激活";
+                    PayData = new Alipay.AlipayPublicClass(_accessor.HttpContext).GetAlipayInfo(query.OrderNo, TotalPrice, ProductName, LKBAliPayInfo.AppId, LKBAliPayInfo.PrivateKey, SpHost + "/Api/Alipay/NoticePay2");
+                    function.WriteLog(PayData, "支付宝支付日志");
+                }
+                Obj.Add("PayData", PayData); //支付宝微信SDK所需数据
+            }
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+
+        #region 商户激活-确认订单
+        [Authorize]
+        public JsonResult ConfirmOrder(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = ConfirmOrderDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson ConfirmOrderDo(string value)
+        {
+            function.WriteLog(value, "商户激活—确认订单");
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            MerchantInfo merchant = new MerchantInfoService().Query(MerchantId);
+            string OrderNo = "D" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
+            string check = RedisDbconn.Instance.Get<string>("ConfirmOrder:" + MerchantId + "_" + OrderNo);
+            if (!string.IsNullOrEmpty(check))
+            {
+                return new AppResultJson() { Status = "-1", Info = "请勿重复下单!" };
+            }
+            RedisDbconn.Instance.Set("ConfirmOrder:" + MerchantId + "_" + OrderNo, "1");
+            RedisDbconn.Instance.SetExpire("ConfirmOrder:" + MerchantId + "_" + OrderNo, 10);
+            var IsBuy = new MerchantDepositOrderService().QueryByMerchantId(MerchantId);
+            if (IsBuy.Id > 0) return new AppResultJson() { Status = "-1", Info = "请勿重复下单!" };
+            decimal ActPayPrice = 365; //服务费总额
+            var Id = MerchantDepositOrderUtil.AddMerchantDepositOrder(OrderNo, merchant.UserId, MerchantId, ActPayPrice);
+            var query = new MerchantDepositOrderService().QueryById(Id);
+            Obj.Add("Id", Id); //Id
+            Obj.Add("CreateDate", query.CreateDate); //创建时间
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+
+        #region 已激活商户-活动时间
+        [Authorize]
+        public JsonResult Info(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = InfoDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson InfoDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var CreateDate = "";
+            var StartDate = "";
+            var EndDate = "";
+            var Status = -1;
+            var query = new MerchantDepositOrderService().QueryByMerchantId(MerchantId);
+            if (query.Id > 0)
+            {
+                CreateDate = DateTime.Parse(query.UpdateDate.ToString()).Year + "年" + DateTime.Parse(query.UpdateDate.ToString()).Month + "月" + DateTime.Parse(query.UpdateDate.ToString()).Day + "日";
+                StartDate = DateTime.Parse(query.UpdateDate.ToString()).AddMonths(1).Year + "年" + DateTime.Parse(query.UpdateDate.ToString()).AddMonths(1).Month + "月";
+                EndDate = DateTime.Parse(query.UpdateDate.ToString()).AddMonths(11).Year + "年" + DateTime.Parse(query.UpdateDate.ToString()).AddMonths(11).Month + "月";
+                Status = new MerchantInfoService().Query(MerchantId).ExamineStatus;
+            }
+            Obj.Add("CreateDate", CreateDate); //参与时间
+            Obj.Add("StartDate", StartDate); //考核开始时间
+            Obj.Add("EndDate", EndDate); //考核结束时间
+            Obj.Add("Status", Status); //考核状态(-1 未参与 0 考核中 1 已通过 2 未通过 101 待领取 100 已领取 99 发放中)
+
+            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
+        }
+        #endregion
+
+
+
+        #region 检查签名是否合法,合法返回1,不合法返回提示信息
+
+        /// <summary>
+        /// 检查签名是否合法,合法返回1,不合法返回提示信息
+        /// </summary>
+        /// <param name="value">请求的参数(json字符串)</param>
+        /// <param name="signField">要签名的字段</param>
+        /// <returns></returns>
+        private string CheckSign(string value, string[] signField)
+        {
+            JsonData json = JsonMapper.ToObject(value);
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            for (int i = 0; i < signField.Length; i++)
+            {
+                dic.Add(signField[i], json[signField[i]].ToString());
+            }
+            string sign = json["sign"].ToString(); //客户端签名字符串
+            return new Sign().sign(dic, sign);
+        }
+
+        #endregion
+
+    }
+}

+ 149 - 45
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -24,7 +24,7 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
-        
+
         #region 首页-快联盟产品-我的业绩-团队业绩-商户列表
         [Authorize]
         public JsonResult TeamPerformanceMerchants(string value)
@@ -133,7 +133,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             string SearchKey = data["SearchKey"].ToString(); //搜索关键词
             int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int ActiveStatus = int.Parse(function.CheckInt(data["ActiveStatus"].ToString())); //商户激活状态
+            int ActiveStatus = int.Parse(function.CheckInt(data["ActiveStatus"].ToString())); //商户达标状态
+            int IsAct = int.Parse(function.CheckInt(data["IsAct"].ToString())); //激活状态(1 已激活 2 未激活)
             int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
             string TradeSort = data["TradeSort"].ToString(); //排序
             string DateSort = data["DateSort"].ToString(); //排序
@@ -146,9 +147,14 @@ namespace MySystem.Areas.Api.Controllers.v1
             {
                 query = query.Where(m => m.Name.Contains(SearchKey));
             }
-            if(Kind > 0)
+            if (Kind > 0)
             {
-                query = query.Where(m => m.QueryCount == Kind);
+                string subjectType = "";
+                if (Kind == 1) subjectType = "SUBJECT_TYPE_INDIVIDUAL";
+                if (Kind == 2) subjectType = "SUBJECT_TYPE_ENTERPRISE";
+                if (Kind == 3) subjectType = "SUBJECT_TYPE_SMALL";
+                List<int> ids = maindb.MerchantAddInfo.Where(m => m.SubjectType == subjectType).ToList().Select(m => m.Id).ToList();
+                query = query.Where(m => ids.Contains(m.Id));
             }
             if (ActiveStatus > 0)
             {
@@ -156,10 +162,17 @@ namespace MySystem.Areas.Api.Controllers.v1
                 query = query.Where(m => m.ActivationStatus == ActiveStatus);
             }
             int TotalCount = query.Count();
-            int ActCount = query.Count(m => m.ActivationDate == today);
+            int IsActNum = query.Count(m => m.IsAct == 1);
             int ProductCount = query.Count();
+            if (IsAct > 0)
+            {
+                if (IsAct == 2) IsAct = 0;
+                query = query.Where(m => m.IsAct == IsAct);
+            }
+            int ActCount = query.Count(m => m.ActivationDate == today);
             int ProductActCount = query.Count(m => m.ActivationStatus == 1);
             int ProductUnActCount = ProductCount - ProductActCount;
+            int UnActNum = ProductCount - IsActNum;
             if (TradeSort == "1")
             {
                 if (DateSort == "1")
@@ -207,6 +220,8 @@ namespace MySystem.Areas.Api.Controllers.v1
             Other.Add("TotalCount", TotalCount); //商户数
             Other.Add("ActCount", ActCount); //商户达标数
             Other.Add("UnActCount", ProductUnActCount); //未达标数
+            Other.Add("IsActNum", IsActNum); //商户激活数
+            Other.Add("UnActNum", UnActNum); //商户未激活数
             return dataList;
         }
         #endregion
@@ -237,6 +252,23 @@ namespace MySystem.Areas.Api.Controllers.v1
             Obj.Add("ActivationDate", merchant.ActivationDate == null ? "" : merchant.ActivationDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //达标时间
             Obj.Add("TotalAmount", merchant.TotalAmount.ToString("f2")); //总交易额
             Obj.Add("ActivationStatus", merchant.ActivationStatus); //达标状态
+            Obj.Add("IsAct", merchant.IsAct); //是否激活(0 否 1 是)
+            if (merchant.IsAct == 1)
+            {
+                var orderInfo = maindb.MerchantDepositOrder.FirstOrDefault(m => m.Status > 0 && m.MerchantId == Id) ?? new MerchantDepositOrder();
+                var IsPay = 0;
+                if (orderInfo.Id > 0)
+                {
+                    IsPay = 1;
+                    Obj.Add("IsPay", IsPay); //是否缴纳服务费(0 否 1 是)
+                    Obj.Add("ActDate", orderInfo.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
+                }
+                else
+                {
+                    Obj.Add("IsPay", IsPay); //是否缴纳服务费(0 否 1 是)
+                    Obj.Add("ActDate", ""); //激活时间
+                }
+            }
             return Obj;
         }
         #endregion
@@ -262,7 +294,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             string limit = " limit " + PageSize;
-            if (PageNum == 1)
+            if (PageNum > 1)
             {
                 int skipNum = PageSize * (PageNum - 1);
                 limit = " limit " + skipNum + "," + PageSize;
@@ -280,14 +312,14 @@ namespace MySystem.Areas.Api.Controllers.v1
                 dataList.Add(curData);
             }
             other = new Dictionary<string, object>();
-            if(PageNum == 1)
+            if (PageNum == 1)
             {
                 DataTable total = CustomerSqlConn.dtable("select sum(TradeAmount),sum(TradeCount),sum(if(IsAct=1, TradeAmount, 0)),sum(if(IsAct=0, TradeAmount, 0)) from MerchantAmountSummay where MerchantId=" + MerchantId + " and TradeMonth='" + TradeMonth + "'", AppConfig.Base.SqlConnStr);
                 decimal TradeAmt = 0;
                 decimal ActTradeAmt = 0;
                 decimal UnActTradeAmt = 0;
                 int TradeCount = 0;
-                if(total.Rows.Count > 0)
+                if (total.Rows.Count > 0)
                 {
                     TradeAmt = decimal.Parse(function.CheckNum(total.Rows[0][0].ToString())); //交易金额
                     ActTradeAmt = decimal.Parse(function.CheckNum(total.Rows[0][2].ToString())); //活动交易金额
@@ -346,6 +378,48 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
+        #region 创客-首页-我的商户-商户详情-音响
+        // [Authorize]
+        public JsonResult QrCodeList2(string value)
+        {
+            value = DesDecrypt(value);
+            value = value.Replace("null", "\"\"");
+            JsonData data = JsonMapper.ToObject(value);
+            int TotalCount = 0;
+            List<Dictionary<string, object>> dataList = QrCodeList2Do(value, out TotalCount);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = TotalCount });
+        }
+        public List<Dictionary<string, object>> QrCodeList2Do(string value, out int TotalCount)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
+            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            IQueryable<MachineForQrCode> query = maindb.MachineForQrCode.Where(m => m.MerchantId == MerchantId && m.DataId.EndsWith("_1") && m.MachineSnNo != m.SnNo && !string.IsNullOrEmpty(m.MachineSnNo)).OrderByDescending(m => m.MerchantId);
+            TotalCount = query.Count();
+            if (PageNum == 1)
+            {
+                query = query.Take(PageSize);
+            }
+            else
+            {
+                int skipNum = PageSize * (PageNum - 1);
+                query = query.Skip(skipNum).Take(PageSize);
+            }
+            foreach (MachineForQrCode item in query.ToList())
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("SnNo", item.SnNo); //sn
+                curData.Add("TradeAmount", QrCodeTradeStat.Instance.Amount(item.SnNo).ToString("f2"));
+                curData.Add("BindTime", item.BindDate == null ? "" : item.BindDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+
 
 
         #region 首页-我的商户-商户搜索
@@ -423,7 +497,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 if (Status == 4) Status = 2;
                 query = query.Where(m => m.Status == Status);
             }
-            if(!string.IsNullOrEmpty(SearchKey))
+            if (!string.IsNullOrEmpty(SearchKey))
             {
                 query = query.Where(m => m.Name.Contains(SearchKey));
             }
@@ -514,15 +588,23 @@ namespace MySystem.Areas.Api.Controllers.v1
             int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantInfo edit = maindb.MerchantInfo.FirstOrDefault(m => m.Id == Id && m.UserId == UserId);
-            if(edit != null)
+            if (edit != null)
             {
-                maindb.MerchantInfo.Remove(edit);
-                MerchantAddInfo editadd = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == Id);
-                if(editadd != null)
+                if (edit.Sort == 0 && edit.Status == 0 && edit.QueryCount == 0)
+                {
+
+                    maindb.MerchantInfo.Remove(edit);
+                    MerchantAddInfo editadd = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == Id);
+                    if (editadd != null)
+                    {
+                        maindb.MerchantAddInfo.Remove(editadd);
+                    }
+                    maindb.SaveChanges();
+                }
+                else
                 {
-                    maindb.MerchantAddInfo.Remove(editadd);
+                    return new AppResultJson() { Status = "-1", Info = "商户已进件签约,暂不支持删除", Data = Obj };
                 }
-                maindb.SaveChanges();
             }
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
         }
@@ -546,8 +628,17 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && m.Sort == 0).ToList();
-            foreach (var subdata in query)
+            IQueryable<MerchantInfo> query = maindb.MerchantInfo.Where(m => m.UserId == UserId && m.Sort == 0);
+            if (PageNum == 1)
+            {
+                query = query.Take(PageSize);
+            }
+            else
+            {
+                int skipNum = PageSize * (PageNum - 1);
+                query = query.Skip(skipNum).Take(PageSize);
+            }
+            foreach (var subdata in query.ToList())
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 curData.Add("Name", subdata.Name); //名称
@@ -588,14 +679,14 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
             }
             else if (TimeType == "2")
-            { 
+            {
                 Start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00").AddDays(-6);
             }
             else if (TimeType == "3")
-            { 
+            {
                 Start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00");
             }
-            while(Start <= DateTime.Now)
+            while (Start <= DateTime.Now)
             {
                 Dictionary<string, string> dic = new MerchantAmountSummayService().Sum("TradeAmount,TradeCount,TotalActual", " and MerchantId=" + Id + " and TradeDate='" + Start.ToString("yyyyMMdd") + "'");
                 TotalAmount += decimal.Parse(dic["TradeAmount"]);
@@ -610,7 +701,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             Obj.Add("TotalActual", TotalActual); //实收总额
             MerchantInfo merchant = new MerchantInfoService().Query(Id);
             decimal AllocationAmount = merchant.ActMaxAmount - merchant.ActCurrentAmount;
-            if(AllocationAmount < 0) AllocationAmount = 0;
+            if (AllocationAmount < 0) AllocationAmount = 0;
             Obj.Add("AllocationAmount", AllocationAmount); //未分配活动金额
 
             return Obj;
@@ -716,34 +807,45 @@ namespace MySystem.Areas.Api.Controllers.v1
             Obj.Add("AlipayStatus", merchantAddInfo.QueryCount);
             Obj.Add("WeChatStatus", merchantAddInfo.Status);
             Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd"));
+            Obj.Add("IsAct", query.IsAct); //是否激活(0 否 1 是)
+            if (query.IsAct == 1)
+            {
+                var orderInfo = maindb.MerchantDepositOrder.FirstOrDefault(m => m.Status > 0 && m.MerchantId == Id) ?? new MerchantDepositOrder();
+                var IsPay = 0;
+                if (orderInfo.Id > 0)
+                {
+                    IsPay = 1;
+                }
+                Obj.Add("IsPay", IsPay); //是否缴纳服务费(0 否 1 是)
+            }
             return Obj;
         }
         private string GetMainStatusName(int AlipayStatus, int WeChatStatus)
         {
-            if(AlipayStatus == 0 && WeChatStatus == 0) return "待审核";
-            if(AlipayStatus == 0 && WeChatStatus == -1) return "部分未通过";
-            if(AlipayStatus == -1 && WeChatStatus == 0) return "部分未通过";
-            if(AlipayStatus == 0 && WeChatStatus == 1) return "部分待签约";
-            if(AlipayStatus == 1 && WeChatStatus == 0) return "部分待签约";
-            if(AlipayStatus == 0 && WeChatStatus == 2) return "部分已通过";
-            if(AlipayStatus == 2 && WeChatStatus == 0) return "部分已通过";
-            if(AlipayStatus == -1 && WeChatStatus == -1) return "审核未通过";
-            if(AlipayStatus == -1 && WeChatStatus == 1) return "部分未通过";
-            if(AlipayStatus == 1 && WeChatStatus == -1) return "部分未通过";
-            if(AlipayStatus == -1 && WeChatStatus == 2) return "部分未通过";
-            if(AlipayStatus == 2 && WeChatStatus == -1) return "部分未通过";
-            if(AlipayStatus == 1 && WeChatStatus == 1) return "待签约";
-            if(AlipayStatus == 1 && WeChatStatus == 2) return "部分待签约";
-            if(AlipayStatus == 2 && WeChatStatus == 1) return "部分待签约";
-            if(AlipayStatus == 2 && WeChatStatus == 2) return "已通过";
+            if (AlipayStatus == 0 && WeChatStatus == 0) return "待审核";
+            if (AlipayStatus == 0 && WeChatStatus == -1) return "部分未通过";
+            if (AlipayStatus == -1 && WeChatStatus == 0) return "部分未通过";
+            if (AlipayStatus == 0 && WeChatStatus == 1) return "部分待签约";
+            if (AlipayStatus == 1 && WeChatStatus == 0) return "部分待签约";
+            if (AlipayStatus == 0 && WeChatStatus == 2) return "部分已通过";
+            if (AlipayStatus == 2 && WeChatStatus == 0) return "部分已通过";
+            if (AlipayStatus == -1 && WeChatStatus == -1) return "审核未通过";
+            if (AlipayStatus == -1 && WeChatStatus == 1) return "部分未通过";
+            if (AlipayStatus == 1 && WeChatStatus == -1) return "部分未通过";
+            if (AlipayStatus == -1 && WeChatStatus == 2) return "部分未通过";
+            if (AlipayStatus == 2 && WeChatStatus == -1) return "部分未通过";
+            if (AlipayStatus == 1 && WeChatStatus == 1) return "待签约";
+            if (AlipayStatus == 1 && WeChatStatus == 2) return "部分待签约";
+            if (AlipayStatus == 2 && WeChatStatus == 1) return "部分待签约";
+            if (AlipayStatus == 2 && WeChatStatus == 2) return "已通过";
             return "";
         }
         private string GetStatusName(int WeChatStatus)
         {
-            if(WeChatStatus == -1) return "审核未通过";
-            if(WeChatStatus == 0) return "待审核";
-            if(WeChatStatus == 1) return "待签约";
-            if(WeChatStatus == 2) return "已通过";
+            if (WeChatStatus == -1) return "审核未通过";
+            if (WeChatStatus == 0) return "待审核";
+            if (WeChatStatus == 1) return "待签约";
+            if (WeChatStatus == 2) return "已通过";
             return "";
         }
         #endregion
@@ -772,10 +874,10 @@ namespace MySystem.Areas.Api.Controllers.v1
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             string Sn = data["Sn"].ToString();
             string Machine = data["Machine"].ToString();
-            if(Sn.Length > 20)
+            if (Sn.Length > 20)
             {
                 Sn = System.Web.HttpUtility.UrlDecode(Sn);
-                if(!Sn.EndsWith("="))
+                if (!Sn.EndsWith("="))
                 {
                     Sn += "=";
                 }
@@ -783,7 +885,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Sn = Sn.TrimEnd('\0');
                 Sn = Sn.Substring(0, Sn.Length - 8);
             }
-            if(Machine == Sn)
+            if (Machine == Sn)
             {
                 MerchantQrCode code = new MerchantQrCodeService().Query(Sn);
                 MerchantInfo query = new MerchantInfoService().Query(code.MerchantId);
@@ -794,6 +896,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Obj.Add("Logo", DefaultPic(query.Logo)); //Logo图片
                 Obj.Add("DiviPercent", set.IsAll == 1 ? 0M : set.DiviPercent);
                 Obj.Add("MinPayMoney", set.MinPayMoney);
+                Obj.Add("IsAct", query.IsAct); //是否激活(0 否 1 是)
             }
             else
             {
@@ -806,6 +909,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 Obj.Add("Logo", DefaultPic(query.Logo)); //Logo图片
                 Obj.Add("DiviPercent", set.IsAll == 1 ? 0M : set.DiviPercent);
                 Obj.Add("MinPayMoney", set.MinPayMoney);
+                Obj.Add("IsAct", query.IsAct); //是否激活(0 否 1 是)
             }
             return Obj;
         }
@@ -883,7 +987,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             if (Mobile == "13802211996")
             {
                 if (LoginPwd != "kxs2022")
-                { 
+                {
                     return Json(new AppResultJson() { Status = "-1", Info = "登录密码不正确" });
                 }
                 Obj.Add("Id", 1);

+ 25 - 2
Areas/Api/Controllers/v1/MainServer/MerchantParamSetController.cs

@@ -110,6 +110,10 @@ namespace MySystem.Areas.Api.Controllers.v1
             }
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
             MerchantInfo merchant = maindb.MerchantInfo.FirstOrDefault(m => m.Id == Id);
+            if (merchant.Id > 0 && merchant.IsAct == 0)
+            {
+                return new AppResultJson() { Status = "-1", Info = "商户尚未激活,不能开启活动配置活动参数" };
+            }
             MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + merchant.Mobile);
             if (mobilecheck == null)
             {
@@ -122,7 +126,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             RedisDbconn.Instance.Clear("MobileCodeCheck:" + merchant.Mobile);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantParamSet query = maindb.MerchantParamSet.FirstOrDefault(m => m.Id == Id);
-            if(query == null)
+            if (query == null)
             {
                 query = maindb.MerchantParamSet.Add(new MerchantParamSet()
                 {
@@ -131,6 +135,25 @@ namespace MySystem.Areas.Api.Controllers.v1
                 }).Entity;
                 maindb.SaveChanges();
             }
+            var merchantParamSetRecord = maindb.MerchantParamSetRecord.Add(new MerchantParamSetRecord()
+            {
+                // Status = status, //活动状态(1 使用中 -1 已失效 0 已关闭)
+                CreateDate = DateTime.Now,
+                MerchantId = Id,
+                BeforeDiviPersons = query.DiviPersons,
+                BeforeDiviPercent = query.DiviPercent,
+                BeforeProfitDays = query.ProfitDays,
+                BeforeGetPercent = query.GetPercent,
+                BeforeMinPayMoney = query.MinPayMoney,
+                BeforeIsAll = query.IsAll,
+                AfterDiviPersons = DiviPersons,
+                AfterDiviPercent = DiviPercent,
+                AfterProfitDays = ProfitDays,
+                AfterGetPercent = GetPercent,
+                AfterMinPayMoney = MinPayMoney,
+                AfterIsAll = IsAll,
+            }).Entity;
+            maindb.SaveChanges();
             query.UpdateDate = DateTime.Now; //修改时间
             query.IsAll = IsAll; //是否收全额
             query.MinPayMoney = MinPayMoney; //订单参与门槛
@@ -138,6 +161,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             query.ProfitDays = ProfitDays; //分红期限(天)
             query.DiviPercent = DiviPercent; //最大分红比例
             query.DiviPersons = DiviPersons; //单笔订单分红人数
+            query.Version = merchantParamSetRecord.Id;
             maindb.SaveChanges();
             Obj.Add("UpdateDate", query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //更新时间
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
@@ -145,7 +169,6 @@ namespace MySystem.Areas.Api.Controllers.v1
         #endregion
 
 
-
         #region 检查签名是否合法,合法返回1,不合法返回提示信息
 
         /// <summary>

+ 92 - 51
Areas/Api/Controllers/v1/MainServer/MerchantQrCodeController.cs

@@ -70,7 +70,7 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
         #region 商户-绑定收款码
-        // [Authorize]
+        [Authorize]
         public JsonResult Bind(string value)
         {
             value = DesDecrypt(value);
@@ -83,29 +83,61 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
             string SnNo = data["SnNo"].ToString(); //Sn编号
-            // string MachineNo = data["Machine"].ToString(); //音箱码
-            if(SnNo.Length > 20)
+            string MachineNo = data["Machine"].ToString(); //音箱码
+            if (SnNo.Length > 20)
             {
                 SnNo = System.Web.HttpUtility.UrlDecode(SnNo);
-                if(!SnNo.EndsWith("="))
+                if (!SnNo.EndsWith("="))
                 {
                     SnNo += "=";
                 }
                 SnNo = dbconn.Decrypt3DES(SnNo, "l2k0b2#3");
                 SnNo = SnNo.TrimEnd('\0');
-                SnNo = SnNo.Substring(0, SnNo.Length - 8);
+                SnNo = SnNo.Substring(0, 20);
+            }
+            if(!string.IsNullOrEmpty(MachineNo))
+            {
+                if (MachineNo.Length > 20)
+                {
+                    MachineNo = System.Web.HttpUtility.UrlDecode(MachineNo);
+                    if (!MachineNo.EndsWith("="))
+                    {
+                        MachineNo += "=";
+                    }
+                    MachineNo = dbconn.Decrypt3DES(MachineNo, "l2k0b2#3");
+                    MachineNo = MachineNo.TrimEnd('\0');
+                    MachineNo = MachineNo.Substring(0, 20);
+                }
             }
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantQrCode query = new MerchantQrCodeService().Query(SnNo);
             PosMachinesTwo pos = new PosMachinesTwoService().Query(SnNo);
+            PosMachines machines = new PosMachinesService().Query(SnNo);
             MerchantInfo merchant = new MerchantInfoService().Query(MerchantId);
-            if(pos.Id == 0)
+            if (pos.BindingState == 1)
             {
-                return new AppResultJson() { Status = "-1", Info = "绑定失败" };
+                return new AppResultJson() { Status = "-1", Info = "此码已被绑定" };
             }
-            if(pos.BuyUserId == 0)
+            if (machines.BindingState == 1)
             {
-                return new AppResultJson() { Status = "-1", Info = "码牌未授权" };
+                return new AppResultJson() { Status = "-1", Info = "此码已被绑定" };
+            }
+            int PosId = 0;
+            if (SnNo == MachineNo || string.IsNullOrEmpty(MachineNo))
+            {
+                if (pos.Id == 0)
+                {
+                    return new AppResultJson() { Status = "-1", Info = "绑定失败" };
+                }
+                PosId = pos.Id;
+            }
+            else if (SnNo != MachineNo)
+            {
+                if (machines.Id == 0)
+                {
+                    return new AppResultJson() { Status = "-1", Info = "绑定失败" };
+                }
+                PosId = machines.Id;
             }
             if (query.Id > 0)
             {
@@ -115,53 +147,62 @@ namespace MySystem.Areas.Api.Controllers.v1
                 }
             }
             Dictionary<string, object> fields = new Dictionary<string, object>();
-            fields.Add("MerchantId", MerchantId);
-            fields.Add("SnNo", SnNo);
-            fields.Add("QueryCount", 1);
-            new MerchantQrCodeService().Add(fields);
-            // query = maindb.MerchantQrCode.Add(new MerchantQrCode()
-            // {
-            //     CreateDate = DateTime.Now, //绑定时间
-            //     MerchantId = MerchantId, //商户
-            //     SnNo = SnNo,
-            // }).Entity;
-            // maindb.SaveChanges();
-            string DataId = query.Id + "_0";
-            MachineForQrCode forQrCode = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
-            if (forQrCode == null)
+            if (SnNo == MachineNo || string.IsNullOrEmpty(MachineNo))
             {
-                forQrCode = maindb.MachineForQrCode.Add(new MachineForQrCode(){
-                    DataId = DataId,
-                    SnNo = SnNo,
-                    // MachineSnNo = MachineNo,
-                    BindDate = DateTime.Now,
-                    MerchantId = MerchantId,
-                }).Entity;
+                fields.Add("MerchantId", MerchantId);
+                fields.Add("SnNo", SnNo);
+                fields.Add("QueryCount", 1);
+                new MerchantQrCodeService().Add(fields);
             }
             else
-            { 
-                forQrCode.SnNo = SnNo;
-                // forQrCode.MachineSnNo = MachineNo;
-                forQrCode.BindDate = DateTime.Now;
-                forQrCode.MerchantId = MerchantId;
+            {
+                string DataId = PosId + "_1";
+                MachineForQrCode forQrCode = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
+                if (forQrCode == null)
+                {
+                    forQrCode = maindb.MachineForQrCode.Add(new MachineForQrCode(){
+                        DataId = DataId,
+                        SnNo = SnNo,
+                        MachineSnNo = MachineNo,
+                        BindDate = DateTime.Now,
+                        MerchantId = MerchantId,
+                    }).Entity;
+                }
+                else
+                { 
+                    forQrCode.SnNo = SnNo;
+                    forQrCode.MachineSnNo = MachineNo;
+                    forQrCode.BindDate = DateTime.Now;
+                    forQrCode.MerchantId = MerchantId;
+                }
             }
             maindb.SaveChanges();
-            fields = new Dictionary<string, object>();
-            fields.Add("BuyUserId", merchant.UserId);
-            fields.Add("UserId", merchant.UserId);
-            fields.Add("BindingTime", DateTime.Now);
-            fields.Add("BindingState", 1);
-            fields.Add("BindMerchantId", MerchantId);
-            fields.Add("OpId", 1);
-            new PosMachinesTwoService().Edit(fields, pos.Id);
-            // pos.BuyUserId = merchant.UserId;
-            // pos.UserId = merchant.UserId;
-            // pos.BindingTime = DateTime.Now;
-            // pos.BindingState = 1;
-            // pos.BindMerchantId = MerchantId;
-            // maindb.SaveChanges();
-
-            PublicFunction.BindUserMachineData(maindb, merchant.UserId, 0, 1, SnNo);
+            if (SnNo == MachineNo || string.IsNullOrEmpty(MachineNo))
+            {
+                fields = new Dictionary<string, object>();
+                fields.Add("BuyUserId", merchant.UserId);
+                fields.Add("UserId", merchant.UserId);
+                fields.Add("BindingTime", DateTime.Now);
+                fields.Add("BindingState", 1);
+                fields.Add("BindMerchantId", MerchantId);
+                fields.Add("OpId", 1);
+                new PosMachinesTwoService().Edit(fields, pos.Id);
+            }
+            else if (SnNo != MachineNo && !string.IsNullOrEmpty(MachineNo))
+            {
+                fields = new Dictionary<string, object>();
+                fields.Add("BindMerchantId", MerchantId);
+                fields.Add("DeviceKind", "1");
+                new PosMachinesService().Edit(fields, machines.Id);
+            }
+            if (SnNo == MachineNo || string.IsNullOrEmpty(MachineNo))
+            {
+                PublicFunction.BindUserMachineData(maindb, merchant.UserId, 0, 1, SnNo);
+            }
+            else
+            {
+                PublicFunction.BindUserMachineData(maindb, merchant.UserId, 1, 1, SnNo);
+            }
             
             return new AppResultJson() { Status = "1", Info = "绑定成功" };
         }

+ 73 - 8
Areas/Api/Controllers/v1/MainServer/PosMachinesController.cs

@@ -298,7 +298,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             {
                 PageSize = 100000;
             }
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BindingState == 1);
+            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BindingState == 1 && m.OpId != 2);
             if (!string.IsNullOrEmpty(SnNo))
             {
                 query = query.Where(m => m.PosSn == SnNo);
@@ -332,7 +332,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 curData.Add("Id", subdata.Id); //Id
                 decimal Deposit = 299;
                 if (BrandId == 6)
-                { 
+                {
                     Deposit = 249;
                 }
                 if (!string.IsNullOrEmpty(subdata.PrizeParams))
@@ -342,7 +342,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 curData.Add("Deposit", Deposit);
                 MerchantAddInfo merchant = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == subdata.BindMerchantId) ?? new MerchantAddInfo();
                 curData.Add("BindedMerchant", merchant.CertMerchantName);
-                curData.Add("IsLeader",IsLeader);
+                curData.Add("IsLeader", IsLeader);
                 dataList.Add(curData);
             }
             return dataList;
@@ -408,7 +408,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 curData.Add("FromStore", store.StoreName); //来自仓库
                 decimal Deposit = 299;
                 if (BrandId == 6)
-                { 
+                {
                     Deposit = 249;
                 }
                 if (!string.IsNullOrEmpty(subdata.PrizeParams))
@@ -416,7 +416,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                     Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
                 }
                 curData.Add("Deposit", Deposit);
-                curData.Add("IsLeader",IsLeader);
+                curData.Add("IsLeader", IsLeader);
                 dataList.Add(curData);
             }
             return dataList;
@@ -483,14 +483,14 @@ namespace MySystem.Areas.Api.Controllers.v1
                     curData.Add("ActDays", ts.TotalDays.ToString("f0")); //活动剩余天数
                 }
                 else
-                { 
+                {
                     curData.Add("ActDays", 0); //活动剩余天数
                 }
                 curData.Add("CreateDate", subdata.CreateDate.Value.ToString("yyyy-MM-dd")); //机具初始日期
                 curData.Add("EndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd")); //截止日期
                 decimal Deposit = 299;
                 if (BrandId == 6)
-                { 
+                {
                     Deposit = 249;
                 }
                 if (!string.IsNullOrEmpty(subdata.PrizeParams))
@@ -498,13 +498,78 @@ namespace MySystem.Areas.Api.Controllers.v1
                     Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
                 }
                 curData.Add("Deposit", Deposit);
-                curData.Add("IsLeader",IsLeader);
+                curData.Add("IsLeader", IsLeader);
                 dataList.Add(curData);
             }
             return dataList;
         }
         #endregion
 
+        #region 首页-客小爽产品-机具管理-已绑定机具列表
+        // [Authorize]
+        public JsonResult MyMachinesForBind2(string value)
+        {
+            value = DesDecrypt(value);
+            value = value.Replace("null", "\"\"");
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Other = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = MyMachinesForBind2Do(value, out Other);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
+        }
+        public List<Dictionary<string, object>> MyMachinesForBind2Do(string value, out Dictionary<string, object> Other)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
+            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
+            string SnNo = data["SnNo"].ToString(); //SN号
+            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
+            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            if (!string.IsNullOrEmpty(SnNo))
+            {
+                PageSize = 100000;
+            }
+            IQueryable<PosMachines> query = maindb.PosMachines.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BindingState == 1 && m.DeviceKind == "1");
+            if (!string.IsNullOrEmpty(SnNo))
+            {
+                query = query.Where(m => m.PosSn == SnNo);
+            }
+            Other = new Dictionary<string, object>();
+            if (PageNum == 1)
+            {
+                Other.Add("count", query.Count());
+                query = query.Take(PageSize);
+            }
+            else
+            {
+                int skipNum = PageSize * (PageNum - 1);
+                query = query.Skip(skipNum).Take(PageSize);
+            }
+            foreach (var subdata in query.ToList())
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("ActivationState", subdata.ActivationState == 1 ? "已激活" : "未激活"); //激活状态
+                curData.Add("PosSn", subdata.PosSn); //SN编号
+                curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
+                curData.Add("Id", subdata.Id); //Id
+                decimal Deposit = 299;
+                if (BrandId == 6)
+                {
+                    Deposit = 249;
+                }
+                if (!string.IsNullOrEmpty(subdata.PrizeParams))
+                {
+                    Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
+                }
+                curData.Add("Deposit", Deposit);
+                MerchantAddInfo merchant = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == subdata.BindMerchantId) ?? new MerchantAddInfo();
+                curData.Add("BindedMerchant", merchant.CertMerchantName);
+                curData.Add("IsLeader", 0);
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
 
 
 

+ 55 - 0
Areas/Api/Controllers/v1/MainServer/UserSwapWhiteController.cs

@@ -0,0 +1,55 @@
+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.MainModels;
+using MySystem.Service;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1
+{
+    [Area("Api")]
+    [Route("/v1/QrCodePlateMain/[controller]/[action]")]
+    public class UserSwapWhiteController : BaseController
+    {
+        public UserSwapWhiteController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+        }
+
+
+        #region 风险管理-风险创客列表
+        [Authorize]
+        public JsonResult QueryUserRiskFlag(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            Dictionary<string, object> Obj = QueryUserRiskFlagDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
+        }
+        private Dictionary<string, object> QueryUserRiskFlagDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //风控创客Id
+            var RiskFlag = 0;
+            var Remark = "";
+            var info = UserSwapWhiteService.QueryByUserId(UserId);
+            if (info.Id > 0)
+            {
+                RiskFlag = 1;
+                Remark = info.Remark;
+            }
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            Obj.Add("RiskFlag", RiskFlag);
+            Obj.Add("Remark", Remark);
+            return Obj;
+        }
+        #endregion
+
+    }
+}

+ 19 - 0
Config/LKBAliPayInfo.cs

@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+using Library;
+
+namespace LKBAAlipayConfig
+{
+    public class LKBAliPayInfo
+    {
+        
+        //AppId
+        public static string AppId = "2021004123675441";
+        //私钥
+        public static string PrivateKey = "MIIEogIBAAKCAQEAn6vdQjedN72fPHtU1a1zSBvoYoyn9fIrjJhnJg4tGAVPk20I4AMiiKpgWn9cDAEgLddceYfR0IRWw+ojZZqVjJsLG8D715H4xJ6AnllWyeNJd43CdTctTnXRAl25Cw2SuG1kanAA/BO186J2LyN/z7l70LkxOFUJVHXhTx0sKxAS7ZBA43ewjl7ycp108eNNbR63gLjy4VDP63pOnI4MuTNeXh3ET/eunREs8gGuvdXOfY9r2Dyj9lOiOPn1xyrZPpT+WGXrPxLyWnSAz1EkLx7d2aRPFFC1rwJQbcsdBnmN35d6hbofOOe9kPN23Z34d0X6ohD0VbiUUdpzU4f9ZwIDAQABAoIBAFK+U3i/LT/3ig9jskDRE86od7KqRVgU2TCQwdNcwU2TYvt5I4JC3aCI+kmrel3WL4DR++AW3En8aqI4MYOzqhAlQIpvZZL+2DW8Fdb5YRpaKHZGBiGMKHRiZZ+eRghOTlw4hDMMO9ZluIK7DBe9g7x32Iv/jFwu5RjZxZqj+YGOjnMTQvXdrHc5WH7nI9bJC4EJUD1WsO5wmgHkdwPLSKAPLoc+PcCD8manlq2XU560TycZJmaXhBNtkAwlhhu8tY/hPsbQBMwIN8VtWiE0sD0fgR8r0Hq3yLxG1ysXQfrL105UC6+6Srxz17MmcS/beIPvFUSu0GHYgeHHKc1FnVECgYEA3ZtDhG/e7/hCKWW3xAKse+xJ77T3lSxH9HP4Shh6fEaKefFx+aN3VddpAEJpt7w0WbxJTduwD0gtu3IY9XCIX8mJPMk/Thy14MI/VTynJheK2zGylPep4MF6nXP3QfBfgN+Kq/XYHTWZK7gD2vfgHjGKuAW7fHQLLhMjNZ3/o3UCgYEAuHPUiZueKXYIZ7hPdNvChb9UKQdyrx9SVS8gQph4uAbHmNT1caVyvdmWSOYP3h2/UnJ8dCGAEBzd1CFlf959jzT7uceabZXOLtgTKa8qfJfvM4a5uTfr7XxUfcJgQzaugAqXwl4Wiwe0Y8DrWudo+Umb5MvpfQCXQVpIBBJQDesCgYA2mXGKKNIBx+XtMy2SsqHyqmYRFEJH07Aqz4PmJZ/QDMVDhDRzsE3PrZImSTao2UsArP5Wm4EGUt9JprP1jPNcvlf8zQy23yYEqXdXNels3jINDXKVd2u4f5MJRjAuY93z75/H/HtxvuntNppkkdv7NHOcIXVvFVxHztlG9ZWtnQKBgB2OwjJC87dlKLemO2VYifVw0YW5odEaTdFEugCx+jZTL8z341UQ1DBEG+cWpthLIAuQOQ1LCQCL/6gsqd0xxCEctnHw4HhLFz0+duOpJD/PAQ/auQxLP81QrSFx8ocSzifKisMk3Kvu0iNiGNT6XEIGX6rsWkAjxhk85Glync19AoGAazxVqVo3SMOzfAZHxvYWu81asFDN7+wvnOhUwWM+BOIYrhd4rspmQ691tOPQSAsXFXeFOmVtJDguRp0TtnysFVTH2goljCvc9WTuBLjUlj/g0hyBNQA5bBItdvlA1aRhYQSa1yhGK3IGcCYW6agkDhb8LdLZMlEsTcEpkOLoSmQ=";
+        // 公钥
+        public static string PublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn6vdQjedN72fPHtU1a1zSBvoYoyn9fIrjJhnJg4tGAVPk20I4AMiiKpgWn9cDAEgLddceYfR0IRWw+ojZZqVjJsLG8D715H4xJ6AnllWyeNJd43CdTctTnXRAl25Cw2SuG1kanAA/BO186J2LyN/z7l70LkxOFUJVHXhTx0sKxAS7ZBA43ewjl7ycp108eNNbR63gLjy4VDP63pOnI4MuTNeXh3ET/eunREs8gGuvdXOfY9r2Dyj9lOiOPn1xyrZPpT+WGXrPxLyWnSAz1EkLx7d2aRPFFC1rwJQbcsdBnmN35d6hbofOOe9kPN23Z34d0X6ohD0VbiUUdpzU4f9ZwIDAQAB";
+        // 支付宝公钥
+        public static string AlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnw14hKejqS+si/XZpNQpFAVOVXJIThj5Qn7H14n/vsb7uRLug1+Jcve8ehTkaN3s5ibrrELCnz0dvshi3cOz9svDSbLG5OdC1biAvZzpDkvVPswOd9f9jO8Jvqk3QTXTI3MSN9gOpKomI0te3qs5kkOQx6kRozzKjU/G//o/PbJCxpBxf/QNRV3XmCwJLZMBE7ukYqi1WO9Jra8jdczFKwrd/nhiKBKdupAtVVeKlylGD2i2YLkGAH1cLsPUN9DtzrXNblGXm2HK3l9SnMDjqnakiVdEQJTNYNpEiHaOJsVmPQL38nM6miz5wNd4gTchKzXPtoZWqto+eIvYaEA/KwIDAQAB";
+
+    }
+}

+ 6 - 0
MainModels/ConsumerOrders.cs

@@ -29,5 +29,11 @@ namespace MySystem.MainModels
         public ulong IsAct { get; set; }
         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 ulong ReturnFlag { get; set; }
     }
 }

+ 24 - 0
MainModels/CustomQuery.cs

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

+ 21 - 0
MainModels/ExportExcels.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.MainModels
+{
+    public partial class ExportExcels
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string FileName { get; set; }
+        public int SysId { get; set; }
+        public string FileUrl { get; set; }
+    }
+}

+ 1 - 0
MainModels/MerchantAddInfo.cs

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

+ 29 - 0
MainModels/MerchantDepositBack.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.MainModels
+{
+    public partial class MerchantDepositBack
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string Remark { get; set; }
+        public int UserId { get; set; }
+        public string ApplyNo { get; set; }
+        public int ReturnWay { get; set; }
+        public decimal ReturnAmount { get; set; }
+        public string BankCardNo { get; set; }
+        public string AlipayAccountNo { get; set; }
+        public int MerchantId { get; set; }
+    }
+}

+ 25 - 0
MainModels/MerchantDepositOrder.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.MainModels
+{
+    public partial class MerchantDepositOrder
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string OrderNo { get; set; }
+        public decimal ActPayPrice { get; set; }
+        public int UserId { get; set; }
+        public int MerchantId { get; set; }
+    }
+}

+ 10 - 0
MainModels/MerchantInfo.cs

@@ -45,5 +45,15 @@ namespace MySystem.MainModels
         public decimal AllocationAmount { get; set; }
         public decimal ActMaxAmount { get; set; }
         public decimal ActCurrentAmount { get; set; }
+        public int IsAct { get; set; }
+        public int ExamineStatus { get; set; }
+        public int Months { get; set; }
+        public DateTime? EndTime { get; set; }
+        public DateTime? StartTime { get; set; }
+        public string BusinessHours { get; set; }
+        public string BriefIntroduction { get; set; }
+        public int Popularity { get; set; }
+        public decimal Latitude { get; set; }
+        public decimal Longitude { get; set; }
     }
 }

+ 34 - 0
MainModels/MerchantParamSetRecord.cs

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

+ 23 - 0
MainModels/SysWithdrawalApplyRecord.cs

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

+ 560 - 0
MainModels/WebCMSEntities.cs

@@ -48,8 +48,10 @@ namespace MySystem.MainModels
         public virtual DbSet<CouponAssignRecords> CouponAssignRecords { get; set; }
         public virtual DbSet<Coupons> Coupons { get; set; }
         public virtual DbSet<CouponsForUser> CouponsForUser { get; set; }
+        public virtual DbSet<CustomQuery> CustomQuery { get; set; }
         public virtual DbSet<CustomTagSet> CustomTagSet { get; set; }
         public virtual DbSet<ErpCompanys> ErpCompanys { get; set; }
+        public virtual DbSet<ExportExcels> ExportExcels { get; set; }
         public virtual DbSet<FileUpdateInfo> FileUpdateInfo { get; set; }
         public virtual DbSet<FluxProfitDetail> FluxProfitDetail { get; set; }
         public virtual DbSet<FluxProfitSummary> FluxProfitSummary { get; set; }
@@ -92,6 +94,8 @@ namespace MySystem.MainModels
         public virtual DbSet<MerchantClass> MerchantClass { get; set; }
         public virtual DbSet<MerchantCol> MerchantCol { get; set; }
         public virtual DbSet<MerchantComment> MerchantComment { get; set; }
+        public virtual DbSet<MerchantDepositBack> MerchantDepositBack { get; set; }
+        public virtual DbSet<MerchantDepositOrder> MerchantDepositOrder { get; set; }
         public virtual DbSet<MerchantDepositReturns> MerchantDepositReturns { get; set; }
         public virtual DbSet<MerchantDepositSet> MerchantDepositSet { get; set; }
         public virtual DbSet<MerchantDiviSummay> MerchantDiviSummay { get; set; }
@@ -101,6 +105,7 @@ namespace MySystem.MainModels
         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; }
@@ -212,6 +217,7 @@ namespace MySystem.MainModels
         public virtual DbSet<SysAdminRole> SysAdminRole { get; set; }
         public virtual DbSet<SysLog> SysLog { get; set; }
         public virtual DbSet<SysRechargeRecord> SysRechargeRecord { get; set; }
+        public virtual DbSet<SysWithdrawalApplyRecord> SysWithdrawalApplyRecord { get; set; }
         public virtual DbSet<SystemSet> SystemSet { get; set; }
         public virtual DbSet<TeamApply> TeamApply { get; set; }
         public virtual DbSet<TeamApplyForTeamName> TeamApplyForTeamName { get; set; }
@@ -2255,6 +2261,20 @@ namespace MySystem.MainModels
 
                 entity.Property(e => e.CurDivi).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.DivideDate)
+                    .HasColumnType("datetime")
+                    .HasComment("提交分账时间");
+
+                entity.Property(e => e.DivideFlag)
+                    .HasColumnType("int(11)")
+                    .HasComment("分账标记");
+
+                entity.Property(e => e.DivideLog)
+                    .HasColumnType("mediumtext")
+                    .HasComment("分账结果日志")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.IsAct)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
@@ -2278,6 +2298,11 @@ namespace MySystem.MainModels
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
+                entity.Property(e => e.ReturnFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'")
+                    .HasComment("返现队列标记");
+
                 entity.Property(e => e.ReturnMoney).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.SeoDescription)
@@ -2295,6 +2320,10 @@ namespace MySystem.MainModels
                     .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")
@@ -2304,6 +2333,12 @@ namespace MySystem.MainModels
 
                 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)
@@ -2725,6 +2760,82 @@ namespace MySystem.MainModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<CustomQuery>(entity =>
+            {
+                entity.HasComment("自定义查询");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AdminNames)
+                    .HasColumnType("varchar(500)")
+                    .HasComment("后台账号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.SqlContent)
+                    .HasColumnType("mediumtext")
+                    .HasComment("sql语句")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.Title)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("标题")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<CustomTagSet>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -2839,6 +2950,48 @@ namespace MySystem.MainModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<ExportExcels>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.FileName)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.FileUrl)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.SysId).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
             modelBuilder.Entity<FileUpdateInfo>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -5502,6 +5655,12 @@ namespace MySystem.MainModels
                     .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")
@@ -6283,6 +6442,180 @@ namespace MySystem.MainModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<MerchantDepositBack>(entity =>
+            {
+                entity.HasComment("商户服务费退还记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AlipayAccountNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("支付宝账号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ApplyNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("申请单号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.BankCardNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("银行卡号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerchantId)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户Id");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("备注")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ReturnAmount)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("退还金额");
+
+                entity.Property(e => e.ReturnWay)
+                    .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.UserId)
+                    .HasColumnType("int(11)")
+                    .HasComment("创客Id");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
+            modelBuilder.Entity<MerchantDepositOrder>(entity =>
+            {
+                entity.HasComment("商户服务费缴纳记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ActPayPrice)
+                    .HasColumnType("decimal(18,2)")
+                    .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.OrderNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("订单号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UserId)
+                    .HasColumnType("int(11)")
+                    .HasComment("创客Id");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<MerchantDepositReturns>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -6537,6 +6870,18 @@ namespace MySystem.MainModels
 
                 entity.Property(e => e.BindStatus).HasColumnType("int(11)");
 
+                entity.Property(e => e.BriefIntroduction)
+                    .HasColumnType("longtext")
+                    .HasComment("简介")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.BusinessHours)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("营业时间段")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
                 entity.Property(e => e.CreateMan)
@@ -6544,6 +6889,18 @@ namespace MySystem.MainModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.EndTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业结束时间");
+
+                entity.Property(e => e.ExamineStatus)
+                    .HasColumnType("int(11)")
+                    .HasComment("服务费考核状态");
+
+                entity.Property(e => e.IsAct)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户激活标记");
+
                 entity.Property(e => e.IsAuth)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
@@ -6552,6 +6909,10 @@ namespace MySystem.MainModels
 
                 entity.Property(e => e.LastConsumeDate).HasColumnType("datetime");
 
+                entity.Property(e => e.Latitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("纬度");
+
                 entity.Property(e => e.LoginPwd)
                     .HasColumnType("varchar(32)")
                     .HasCharSet("utf8")
@@ -6562,11 +6923,19 @@ namespace MySystem.MainModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Longitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("经度");
+
                 entity.Property(e => e.Mobile)
                     .HasColumnType("varchar(11)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Months)
+                    .HasColumnType("int(11)")
+                    .HasComment("达标月数");
+
                 entity.Property(e => e.Name)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -6577,6 +6946,10 @@ namespace MySystem.MainModels
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Popularity)
+                    .HasColumnType("int(11)")
+                    .HasComment("人气值");
+
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
                 entity.Property(e => e.SeoDescription)
@@ -6600,6 +6973,10 @@ namespace MySystem.MainModels
 
                 entity.Property(e => e.Sort).HasColumnType("int(11)");
 
+                entity.Property(e => e.StartTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业开始时间");
+
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TotalActActual).HasColumnType("decimal(18,2)");
@@ -6754,6 +7131,116 @@ namespace MySystem.MainModels
                 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)");
@@ -14631,6 +15118,76 @@ namespace MySystem.MainModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<SysWithdrawalApplyRecord>(entity =>
+            {
+                entity.HasComment("润观米提现申请记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AccountNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("账户号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ApplyNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("申请单号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<SystemSet>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -16056,6 +16613,9 @@ namespace MySystem.MainModels
 
             modelBuilder.Entity<UserAmountSummary>(entity =>
             {
+                entity.HasIndex(e => new { e.UserId, e.IsAct, e.TradeMonth, e.TradeDate, e.SeoTitle })
+                    .HasName("UserAmountSummaryIndex");
+
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
                 entity.Property(e => e.CreateDate).HasColumnType("datetime");

+ 7 - 0
MainModels2/ConsumerOrders.cs

@@ -29,5 +29,12 @@ namespace MySystem.MainModels2
         public ulong IsAct { get; set; }
         public int UserId { get; set; }
         public decimal MerchantActualAmount { get; set; }
+        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; }
+        public int SettleAmount { get; set; }
+        public ulong ReturnFlag { get; set; }
     }
 }

+ 4 - 0
MainModels2/MerchantAddInfo.cs

@@ -144,5 +144,9 @@ namespace MySystem.MainModels2
         public string OutMchtNo { get; set; }
         public string AliMerchantId { get; set; }
         public string WeChatMerchantId { get; set; }
+        public int HdStatus { get; set; }
+        public DateTime? HdPassDate { get; set; }
+        public ulong HdBindWeChat { get; set; }
+        public string MerchantType { get; set; }
     }
 }

+ 29 - 0
MainModels2/MerchantDepositBack.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.MainModels2
+{
+    public partial class MerchantDepositBack
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string Remark { get; set; }
+        public int UserId { get; set; }
+        public string ApplyNo { get; set; }
+        public int ReturnWay { get; set; }
+        public decimal ReturnAmount { get; set; }
+        public string BankCardNo { get; set; }
+        public string AlipayAccountNo { get; set; }
+        public int MerchantId { get; set; }
+    }
+}

+ 25 - 0
MainModels2/MerchantDepositOrder.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.MainModels2
+{
+    public partial class MerchantDepositOrder
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public string OrderNo { get; set; }
+        public decimal ActPayPrice { get; set; }
+        public int UserId { get; set; }
+        public int MerchantId { get; set; }
+    }
+}

+ 12 - 0
MainModels2/MerchantInfo.cs

@@ -43,5 +43,17 @@ namespace MySystem.MainModels2
         public int ActStat { get; set; }
         public DateTime? SignDate { get; set; }
         public decimal AllocationAmount { get; set; }
+        public decimal ActMaxAmount { get; set; }
+        public decimal ActCurrentAmount { get; set; }
+        public int ExamineStatus { get; set; }
+        public int Months { get; set; }
+        public int IsAct { get; set; }
+        public DateTime? EndTime { get; set; }
+        public DateTime? StartTime { get; set; }
+        public string BusinessHours { get; set; }
+        public string BriefIntroduction { get; set; }
+        public int Popularity { get; set; }
+        public decimal Latitude { get; set; }
+        public decimal Longitude { get; set; }
     }
 }

+ 34 - 0
MainModels2/MerchantParamSetRecord.cs

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

+ 2 - 2
MainModels2/MerchantTradeSummary.cs

@@ -17,14 +17,14 @@ namespace MySystem.MainModels2
         public string SeoTitle { get; set; }
         public string SeoKeyword { get; set; }
         public string SeoDescription { get; set; }
+        public decimal AliPayInFactAmount { get; set; }
+        public decimal WeChatInfactAmount { get; set; }
         public int OderCount { get; set; }
         public decimal InFactAmount { get; set; }
         public decimal TradeAmount { get; set; }
         public string TradeDate { get; set; }
         public string TradeMonth { get; set; }
         public int MerchantId { get; set; }
-        public decimal AliPayInFactAmount { get; set; }
-        public decimal WeChatInfactAmount { get; set; }
         public decimal ActAmount { get; set; }
         public decimal NonActAmount { get; set; }
     }

+ 392 - 1
MainModels2/WebCMSEntities.cs

@@ -92,6 +92,8 @@ namespace MySystem.MainModels2
         public virtual DbSet<MerchantClass> MerchantClass { get; set; }
         public virtual DbSet<MerchantCol> MerchantCol { get; set; }
         public virtual DbSet<MerchantComment> MerchantComment { get; set; }
+        public virtual DbSet<MerchantDepositBack> MerchantDepositBack { get; set; }
+        public virtual DbSet<MerchantDepositOrder> MerchantDepositOrder { get; set; }
         public virtual DbSet<MerchantDepositReturns> MerchantDepositReturns { get; set; }
         public virtual DbSet<MerchantDepositSet> MerchantDepositSet { get; set; }
         public virtual DbSet<MerchantDiviSummay> MerchantDiviSummay { get; set; }
@@ -101,6 +103,7 @@ namespace MySystem.MainModels2
         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; }
@@ -2255,6 +2258,20 @@ namespace MySystem.MainModels2
 
                 entity.Property(e => e.CurDivi).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.DivideDate)
+                    .HasColumnType("datetime")
+                    .HasComment("提交分账时间");
+
+                entity.Property(e => e.DivideFlag)
+                    .HasColumnType("int(11)")
+                    .HasComment("分账标记");
+
+                entity.Property(e => e.DivideLog)
+                    .HasColumnType("mediumtext")
+                    .HasComment("分账结果日志")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.IsAct)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
@@ -2278,6 +2295,11 @@ namespace MySystem.MainModels2
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
+                entity.Property(e => e.ReturnFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'")
+                    .HasComment("返现队列标记");
+
                 entity.Property(e => e.ReturnMoney).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.SeoDescription)
@@ -2295,6 +2317,14 @@ namespace MySystem.MainModels2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.SetRecordId)
+                    .HasColumnType("int(11)")
+                    .HasComment("活动记录Id");
+
+                entity.Property(e => e.SettleAmount)
+                    .HasColumnType("int(11)")
+                    .HasComment("结算金额");
+
                 entity.Property(e => e.SnNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -2304,6 +2334,12 @@ namespace MySystem.MainModels2
 
                 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)
@@ -5308,7 +5344,7 @@ namespace MySystem.MainModels2
                     .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.BizStoreAddress)
-                    .HasColumnType("varchar(50)")
+                    .HasColumnType("varchar(100)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -5421,6 +5457,19 @@ namespace MySystem.MainModels2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.HdBindWeChat)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'")
+                    .HasComment("好哒绑定微信状态");
+
+                entity.Property(e => e.HdPassDate)
+                    .HasColumnType("datetime")
+                    .HasComment("好哒审核通过时间");
+
+                entity.Property(e => e.HdStatus)
+                    .HasColumnType("int(11)")
+                    .HasComment("好哒进件状态");
+
                 entity.Property(e => e.HoldAgentProtocol)
                     .HasColumnName("holdAgentProtocol")
                     .HasColumnType("varchar(200)")
@@ -5502,6 +5551,12 @@ namespace MySystem.MainModels2
                     .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")
@@ -6283,6 +6338,180 @@ namespace MySystem.MainModels2
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<MerchantDepositBack>(entity =>
+            {
+                entity.HasComment("商户服务费退还记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.AlipayAccountNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("支付宝账号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ApplyNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("申请单号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.BankCardNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("银行卡号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("创建人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.MerchantId)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户Id");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                entity.Property(e => e.Remark)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("备注")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ReturnAmount)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("退还金额");
+
+                entity.Property(e => e.ReturnWay)
+                    .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.UserId)
+                    .HasColumnType("int(11)")
+                    .HasComment("创客Id");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
+            modelBuilder.Entity<MerchantDepositOrder>(entity =>
+            {
+                entity.HasComment("商户服务费缴纳记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ActPayPrice)
+                    .HasColumnType("decimal(18,2)")
+                    .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.OrderNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("订单号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("点击量");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("更新时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("更新人")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UserId)
+                    .HasColumnType("int(11)")
+                    .HasComment("创客Id");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<MerchantDepositReturns>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -6503,6 +6732,14 @@ namespace MySystem.MainModels2
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
+                entity.Property(e => e.ActCurrentAmount)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("活动已返金额");
+
+                entity.Property(e => e.ActMaxAmount)
+                    .HasColumnType("decimal(18,2)")
+                    .HasComment("活动应返金额");
+
                 entity.Property(e => e.ActStat)
                     .HasColumnType("int(11)")
                     .HasComment("激活统计标记");
@@ -6529,6 +6766,18 @@ namespace MySystem.MainModels2
 
                 entity.Property(e => e.BindStatus).HasColumnType("int(11)");
 
+                entity.Property(e => e.BriefIntroduction)
+                    .HasColumnType("longtext")
+                    .HasComment("简介")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.BusinessHours)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("营业时间段")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
                 entity.Property(e => e.CreateMan)
@@ -6536,6 +6785,18 @@ namespace MySystem.MainModels2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.EndTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业结束时间");
+
+                entity.Property(e => e.ExamineStatus)
+                    .HasColumnType("int(11)")
+                    .HasComment("服务费考核状态");
+
+                entity.Property(e => e.IsAct)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户激活标记");
+
                 entity.Property(e => e.IsAuth)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
@@ -6544,6 +6805,10 @@ namespace MySystem.MainModels2
 
                 entity.Property(e => e.LastConsumeDate).HasColumnType("datetime");
 
+                entity.Property(e => e.Latitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("纬度");
+
                 entity.Property(e => e.LoginPwd)
                     .HasColumnType("varchar(32)")
                     .HasCharSet("utf8")
@@ -6554,11 +6819,19 @@ namespace MySystem.MainModels2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Longitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("经度");
+
                 entity.Property(e => e.Mobile)
                     .HasColumnType("varchar(11)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Months)
+                    .HasColumnType("int(11)")
+                    .HasComment("达标月数");
+
                 entity.Property(e => e.Name)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -6569,6 +6842,10 @@ namespace MySystem.MainModels2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Popularity)
+                    .HasColumnType("int(11)")
+                    .HasComment("人气值");
+
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
                 entity.Property(e => e.SeoDescription)
@@ -6592,6 +6869,10 @@ namespace MySystem.MainModels2
 
                 entity.Property(e => e.Sort).HasColumnType("int(11)");
 
+                entity.Property(e => e.StartTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业开始时间");
+
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TotalActActual).HasColumnType("decimal(18,2)");
@@ -6746,6 +7027,116 @@ namespace MySystem.MainModels2
                 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)");

+ 1 - 1
Program.cs

@@ -22,7 +22,7 @@ namespace MySystem
                 .ConfigureWebHostDefaults(webBuilder =>
                 {
                     webBuilder
-                    .UseUrls("http://*:5301")
+                    .UseUrls("http://*:5311")
                     .UseKestrel()
                     .UseContentRoot(Directory.GetCurrentDirectory())
                     .UseIISIntegration()

+ 1 - 1
Properties/launchSettings.json

@@ -21,7 +21,7 @@
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
       },
-      "applicationUrl": "http://127.0.0.1:5301"
+      "applicationUrl": "http://127.0.0.1:5311"
     }
   }
 }

+ 14 - 6
Services/MerchantAccountLinkInfoService.cs

@@ -41,17 +41,25 @@ namespace MySystem
                 if(item.Kind == 1)
                 {
                     var merchant = new MerchantAddInfoService().Query(item.MerchantId);
-                    row.Add("MerchantId", merchant.Id);
-                    row.Add("MerchantName", merchant.CertMerchantName);
+                    if(merchant.Status >= 1 || merchant.QueryCount >= 1)
+                    {
+                        row.Add("MerchantId", merchant.Id);
+                        row.Add("MerchantName", merchant.CertMerchantName);
+                        row.Add("Kind", item.Kind);
+                        diclist.Add(row);
+                    }
                 }
                 else
                 {
                     var merchant = new MerchantAddInfo2Service().Query(item.MerchantId);
-                    row.Add("MerchantId", merchant.Id);
-                    row.Add("MerchantName", merchant.CertMerchantName);
+                    if(merchant.HdStatus > 0)
+                    {
+                        row.Add("MerchantId", merchant.Id);
+                        row.Add("MerchantName", merchant.CertMerchantName);
+                        row.Add("Kind", item.Kind);
+                        diclist.Add(row);
+                    }
                 }
-                row.Add("Kind", item.Kind);
-                diclist.Add(row);
             }
             db.Dispose();
             return diclist;

+ 21 - 21
Services/MerchantAddInfoService.cs

@@ -105,28 +105,28 @@ namespace MySystem
             db.Dispose();
         }
 
-        /// <summary>
-        /// 导出excel表格
-        /// </summary>
-        /// <param name="fields">查询条件(单个字段)</param>
-        /// <param name="condition">查询条件(sql语句)</param>
-        /// <returns></returns>
-        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition, string orderby = "Id desc")
-        {
-            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantAddInfo", fields, orderby, "0", 1, 20000, condition, "Id", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            foreach (Dictionary<string, object> dic in diclist)
-            {
-            }
+        // /// <summary>
+        // /// 导出excel表格
+        // /// </summary>
+        // /// <param name="fields">查询条件(单个字段)</param>
+        // /// <param name="condition">查询条件(sql语句)</param>
+        // /// <returns></returns>
+        // public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition, string orderby = "Id desc")
+        // {
+        //     Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantAddInfo", fields, orderby, "0", 1, 20000, condition, "Id", false);
+        //     List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+        //     foreach (Dictionary<string, object> dic in diclist)
+        //     {
+        //     }
 
-            Dictionary<string, object> result = new Dictionary<string, object>();
-            result.Add("Status", "1");
-            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
-            result.Add("Obj", diclist);
-            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+        //     Dictionary<string, object> result = new Dictionary<string, object>();
+        //     result.Add("Status", "1");
+        //     result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+        //     result.Add("Obj", diclist);
+        //     Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
 
-            result.Add("Fields", ReturnFields);
-            return result;
-        }
+        //     result.Add("Fields", ReturnFields);
+        //     return result;
+        // }
     }
 }

+ 43 - 21
Services/MerchantAmountSummayService.cs

@@ -43,6 +43,28 @@ namespace MySystem
             db.Dispose();
             return editData;
         }
+
+        public Dictionary<string, string> QueryAmount(string field, string condition)
+        {
+            Dictionary<string, string> result = new Dictionary<string, string>();
+            string sumString = "";
+            string[] fieldlist = field.Split(',');
+            foreach(string f in fieldlist)
+            {
+                sumString += "sum(" + f + ") " + f + ",";
+            }
+            sumString = sumString.TrimEnd(',');
+            DataTable dt = CustomerSqlConn.dtable("select " + sumString + " from MerchantAmountSummay where 1=1" + condition, _conn);
+            if(dt.Rows.Count > 0)
+            {
+                foreach(string f in fieldlist)
+                {
+                    result.Add(f, function.CheckNum(dt.Rows[0][f].ToString()));
+                }
+            }
+            return result;
+        }
+
         public Dictionary<string, string> Sum(string field, string condition)
         {
             Dictionary<string, string> result = new Dictionary<string, string>();
@@ -126,28 +148,28 @@ namespace MySystem
             db.Dispose();
         }
 
-        /// <summary>
-        /// 导出excel表格
-        /// </summary>
-        /// <param name="fields">查询条件(单个字段)</param>
-        /// <param name="condition">查询条件(sql语句)</param>
-        /// <returns></returns>
-        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition, string orderby = "Id desc")
-        {
-            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantAmountSummay", fields, orderby, "0", 1, 20000, condition, "Id", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            foreach (Dictionary<string, object> dic in diclist)
-            {
-            }
+        // /// <summary>
+        // /// 导出excel表格
+        // /// </summary>
+        // /// <param name="fields">查询条件(单个字段)</param>
+        // /// <param name="condition">查询条件(sql语句)</param>
+        // /// <returns></returns>
+        // public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition, string orderby = "Id desc")
+        // {
+        //     Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantAmountSummay", fields, orderby, "0", 1, 20000, condition, "Id", false);
+        //     List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+        //     foreach (Dictionary<string, object> dic in diclist)
+        //     {
+        //     }
 
-            Dictionary<string, object> result = new Dictionary<string, object>();
-            result.Add("Status", "1");
-            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
-            result.Add("Obj", diclist);
-            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+        //     Dictionary<string, object> result = new Dictionary<string, object>();
+        //     result.Add("Status", "1");
+        //     result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+        //     result.Add("Obj", diclist);
+        //     Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
 
-            result.Add("Fields", ReturnFields);
-            return result;
-        }
+        //     result.Add("Fields", ReturnFields);
+        //     return result;
+        // }
     }
 }

+ 162 - 0
Services/MerchantDepositBackService.cs

@@ -0,0 +1,162 @@
+/*
+ * 商户服务费退还记录
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem.Service.Main
+{
+    public class MerchantDepositBackService
+    {
+     string _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<Dictionary<string, object>> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30, string orderby = "Id desc")
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantDepositBack", fields, orderby, "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public MerchantDepositBack Query(int MerchantId)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantDepositBack editData = db.MerchantDepositBack.FirstOrDefault(m => m.Status == 1 && m.MerchantId == MerchantId) ?? new MerchantDepositBack();
+            db.Dispose();
+            return editData;
+        }
+
+        public Dictionary<string, string> Sum(string field, string condition)
+        {
+            Dictionary<string, string> result = new Dictionary<string, string>();
+            string sumString = "";
+            string[] fieldlist = field.Split(',');
+            foreach(string f in fieldlist)
+            {
+                sumString += "sum(" + f + ") " + f + ",";
+            }
+            sumString = sumString.TrimEnd(',');
+            DataTable dt = CustomerSqlConn.dtable("select " + sumString + " from MerchantDepositBack where 1=1" + condition, _conn);
+            if(dt.Rows.Count > 0)
+            {
+                foreach(string f in fieldlist)
+                {
+                    result.Add(f, function.CheckNum(dt.Rows[0][f].ToString()));
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public AppResultJson Add(Dictionary<string, object> fields, bool check = true)
+        {
+            if (check)
+            {
+
+            }
+            int Id = new DbService(AppConfig.Base.mainTables, _conn).Add("MerchantDepositBack", fields, 0);
+            return new AppResultJson() { Status = "1", Data = Id };
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public AppResultJson Edit(Dictionary<string, object> fields, int Id, bool check = true)
+        {
+            if (check)
+            {
+
+            }
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("MerchantDepositBack", fields, Id);
+            return new AppResultJson() { Status = "1", Data = Id };
+        }
+
+        /// <summary>
+        /// 逻辑删除
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Remove(int Id)
+        {
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            fields.Add("Status", -1);
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("MerchantDepositBack", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("MerchantDepositBack", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("MerchantDepositBack", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public 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.MerchantDepositBack.Add(new MerchantDepositBack()
+            //     {
+            //         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 void ExportExcel(List<RelationData> relationData, string condition)
+        // {
+
+        // }
+    }
+}

+ 238 - 0
Services/MerchantDepositOrderService.cs

@@ -0,0 +1,238 @@
+/*
+ * 商户服务费缴纳记录
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem.Service.Main
+{
+    public class MerchantDepositOrderService
+    {
+        static string _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<Dictionary<string, object>> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30, string orderby = "Id desc")
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("MerchantDepositOrder", fields, orderby, "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 通过商户Id查询一条记录
+        /// </summary>
+        /// <param name="MerchantId">商户Id</param>
+        /// <returns></returns>
+        public MerchantDepositOrder QueryByMerchantId(int MerchantId)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantDepositOrder editData = db.MerchantDepositOrder.FirstOrDefault(m => m.Status > 0 && m.MerchantId == MerchantId) ?? new MerchantDepositOrder();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 通过Id查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public MerchantDepositOrder QueryById(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantDepositOrder editData = db.MerchantDepositOrder.FirstOrDefault(m =>  m.Id == Id) ?? new MerchantDepositOrder();
+            db.Dispose();
+            return editData;
+        }
+
+        public Dictionary<string, string> Sum(string field, string condition)
+        {
+            Dictionary<string, string> result = new Dictionary<string, string>();
+            string sumString = "";
+            string[] fieldlist = field.Split(',');
+            foreach(string f in fieldlist)
+            {
+                sumString += "sum(" + f + ") " + f + ",";
+            }
+            sumString = sumString.TrimEnd(',');
+            DataTable dt = CustomerSqlConn.dtable("select " + sumString + " from MerchantDepositOrder where 1=1" + condition, _conn);
+            if(dt.Rows.Count > 0)
+            {
+                foreach(string f in fieldlist)
+                {
+                    result.Add(f, function.CheckNum(dt.Rows[0][f].ToString()));
+                }
+            }
+            return result;
+        }
+
+        // /// <summary>
+        // /// 查询记录数
+        // /// </summary>
+        // /// <param name="Id">主键Id</param>
+        // /// <returns></returns>
+        // public static int Count(string condition = "", string field = "Id")
+        // {
+        //     int result = 0;
+        //     Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).Query("count(" + field + ") " + field + "", "MerchantDepositOrder", 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 DbService(AppConfig.Base.mainTables, _conn).Query("1", "MerchantDepositOrder", 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" };
+                }
+
+            }
+            int Id = new DbService(AppConfig.Base.mainTables, _conn).Add("MerchantDepositOrder", 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" };
+                }
+
+            }
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("MerchantDepositOrder", 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 DbService(AppConfig.Base.mainTables, _conn).Edit("MerchantDepositOrder", fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("MerchantDepositOrder", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public static void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("MerchantDepositOrder", 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.MerchantDepositOrder.Add(new MerchantDepositOrder()
+            //     {
+            //         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)
+        // {
+
+        // }
+    }
+}

+ 117 - 0
Services/UserSwapWhiteService.cs

@@ -0,0 +1,117 @@
+/*
+ * 循环返风控白名单
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem.Service
+{
+    public class UserSwapWhiteService
+    {
+        static string _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public static List<Dictionary<string, object>> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30, string orderby = "Id desc")
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("UserSwapWhite", fields, orderby, "0", page, limit, condition);
+            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)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            UserSwapWhite editData = db.UserSwapWhite.FirstOrDefault(m => m.Id == Id) ?? new UserSwapWhite();
+            db.Dispose();
+            return editData;
+        }
+
+        public static UserSwapWhite QueryByUserId(int UserId)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            UserSwapWhite editData = db.UserSwapWhite.FirstOrDefault(m => m.UserId == UserId) ?? new UserSwapWhite();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public static int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("UserSwapWhite", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public static void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("UserSwapWhite", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public static void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("UserSwapWhite", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public static void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _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();
+        }
+    }
+}

+ 11 - 10
Startup.cs

@@ -57,7 +57,8 @@ namespace MySystem
             {
                 x.MultipartBodyLengthLimit = 50 * 1024 * 1024;//不到300M
             });
-            services.AddControllers(option => {
+            services.AddControllers(option =>
+            {
                 option.Filters.Add(new GlobalActionFilter());
             });
             //生成密钥
@@ -83,8 +84,8 @@ namespace MySystem
                     {
                         // if(n.Issuer.StartsWith("new_"))
                         // {
-                            string check = RedisDbconn.Instance.Get<string>("utoken:" + n.Issuer);
-                            return m != null && m.FirstOrDefault().Equals(check);
+                        string check = RedisDbconn.Instance.Get<string>("utoken:" + n.Issuer);
+                        return m != null && m.FirstOrDefault().Equals(check);
                         // }
                         // else
                         // {
@@ -117,13 +118,13 @@ namespace MySystem
                 Library.ConfigurationManager.EnvironmentFlag = 2;
             }
             Library.function.WritePage("/", "WebRootPath.txt", env.WebRootPath);
-            
+
             app.UseStaticFiles();
-            app.UseStaticFiles(new StaticFileOptions
-            {
-                FileProvider = new PhysicalFileProvider(AppContext.BaseDirectory + "/static"),
-                RequestPath = "/static"
-            });
+            // app.UseStaticFiles(new StaticFileOptions
+            // {
+            //     FileProvider = new PhysicalFileProvider(AppContext.BaseDirectory + "/static"),
+            //     RequestPath = "/static"
+            // });
             // app.UseStaticFiles(new StaticFileOptions
             // {
             //     FileProvider = new PhysicalFileProvider(AppContext.BaseDirectory + "/" + Configuration["Setting:Database"]),
@@ -150,7 +151,7 @@ namespace MySystem
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
             });
 
-            
+
             InitMain();
             InitStat();
             InitBs();

+ 8 - 2
Util/BusinessUtil.cs

@@ -27,7 +27,7 @@ namespace MySystem
             {
                 return dataList;
             }
-            List<Dictionary<string, object>> source = new MerchantTradeSummaryService().List2(new List<FieldItem>(), " and MerchantId=" + MerchantId, TradeMonth, pageNum, pageSize);
+            List<Dictionary<string, object>> source = new MerchantTradeSummaryService().List2(new List<FieldItem>(), " and MerchantId=" + MerchantId, TradeMonth, pageNum, pageSize, "TradeDate desc");
             // var infos = UserTradeDbconn.GetDateTradeList(MerchantId,TradeMonth);
             foreach (Dictionary<string, object> subdata in source)
             {
@@ -40,6 +40,7 @@ namespace MySystem
                 curData.Add("WeChatInFactAmount", subdata["WeChatInfactAmount"].ToString()); //微信实收
                 curData.Add("AliPayInFactAmount", subdata["AliPayInFactAmount"].ToString()); //支付宝实收
                 curData.Add("OrderCount", subdata["OderCount"].ToString()); //订单数
+                curData.Add("Kind", 1); //通道(1 直连 2 银联)
                 dataList.Add(curData);
             }
             return dataList;
@@ -97,6 +98,7 @@ namespace MySystem
                 curData.Add("PayMode", subdata["PayMode"].ToString()); //支付方式(1 支付宝 2 微信)
                 curData.Add("IsAct", subdata["IsAct"].ToString()); //是否活动(1 是 0 否)
                 curData.Add("PayMoney", subdata["PayMoney"].ToString()); //订单金额
+                curData.Add("Kind", 1); //通道(1 直连 2 银联)
                 dataList.Add(curData);
             }
             return dataList;
@@ -116,18 +118,22 @@ namespace MySystem
             List<Dictionary<string, object>> source = new ConsumerOrdersService().List(new List<FieldItem>(), condition, 1, 999);
             foreach (Dictionary<string, object> subdata in source)
             {
+                var leaveAmount = decimal.Parse(subdata["MaxDivi"].ToString()) - decimal.Parse(subdata["CurDivi"].ToString());
                 obj.Add("TradeDate", DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //日期
                 obj.Add("PayMode", subdata["PayMode"].ToString()); //支付方式(1 微信 2 支付宝)
                 obj.Add("PayMoney", subdata["PayMoney"].ToString()); //是否活动(1 是 0 否)
                 obj.Add("IsAct", subdata["IsAct"].ToString()); //是否活动(1 是 0 否)
                 obj.Add("OrderNo", subdata["OrderNo"].ToString()); //订单号
+                obj.Add("ReturnFlag", int.Parse(subdata["ReturnFlag"].ToString())); //返现标记(0 否 1 是)
+                obj.Add("Kind", 1); //通道(1 直连 2 银联)
+                obj.Add("LeaveAmount", leaveAmount); //剩余返现金额
                 List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
                 List<Dictionary<string, object>> dics = new ConsumerProfitService().List(new List<FieldItem>(), " and OrderId=" + int.Parse(subdata["Id"].ToString()) + "", 1, 999);
 
                 foreach (Dictionary<string, object> dic in dics)
                 {
                     Dictionary<string, object> cdata = new Dictionary<string, object>();
-                    var CreateDate = DateTime.Parse(subdata["CreateDate"].ToString());
+                    var CreateDate = DateTime.Parse(dic["CreateDate"].ToString());
                     var TradeDate = CreateDate.Month + "月" + CreateDate.Day + "日" + " " + CreateDate.ToString("HH:mm");
                     cdata.Add("ProfitDate", TradeDate); //分红时间
                     cdata.Add("ProfitAmount", dic["GetMoney"].ToString()); //分红金额

+ 441 - 0
Util/Kxs/AlipayFunctionForKxs.cs

@@ -0,0 +1,441 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Aop.Api;
+using Library;
+using LitJson;
+using Microsoft.AspNetCore.Http;
+using Aop.Api.Request;
+using Aop.Api.Response;
+using Aop.Api.Util;
+using System.Collections;
+using MySystem.KxsMainModels;
+
+namespace MySystem
+{
+    public class AlipayFunctionForKxs
+    {
+        private HttpContext _context;
+        private string AppId = "2021003116616751";
+        private string PrivateKey = "MIIEpAIBAAKCAQEA1KjMzZJIRG6QQ3+c/euVrc+8RR0xMw6A+EONSKhJq4Bg+rtxQPCfdF2bpZ4NMaSqfalSiLoxrZSYBYOZhpDP67i9LXGUoFCWdRL7ROTqJvuU6KyEeMplQ6Q3uwWbuKbh9COt0vhqn/pjlUsomTwq+DRQv10awynkZikqceXdP0EH4iGZG0hyerEP5yLHpHiggf4f7TOsovHX+fGLPmWFO1zUTHHbz7HxU4BQKn3yuje4yMhoyv5h/wZzeVwvj+Qti8Hlh351rF0f5BHwN1YMGIrWuPU5bF8OMHS/UXPxh7Bs795ZZyplYztTz26QfKfLWVVsLOng4pvgPS+OgzZydwIDAQABAoIBAEu6mMQT9Zw46zK+PP/HZxPwSBEsphqSbab7F1LqauGh4+cl3NzNU1szAnxl3jjxdK0vIO8DrzErGz/Lb16WLxS4QtXt/olgaVPjoIsWIbQkHxEEbmA9YvZFgnsdMij9dLVmBz57rCywE8pUa262GG8u4hpjY2Zggq9GtZC91J3zOeETBG828gU+FLHGcDpfz7pD1jC0noDfDRxmIImOMZvChIvvY+tm6MpySXN8lw1vxhLc0aZbKSQkuVyCyB4fIsdJJvh2dRPiY+BA0jXNK3mWwnnHzac/9JXqWFlwk6iPIIjXPUldz7Zq3EpCI+9p+UqLtIu6BAUbk1biFTt8xMECgYEA+2iIxZfdl1N1suA/aEbUdjd0kxeeOsGv7Ps0rOYn+4/q1dkUukg2V6VRy3E8BUt+9zLPTR8DmL7oBi+kDsGehjHlH7U6Pe8qKszB4ufQBDHc71yg9liqOWa4s9VoBD0VIU9CO0HtYjRor7rVuUzp+j58SLP7wIEPGEwdgjeYENECgYEA2IsYEyHiwhjy5rx7fmv3duZC5zyesIqxdAz79AuZ7gnpNEhddi5cEpcibnVmwZliCe6SoLzXZ6difEfD4VmLsYEAWqf5sqJ2PswZmHtA9F4We9WUe2zj+pFG0yCCVrcbDZXzQYaLmyuMNe/jpgyY178czohpnvQlr++bYa9DYMcCgYEAqGX6xy/UM9qpiel/T1+yTIUUxroZOI4oQvp47B82ROC/kgJYSfa4v7hys2zjoUBSiU41YRkXFac6T3p1z5SNlKGzMav4mSer/QMuE8jmowirToGjJ594Vf6iVYLqq3wmvSsT2BFu6krknGDva7FDQGW+Zgx44xcPf1zsnx6R8yECgYEAtfFA3Cp3lbBSvy4U8ScUOPHFuvbDOwB9k02pkOcCgfAP4p7+8GKJeBFGm9rG6NnQdxneV3Hz5yLL7DJ8UebkKdODEajbc41vntnsk6LT877uU0QkSwQ2FX1lLdW9zdBxyZt5VVAQEuOnHlaeRxGEhpoMQTh6zlTDKa1AN/aDvVcCgYApytvSEdTpKcQuEyPOfbQv2pXYujCacMFIRHvJW/HvX7yaZSAvSYK+lw8l53bTbJpJ3pq/1Tol6tyjY7HRsVvQ68Jn1MApARMlldn1GoAPcgDFzlJCB0JCOUAE1rBS5lA97wQ1YhI8qBRqaE7Qrtf4D5oZdEjbtq8VCeIaD9huIQ==";
+        private string PublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1KjMzZJIRG6QQ3+c/euVrc+8RR0xMw6A+EONSKhJq4Bg+rtxQPCfdF2bpZ4NMaSqfalSiLoxrZSYBYOZhpDP67i9LXGUoFCWdRL7ROTqJvuU6KyEeMplQ6Q3uwWbuKbh9COt0vhqn/pjlUsomTwq+DRQv10awynkZikqceXdP0EH4iGZG0hyerEP5yLHpHiggf4f7TOsovHX+fGLPmWFO1zUTHHbz7HxU4BQKn3yuje4yMhoyv5h/wZzeVwvj+Qti8Hlh351rF0f5BHwN1YMGIrWuPU5bF8OMHS/UXPxh7Bs795ZZyplYztTz26QfKfLWVVsLOng4pvgPS+OgzZydwIDAQAB";
+        private string AlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxycehrmnTl2IaIAECP+0HWc1eWGM/T6x022K7K6fdf+xoyC97TBJaG4G3Bcon4gsJX+Sad5IA9OJIQ4eN1joM35hIlwcFZ6MmCuVXx/SMAKThIjK0jsRc6aTxVQG+GVCgS7dXMKb4Sm+vK2wEM6xtDeqcfYMB0BqGZRvxbIV59a2ooPrha4FkV6nNC9DQefzC0picHXV64oYUjMM2ed4ASTQVds7HP9BZfalz//APZcWdBV08f+xv7n79Twz/gNtVAadfuTAlcjsS6aK+G/OrZtr/diuemeRPRUKlVhcr5xOQDhqBgtdIw8M9Wp6I4ULXRlthKVBWToH9j6n9vDIiwIDAQAB";
+        public AlipayFunctionForKxs(HttpContext context)
+        {
+            _context = context;
+        }
+
+
+        #region 代商家签约
+
+        //(开启事务)接口创建应用事务,返回生成代商户操作事务编号 batch_no
+        public string GetBatchNo(string AlipayAccount, string Name, string Mobile, string Email)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentCreateRequest request = new AlipayOpenAgentCreateRequest();
+            request.BizContent = "{" +
+            "\"account\":\"" + AlipayAccount + "\"," +
+            "\"contact_info\":{" +
+            "\"contact_name\":\"" + Name + "\"," +
+            "\"contact_mobile\":\"" + Mobile + "\"," +
+            "\"contact_email\":\"" + Email + "\"" +
+            "}" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentCreateResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_agent_create_response":{"code":"10000","msg":"Success","batch_no":"2022021011321326200059849","batch_status":"init"},"sign":"su+weyK1CZEXES8mdckalg16J4BELTQeVNJSpXVYg3nh5g3E7jDh/mQctkjH8HbM0RybQSahZ2j60aUTossPMXqdq2nPRkR4c/kM34toFFNU/2p7jqo9k/MbB1JotW+qFI+C/GCX/9mZQqm2tSQdYIiZlCsEtP13ZP2EQ6momEZrApyLQYUl1H54PojJgqo6zGKDXTnXuZcpi/VPP5YoWhYMx8WPFMS6+T3zr+LNPDOI94j5vDdUHQdjFAGiQMyyhfNOBcFFi18bAfWhPqlLWwblCZamTHN/QaOHo+fkBZeo9uKqrnSHPn8XW0tDAIf1qNUfY2eBzYZUIqWKbz509A=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                result = "";
+            }
+            return result;
+        }
+        //代签约产品通用接口,代商家发起签约产品申请
+        public string CommonSign(string BatchNo, string MccCode, string BusinessLicenseNo = "", string BusinessLicensePicPath = "", string ShopScenePicPath = "", string ShopSignBoardPicPath = "")
+        { 
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentCommonSignRequest request = new AlipayOpenAgentCommonSignRequest();
+            request.BatchNo = BatchNo;
+            request.MccCode = MccCode; //软件系统商 D_D05_7372
+            FileItem SpecialLicensePic = new FileItem(BusinessLicensePicPath);
+            request.SpecialLicensePic = SpecialLicensePic;
+            if (!string.IsNullOrEmpty(BusinessLicenseNo))
+            {
+                request.BusinessLicenseNo = BusinessLicenseNo;  //营业执照号码
+            }
+            if (!string.IsNullOrEmpty(BusinessLicensePicPath))
+            {
+                FileItem BusinessLicensePic = new FileItem(BusinessLicensePicPath);
+                request.BusinessLicensePic = BusinessLicensePic; //营业执照图片。被代创建商户运营主体为个人账户必填,企业账户无需填写
+            }
+            FileItem BusinessLicenseAuthPic = new FileItem(BusinessLicensePicPath);
+            request.BusinessLicenseAuthPic = BusinessLicenseAuthPic;
+            request.LongTerm = true;
+            request.DateLimitation = "长期";
+            if (!string.IsNullOrEmpty(ShopScenePicPath))
+            {
+                FileItem ShopScenePic = new FileItem(ShopScenePicPath);
+                request.ShopScenePic = ShopScenePic;
+            }
+            if (!string.IsNullOrEmpty(ShopSignBoardPicPath))
+            {
+                FileItem ShopSignBoardPic = new FileItem(ShopSignBoardPicPath);
+                request.ShopSignBoardPic = ShopSignBoardPic;
+            }
+            request.ProductCode = "QUICK_WAP_WAY"; //isv要代商户签约产品码,产品码是支付宝内部对产品的唯一标识
+            request.AppName = "客小爽";
+            // FileItem AppDemo = new FileItem(BusinessLicensePicPath);
+            // request.AppDemo = AppDemo;
+            List<string> WebSites = new List<string>();
+            WebSites.Add("www.kexiaoshuang.com");
+            request.WebSites = WebSites;
+            request.AlipayLifeName = "客小爽";
+            request.WechatOfficialAccountName = "客小爽";
+            // FileItem WebSitesLoa = new FileItem(BusinessLicensePicPath);
+            // request.WebSitesLoa = WebSitesLoa;
+            request.WebTestAccount = "testAccount";
+            request.WebTestAccountPassword = "testPassword";
+            FileItem WebHomeScreenshot = new FileItem(BusinessLicensePicPath);
+            request.WebHomeScreenshot = WebHomeScreenshot;
+            FileItem WebItemScreenshot = new FileItem(BusinessLicensePicPath);
+            request.WebItemScreenshot = WebItemScreenshot;
+            FileItem WebPayScreenshot = new FileItem(BusinessLicensePicPath);
+            request.WebPayScreenshot = WebPayScreenshot;
+            request.WebStatus = "已上线";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentCommonSignResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_agent_common_sign_response":{"code":"10000","msg":"Success"},"sign":"qt0DiXFXIJ7mX+W2+IX+cyYXx8ROGe8yxesXHGNltxpEv/s/zW16xzf4HQLtUlaAiWf3DiD2QV7Hj+REyoZw9AcktDAmlobcjQ28lTYufPECZoUJHpkn9VpGB932FC0hScVwCbsxQakH84MGT4cmjr1hCuSs7+XogdhlCTIKjau1e7ZglLnt7f1NqT8JnljVhmvkkE9gJTLq5H+Zq6XbFfBVptvM9w09HdjfhrsxAXJyQ4yU6JYX2tUYsRGz8ZrveDQMvXKTN9jnwKE9hh8ik6Sq49eUqfutV9GkKqhC96+Vy3nOTOTnPoECXZkco1wP5jsqHottWVsRV+NxdylnTw=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "代签约产品通用接口异常");
+                result = "";
+            }
+            return result;
+        }
+        //代商户签约,提交信息确认接口
+        public string CommonSignConfirm(string BatchNo)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentCommonsignConfirmRequest request= new AlipayOpenAgentCommonsignConfirmRequest();
+            request.BizContent="{" +
+            "\"batch_no\":\"" + BatchNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentCommonsignConfirmResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_agent_order_query_response":{"code":"10000","msg":"Success","order_no":"20220210034000100000015895929361","product_agent_status_infos":[{"product_code":"QUICK_WAP_WAY","product_name":"手机网站支付","status":"WAIT_CONFIRM"}],"order_status":"MERCHANT_CONFIRM","confirm_url":"https:\/\/openhome.alipay.com\/isv\/settling\/confirm.htm?orderNo=20220210034000100000015895929361","merchant_pid":"2088012934025363"},"sign":"mgdhauHMV9352S3FVrQmesXvHOrk633FX/EOXRYdc2ix5phCBZJ2KZRRP9MWJ566YEtWbnQlAJzHVS9X29hjgiJWOQ/wCidql4AoSAYYeqPtxiqKAZw/QEM/du5AdbWC0xBmmkQljXF9Hx8cm+IrOyPMSJXIw4Tqpm/T96YBwhsjw4Xr5dcUcvF6HX9h/i5FSdIJODxQ26PJcqQ98GQ3Y50YhTpPQkIPDFVE2QzcL6dvuhBOpwu5KbTxvgzS8Wtm3G6nMbzJ33Cv/I2lhTCIMHz90c9bvyjJpWxPWBzywO2zzv7+EZCbDkZGkdRic9l5s6qac+ZVMHkPbveaZ2wyig=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "接口创建应用事务异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+        #region (查询申请单状态)查询签约申请的结果
+        public string QuerySignStatus(string BatchNo)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAgentOrderQueryRequest  request= new AlipayOpenAgentOrderQueryRequest() ;
+            request.BizContent="{" +
+            "  \"batch_no\":\"" + BatchNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayOpenAgentOrderQueryResponse response = client.Execute(request);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "查询签约申请的结果异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+        
+        #region 小程序支付请调用MySystemLib下的统一收单交易创建,返回交易号返给小程序请求支付my.tradePay
+        public string GetToken()
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayOpenAuthTokenAppRequest request = new AlipayOpenAuthTokenAppRequest();
+            request.BizContent = "{" +
+            "\"grant_type\":\"authorization_code\"," +
+            "\"code\":\"P16be77ee92264acc99553528b8a7103\"" +
+            "  }";
+            string result = "";
+            try
+            {
+                AlipayOpenAuthTokenAppResponse response = client.Execute(request);
+                result = response.Body;
+                //{"alipay_open_auth_token_app_response":{"code":"10000","msg":"Success","tokens":[{"app_auth_token":"202202BBd8c1365cd09b4a27a0c0f0b7f8cabX03","app_refresh_token":"202202BB539f0f5aa99f4b509aa3628b0af25X03","auth_app_id":"2021003116654736","expires_in":31536000,"re_expires_in":32140800,"user_id":"2088141704579033"}]},"sign":"VZINXguZZFvVDyhVp/iMK5BWXYnDYLvxYEMEZTZOVUl9MUy6xQesDzpwBBUclLLU+QgrKpeekaxj9zgwRXdh7cKlVot2lkVPkGdfkqcK/B9t8kxPXa13WIszcROCqIutlcBZW9pCIUAbWRjorDvzRCc5rLNfSBAjEldZDA0rGOPeWJXM/5uLi/70oTwyO6eaEbKdRyHLjUwp0qtolhXIvyf9HL1HbZMGtyY/Hzq35BmhB/jQ4XIVdcOEpFtNoC/1S/viLOsBCD2m4aNCGUY0i24lr92dRsEinZlCxAQq+FK6ILNUnDmBUjNkPTycDrJFw+w9sEC6AcZodNB6OC8XTw=="}
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建(获取authtoken)异常");
+                result = "";
+            }
+            return result;
+        }
+
+        public string CreateTrade(string OrderNo, string Subject, string Amount, string BuyerId, string Notify_Url, string Token)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
+            request.SetNotifyUrl(Notify_Url);
+            request.BizContent = "{" +
+            "\"out_trade_no\":\"" + OrderNo + "\"," +
+            "\"total_amount\":" + Amount + "," +
+            "\"subject\":\"" + Subject + "\"," +
+            "\"buyer_id\":\"" + BuyerId + "\"," +
+            "\"timeout_express\":\"10m\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeCreateResponse response = client.Execute(request, null, Token);
+                result = response.Body;
+                function.WriteLog(DateTime.Now.ToString() + "\n" + result, "支付宝统一收单交易创建");
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "支付宝统一收单交易创建异常");
+                result = "";
+            }
+            return result;
+        }
+
+        public string QueryTrade(string OrderNo, string Token)
+        {
+            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
+            AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
+            request.BizContent = "{" +
+            "\"out_trade_no\":\"" + OrderNo + "\"" +
+            "}";
+            string result = "";
+            try
+            {
+                AlipayTradeQueryResponse response = client.Execute(request, null, Token);
+                result = response.Body;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(ex.ToString(), "统一收单线下交易查询异常");
+                result = "";
+            }
+            return result;
+        }
+
+        #endregion
+
+
+
+
+
+
+
+
+
+        //小程序
+        string MiniAppId = "2021003116654736";
+        //应用公钥
+        // string PublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnTchC1mU0rFnRv8/eqDz1i/gS5Wd5fDD/TobKDBlj1UgQPRnT9g8wy/uTtqMnImR09ZQ5C/Ekw8B2GlN6bLbza0+7Fym7rNNKw3EvEL8tQ6pMe1GbIu68tCEjIslPXswGCgGRI30LeSj0BElaSAaqbvvyTHp+vxNLwav/hSGokPa8C76SzgCpvvzjXk9oGiNV5eutdoWEKbwyvw45kv70JHragNANTqU8DouzPLHenoD5V+QqJw1He9mZSb08QgSHCFW1dau8Hmxy0oXsfUVXXHJfzkhoyJOerYiR+oVuRqaIIF9xFlUPsNdpsAnJCP+HaAqRJpvuKfV4hNdg7uvIQIDAQAB";
+        //支付宝公钥
+        string MiniAlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxycehrmnTl2IaIAECP+0HWc1eWGM/T6x022K7K6fdf+xoyC97TBJaG4G3Bcon4gsJX+Sad5IA9OJIQ4eN1joM35hIlwcFZ6MmCuVXx/SMAKThIjK0jsRc6aTxVQG+GVCgS7dXMKb4Sm+vK2wEM6xtDeqcfYMB0BqGZRvxbIV59a2ooPrha4FkV6nNC9DQefzC0picHXV64oYUjMM2ed4ASTQVds7HP9BZfalz//APZcWdBV08f+xv7n79Twz/gNtVAadfuTAlcjsS6aK+G/OrZtr/diuemeRPRUKlVhcr5xOQDhqBgtdIw8M9Wp6I4ULXRlthKVBWToH9j6n9vDIiwIDAQAB";
+        //应用私钥
+        string MiniPrivateKey = "MIIEogIBAAKCAQEAnTchC1mU0rFnRv8/eqDz1i/gS5Wd5fDD/TobKDBlj1UgQPRnT9g8wy/uTtqMnImR09ZQ5C/Ekw8B2GlN6bLbza0+7Fym7rNNKw3EvEL8tQ6pMe1GbIu68tCEjIslPXswGCgGRI30LeSj0BElaSAaqbvvyTHp+vxNLwav/hSGokPa8C76SzgCpvvzjXk9oGiNV5eutdoWEKbwyvw45kv70JHragNANTqU8DouzPLHenoD5V+QqJw1He9mZSb08QgSHCFW1dau8Hmxy0oXsfUVXXHJfzkhoyJOerYiR+oVuRqaIIF9xFlUPsNdpsAnJCP+HaAqRJpvuKfV4hNdg7uvIQIDAQABAoIBACrMZDmDxIjq9JOWTwCiKl8nn2bULyz2s1QPam8xZaR0ZxhnsGxDEJ+OP9DFnDvNE57YnCLSgjAKiNUSLbyuDTpbrGKKAoO+2gYbdHBPyB2+BP9reZ15GIabj0n3Y0bubzRUSQiGoG+R66pr0IRi0f9dAzUBWpIR9y0TI/wGOHSZmQ92CgTbdmimtUNxE17vF1jaiahDzvJ1MMag0iAbCXybe48eccURKNYOTm+CuQvykBExZyN45ppKQte4YMCCIqy8VlNlAaRQtcwsQjnWh6leLitfNSfSXV+14Zzyyb/acNPGv6Hq0sw4JlQiFOaoyBVSYqapaa2l7J0RCGs5HrECgYEAzerndj/KUh2YCc2zeC7RdjbsXY2w3wTvVPTZ5DTfhJe1+xGTMC1GXLqfdPrN94DoIhvAjQsNPM9lZES32S35KI73uauxVoVr0wP8RQr8VrVUZhkvUSfLy/u5/Y6iRMnq2oM58GxeBYzewKBUN4Spm62Rl1rosvxRCO2SHw8AFW0CgYEAw3PdjlzwJYlcIx04963oGcEXpPjYg2vpJwJ+GJYWKZlp7xL5bUrDiO8BYr1V5Gmcusa3RgKLxOCZZyEenkglhg64IITa9bT9R/yjaKQBQsiTDnWHogijnkn2Oh7Z5JymBG3OCgbU6eSLr1g7y3PypZ49Ur5cBqV49jVhsq3R1AUCgYANhSHjarbPA3BrHF1vQ6uvFlYYomf9jKZmLplr2WjfnNJvBK1kWWSoS/ySQrFpUcZsDuRqnlIlLvzaQ4TKtrEIT7LGNxaytpnoxfc3VUxSKR+8gGTR8En6P7HriwTufU91P257cbIOrTwm65/78TLtrMzFYkurDNQJQQf6EBMSVQKBgEypIGhbSZHfe3UGXDbBTjzzwHtjY0DAzZUQZDbuf0jXtHYiAhT88w69d9SroInTZrbXhEEAdKPG2ERb+C9q6tTW5x9SHLOsxn86tzkuwpPYKd3M+WLzcoF+TwZi3WHOk0s/akYCgfYvPx6KRAG7u5t8Il9W7K9qrbQcIfK8PIWlAoGAB+Nn+C7GGXYtEOWyJo4SqTYpaVJBdyqbq+UighHXQD0wci8b3E35SsR/QqDAvOgEpKhmjrt63KcfdJax4VztPwroKRTz+Iy/HwGcBSVwnUn8XPTlHFkTufUtPScWuYjSXTJ+MyIMif2rcaJubvSGyZOKNMbcvAQx5tnNbF5SrVU=";
+
+        //小程序AES密钥,目前用于解密手机号
+        string Key = "2Krm6dSew4NAL+l0mQf0fA==";
+        public string GetAlipayUserId(string Auth_code)
+        {
+            string result = "";
+            try
+            {
+                IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", MiniAppId, MiniPrivateKey, "json", "1.0", "RSA2", MiniAlipayPublicKey, "UTF-8", false);
+                //获取access_token
+                AlipaySystemOauthTokenRequest requestAccess_token = new AlipaySystemOauthTokenRequest();
+                requestAccess_token.GrantType = "authorization_code";
+                requestAccess_token.Code = Auth_code;
+                AlipaySystemOauthTokenResponse responseAccess_token = client.Execute(requestAccess_token);
+                string AlipayUserId = responseAccess_token.AlipayUserId; //20881043611849171819285350010300
+                string UserId = responseAccess_token.UserId; //2088222145274001
+                result = UserId + "|" + AlipayUserId;
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
+            }
+            return result;
+        }
+
+
+        public string GetAlipayMobile(string response)
+        {
+            function.WriteLog(response, "解密报文");
+            //1. 获取验签和解密所需要的参数
+            IDictionary openapiResult = Jayrock.Json.Conversion.JsonConvert.Import(response) as IDictionary;
+            string signType;
+            if (openapiResult.Contains("sign_type"))
+            {
+                signType = openapiResult["sign_type"].ToString();
+            }
+            else
+            {
+                signType = "RSA2";
+            }
+            string charset;
+            if (openapiResult.Contains("charset"))
+            {
+                charset = openapiResult["charset"].ToString();
+            }
+            else
+            {
+                charset = "UTF-8";
+            }
+            string encryptType;
+            if (openapiResult.Contains("encrypt_type"))
+            {
+                encryptType = openapiResult["encrypt_type"].ToString();
+            }
+            else
+            {
+                encryptType = "AES";
+            }
+            string sign = openapiResult["sign"].ToString();
+            string content = openapiResult["response"].ToString();
+            // 是否为加密报文
+            bool isDataEncrypted = !content.StartsWith("{", StringComparison.Ordinal);
+            // bool signCheckPass = false;
+            //2. 验签
+            string signContent = content;
+            signContent = "\"" + signContent + "\"";
+            string signVeriKey = MiniAlipayPublicKey;
+            string decryptKey = MiniPrivateKey;
+            string result = "";
+            try
+            {
+                function.WriteLog(content, "解密报文");
+                result = AlipayEncrypt.AesDencrypt(Key, content, charset);
+                JsonData obj = JsonMapper.ToObject(result);
+                if (obj["code"].ToString() == "10000")
+                {
+                    result = "success|" + obj["mobile"].ToString();
+                }
+                //{\"code\":\"10000\",\"msg\":\"Success\",\"mobile\":\"14781419364\"}
+            }
+            catch (Exception ex)
+            {
+                //解密异常, 记录日志        
+                function.WriteLog(ex.ToString(), "获取手机号解密异常");
+            }
+            return result;
+            // 如果是加密的报文则需要在密文的前后添加双引号
+            // if (isDataEncrypted)
+            // {
+            //     signContent = "\"" + signContent + "\"";
+            // }
+            // try
+            // {
+            //     signContent = signContent.Trim('"');
+            //     signCheckPass = AlipaySignature.RSACheckContent(signContent, sign, signVeriKey, charset, signType);
+            // }
+            // catch (Exception ex)
+            // {
+            //     //验签异常, 日志    
+            //     throw new Exception("验签失败", ex);
+            // }
+            // if (!signCheckPass)
+            // {
+            //     //验签不通过(异常或者报文被篡改),终止流程(不需要做解密)   
+            //     throw new Exception("验签失败");
+            // }
+            // //3. 解密
+            // string plainData = null;
+            // if (isDataEncrypted)
+            // {
+            //     try
+            //     {
+            //         plainData = AlipayEncrypt.AesDencrypt(decryptKey, content, charset);
+            //     }
+            //     catch (Exception ex)
+            //     {
+            //         //解密异常, 记录日志        
+            //         throw new Exception("解密异常", ex);
+            //     }
+            // }
+            // else
+            // {
+            //     plainData = content;
+            // }
+            // return result;
+        }
+
+        public string test()
+        {
+            string result = "";
+            string str = "PsQMXBobiYsZPG5q2dbsX5Zvnee73Zpg55guE2FTxMijl+xdj+oCjEErUpZNxRK0S132GVcWBQUjFeA5fcLq1A==";
+            try
+            {
+                result = AlipayEncrypt.AesDencrypt(Key, str, "UTF-8");
+                JsonData obj = JsonMapper.ToObject(result);
+                if (obj["code"].ToString() == "10000")
+                {
+                    result = "success|" + obj["mobile"].ToString();
+                }
+                //{\"code\":\"10000\",\"msg\":\"Success\",\"mobile\":\"14781419364\"}
+            }
+            catch (Exception ex)
+            {
+                //解密异常, 记录日志        
+                function.WriteLog(ex.ToString(), "获取手机号解密异常");
+            }
+            return result;
+        }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+        // 支付宝参数
+        public PublicAccountSet SetData(int UserId = 0)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            PublicAccountSet set = db.PublicAccountSet.FirstOrDefault() ?? new PublicAccountSet();
+            // set.AlipayAppId = "2021003122642236";
+            // set.AlipayPrivateKey = "MIIEpAIBAAKCAQEAmfSplznW6H+wCyKh806jBxVdRabpK2P9RP4QNSGsHNIAscuH2yPbI1dNfKESC+QXAfWVRg90Vb+7yQz1I/S2vT159yY7ZH6duCopPpScfpNmICtjVukc1V5PZX+ptuDZc0YQSsRnn5WVKNO0bBR6iS3Jl9HQT949I3rHttA1+iqBn2LWyvGcUSDCOFNwstOYFM3FJTg7rQEdjmEQonEPXSbTQl1aw+fx1D+NcGx9BFSVAbE+nqfiX2co4V6yQ++N1RMlnBtbMZmTgvcoHZujqqBmjRcfRUW8I0B9aPJGNji94STBRPf0hP7yN4PHP2LixAK5gfzZ5NP2iK99sQ9tmwIDAQABAoIBAAR0N5PQcI85YnZwAg9v7vd9fr1NHuHKesFMOFvRJZGP4cVDBiMo3mYfWHaKkmMVrjS4TiFAwTTZ3yzp2w23PrIq3SRxTraRky6Iybitw/lFembj2nPhOpxRpiphjx9jUecr17zSAc10HmSX+1hFH2ZolLR3tXcaDtq/6pc3Xthl5uT0HIkisgbgxG5M8B+x26ZWnu8pbk+nT9bsAh9LrkQX+xaxTCgpmWpUTFMhG2t9pl04jT/LPOWXCmrs1BYEadqMirivcZdAXEiRbisSVrDI8cGKvPZpNZU9jfg9W5DEgfUdhnaZfRZzeAWORrBogXV1Osjlcjh2XXA3pAzCP8ECgYEA1jKv/S4RVCswh5LZTVFqVTAVyMBL/nLSu1L4mgaim19QDINxCDpN8kOfIBIBatwvkg7HzzQquotbDqj8pKgCFHTyf5gof6iFA1uGGP6AYBdL0k5tAG+uKwpo9rtRAUlOeLqwCC4rVhO1hE9tsey+t57BoAGVqi9JYIyCwEmCmo8CgYEAuABGodDT+RVbzJhUi4gHmDNDsil214uDyRYprCvD+wsJp5ma7M30hPm2NluGRWJUSdo237T0a8RkrNuXHW1ptgFKED8Qy4JV+eKemMZ21yMKyNZcjNs9X55b9BK3cGKkxXieXcxGLhz1YeLqTatS516uKfUHte62E3neZDySsjUCgYEApQGLHWi9pK9YxTfU+oD7fwB555prcGqX+AJkzJLL9REpo1omWwY/QZ/iF1yHhwB0DPoh5nbza50q2lJHvbhHUeb9YFmg6SaywPFijiKQVnXbzPjpc2qVK0brsRZ/wpPsRYjbTpHyhG7OaEyf3m7YRK+hzVcrKl0fE6dqmiKG3/UCgYEAt+2WrVRZQAjIrdir0pqUtOCxz9tA76+HebAM0g0hp8XdzcpvIj2yKmaPbQDKVHs5NGXMKozxMvSrilsrUIA5hnT9ewX/nN7ZYKPW03K4AtAFjMMy2p6hV/6tfmpjMhV5DehHrg1vLdNGuqWgfyk+AwgS4uAL6CIJoahV1S7zmO0CgYBGMNtHyIsYbnYycat2SEOQOGbLAro+jRNDPCI3FGOf1fAOpXD9JgQMD7oXSRSnZRzwvsxNQ944UXqLrHPS5yEtcmAu6BdR1QjJlpj5ClRYuQuDK7k1LR3+0eI3FySbinAMspr6UVNo0UqUkLa2k/igH2yUyThIUDOiqkfuxsu/aA==";
+            // set.AlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxycehrmnTl2IaIAECP+0HWc1eWGM/T6x022K7K6fdf+xoyC97TBJaG4G3Bcon4gsJX+Sad5IA9OJIQ4eN1joM35hIlwcFZ6MmCuVXx/SMAKThIjK0jsRc6aTxVQG+GVCgS7dXMKb4Sm+vK2wEM6xtDeqcfYMB0BqGZRvxbIV59a2ooPrha4FkV6nNC9DQefzC0picHXV64oYUjMM2ed4ASTQVds7HP9BZfalz//APZcWdBV08f+xv7n79Twz/gNtVAadfuTAlcjsS6aK+G/OrZtr/diuemeRPRUKlVhcr5xOQDhqBgtdIw8M9Wp6I4ULXRlthKVBWToH9j6n9vDIiwIDAQAB";
+        
+            // set.AlipayAppId = "2021003126605468";
+            // set.AlipayPrivateKey = "MIIEogIBAAKCAQEA1O3mknrWGkWsDiojx/hUgq5jnO/D8rjMGUpz8C7A88iJmm6ZSxssTz2+OkL75omlxRJcMZAYt+icZtLWVm6mSklCipieWZGEWiId6bsHwlEPOkwmhPw5bDBF+y6ZSkXtW+fofrmsk8/a9SZ/N3h+FJ5sqLbihn9pXNp4X1VgnZHGGNWsRTFgBdWdEWAEhDImAPNRv8IB7ZyVbbRo3aIvTCH4EDUu8Y5IMs8l5Ne0aUAkPgz81IbiSMzWqU5z9W5m1cPIOz/w5Bru/JvJliu2qkQrDlh9ccIcBIsrOddYAzxyXsxO+EqUM/m9HEtg5atvMIV9XMzgwnGpM3jVydRBywIDAQABAoIBAAdaO6b9NN1tYHaQv/GMwqZMjUYDBXohJXMOHhjCFImWeCHsBcERLCOEV0g9veMFB8NZUfOoLSJUlun6B8quQXG5O+H7SSSAoNhX6z6B5c+w6tyxencHGpiAxjnZLxPgfES7Kk0N7kagW8gxTx1EPN5LZichQYsxZRr+tD9efFqUeOnutUjECdvYNb6FsJ46tgCVRSEl7kBueR+VmFl5FXjc7B3bREGzaNylu846BK4vK6u1/IKIDczJKfZDRtwSpvMPUGwscfZAkPHOxtneKCyB1itouUyrhjaBb9AJMKIaCi7j5btazo81B3BZVK9uHV+B+gVA3d+aWwSteU9WMukCgYEA6bk0ua6285e/N6YC5KvqRTaangjtSJckx3FRVuK6799mIDyyvScz6Befi/EJ0kwF0J0HPI+GKGa7XWzk1CR4pz1Zd85uzL8TIcn9AHqjeYe62hKLSPQMlR+GTP/J604rHERlGVoo7LEHT7MrVmQhTJWmJGezldPpmwbuKoWgel8CgYEA6TlShy3qO5LYVmd360BRWrR7k6cZkkTaC/ivjLZNENLXG7nJeUKkS4LaexLu7RB2L45IWzDqhCrPqfG5P/XkxvskkzntEUmChN58xhfpS20yeTpfDhjvdbJEEYgbmkNqOD8L2Q25XRMAJ8vomzgIEIw9aDQCM3ZBK1s0zyXwyBUCgYARqthbeOOHgl8H+9qYIo6w8LG7ZH1bUWGMWfqGENmErGRx52Sze7UmxDJhR7UwWmLOJDCZ2VeQ0kMzirm5d5BPRAnxTn99pqvxj+06DgsxcpsjROeWeixBUYK7a1J+IQiNOHZT9kbFrZQZ6DdMboE94soOUnB20PAFsf5q5HL/DQKBgHXVmHTkJexjjRpavKQHoxMJDUbUrn7QerqBs3CMyvMtE7HWdIzntsrQGkMEleMA5jWw1a39UP/mAXYDw20ld6lxSlF4eua5FVC8eJ49homtaksFyvD8eEAnCW0yL4AJf6lbcUkBPh5gczuoMqX58VkrAfucC2Ck5thZBJ2EtdrhAoGAVeQbC4m789Yr+kXKPECGxI7RwIVV5xjc3TCvfE6JKztmn0IZyWT53vqvxi2LpqeAMlwc8PrCpiqd/8Tk5M/WZkzGYTj7mrp0A7BXXRWMjnbrhq3W15P1Q45aU64NofOcQvX3LdKkpEWHYXktJaSKBlZgjSQVK7ZntF6LJCiMcQ0=";
+            // set.AlipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnw14hKejqS+si/XZpNQpFAVOVXJIThj5Qn7H14n/vsb7uRLug1+Jcve8ehTkaN3s5ibrrELCnz0dvshi3cOz9svDSbLG5OdC1biAvZzpDkvVPswOd9f9jO8Jvqk3QTXTI3MSN9gOpKomI0te3qs5kkOQx6kRozzKjU/G//o/PbJCxpBxf/QNRV3XmCwJLZMBE7ukYqi1WO9Jra8jdczFKwrd/nhiKBKdupAtVVeKlylGD2i2YLkGAH1cLsPUN9DtzrXNblGXm2HK3l9SnMDjqnakiVdEQJTNYNpEiHaOJsVmPQL38nM6miz5wNd4gTchKzXPtoZWqto+eIvYaEA/KwIDAQAB";
+            return set;
+        }
+    }
+}

+ 80 - 0
Util/MerchantAmountSummayUtil.cs

@@ -0,0 +1,80 @@
+using MySystem.MainModels;
+using Library;
+using MySystem.Service.Main;
+using System.Collections.Generic;
+using System;
+namespace MySystem
+{
+    /// <summary>
+    /// 商户业绩统计工具类
+    /// </summary>
+    public class MerchantAmountSummayUtil
+    {
+        #region 已激活商户-达标信息列表
+        /// <summary>
+        /// 已激活商户-达标信息列表
+        /// </summary>
+        /// <param name="MerchantId">商户Id</param>
+        /// <param name="PageSize">条数</param>
+        /// <param name="PageNum">页数</param>
+        /// <returns></returns>
+        public static List<Dictionary<string, object>> ListDo(int MerchantId, int PageSize, int PageNum)
+        {
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            var query = new MerchantDepositOrderService().QueryByMerchantId(MerchantId);
+            if (query.Id > 0)
+            {
+                var month = DateTime.Parse(query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                var TradeMonth = "";
+                var TradeTime = "";
+                Dictionary<string, string> dic = new Dictionary<string, string>();
+                for (int i = 0; i < 10; i++)
+                {
+                    var Status = 0;//活动交易状态
+                    decimal TradeAmount = 0.00M;
+                    TradeMonth = month.AddMonths(i + 1).ToString("yyyy-MM");
+                    TradeTime = month.AddMonths(i + 1).ToString("yyyyMM");
+                    //测试指定激活时间
+                    // TradeMonth = (int.Parse("202307") + i + 1).ToString();
+                    // TradeTime = (int.Parse("202307") + i + 1).ToString();
+                    var check = new MerchantAmountSummayService().QueryAmount("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
+                    if (check.Count > 0)
+                    {
+                        dic = new MerchantAmountSummayService().Sum("TradeAmount", " and IsAct=1 and TradeMonth='" + TradeTime + "' and MerchantId=" + MerchantId + "");
+                        TradeAmount = decimal.Parse(dic["TradeAmount"].ToString());
+                    }
+                    //待考核
+                    if (int.Parse(DateTime.Now.ToString("yyyyMM")) < int.Parse(TradeTime))
+                    // if (int.Parse("202310") < int.Parse(TradeTime))//测试指定当前时间
+                    {
+                        Status = 0;
+                    }
+                    else
+                    {
+                        //考核中
+                        if (DateTime.Now.ToString("yyyyMM") == TradeTime)
+                        {
+                            Status = 1;
+                        }
+                        else
+                        {
+                            //已通过
+                            if (TradeAmount >= 10000 && check.Count > 0) Status = 2;
+                            //未通过
+                            if (TradeAmount < 10000 && check.Count >= 0) Status = -1;
+                        }
+                    }
+
+                    Dictionary<string, object> curData = new Dictionary<string, object>();
+                    curData.Add("TradeMonth", TradeMonth); //月份
+                    curData.Add("TradeAmount", TradeAmount); //订单金额
+                    curData.Add("Status", Status); //状态(-1 未通过 0 待考核 1 考核中 2 已通过 3 未参与)
+                    dataList.Add(curData);
+                }
+            }
+            return dataList;
+        }
+        #endregion
+
+    }
+}

+ 52 - 0
Util/MerchantDepositBackUtil.cs

@@ -0,0 +1,52 @@
+using MySystem.MainModels;
+using Library;
+using MySystem.Service.Main;
+using System.Collections.Generic;
+namespace MySystem
+{
+    /// <summary>
+    /// 商户服务费退还记录工具类
+    /// </summary>
+    public class MerchantDepositBackUtil
+    {
+
+        #region 商户激活—商户服务费退还
+        /// <summary>
+        /// 商户激活—商户服务费退还
+        /// </summary>
+        /// <param name="MerchantId">商户Id</param>
+        /// <param name="ReturnWay">退还方式</param>
+        /// <param name="MobileCode">短信验证码</param>
+        /// <param name="ReturnNo">退还账号</param>
+        /// <returns></returns>
+        public static string AddMerchantDepositBackDo(int MerchantId, int ReturnWay, string MobileCode, string ReturnNo)
+        {
+            var query = new MerchantAddInfoService().Query(MerchantId);
+            MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + query.ServicePhone);
+            if (mobilecheck == null)
+            {
+                return "短信验证码不正确";
+            }
+            if (mobilecheck.CheckCode != MobileCode)
+            {
+                return "短信验证码不正确";
+            }
+            string checks = RedisDbconn.Instance.Get<string>("MerchantDepositBack:" + MerchantId);
+            if (checks == "1")
+            {
+                return "已申请退押,请勿重复申请";
+            }
+            RedisDbconn.Instance.Clear("MobileCodeCheck:" + query.ServicePhone);
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            RedisDbconn.Instance.Set("MerchantDepositBack:" + MerchantId, "1");
+            RedisDbconn.Instance.SetExpire("MerchantDepositBack:" + MerchantId, 10);
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            fields.Add("MerchantId", MerchantId); //商户Id
+            fields.Add("ReturnWay", ReturnWay); //退还方式
+            new MerchantDepositBackService().Add(fields);
+            return "success";
+        }
+        #endregion
+
+    }
+}

+ 35 - 0
Util/MerchantDepositOrderUtil.cs

@@ -0,0 +1,35 @@
+using MySystem.MainModels;
+using Library;
+using MySystem.Service.Main;
+using System.Collections.Generic;
+using System;
+namespace MySystem
+{
+    /// <summary>
+    /// 商户服务费缴纳记录工具类
+    /// </summary>
+    public class MerchantDepositOrderUtil
+    {
+        #region 添加商户服务费缴纳记录
+        /// <summary>
+        /// 添加商户服务费缴纳记录
+        /// </summary>
+        /// <param name="OrderNo">订单号</param>
+        /// <param name="UserId">创客Id</param>
+        /// <param name="MerchantId">商户Id</param>
+        /// <param name="ActPayPrice">总金额</param>
+        /// <returns></returns>
+        public static int AddMerchantDepositOrder(string OrderNo, int UserId, int MerchantId, decimal ActPayPrice)
+        {
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            fields.Add("OrderNo", OrderNo); //订单号
+            fields.Add("UserId", UserId); //所属创客Id
+            fields.Add("MerchantId", MerchantId); //商户Id
+            fields.Add("ActPayPrice", ActPayPrice); //服务费总额
+            AppResultJson resultJson = MerchantDepositOrderService.Add(fields, false);
+            var Id = int.Parse(resultJson.Data.ToString());
+            return Id;
+        }
+        #endregion
+    }
+}

+ 1 - 1
Views/Home/Index.cshtml

@@ -1 +1 @@
-<h2>客小爽AP1</h2>
+<h2>来客吧channel1</h2>

+ 1 - 1
appsettings.Development.json

@@ -22,7 +22,7 @@
     "SqlConnStr2": "server=47.109.31.237;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer2;charset=utf8;",
     "StatSqlConnStr": "server=47.109.31.237;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateStatServer;charset=utf8;",
     "BsSqlConnStr": "server=47.109.31.237;port=3306;user=QrCodePlateBsServer;password=ld5Px33wvhyEz44P;database=QrCodePlateBsServer;charset=utf8;",
-    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=4,poolsize=500,preheat=50,asyncPipeline=true",
+    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=5,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "",

+ 0 - 42
appsettings.json

@@ -1,42 +0,0 @@
-{
-  "Logging": {
-    "LogLevel": {
-      "Default": "Information",
-      "Microsoft": "Warning",
-      "Microsoft.Hosting.Lifetime": "Information"
-    }
-  },
-  "AllowedHosts": "*",
-  "Setting": {
-    "ConnectionStrings": "",
-    "Host": "http://test.mpap.kexiaoshuang.com/",
-    "Host2": "http://test.mpap2.kexiaoshuang.com/",
-    "SourceHost": "http://test.mpap.kexiaoshuang.com/",
-    "SpHost": "http://mpsp.kexiaoshuang.com/",
-    "OssHost": "http://oss.qrcodeplate.com",
-    "QrCodeHost": "http://test.mpap.kexiaoshuang.com/",
-    "Database": "ApServer",
-    "KxsSqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;Max Pool Size=512",
-    "MiniSqlConnStr": "server=47.109.31.237;port=3306;user=MiniProgram;password=sxqHokkreqE6HnUg;database=MiniProgram;charset=utf8;",
-    "SqlConnStr": "server=rm-2vc27k81v217qs1t55o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer;charset=utf8;",
-    "StatSqlConnStr": "server=rm-2vc27k81v217qs1t55o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateStatServer;charset=utf8;",
-    "SqlConnStr2": "server=rm-2vc27k81v217qs1t55o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer2;charset=utf8;",
-    "BsSqlConnStr": "server=rm-2vc27k81v217qs1t55o.mysql.cn-chengdu.rds.aliyuncs.com;port=3306;user=QrCodePlateBsServer;password=ld5Px33wvhyEz44P;database=QrCodePlateBsServer;charset=utf8;",
-    "RedisConnStr": "redis:6379,password=kxsmp@2023,DefaultDatabase=0,poolsize=500,preheat=50,asyncPipeline=true",
-    "IOSAppVersion": "1.0.0",
-    "AndroidAppVersion": "1.0.0",
-    "OSSKey": "",
-    "OSSSecret": "",
-    "OSSEndpoint": "",
-    "OSSBucketName": "",
-    "AppSource": "/skin/app/default/",
-    "JwtSecret": "JvDHuowbOnWiyxMIFc9gG5rw1LSSc0xx68L31oRfxS0",
-    "JwtIss": "ApServer",
-    "JwtAud": "api",
-    "MqUserName": "skb@rabbitmq",
-    "MqPassword": "skb@rabbitmq",
-    "MqHostName": "47.109.31.237:5672,47.109.31.237:5672",
-    "MqOneHostName": "47.109.31.237",
-    "MqOnePort": "5672"
-  }
-}

+ 5 - 0
global.json

@@ -0,0 +1,5 @@
+{
+  "sdk": {
+    "version": "3.0.100"
+  }
+}

Деякі файли не було показано, через те що забагато файлів було змінено