lichunlei 3 лет назад
Родитель
Сommit
12540ebc66
100 измененных файлов с 13170 добавлено и 5736 удалено
  1. 3 0
      .gitignore
  2. 0 327
      AppStart/Alipay/AlipayFunction.cs
  3. 46 0
      AppStart/DictionaryClass/DictionaryClass.cs
  4. 0 70
      AppStart/DictionaryClass/PageUpdateInfoDictionary.cs
  5. 494 100
      AppStart/ExcelHelper.cs
  6. 90 9
      AppStart/Helper/SycnProfitService.cs
  7. 275 0
      AppStart/Helper/SycnProfitServiceV2.cs
  8. 275 0
      AppStart/Helper/SycnSpTradeService.cs
  9. 21 20
      AppStart/OssHelper.cs
  10. 25 0
      AppStart/PublicFunction.cs
  11. 26 0
      AppStart/RelationClass.cs
  12. 27 0
      AppStart/RelationClassForConst.cs
  13. 11 0
      AppStart/Tables/RecommendPriceList.cs
  14. 0 483
      AppStart/WeChatFunction.cs
  15. 2 0
      Areas/Admin/Controllers/BsServer/BaseController.cs
  16. 25 19
      Areas/Admin/Controllers/BsServer/MsgPersonalController.cs
  17. 29 23
      Areas/Admin/Controllers/BsServer/MsgPlacardController.cs
  18. 0 339
      Areas/Admin/Controllers/BsServer/RightDicController.cs
  19. 0 339
      Areas/Admin/Controllers/BsServer/UploadParamsController.cs
  20. 369 0
      Areas/Admin/Controllers/CashServer/UserIdentityController.cs
  21. 394 0
      Areas/Admin/Controllers/CashServer/WithdrawRecordController.cs
  22. 21 3
      Areas/Admin/Controllers/MainServer/ActiveRewardController.cs
  23. 87 87
      Areas/Admin/Controllers/MainServer/ConsumerOrdersController.cs
  24. 0 397
      Areas/Admin/Controllers/MainServer/FileUpdateInfoController.cs
  25. 28 3
      Areas/Admin/Controllers/MainServer/FluxProfitDetailController.cs
  26. 15 2
      Areas/Admin/Controllers/MainServer/FluxProfitSummaryController.cs
  27. 388 0
      Areas/Admin/Controllers/MainServer/HelpProfitAccountRecordController.cs
  28. 349 0
      Areas/Admin/Controllers/MainServer/HelpProfitExchangeController.cs
  29. 369 0
      Areas/Admin/Controllers/MainServer/HelpProfitExchangeDetailController.cs
  30. 98 59
      Areas/Admin/Controllers/MainServer/HelpProfitMerTradeSummayController.cs
  31. 352 0
      Areas/Admin/Controllers/MainServer/HelpProfitMerchantForUserController.cs
  32. 89 76
      Areas/Admin/Controllers/MainServer/HelpProfitRebateDetailController.cs
  33. 41 9
      Areas/Admin/Controllers/MainServer/MachineApplyController.cs
  34. 17 10
      Areas/Admin/Controllers/MainServer/MachineChangeController.cs
  35. 26 26
      Areas/Admin/Controllers/MainServer/MachineChangeDetailController.cs
  36. 407 0
      Areas/Admin/Controllers/MainServer/MachineUnBindController.cs
  37. 1 1
      Areas/Admin/Controllers/MainServer/MerchantAddInfoController.cs
  38. 14 4
      Areas/Admin/Controllers/MainServer/MerchantRebateDetailController.cs
  39. 8 2
      Areas/Admin/Controllers/MainServer/OpenRewardController.cs
  40. 24 6
      Areas/Admin/Controllers/MainServer/OpenRewardDetailController.cs
  41. 9 0
      Areas/Admin/Controllers/MainServer/OpenSnSnapshotController.cs
  42. 166 20
      Areas/Admin/Controllers/MainServer/OrdersController.cs
  43. 0 456
      Areas/Admin/Controllers/MainServer/PageUpdateInfoController.cs
  44. 12 6
      Areas/Admin/Controllers/MainServer/PosCouponOrdersController.cs
  45. 0 1
      Areas/Admin/Controllers/MainServer/PosCouponRecordController.cs
  46. 527 0
      Areas/Admin/Controllers/MainServer/PosCouponsController.cs
  47. 116 4
      Areas/Admin/Controllers/MainServer/PosMachinesTwoController.cs
  48. 195 39
      Areas/Admin/Controllers/MainServer/PosMerchantInfoController.cs
  49. 541 0
      Areas/Admin/Controllers/MainServer/PosMerchantInfoListController.cs
  50. 573 0
      Areas/Admin/Controllers/MainServer/PreSendStockDetailController.cs
  51. 0 326
      Areas/Admin/Controllers/MainServer/ProfitObjectActivationsController.cs
  52. 0 310
      Areas/Admin/Controllers/MainServer/ProfitObjectContinueFloorsController.cs
  53. 0 312
      Areas/Admin/Controllers/MainServer/ProfitObjectFloorsController.cs
  54. 0 318
      Areas/Admin/Controllers/MainServer/ProfitObjectLevelKindsController.cs
  55. 0 353
      Areas/Admin/Controllers/MainServer/ProfitObjectLevelsController.cs
  56. 0 329
      Areas/Admin/Controllers/MainServer/ProfitObjectsActivesController.cs
  57. 0 427
      Areas/Admin/Controllers/MainServer/ProfitObjectsController.cs
  58. 55 11
      Areas/Admin/Controllers/MainServer/ProfitRewardRecordController.cs
  59. 14 2
      Areas/Admin/Controllers/MainServer/ProfitSubsidyDetailController.cs
  60. 59 58
      Areas/Admin/Controllers/MainServer/SchoolMakerStudyController.cs
  61. 77 73
      Areas/Admin/Controllers/MainServer/SchoolMorningMeetController.cs
  62. 375 0
      Areas/Admin/Controllers/MainServer/SmallStoreHouseController.cs
  63. 40 8
      Areas/Admin/Controllers/MainServer/StoreBalanceController.cs
  64. 8 2
      Areas/Admin/Controllers/MainServer/StoreChangeHistoryController.cs
  65. 445 0
      Areas/Admin/Controllers/MainServer/StoreHouseAmountPromissController.cs
  66. 390 0
      Areas/Admin/Controllers/MainServer/StoreHouseAmountRecordController.cs
  67. 474 13
      Areas/Admin/Controllers/MainServer/StoreHouseController.cs
  68. 713 0
      Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs
  69. 8 3
      Areas/Admin/Controllers/MainServer/StoreSnActivateSummaryController.cs
  70. 8 2
      Areas/Admin/Controllers/MainServer/StoreStockChangeController.cs
  71. 145 34
      Areas/Admin/Controllers/MainServer/SysRechargeRecordController.cs
  72. 2005 0
      Areas/Admin/Controllers/MainServer/SysToolsController.cs
  73. 38 6
      Areas/Admin/Controllers/MainServer/TradeDaySummaryController.cs
  74. 46 6
      Areas/Admin/Controllers/MainServer/TradeRecordController.cs
  75. 45 1
      Areas/Admin/Controllers/MainServer/UserAccountController.cs
  76. 33 22
      Areas/Admin/Controllers/MainServer/UserAccountRecordController.cs
  77. 1 1
      Areas/Admin/Controllers/MainServer/UserCardForWeChatController.cs
  78. 652 37
      Areas/Admin/Controllers/MainServer/UserCashRecordController.cs
  79. 39 22
      Areas/Admin/Controllers/MainServer/UserStoreChangeController.cs
  80. 82 36
      Areas/Admin/Controllers/MainServer/UserTradeDaySummaryController.cs
  81. 799 50
      Areas/Admin/Controllers/MainServer/UsersController.cs
  82. 6 6
      Areas/Admin/Views/BsServer/Advertisment/Add.cshtml
  83. 2 2
      Areas/Admin/Views/BsServer/Advertisment/Edit.cshtml
  84. 2 2
      Areas/Admin/Views/BsServer/Col/Add.cshtml
  85. 2 2
      Areas/Admin/Views/BsServer/Col/Edit.cshtml
  86. 1 1
      Areas/Admin/Views/BsServer/MsgBlackList/Add.cshtml
  87. 1 1
      Areas/Admin/Views/BsServer/MsgBlackList/Edit.cshtml
  88. 2 2
      Areas/Admin/Views/BsServer/MsgPersonal/Add.cshtml
  89. 3 3
      Areas/Admin/Views/BsServer/MsgPersonal/Edit.cshtml
  90. 2 2
      Areas/Admin/Views/BsServer/MsgPlacard/Add.cshtml
  91. 2 2
      Areas/Admin/Views/BsServer/MsgPlacard/Detail.cshtml
  92. 3 3
      Areas/Admin/Views/BsServer/MsgPlacard/Edit.cshtml
  93. 1 1
      Areas/Admin/Views/BsServer/MsgPlacardRead/Add.cshtml
  94. 1 1
      Areas/Admin/Views/BsServer/MsgPlacardRead/Edit.cshtml
  95. 1 1
      Areas/Admin/Views/BsServer/MsgPush/Add.cshtml
  96. 1 1
      Areas/Admin/Views/BsServer/MsgPush/Edit.cshtml
  97. 1 1
      Areas/Admin/Views/BsServer/MsgSms/Add.cshtml
  98. 1 1
      Areas/Admin/Views/BsServer/MsgSms/Edit.cshtml
  99. 1 1
      Areas/Admin/Views/BsServer/MsgSmsSet/Add.cshtml
  100. 1 1
      Areas/Admin/Views/BsServer/MsgSmsSet/Edit.cshtml

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+/bin
+/publish
+/obj

+ 0 - 327
AppStart/Alipay/AlipayFunction.cs

@@ -1,327 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Aop.Api;
-using Library;
-using Microsoft.AspNetCore.Http;
-using Aop.Api.Request;
-using Aop.Api.Response;
-using Aop.Api.Util;
-
-namespace MySystem
-{
-    public class AlipayFunction
-    {
-        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 AlipayFunction(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;
-            }
-            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
-
-        #region 退款
-
-        public string Refund(string TradeNo, string Amount, string Token)
-        {
-            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
-            AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
-            request.BizContent = "{" +
-            "\"trade_no\":\"" + TradeNo + "\"," +
-            "\"refund_amount\":" + Amount + "" +
-            "}";
-            string result = "";
-            try
-            {
-                AlipayTradeRefundResponse response = client.Execute(request, null, Token);
-                result = response.Body;
-            }
-            catch (Exception ex)
-            {
-                function.WriteLog(ex.ToString(), "退款异常");
-                result = "";
-            }
-            return result;
-        }
-
-        #endregion
-
-        #region 分账
-        public string Settle(string OrderNo, string TradeNo, List<RoyaltyParameters> Parameters)
-        {
-            IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", AppId, PrivateKey, "json", "1.0", "RSA2", AlipayPublicKey, "utf-8", false);
-            AlipayTradeOrderSettleRequest  request= new AlipayTradeOrderSettleRequest();
-            string royalty_parameters = "";
-            foreach (RoyaltyParameters Parameter in Parameters)
-            {
-                royalty_parameters += "    {" +
-                "      \"royalty_type\":\"transfer\"," +
-                "      \"trans_in_type\":\"loginName\"," +
-                "      \"trans_in\":\"" + Parameter.Account + "\"," +
-                "      \"amount\":" + Parameter.Amount + "," +
-                "      \"trans_in_name\":\"" + Parameter.Name + "\"" +
-                "    },";
-            }
-            request.BizContent = "{" +
-            "  \"out_request_no\":\"" + OrderNo + "\"," +
-            "  \"trade_no\":\"" + TradeNo + "\"," +
-            "  \"royalty_parameters\":[" +
-            royalty_parameters.TrimEnd(',') +
-            "  ]" +
-            "}";
-            string result = "";
-            try
-            {
-                AlipayTradeOrderSettleResponse response = client.Execute(request);
-                result = response.Body;
-            }
-            catch (Exception ex)
-            {
-                function.WriteLog(ex.ToString(), "分账异常");
-                result = "";
-            }
-            return result;
-        }
-
-        #endregion
-
-
-
-
-
-
-        // 支付宝参数
-        public Models.PublicAccountSet SetData()
-        {
-            Models.PublicAccountSet set = new Models.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;
-        }
-    }
-}

+ 46 - 0
AppStart/DictionaryClass/DictionaryClass.cs

@@ -350,6 +350,52 @@ namespace MySystem
 
         #endregion
 
+        #region SmallStoreHouse字典
+
+        public Dictionary<string, string> getSmallStoreHouseDic()
+        {
+            List<SmallStoreHouse> SmallStoreHouseList = db.SmallStoreHouse.ToList();
+            Dictionary<string, string> SmallStoreHouseDic = new Dictionary<string, string>();
+            foreach (SmallStoreHouse subSmallStoreHouse in SmallStoreHouseList)
+            {
+                SmallStoreHouseDic.Add(subSmallStoreHouse.Id.ToString(), subSmallStoreHouse.StoreName.ToString());
+            }
+            return SmallStoreHouseDic;
+        }
+
+        #endregion
+
+
+        #region KqProducts字典
+
+        public Dictionary<string, string> getKqProductsDic()
+        {
+            List<KqProducts> KqProductsList = db.KqProducts.ToList();
+            Dictionary<string, string> KqProductsDic = new Dictionary<string, string>();
+            foreach (KqProducts subKqProducts in KqProductsList)
+            {
+                KqProductsDic.Add(subKqProducts.Id.ToString(), subKqProducts.Name.ToString());
+            }
+            return KqProductsDic;
+        }
+
+        #endregion
+
+        #region PosMachinesTwo字典
+
+        public Dictionary<string, string> getPosMachinesTwoDic()
+        {
+            List<PosMachinesTwo> PosMachinesTwoList = db.PosMachinesTwo.ToList();
+            Dictionary<string, string> PosMachinesTwoDic = new Dictionary<string, string>();
+            foreach (PosMachinesTwo subPosMachinesTwo in PosMachinesTwoList)
+            {
+                PosMachinesTwoDic.Add(subPosMachinesTwo.Id.ToString(), subPosMachinesTwo.PosSn.ToString());
+            }
+            return PosMachinesTwoDic;
+        }
+
+        #endregion
+
 
 
         #region 根据字典key获取字典值

+ 0 - 70
AppStart/DictionaryClass/PageUpdateInfoDictionary.cs

@@ -1,70 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using Microsoft.AspNetCore.Mvc;
-using MySystem.Models;
-
-namespace MySystem
-{
-    public class PageUpdateInfoDictionary
-    {
-        WebCMSEntities db = new WebCMSEntities();
-
-
-        #region 页面模板字典
-
-        public Dictionary<string, string> getPageUpdateInfoDic(string Kind = "default")
-        {
-            List<PageUpdateInfo> PageUpdateInfoList = db.PageUpdateInfo.Where(m => m.SeoKeyword == Kind).OrderBy(m => m.ModulePath).ToList();
-            Dictionary<string, string> PageUpdateInfoDic = new Dictionary<string, string>();
-            foreach (PageUpdateInfo subPageUpdateInfo in PageUpdateInfoList)
-            {
-                PageUpdateInfoDic.Add(subPageUpdateInfo.ModulePath.Replace(".html", ""), subPageUpdateInfo.Title+subPageUpdateInfo.ModulePath.Replace(".html", ""));
-            }
-            return PageUpdateInfoDic;
-        }
-
-        #endregion
-
-
-
-
-
-
-
-        #region 根据字典key获取字典值
-
-        public string getDictionaryNameByKey(Dictionary<string, string> data, string key)
-        {
-            if (data.ContainsKey(key))
-            {
-                return data[key];
-            }
-            return "";
-        }
-        public string getDictionaryNameById(Dictionary<int, string> data, int key)
-        {
-            if (data.ContainsKey(key))
-            {
-                return data[key];
-            }
-            return "";
-        }
-        public string getDictionaryNamesByKeys(Dictionary<string, string> data, string keys)
-        {
-            string result = "";
-            string[] keylist = keys.Split(',');
-            foreach (string subkey in keylist)
-            {
-                if (data.ContainsKey(subkey))
-                {
-                    result += data[subkey] + ",";
-                }
-            }
-            return result.TrimEnd(',');
-        }
-
-        #endregion
-    }
-}

+ 494 - 100
AppStart/ExcelHelper.cs

@@ -34,11 +34,7 @@ namespace MySystem
                     string _ExcelPath = dataList[0];
                     string _Kind = dataList[1];
                     string checkKey = dataList[2];
-                    string Operator = "";
-                    if (_Kind == "UserCashRecord")
-                    {
-                        Operator = dataList[3];
-                    }
+                    string Operator = dataList[3];
                     int SuccessCount = 0;
                     int DoCount = 0;
                     string FullExcelPath = function.getPath(_ExcelPath);
@@ -99,6 +95,7 @@ namespace MySystem
                                             StoreStockChange stockchange = db.StoreStockChange.Add(new StoreStockChange()
                                             {
                                                 CreateDate = DateTime.Now,
+                                                CreateMan = Operator,
                                                 StoreId = storefor.StoreId, //仓库
                                                 BrandId = BrandId, //产品类型
                                                 ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
@@ -129,6 +126,7 @@ namespace MySystem
                                             db.StoreChangeHistory.Add(new StoreChangeHistory()
                                             {
                                                 CreateDate = DateTime.Now,
+                                                CreateMan = Operator,
                                                 UserId = store.UserId, //创客
                                                 BrandId = BrandId, //产品类型
                                                 ChangeRecordNo = ChangeNo, //变更记录单号
@@ -174,6 +172,14 @@ namespace MySystem
                                             SuccessCount += 1;
                                             RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
                                         }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "的品牌填写有误");
+                                        }
+                                    }
+                                    else
+                                    {
+                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "已存在,请勿重复录入");
                                     }
                                 }
                                 DoCount += Size;
@@ -187,6 +193,7 @@ namespace MySystem
                                     StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
                                     {
                                         CreateDate = DateTime.Now,
+                                        CreateMan = Operator,
                                         StoreId = StoreId, //仓库
                                         TransType = 0, //交易类型
                                         BrandId = BrandId, //产品类型
@@ -224,6 +231,7 @@ namespace MySystem
                             }
                             catch (Exception ex)
                             {
+                                DoCount = list.Rows.Count;
                                 function.WriteLog(ex.ToString(), "机具导入异常");
                                 tran.Rollback();
                                 ErrorMsg msg = new ErrorMsg()
@@ -284,6 +292,7 @@ namespace MySystem
                                                         StoreStockChange stockchange = db.StoreStockChange.Add(new StoreStockChange()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             StoreId = storefor.StoreId, //仓库
                                                             BrandId = BrandId, //产品类型
                                                             ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
@@ -318,6 +327,7 @@ namespace MySystem
                                                         db.StoreChangeHistory.Add(new StoreChangeHistory()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             UserId = store.UserId, //创客
                                                             BrandId = BrandId, //产品类型
                                                             ChangeRecordNo = ChangeNo, //变更记录单号
@@ -339,6 +349,7 @@ namespace MySystem
                                                         db.StoreChangeHistory.Add(new StoreChangeHistory()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             UserId = tostore.UserId, //创客
                                                             BrandId = BrandId, //产品类型
                                                             ChangeRecordNo = ChangeNo, //变更记录单号
@@ -381,15 +392,31 @@ namespace MySystem
                                                         SuccessCount += 1;
                                                         RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
                                                     }
+                                                    else
+                                                    {
+                                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "不是仓库机或不在填写的收货仓库中");
+                                                    }
                                                     if (string.IsNullOrEmpty(tostore.ProductName))
                                                     {
                                                         tostore.BrandId = BrandId.ToString();
                                                         tostore.ProductName = kqProduct.Name;
                                                     }
                                                 }
+                                                else
+                                                {
+                                                    RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "填写的收货仓库编号不正确");
+                                                }
+                                            }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "所在的仓库" + store.StoreName + "(" + store.StoreNo + ")库存不足");
                                             }
                                             db.SaveChanges();
                                         }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "的品牌填写有误");
+                                        }
                                     }
                                     DoCount += Size;
                                     foreach (string key in storeData.Keys)
@@ -402,6 +429,7 @@ namespace MySystem
                                         StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
                                         {
                                             CreateDate = DateTime.Now,
+                                            CreateMan = Operator,
                                             StoreId = StoreId, //仓库
                                             TransType = 1, //交易类型
                                             BrandId = BrandId, //产品类型
@@ -427,6 +455,8 @@ namespace MySystem
                                         store.LaveNum -= OpStoreNum;
                                         store.OutNum += OpStoreNum;
                                         db.SaveChanges();
+                                        string SendData = "{\"Kind\":\"5\",\"Data\":{\"StoreId\":\"" + StoreId + "\",\"BrandId\":\"" + BrandId + "\",\"OpStoreNum\":\"" + OpStoreNum + "\"}}";
+                                        RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
                                         RedisDbconn.Instance.Clear("StoreHouse:" + StoreId);
                                         RedisDbconn.Instance.Clear("StoreHouseList:" + store.UserId);
                                     }
@@ -440,6 +470,7 @@ namespace MySystem
                                         StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
                                         {
                                             CreateDate = DateTime.Now,
+                                            CreateMan = Operator,
                                             StoreId = StoreId, //仓库
                                             TransType = 0, //交易类型
                                             BrandId = BrandId, //产品类型
@@ -465,17 +496,18 @@ namespace MySystem
                                         store.TotalNum += OpStoreNum;
                                         store.LaveNum += OpStoreNum;
                                         db.SaveChanges();
+                                        string SendData = "{\"Kind\":\"5\",\"Data\":{\"StoreId\":\"" + StoreId + "\",\"BrandId\":\"" + BrandId + "\",\"OpStoreNum\":\"-" + OpStoreNum + "\"}}";
                                         RedisDbconn.Instance.Clear("StoreHouse:" + StoreId);
                                         RedisDbconn.Instance.Clear("StoreHouseList:" + store.UserId);
                                     }
                                     db.SaveChanges();
                                     tran.Commit();
-                                    RedisDbconn.Instance.Clear("StoreHouse");
                                     RedisDbconn.Instance.Set("CheckImport:" + checkKey, "success|" + SuccessCount);
                                     RedisDbconn.Instance.SetExpire("CheckImport:" + checkKey, 60000);
                                 }
                                 catch (Exception ex)
                                 {
+                                    DoCount = list.Rows.Count;
                                     tran.Rollback();
                                     ErrorMsg msg = new ErrorMsg()
                                     {
@@ -539,6 +571,7 @@ namespace MySystem
                                                         StoreStockChange stockchange = db.StoreStockChange.Add(new StoreStockChange()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             StoreId = storefor.StoreId, //仓库
                                                             BrandId = BrandId, //产品类型
                                                             ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
@@ -577,6 +610,7 @@ namespace MySystem
                                                         UserStoreChange userstore = db.UserStoreChange.Add(new UserStoreChange()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             UserId = store.UserId, //创客
                                                             BrandId = BrandId, //产品类型
                                                             ChangeRecordNo = ChangeNo, //变更记录单号
@@ -603,6 +637,7 @@ namespace MySystem
                                                         db.StoreChangeHistory.Add(new StoreChangeHistory()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             UserId = store.UserId, //创客
                                                             BrandId = BrandId, //产品类型
                                                             ChangeRecordNo = ChangeNo, //变更记录单号
@@ -624,6 +659,7 @@ namespace MySystem
                                                         db.StoreChangeHistory.Add(new StoreChangeHistory()
                                                         {
                                                             CreateDate = DateTime.Now,
+                                                            CreateMan = Operator,
                                                             UserId = touser.Id, //创客
                                                             BrandId = BrandId, //产品类型
                                                             ChangeRecordNo = ChangeNo, //变更记录单号
@@ -680,8 +716,24 @@ namespace MySystem
                                                         SuccessCount += 1;
                                                         RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
                                                     }
+                                                    else
+                                                    {
+                                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "不是仓库机");
+                                                    }
+                                                }
+                                                else
+                                                {
+                                                    RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "填写的收货创客编号不正确或创客未认证");
                                                 }
                                             }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "所在的仓库" + store.StoreName + "(" + store.StoreNo + ")库存不足");
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "的品牌填写有误");
                                         }
                                     }
                                     DoCount += Size;
@@ -695,6 +747,7 @@ namespace MySystem
                                         StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
                                         {
                                             CreateDate = DateTime.Now,
+                                            CreateMan = Operator,
                                             StoreId = StoreId, //仓库
                                             TransType = 1, //交易类型
                                             BrandId = BrandId, //产品类型
@@ -732,6 +785,204 @@ namespace MySystem
                                 }
                                 catch (Exception ex)
                                 {
+                                    DoCount = list.Rows.Count;
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "BsServerAdminError");
+                                }
+                            }
+                        }
+                        else if (_Kind == "4")
+                        {
+                            Dictionary<string, int> storeData = new Dictionary<string, int>();
+                            Dictionary<string, int> toStoreData = new Dictionary<string, int>();
+                            using (var tran = db.Database.BeginTransaction())
+                            {
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string BatchNo = dr[0].ToString(); // 业务批次号
+                                        string OldStoreNo = dr[1].ToString(); // 原仓库编号
+                                        string OldOperator = dr[2].ToString(); // 操作人
+                                        string SnNo = dr[3].ToString(); // SN编号
+                                        SnNo = SnNo.Replace(" ", "");
+                                        string StoreNo = dr[4].ToString(); // 退回仓库编号
+                                        string BrandIdString = dr[5].ToString(); // 产品类型
+                                        string OutNote = "";
+                                        if (list.Columns.Count > 6)
+                                        {
+                                            OutNote = dr[6].ToString(); // 出库备注
+                                        }
+
+                                        int BrandId = int.Parse(function.CheckInt(BrandIdString));
+
+                                        KqProducts kqProduct = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                                        if (kqProduct.Id > 0)
+                                        {
+                                            StoreForCode storefor = db.StoreForCode.FirstOrDefault(m => m.Code == OldStoreNo) ?? new StoreForCode();
+                                            StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == storefor.StoreId) ?? new StoreHouse();
+                                            if (store.Id > 0)
+                                            {
+                                                StoreForCode tostorefor = db.StoreForCode.FirstOrDefault(m => m.Code == StoreNo) ?? new StoreForCode();
+                                                StoreHouse tostore = db.StoreHouse.FirstOrDefault(m => m.Id == tostorefor.StoreId) ?? new StoreHouse();
+                                                if (tostore.Id > 0)
+                                                {
+                                                    MachineForSnNo machinefor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new MachineForSnNo();
+                                                    PosMachinesTwo machine = db.PosMachinesTwo.FirstOrDefault(m => m.Id == machinefor.SnId && m.BuyUserId > 0) ?? new PosMachinesTwo();
+                                                    if (machine.Id > 0)
+                                                    {
+                                                        function.WriteLog(DateTime.Now.ToString() + "\n" + Newtonsoft.Json.JsonConvert.SerializeObject(machine), "机具回仓库日志");
+                                                        machine.StoreId = tostorefor.StoreId;
+                                                        machine.BuyUserId = 0;
+                                                        machine.UserId = 0;
+                                                        machine.BindingState = 0;
+                                                        machine.ActivationState = 0;
+                                                        machine.BindingTime = null;
+                                                        machine.ActivationTime = null;
+                                                        machine.OrderId = 0;
+                                                        machine.RecycEndDate = null;
+                                                        machine.PosSnType = 0;
+                                                        machine.BindMerchantId = 0;
+                                                        machine.ScanQrTrade = 0;
+                                                        machine.DebitCardTrade = 0;
+                                                        machine.CreditTrade = 0;
+                                                        machine.UserNav = null;
+                                                        machine.IsPurchase = 0;
+                                                        machine.LeaderUserId = 0;
+                                                        machine.PreUserId = 0;
+                                                        db.SaveChanges();
+                                                        if (!storeData.ContainsKey(storefor.StoreId + "_" + BrandId))
+                                                        {
+                                                            storeData.Add(storefor.StoreId + "_" + BrandId, 1);
+                                                        }
+                                                        else
+                                                        {
+                                                            storeData[storefor.StoreId + "_" + BrandId] += 1;
+                                                        }
+                                                        if (!toStoreData.ContainsKey(tostorefor.StoreId + "_" + BrandId))
+                                                        {
+                                                            toStoreData.Add(tostorefor.StoreId + "_" + BrandId, 1);
+                                                        }
+                                                        else
+                                                        {
+                                                            toStoreData[tostorefor.StoreId + "_" + BrandId] += 1;
+                                                        }
+                                                        SuccessCount += 1;
+                                                        RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
+                                                    }
+                                                    else
+                                                    {
+                                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "已在仓库中");
+                                                    }
+                                                }
+                                                else
+                                                {
+                                                    RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "填写的退回仓库编号不正确");
+                                                }
+                                            }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "填写的原仓库编号不正确");
+                                            }
+                                            db.SaveChanges();
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "机具" + SnNo + "的品牌填写有误");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    foreach (string key in storeData.Keys)
+                                    {
+                                        string[] keylist = key.Split('_');
+                                        int StoreId = int.Parse(keylist[0]);
+                                        int BrandId = int.Parse(keylist[1]);
+                                        int OpStoreNum = storeData[key];
+                                        StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
+                                        StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
+                                        {
+                                            CreateDate = DateTime.Now,
+                                            CreateMan = Operator,
+                                            StoreId = StoreId, //仓库
+                                            TransType = 1, //交易类型
+                                            BrandId = BrandId, //产品类型
+                                            OpStoreNum = OpStoreNum, //操作库存数
+                                            OpSymbol = "-", //操作符
+                                            BeforeTotalNum = store.TotalNum, //操作前总库存数
+                                            AfterTotalNum = store.TotalNum, //操作后总库存数
+                                            BeforeLaveNum = store.LaveNum, //操作前剩余库存数
+                                            AfterLaveNum = store.LaveNum - OpStoreNum, //操作后剩余库存数
+                                            BeforeOutNum = store.OutNum, //操作前出库数
+                                            AfterOutNum = store.OutNum + OpStoreNum, //操作后出库数
+                                        }).Entity;
+                                        db.SaveChanges();
+                                        string ChangeNo = "SC";
+                                        int StoreStockChangeId = balance.Id;
+                                        string StoreStockChangeIdString = StoreStockChangeId.ToString();
+                                        for (int i = 0; i < 18 - StoreStockChangeId.ToString().Length; i++)
+                                        {
+                                            StoreStockChangeIdString = "0" + StoreStockChangeIdString;
+                                        }
+                                        ChangeNo += StoreStockChangeIdString;
+                                        balance.TransRecordNo = ChangeNo; //交易流水编号
+                                        store.LaveNum -= OpStoreNum;
+                                        db.SaveChanges();
+                                    }
+                                    foreach (string key in toStoreData.Keys)
+                                    {
+                                        string[] keylist = key.Split('_');
+                                        int StoreId = int.Parse(keylist[0]);
+                                        int BrandId = int.Parse(keylist[1]);
+                                        int OpStoreNum = toStoreData[key];
+                                        StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
+                                        StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
+                                        {
+                                            CreateDate = DateTime.Now,
+                                            CreateMan = Operator,
+                                            StoreId = StoreId, //仓库
+                                            TransType = 0, //交易类型
+                                            BrandId = BrandId, //产品类型
+                                            OpStoreNum = OpStoreNum, //操作库存数
+                                            OpSymbol = "+", //操作符
+                                            BeforeTotalNum = store.TotalNum, //操作前总库存数
+                                            AfterTotalNum = store.TotalNum + OpStoreNum, //操作后总库存数
+                                            BeforeLaveNum = store.LaveNum, //操作前剩余库存数
+                                            AfterLaveNum = store.LaveNum + OpStoreNum, //操作后剩余库存数
+                                            BeforeOutNum = store.OutNum, //操作前出库数
+                                            AfterOutNum = store.OutNum, //操作后出库数
+                                        }).Entity;
+                                        db.SaveChanges();
+                                        string ChangeNo = "SC";
+                                        int StoreStockChangeId = balance.Id;
+                                        string StoreStockChangeIdString = StoreStockChangeId.ToString();
+                                        for (int i = 0; i < 18 - StoreStockChangeId.ToString().Length; i++)
+                                        {
+                                            StoreStockChangeIdString = "0" + StoreStockChangeIdString;
+                                        }
+                                        ChangeNo += StoreStockChangeIdString;
+                                        balance.TransRecordNo = ChangeNo; //交易流水编号
+                                        store.LaveNum += OpStoreNum;
+                                        db.SaveChanges();
+                                    }
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    RedisDbconn.Instance.Set("CheckImport:" + checkKey, "success|" + SuccessCount);
+                                    RedisDbconn.Instance.SetExpire("CheckImport:" + checkKey, 60000);
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
                                     tran.Rollback();
                                     ErrorMsg msg = new ErrorMsg()
                                     {
@@ -761,113 +1012,255 @@ namespace MySystem
                                         int Status = int.Parse(function.CheckInt(dr[4].ToString())); // 提现状态
                                         string Remark = dr[5].ToString(); // 备注
                                         CashOrderNo = CashOrderNo.Replace(" ", "");
-                                        UserCashRecord edit = db.UserCashRecord.FirstOrDefault(m => m.CashOrderNo == CashOrderNo && m.ActualTradeAmount == Amount);
+                                        UserCashRecord edit = db.UserCashRecord.FirstOrDefault(m => m.CashOrderNo == CashOrderNo && m.ActualTradeAmount == Amount && m.Status == 0);
                                         if (edit != null)
                                         {
-                                            edit.Status = Status;
-                                            edit.Remark = Remark;
-                                            edit.UpdateMan = Operator;
-                                            if (Status == 1)
-                                            { 
-                                                UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
-                                                if (account != null)
+                                            if (edit.TradeType == 3)
+                                            {
+                                                edit.Status = Status;
+                                                edit.Remark = Remark;
+                                                edit.UpdateMan = Operator;
+                                                if (Status == 1)
                                                 {
-                                                    account.QueryCount = 1;
-                                                    decimal TradeAmount = edit.TradeAmount;
-                                                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
-                                                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
-                                                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                                                    account.WithdrawAmount += edit.TradeAmount;
-                                                    account.FreezeAmount -= edit.TradeAmount;
-                                                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
-                                                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
-                                                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
-                                                    db.UserAccountRecord.Add(new UserAccountRecord()
+                                                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                                                    if (account != null)
                                                     {
-                                                        CreateDate = DateTime.Now,
-                                                        UpdateDate = DateTime.Now,
-                                                        UserId = edit.UserId, //创客
-                                                        ChangeType = 3, //变动类型
-                                                        ProductType = 99, //产品类型
-                                                        ChangeAmount = edit.ActualTradeAmount, //变更金额
-                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                                                    });
-                                                    db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        decimal TradeAmount = edit.TradeAmount;
+                                                        db.LeaderAccountRecord.Add(new LeaderAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 3, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = TradeAmount, //变更金额
+                                                            BeforeBalanceAmount = account.LeaderBalanceAmount, //变更前余额
+                                                            AfterBalanceAmount = account.LeaderBalanceAmount, //变更后余额
+                                                        });
+                                                        db.SaveChanges();
+                                                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                    }
+                                                }
+                                                else if (Status == 2)
+                                                {
+                                                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                                                    if (account != null)
                                                     {
-                                                        CreateDate = DateTime.Now,
-                                                        UpdateDate = DateTime.Now,
-                                                        UserId = edit.UserId, //创客
-                                                        ChangeType = 4, //变动类型
-                                                        ProductType = 99, //产品类型
-                                                        ChangeAmount = edit.TradeFee, //变更金额
-                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                                                    });
-                                                    db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        decimal TradeAmount = edit.TradeAmount;
+                                                        account.LeaderBalanceAmount += TradeAmount;
+                                                        db.LeaderAccountRecord.Add(new LeaderAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 6, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = TradeAmount, //变更金额
+                                                            BeforeBalanceAmount = account.LeaderBalanceAmount - TradeAmount, //变更前余额
+                                                            AfterBalanceAmount = account.LeaderBalanceAmount, //变更后余额
+                                                        });
+                                                        db.SaveChanges();
+                                                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                    }
+                                                }
+                                                db.SaveChanges();
+                                                RedisDbconn.Instance.Clear("UserCashRecord:" + edit.Id);
+                                                SuccessCount += 1;
+                                                RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
+                                            }
+                                            else if (edit.TradeType == 4)
+                                            {
+                                                edit.Status = Status;
+                                                edit.Remark = Remark;
+                                                edit.UpdateMan = Operator;
+                                                if (Status == 1)
+                                                {
+                                                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                                                    if (account != null)
                                                     {
-                                                        CreateDate = DateTime.Now,
-                                                        UpdateDate = DateTime.Now,
-                                                        UserId = edit.UserId, //创客
-                                                        ChangeType = 5, //变动类型
-                                                        ProductType = 99, //产品类型
-                                                        ChangeAmount = edit.ManageFee, //变更金额
-                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                                                    });
-                                                    db.SaveChanges();
-                                                    RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                        decimal TradeAmount = edit.TradeAmount;
+                                                        decimal ActualTradeAmount = edit.ActualTradeAmount;
+                                                        account.HelpProfitBalanceAmount -= TradeAmount;
+                                                        db.HelpProfitAccountRecord.Add(new HelpProfitAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 3, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = ActualTradeAmount, //变更金额
+                                                            BeforeBalanceAmount = account.HelpProfitBalanceAmount + TradeAmount, //变更前余额
+                                                            AfterBalanceAmount = account.HelpProfitBalanceAmount, //变更后余额
+                                                        });
+                                                        db.HelpProfitAccountRecord.Add(new HelpProfitAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 4, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = edit.TradeFee, //变更金额
+                                                            BeforeBalanceAmount = account.HelpProfitBalanceAmount + TradeAmount, //变更前余额
+                                                            AfterBalanceAmount = account.HelpProfitBalanceAmount, //变更后余额
+                                                        });
+                                                        db.HelpProfitAccountRecord.Add(new HelpProfitAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 5, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = edit.ManageFee, //变更金额
+                                                            BeforeBalanceAmount = account.HelpProfitBalanceAmount + TradeAmount, //变更前余额
+                                                            AfterBalanceAmount = account.HelpProfitBalanceAmount, //变更后余额
+                                                        });
+                                                        db.SaveChanges();
+                                                        RedisDbconn.Instance.Set("HelpProfitAccount:" + edit.UserId, account);
+                                                    }
                                                 }
+                                                else if (Status == 2)
+                                                {
+                                                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                                                    if (account != null)
+                                                    {
+                                                        decimal TradeAmount = edit.TradeAmount;
+                                                        decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                        decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                        decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                        account.BalanceAmount += TradeAmount;
+                                                        account.FreezeAmount -= TradeAmount;
+                                                        decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                        decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                        decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                        db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 6, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = TradeAmount, //变更金额
+                                                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        });
+                                                        db.SaveChanges();
+                                                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                    }
+                                                }
+                                                db.SaveChanges();
+                                                RedisDbconn.Instance.Clear("UserCashRecord:" + edit.Id);
+                                                SuccessCount += 1;
+                                                RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
                                             }
-                                            else if (Status == 2)
+                                            else
                                             {
-                                                UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
-                                                if (account != null)
+                                                edit.Status = Status;
+                                                edit.Remark = Remark;
+                                                edit.UpdateMan = Operator;
+                                                if (Status == 1)
+                                                {
+                                                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                                                    if (account != null)
+                                                    {
+                                                        account.QueryCount = 1;
+                                                        decimal TradeAmount = edit.TradeAmount;
+                                                        decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                        decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                        decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                        account.WithdrawAmount += edit.TradeAmount;
+                                                        account.FreezeAmount -= edit.TradeAmount;
+                                                        decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                        decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                        decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                        db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 3, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = edit.ActualTradeAmount, //变更金额
+                                                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        });
+                                                        db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 4, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = edit.TradeFee, //变更金额
+                                                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        });
+                                                        db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 5, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = edit.ManageFee, //变更金额
+                                                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        });
+                                                        db.SaveChanges();
+                                                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                    }
+                                                }
+                                                else if (Status == 2)
                                                 {
-                                                    decimal TradeAmount = edit.TradeAmount;
-                                                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
-                                                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
-                                                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
-                                                    account.BalanceAmount += TradeAmount;
-                                                    account.FreezeAmount -= TradeAmount;
-                                                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
-                                                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
-                                                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
-                                                    db.UserAccountRecord.Add(new UserAccountRecord()
+                                                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                                                    if (account != null)
                                                     {
-                                                        CreateDate = DateTime.Now,
-                                                        UpdateDate = DateTime.Now,
-                                                        UserId = edit.UserId, //创客
-                                                        ChangeType = 6, //变动类型
-                                                        ProductType = 99, //产品类型
-                                                        ChangeAmount = TradeAmount, //变更金额
-                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
-                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
-                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
-                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
-                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
-                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
-                                                    });
-                                                    db.SaveChanges();
-                                                    RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                        decimal TradeAmount = edit.TradeAmount;
+                                                        decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                        decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                        decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                        account.BalanceAmount += TradeAmount;
+                                                        account.FreezeAmount -= TradeAmount;
+                                                        decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                        decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                        decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                        db.UserAccountRecord.Add(new UserAccountRecord()
+                                                        {
+                                                            CreateDate = DateTime.Now,
+                                                            UpdateDate = DateTime.Now,
+                                                            UserId = edit.UserId, //创客
+                                                            ChangeType = 6, //变动类型
+                                                            ProductType = 99, //产品类型
+                                                            ChangeAmount = TradeAmount, //变更金额
+                                                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        });
+                                                        db.SaveChanges();
+                                                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                                                    }
                                                 }
+                                                db.SaveChanges();
+                                                RedisDbconn.Instance.Clear("UserCashRecord:" + edit.Id);
+                                                SuccessCount += 1;
+                                                RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
                                             }
-                                            db.SaveChanges();
-                                            RedisDbconn.Instance.Clear("UserCashRecord:" + edit.Id);
-                                            SuccessCount += 1;
-                                            RedisDbconn.Instance.Set("CheckImport:" + checkKey, SuccessCount + " / " + TotalCount);
+
                                         }
                                     }
                                     DoCount += Size;
@@ -879,6 +1272,7 @@ namespace MySystem
                                 }
                                 catch (Exception ex)
                                 {
+                                    DoCount = list.Rows.Count;
                                     tran.Rollback();
                                     ErrorMsg msg = new ErrorMsg()
                                     {

+ 90 - 9
AppStart/Helper/SycnProfitService.cs

@@ -36,8 +36,16 @@ namespace MySystem
                         string date = data[1];
                         int OpType = int.Parse(data[2]);
                         string SysUserName = data[3];
+                        // if(OpType == 0)
+                        // {
+                        //     DoTradeProfit(BrandId, date, SysUserName, OpType);
+                        // }
+                        // else if(OpType == 1)
+                        // {
+                        //     DoTradeProfit2(BrandId, date, SysUserName, OpType);
+                        // }
                         DoTradeProfit(BrandId, date, SysUserName, OpType);
-                        // DoSubsidyProfit(BrandId, date, OpType);
+                        DoSubsidyProfit(BrandId, date, OpType);
                         function.WriteLog(DateTime.Now.ToString() + "\r\n\r\n", "同步分润数据");
                     }
                     catch (Exception ex)
@@ -90,10 +98,15 @@ namespace MySystem
                         profit.ProfitAmount += ProfitMoney;
                         string IdBrand = UserId + "_" + BrandId;
                         UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                        if (MachineData != null)
+                        if (MachineData == null)
                         {
-                            MachineData.TradeProfit += ProfitMoney;
+                            MachineData = db.UserMachineData.Add(new UserMachineData()
+                            {
+                                IdBrand = IdBrand,
+                            }).Entity;
+                            db.SaveChanges();
                         }
+                        MachineData.TradeProfit += ProfitMoney;
                         db.SaveChanges();
                     }
                     else if (OpType == 1)
@@ -133,8 +146,8 @@ namespace MySystem
                             Remark = ProfitType == 1 ? "直拓商户分润" : "品牌推广服务费",
                         }).Entity;
                         db.SaveChanges();
-                        RedisDbconn.Instance.Clear("UserAccount:" + UserId);
-                        RedisDbconn.Instance.Clear("UserAccount:Income:" + UserId + ":" + DateTime.Now.ToString("yyyyMM"));
+                        // RedisDbconn.Instance.Clear("UserAccount:" + UserId);
+                        // RedisDbconn.Instance.Clear("UserAccount:Income:" + UserId + ":" + DateTime.Now.ToString("yyyyMM"));
                     }
                     tran.Commit();
                 }
@@ -147,6 +160,69 @@ namespace MySystem
             }
             db.Dispose();
         }
+        private void DoTradeProfit2(int BrandId, string date, string SysUserName, int OpType = 0)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+            DataTable dt = OtherMySqlConn.dtable("select UserId,ProfitAmount from ProfitRecord where BrandId=" + BrandId + " and SeoTitle='" + date + "' and UserId>0 order by Id");
+            function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
+            int index = 0;
+            foreach (DataRow dr in dt.Rows)
+            {
+                index += 1;
+                int UserId = int.Parse(dr["UserId"].ToString());
+                decimal ProfitAmount = decimal.Parse(dr["ProfitAmount"].ToString());
+                var tran = db.Database.BeginTransaction();
+                try
+                {
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+                    if (account == null)
+                    {
+                        account = db.UserAccount.Add(new UserAccount()
+                        {
+                            Id = UserId,
+                            UserId = UserId,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                    account.BalanceAmount += ProfitAmount;
+                    account.TotalAmount += ProfitAmount;
+                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                    UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                    {
+                        CreateDate = DateTime.Now,
+                        UpdateDate = DateTime.Now,
+                        UserId = UserId, //创客
+                        ProductType = BrandId,
+                        ChangeType = 1, //变动类型
+                        ChangeAmount = ProfitAmount, //变更金额
+                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                        // Remark = ProfitType == 1 ? "直拓商户分润" : "品牌推广服务费",
+                    }).Entity;
+                    db.SaveChanges();
+                    tran.Commit();
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitAmount + "\n" + ex.ToString(), "同步到余额异常");
+                    tran.Rollback();
+                }
+                function.WriteLog(index.ToString(), "同步分润数据");
+            }
+            db.Dispose();
+        }
+
+
         //分润补贴
         private void DoSubsidyProfit(int BrandId, string date, int OpType = 0)
         { 
@@ -170,10 +246,15 @@ namespace MySystem
                     {
                         string IdBrand = UserId + "_" + BrandId;
                         UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                        if (MachineData != null)
+                        if (MachineData == null)
                         {
-                            MachineData.OtherProfit += ProfitMoney;
+                            MachineData = db.UserMachineData.Add(new UserMachineData()
+                            {
+                                IdBrand = IdBrand,
+                            }).Entity;
+                            db.SaveChanges();
                         }
+                        MachineData.OtherProfit += ProfitMoney;
                         db.SaveChanges();
                     }
                     else if (OpType == 1)
@@ -213,8 +294,8 @@ namespace MySystem
                             Remark = "直拓商户补贴",
                         }).Entity;
                         db.SaveChanges();
-                        RedisDbconn.Instance.Clear("UserAccount:" + UserId);
-                        RedisDbconn.Instance.Clear("UserAccount:Income:" + UserId + ":" + DateTime.Now.ToString("yyyyMM"));
+                        // RedisDbconn.Instance.Clear("UserAccount:" + UserId);
+                        // RedisDbconn.Instance.Clear("UserAccount:Income:" + UserId + ":" + DateTime.Now.ToString("yyyyMM"));
                     }
                     tran.Commit();
                 }

+ 275 - 0
AppStart/Helper/SycnProfitServiceV2.cs

@@ -0,0 +1,275 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading;
+using MySystem.Models;
+using Library;
+
+namespace MySystem
+{
+    public class SycnProfitServiceV2
+    {
+        public readonly static SycnProfitServiceV2 Instance = new SycnProfitServiceV2();
+        private SycnProfitServiceV2()
+        { }
+
+        public void Start()
+        {
+            Thread th = new Thread(doSomething);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void doSomething()
+        {
+            while (true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("SycnProfitQueue2");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n\r\n", "同步分润数据");
+                        string[] data = content.Split(new string[] { "#cut#" }, StringSplitOptions.None);
+                        int BrandId = int.Parse(data[0]);
+                        string date = data[1];
+                        int OpType = int.Parse(data[2]);
+                        string SysUserName = data[3];
+                        if (OpType == 0)
+                        {
+                            DoTradeProfit(BrandId, date, SysUserName);
+                            DoSubsidyProfit(BrandId, date);
+                        }
+                        else if (OpType == 1)
+                        {
+                            DoTradeProfit2(BrandId, date, SysUserName);
+                            DoSubsidyProfit2(BrandId, date);
+                        }
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n\r\n", "同步分润数据");
+                    }
+                    catch (Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "同步分润数据异常");
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(60000);
+                }
+            }
+        }
+
+        private void DoTradeProfit(int BrandId, string date, string SysUserName)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+            OtherMySqlConn.op("insert into ProfitRecord (CreateDate,CreateMan,SeoTitle,ParentNav,BrandId,UserId,DirectFlag,ProfitAmount) select now(),'root','" + date + "',(select ParentNav from Users where Id=p.UserId)," + BrandId + ",UserId,ProfitType,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord p where CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId,ProfitType order by UserId");
+            DataTable dt = OtherMySqlConn.dtable("select UserId,sum(CreditTradeProfit+DebitNonTradeCapProfit+DebitTradeCapProfit) from ProfitRewardRecord where CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "' group by UserId");
+            function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
+            int index = 0;
+            foreach (DataRow dr in dt.Rows)
+            {
+                index += 1;
+                int UserId = int.Parse(dr["UserId"].ToString());
+                decimal ProfitMoney = decimal.Parse(dr[1].ToString());
+                try
+                {
+                    string IdBrand = UserId + "_" + BrandId;
+                    UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                    if (MachineData == null)
+                    {
+                        MachineData = db.UserMachineData.Add(new UserMachineData()
+                        {
+                            IdBrand = IdBrand,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    MachineData.TradeProfit += ProfitMoney;
+                    db.SaveChanges();
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到余额异常");
+                }
+                function.WriteLog(index.ToString(), "同步分润数据");
+            }
+            OtherMySqlConn.op("update ProfitRewardRecord set CheckStatus=1 where CheckStatus=0 and BrandId=" + BrandId + " and UserId>0 and TradeMonth='" + date + "'");
+                
+            db.Dispose();
+        }
+        private void DoTradeProfit2(int BrandId, string date, string SysUserName)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+            
+            DataTable dt = OtherMySqlConn.dtable("select UserId,DirectFlag,ProfitAmount from ProfitRecord where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0");
+            function.WriteLog("分润:" + BrandId + ":" + dt.Rows.Count, "同步分润数据");
+            int index = 0;
+            foreach (DataRow dr in dt.Rows)
+            {
+                index += 1;
+                int UserId = int.Parse(dr["UserId"].ToString());
+                int DirectFlag = int.Parse(dr["DirectFlag"].ToString());
+                decimal ProfitAmount = decimal.Parse(dr["ProfitAmount"].ToString());
+                var tran = db.Database.BeginTransaction();
+                try
+                {
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+                    if (account == null)
+                    {
+                        account = db.UserAccount.Add(new UserAccount()
+                        {
+                            Id = UserId,
+                            UserId = UserId,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                    account.BalanceAmount += ProfitAmount;
+                    account.TotalAmount += ProfitAmount;
+                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                    UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                    {
+                        CreateDate = DateTime.Now,
+                        UpdateDate = DateTime.Now,
+                        UserId = UserId, //创客
+                        ProductType = BrandId,
+                        ChangeType = 1, //变动类型
+                        ChangeAmount = ProfitAmount, //变更金额
+                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                        Remark = DirectFlag == 1 ? "直拓商户分润" : "品牌推广服务费",
+                    }).Entity;
+                    db.SaveChanges();
+                    tran.Commit();
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitAmount + "\n" + ex.ToString(), "同步到余额异常");
+                    tran.Rollback();
+                }
+                function.WriteLog(index.ToString(), "同步分润数据");
+            }
+            OtherMySqlConn.dtable("update ProfitRecord set Version=1 where BrandId=" + BrandId + " and SeoTitle='" + date + "' and Version=0 and UserId>0");
+                
+            db.Dispose();
+        }
+
+
+        //分润补贴
+        private void DoSubsidyProfit(int BrandId, string date)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+            
+            DataTable dt = OtherMySqlConn.dtable("select SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail where Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId");
+            function.WriteLog("补贴:" + BrandId + ":" + dt.Rows.Count, "同步补贴数据");
+            int index = 0;
+            foreach (DataRow dr in dt.Rows)
+            {
+                index += 1;
+                int UserId = int.Parse(dr["SubsidyUserId"].ToString());
+                decimal ProfitMoney = decimal.Parse(dr[1].ToString());
+                try
+                {
+                    Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                    string IdBrand = UserId + "_" + BrandId;
+                    UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                    if (MachineData == null)
+                    {
+                        MachineData = db.UserMachineData.Add(new UserMachineData()
+                        {
+                            IdBrand = IdBrand,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    MachineData.OtherProfit += ProfitMoney;
+                    db.SaveChanges();
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到补贴异常");
+                }
+                function.WriteLog(index.ToString(), "同步补贴数据");
+            }
+            OtherMySqlConn.dtable("update ProfitSubsidyDetail set Status=1 where Status=0 and BrandId=" + BrandId + " and TradeMonth='" + date + "'");
+                
+            db.Dispose();
+        }
+
+        private void DoSubsidyProfit2(int BrandId, string date)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+            
+            DataTable dt = OtherMySqlConn.dtable("select SubsidyUserId,sum(SubsidyProfitRate) from ProfitSubsidyDetail where Status=1 and BrandId=" + BrandId + " and TradeMonth='" + date + "' GROUP BY SubsidyUserId");
+            function.WriteLog("补贴:" + BrandId + ":" + dt.Rows.Count, "同步补贴数据");
+            int index = 0;
+            foreach (DataRow dr in dt.Rows)
+            {
+                index += 1;
+                int UserId = int.Parse(dr["SubsidyUserId"].ToString());
+                decimal ProfitMoney = decimal.Parse(dr[1].ToString());
+                var tran = db.Database.BeginTransaction();
+                try
+                {
+                    Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
+                    if (account == null)
+                    {
+                        account = db.UserAccount.Add(new UserAccount()
+                        {
+                            Id = UserId,
+                            UserId = UserId,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                    account.BalanceAmount += ProfitMoney;
+                    account.TotalAmount += ProfitMoney;
+                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                    UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                    {
+                        CreateDate = DateTime.Now,
+                        UpdateDate = DateTime.Now,
+                        UserId = UserId, //创客
+                        ProductType = BrandId,
+                        ChangeType = 111, //变动类型
+                        ChangeAmount = ProfitMoney, //变更金额
+                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                        Remark = "直拓商户补贴",
+                    }).Entity;
+                    db.SaveChanges();
+                    tran.Commit();
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到补贴异常");
+                    tran.Rollback();
+                }
+                function.WriteLog(index.ToString(), "同步补贴数据");
+            }
+            OtherMySqlConn.dtable("update ProfitSubsidyDetail set Status=2 where Status=1 and BrandId=" + BrandId + " and TradeMonth='" + date + "'");
+                
+            db.Dispose();
+        }
+    }
+}

+ 275 - 0
AppStart/Helper/SycnSpTradeService.cs

@@ -0,0 +1,275 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.Models;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class SycnSpTradeService
+    {
+        public readonly static SycnSpTradeService Instance = new SycnSpTradeService();
+        private SycnSpTradeService()
+        { }
+
+        public void Start(string PosSn, DateTime start, DateTime end)
+        {
+            SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
+            WebCMSEntities db = new WebCMSEntities();
+            IQueryable<SpModels.TradeRecord> trades = spdb.TradeRecord.Where(m => m.CreateDate >= start && m.CreateDate < end && m.TradeSnNo == PosSn);
+            foreach (SpModels.TradeRecord trade in trades.ToList())
+            {
+                bool op = true;
+                if (trade.SerEntryMode == "N")
+                {
+                    if (trade.TradeAmount == 9900 || trade.TradeAmount == 19900 || trade.TradeAmount == 29900)
+                    {
+                        op = false;
+                        MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new MachineForMerNo();
+                        PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
+                        if (pos != null)
+                        {
+                            if (trade.SerEntryMode == "N" && trade.ProductType == "1")
+                            {
+                                pos.SeoKeyword = trade.TradeAmount.ToString("f2");
+                                // pos.IsPurchase = 0;
+                                db.SaveChanges();
+                            }
+                        }
+                        SpModels.TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
+                        if (edit != null)
+                        {
+                            edit.Status = 2;
+                        }
+                        spdb.SaveChanges();
+                    }
+                }
+                if (trade.DiscountRateFlag == "True")
+                {
+                    op = false;
+                    SpModels.TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
+                    if (edit != null)
+                    {
+                        edit.Status = 2;
+                    }
+                    spdb.SaveChanges();
+                }
+                if(trade.ProductType == "7" && trade.TradeStatus != "00")
+                {
+                    op = false;
+                    SpModels.TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
+                    if (edit != null)
+                    {
+                        edit.Status = 2;
+                    }
+                    spdb.SaveChanges();
+                }
+                if (op)
+                {
+                    MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new MachineForMerNo();
+                    PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
+                    if (pos != null)
+                    {
+                        if (pos.BindMerchantId > 0)
+                        {
+                            Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new Users();
+                            int TopUserId = 0;
+                            if (!string.IsNullOrEmpty(user.ParentNav))
+                            {
+                                TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                            }
+                            // TODO: 交易记录表,每月的Id单独存放,解决查询效率问题
+                            bool check = db.TradeRecord.Any(m => m.Id >= 700000 && m.RecordNo == trade.TradeSerialNo);
+                            if (!check)
+                            {
+                                decimal TradeAmount = trade.TradeAmount;
+                                int BankCardType = -1;
+                                int QrPayFlag = 0;
+                                int VipFlag = 0;
+                                int PayType = 0;
+                                if (pos.BrandId == 1 || pos.BrandId == 3)
+                                {
+                                    TradeAmount = TradeAmount / 100;
+                                    BankCardType = int.Parse(trade.BankCardType);
+                                    if (trade.TradeType == "02") QrPayFlag = 1;
+                                    else if (trade.TradeType == "NQ") PayType = 1;
+                                    if (trade.SettleMethod == "E") VipFlag = 1;
+                                }
+                                else if (pos.BrandId == 2)
+                                {
+                                    if (trade.TradeType == "DEBIT_BY_CARD")
+                                    {
+                                        BankCardType = 0;
+                                    }
+                                    else
+                                    {
+                                        BankCardType = 1;
+                                    }
+                                    if (trade.TradeType == "CLOUD_PAY") QrPayFlag = 1;
+                                }
+                                else if (pos.BrandId == 4 || pos.BrandId == 5 || pos.BrandId == 8 || pos.BrandId == 9)
+                                {
+                                    TradeAmount = TradeAmount / 100;
+                                    if (trade.BankCardType == "100")
+                                    {
+                                        BankCardType = 1;
+                                    }
+                                    else if (trade.BankCardType == "200")
+                                    {
+                                        BankCardType = 0;
+                                    }
+                                    if (trade.TradeType == "200") QrPayFlag = 1;
+                                    if (trade.Field1 == "1") VipFlag = 1;
+                                }
+                                else if (pos.BrandId == 6)
+                                {
+                                    TradeAmount = TradeAmount / 100;
+                                    if (trade.BankCardType == "01" || trade.BankCardType == "11")
+                                    {
+                                        BankCardType = 0;
+                                    }
+                                    else
+                                    {
+                                        BankCardType = 1;
+                                    }
+                                }
+                                else if (pos.BrandId == 7)
+                                {
+                                    TradeAmount = TradeAmount / 100;
+                                    if (trade.BankCardType == "OA" || trade.BankCardType == "CC" || trade.BankCardType == "SCC")
+                                    {
+                                        BankCardType = 1;
+                                    }
+                                    else
+                                    {
+                                        BankCardType = 0;
+                                    }
+                                }
+                                int BrandId = int.Parse(trade.ProductType);
+                                if (BrandId == 1 && trade.MerNo.StartsWith("M900"))
+                                {
+                                    BrandId = 3;
+                                }
+                                if (BrandId == 4 && trade.DeviceType == "200")
+                                {
+                                    BrandId = 5;
+                                }
+                                decimal SourceTradeAmount = TradeAmount;
+                                if (pos.Sort == 0 && pos.BrandId == 7)
+                                {
+                                    decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
+                                    if (deposit > 0)
+                                    {
+                                        TradeAmount -= deposit;
+                                        pos.Sort = 1;
+                                    }
+                                }
+                                if (TradeAmount > 0)
+                                {
+                                    ulong MerHelpFlag = 0;
+                                    decimal DepositAmt = decimal.Parse(function.CheckNum(pos.SeoKeyword));
+                                    if (DepositAmt > 0)
+                                    {
+                                        int Days = int.Parse(RedisDbconn.Instance.Get<string>("pobjrule:" + pos.BrandId + ":HelpPolicy:Days")); //天数
+                                        if (pos.BindingTime != null)
+                                        {
+                                            if (pos.BindingTime.Value.AddDays(Days) > DateTime.Now)
+                                            {
+                                                MerHelpFlag = 1;
+                                            }
+                                        }
+                                    }
+                                    int CapFlag = 0;
+                                    if(BankCardType == 0 && TradeAmount >= 1666.67M)
+                                    {
+                                        CapFlag = 1;
+                                    }
+                                    db.TradeRecord.Add(new TradeRecord()
+                                    {
+                                        ParentNav = user.ParentNav,
+                                        CreateDate = trade.CreateDate,
+                                        UpdateDate = trade.UpdateDate,
+                                        RecordNo = trade.TradeSerialNo, //单号
+                                        UserId = pos.UserId, //创客
+                                        MerchantId = pos.BindMerchantId, //商户
+                                        MerNo = trade.MerNo, //渠道商户编号
+                                        MerHelpFlag = MerHelpFlag, //是否属于扶持周期内商户
+                                        HelpMonthCount = 0, //扶持第几个月
+                                        MerBuddyType = user.MerchantType, //商户创客类型
+                                        SnNo = trade.TradeSnNo, //渠道SN号
+                                        TradeSerialNo = trade.ChannelSerial, //交易流水号
+                                        TradeAmount = TradeAmount, //交易金额
+                                        BankCardType = BankCardType, //银行卡类型
+                                        QrPayFlag = QrPayFlag, //云闪付标识
+                                        CapFlag = CapFlag, //借记卡是否封顶
+                                        VipFlag = VipFlag, //会员标记
+                                        PayType = PayType, //支付方式
+                                        BrandId = BrandId, //品牌
+                                        Remark = trade.Remark, //备注
+                                        TopUserId = TopUserId, //顶级创客
+                                        MerUserId = pos.UserId, //商户直属创客
+                                    });
+                                }
+                                decimal CheckMoney = 1000;
+                                int CheckDays = 30;
+                                if (pos.BrandId == 6)
+                                {
+                                    CheckMoney = 5000;
+                                }
+                                if (BankCardType == 1 || (BankCardType == 2 && pos.BrandId == 1) || (BankCardType == 2 && pos.BrandId == 3))
+                                {
+                                    pos.CreditTrade += SourceTradeAmount;
+                                }
+                                else if (BankCardType == 0)
+                                {
+                                    pos.DebitCardTrade += TradeAmount;
+                                }
+                                // if (pos.CreditTrade < CheckMoney)
+                                // {
+                                //     decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
+                                //     if (deposit > 0 && pos.IsPurchase != 1)
+                                //     {
+                                //         pos.IsPurchase = 0;
+                                //     }
+                                // }
+                                if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && pos.TransferTime < pos.BindingTime && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
+                                {
+                                    // decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
+                                    // if (deposit == 0 && pos.IsPurchase != 1)
+                                    // {
+                                    //     pos.IsPurchase = 0;
+                                    // }
+                                    pos.ActivationState = 1;
+                                    pos.ActivationTime = DateTime.Now;
+                                    PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
+                                    if (merchant != null)
+                                    {
+                                        merchant.ActiveStatus = 1;
+                                        merchant.MerStandardDate = DateTime.Now;
+                                        db.SaveChanges();
+                                        RedisDbconn.Instance.Set("PosMerchantInfo:" + merchant.Id, merchant);
+                                    }
+                                    //发放大盟主奖励
+                                    if(pos.LeaderUserId > 0)
+                                    {
+                                        RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
+                                    }
+                                }
+                                db.SaveChanges();
+                            }
+                            SpModels.TradeRecord edit = spdb.TradeRecord.FirstOrDefault(m => m.Id == trade.Id);
+                            if (edit != null)
+                            {
+                                edit.Status = 2;
+                            }
+                            spdb.SaveChanges();
+                        }
+                    }
+                }
+            }
+            spdb.Dispose();
+            db.Dispose();
+        }
+    }
+}

+ 21 - 20
AppStart/OssHelper.cs

@@ -12,27 +12,27 @@ namespace MySystem
 {
     public class OssHelper
     {
-        string key = ConfigurationManager.AppSettings["OSSKey"].ToString(); //阿里云AccessKey ID
-        string secret = ConfigurationManager.AppSettings["OSSSecret"].ToString();  //阿里云Access Key Secret
+        string key = "LTAI5t7ivibdYZTro4SRVZ9M"; //阿里云AccessKey ID
+        string secret = "nfr1bmbJbMhLuaj10iBORkuFfIAX7M";  //阿里云Access Key Secret
         public string PathName = ConfigurationManager.AppSettings["Database"].ToString();
-        public string endpoint = ConfigurationManager.AppSettings["OSSEndpoint"].ToString();  //endpoint
-        public string bucketName = ConfigurationManager.AppSettings["OSSBucketName"].ToString();
-        public string SourceHost = "";
-        public bool OssStatus = false;
+        public string endpoint = "oss-cn-chengdu.aliyuncs.com";  //endpoint
+        public string bucketName = "kexiaoshuang";
+        public string SourceHost = ConfigurationManager.AppSettings["OssHost"].ToString();
+        public bool OssStatus = true;
         public readonly static OssHelper Instance = new OssHelper();
         private OssHelper()
         {
-            SystemSet set = new WebCMSEntities().SystemSet.FirstOrDefault() ?? new SystemSet();
-            if (set.UploadOss == 1)
-            { 
-                SourceHost = "http://" + ConfigurationManager.AppSettings["OSSBucketName"].ToString() + "." + ConfigurationManager.AppSettings["OSSEndpoint"].ToString();
-                OssStatus = true;
-            }
-            else
-            { 
-                SourceHost = "";
-                OssStatus = false;
-            }
+            // SystemSet set = new WebCMSEntities().SystemSet.FirstOrDefault() ?? new SystemSet();
+            // if (set.UploadOss == 1)
+            // { 
+            //     SourceHost = "http://" + ConfigurationManager.AppSettings["OSSBucketName"].ToString() + "." + ConfigurationManager.AppSettings["OSSEndpoint"].ToString();
+            //     OssStatus = true;
+            // }
+            // else
+            // { 
+            //     SourceHost = "";
+            //     OssStatus = false;
+            // }
         }
 
         public void Start()//启动
@@ -82,8 +82,9 @@ namespace MySystem
         //要执行的方法
         public void ScanQueue(string data, string FileFullName)
         {
-            SystemSet set = new WebCMSEntities().SystemSet.FirstOrDefault() ?? new SystemSet();
-            if (set.UploadOss == 1)
+            // SystemSet set = new WebCMSEntities().SystemSet.FirstOrDefault() ?? new SystemSet();
+            // if (set.UploadOss == 1)
+            if(OssStatus)
             {
                 var client = new OssClient(endpoint, key, secret);
                 ScanQueue(data, FileFullName, client);
@@ -92,7 +93,7 @@ namespace MySystem
         private void ScanQueue(string data, string FileFullName, OssClient client)
         {
             // 上传文件。
-            string localFile = function.getPath(data);
+            string localFile = function.getPath(PathName + data);
             string filePath = data.TrimStart('/');
             if (!data.StartsWith(PathName))
             {

+ 25 - 0
AppStart/PublicFunction.cs

@@ -414,6 +414,31 @@ namespace MySystem
         }
         #endregion
 
+        #region 重置创客机具数量
+
+        public static void SycnMachineCount(int Id = 0, int BrandId = 0)
+        {
+            WebCMSEntities dbnew = new WebCMSEntities();
+            string IdBrand = Id + "_" + BrandId;
+            UserMachineData machineData = dbnew.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+            if (machineData == null)
+            {
+                machineData = dbnew.UserMachineData.Add(new UserMachineData()
+                {
+                    IdBrand = IdBrand
+                }).Entity;
+                dbnew.SaveChanges();
+            }
+            machineData.BindCount = dbnew.PosMachinesTwo.Count(m => m.Status > -1 && m.BuyUserId == Id && m.BrandId == BrandId && m.BindingState == 1);
+            machineData.UnBindCount = dbnew.PosMachinesTwo.Count(m => m.Status > -1 && m.BuyUserId == Id && m.BrandId == BrandId && m.BindingState == 0);
+            machineData.TotalMachineCount = machineData.BindCount + machineData.UnBindCount;
+            dbnew.SaveChanges();
+            dbnew.Dispose();
+        }
+
+        #endregion
+
+
 
         #region 测试创客Id
 

+ 26 - 0
AppStart/RelationClass.cs

@@ -473,5 +473,31 @@ namespace MySystem
             return "";
         }
 
+        public static string GetPosMachinesTwoInfo(int key)
+        {
+            using (WebCMSEntities db = new WebCMSEntities())
+            {
+                PosMachinesTwo item = db.PosMachinesTwo.FirstOrDefault(m => m.Id == key);
+                if (item != null)
+                {
+                    return item.PosSn;
+                }
+            }
+            return "";
+        }
+
+        public static string GetStoreMachineApplyInfo(int key)
+        {
+            using (WebCMSEntities db = new WebCMSEntities())
+            {
+                StoreMachineApply item = db.StoreMachineApply.FirstOrDefault(m => m.Id == key);
+                if (item != null)
+                {
+                    return item.ApplyNo;
+                }
+            }
+            return "";
+        }
+
     }
 }

+ 27 - 0
AppStart/RelationClassForConst.cs

@@ -102,6 +102,27 @@ namespace MySystem
                 case 112:
                     result = "推荐奖励";
                     break;
+                case 113:
+                    result = "招商节奖励";
+                    break;
+                case 114:
+                    result = "私董会分红";
+                    break;
+                case 115:
+                    result = "分仓奖励";
+                    break;
+                case 116:
+                    result = "大盟主奖励";
+                    break;
+                case 117:
+                    result = "大盟主奖励(储蓄金入账)";
+                    break;
+                case 118:
+                    result = "大盟主奖励(购机奖励)";
+                    break;
+                case 119:
+                    result = "分仓临时额度退还";
+                    break;
             }
             return result;
         }
@@ -117,6 +138,12 @@ namespace MySystem
                 case 2:
                     result = "用户提现";
                     break;
+                case 3:
+                    result = "盟主提现";
+                    break;
+                case 4:
+                    result = "助利宝提现";
+                    break;
             }
             return result;
         }

+ 11 - 0
AppStart/Tables/RecommendPriceList.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+namespace MySystem
+{
+    public class RecommendPriceList
+    {
+        public int UserId { get; set; }
+        public int ActCount { get; set; }
+        public decimal TradeAmount { get; set; }
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 0 - 483
AppStart/WeChatFunction.cs


+ 2 - 0
Areas/Admin/Controllers/BsServer/BaseController.cs

@@ -24,6 +24,8 @@ namespace MySystem.Areas.Admin.Controllers
         public string ApiKey = "G6H7@J8%";
         public Models.WebCMSEntities db = new Models.WebCMSEntities();
         public BsModels.WebCMSEntities bsdb = new BsModels.WebCMSEntities();
+        public SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
+        public CashModels.WebCMSEntities cashdb = new CashModels.WebCMSEntities();
         public string Host = Library.ConfigurationManager.AppSettings["Host"].ToString();
 
         public string ShareHost = "";

+ 25 - 19
Areas/Admin/Controllers/BsServer/MsgPersonalController.cs

@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
-using MySystem.BsModels;
+using MySystem.Models;
 using Library;
 using LitJson;
 using MySystemLib;
@@ -25,7 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
     {
         public MsgPersonalController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
         #region 个人消息列表
@@ -50,12 +50,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 个人消息列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(MsgPersonal data, string MakerCode, string StatusSelect, string ReadFlagSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(MsgPersonal data, string MakerCode, string StatusSelect, string ReadFlagSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("Title", "1"); //标题
             Fields.Add("Summary", "1"); //内容
 
@@ -75,8 +74,15 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and ReadFlag=" + ReadFlagSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPersonal", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPersonal", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -147,7 +153,7 @@ namespace MySystem.Areas.Admin.Controllers
                     Fields.Add("PushFlag", data.PushFlag); //推送标记
                     Fields.Add("Remark", data.Remark); //备注
                     Fields.Add("Status", 1);
-                    int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("MsgPersonal", Fields, 0);
+                    int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MsgPersonal", Fields, 0);
                     AddSysLog(data.Id.ToString(), "MsgPersonal", "add");
                     bsdb.SaveChanges();
                     SetRedis(Id);
@@ -178,7 +184,7 @@ namespace MySystem.Areas.Admin.Controllers
                                 Fields.Add("PushFlag", data.PushFlag); //推送标记
                                 Fields.Add("Remark", data.Remark); //备注
                                 Fields.Add("Status", 1);
-                                int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("MsgPersonal", Fields, 0);
+                                int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MsgPersonal", Fields, 0);
                                 AddSysLog(data.Id.ToString(), "MsgPersonal", "add");
                                 bsdb.SaveChanges();
                                 SetRedis(Id);
@@ -191,7 +197,7 @@ namespace MySystem.Areas.Admin.Controllers
                     }
                 }
             }
-
+            
             return "success";
         }
 
@@ -209,7 +215,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.right = right;
 
 
-            MsgPersonal editData = bsdb.MsgPersonal.FirstOrDefault(m => m.Id == Id) ?? new MsgPersonal();
+            MsgPersonal editData = db.MsgPersonal.FirstOrDefault(m => m.Id == Id) ?? new MsgPersonal();
             ViewBag.data = editData;
             return View();
         }
@@ -244,7 +250,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, data.Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "MsgPersonal", "update");
             bsdb.SaveChanges();
             SetRedis(data.Id, "edit");
@@ -269,7 +275,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
 
@@ -293,7 +299,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("PushFlag", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
             return "success";
@@ -316,7 +322,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
             return "success";
@@ -339,7 +345,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPersonal", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPersonal", Fields, id);
             }
             bsdb.SaveChanges();
             return "success";
@@ -354,7 +360,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("MsgPersonal", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MsgPersonal", Sort, Id);
 
             AddSysLog(Id.ToString(), "MsgPersonal", "sort");
             return "success";
@@ -374,13 +380,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                bsdb.MsgPersonal.Add(new MsgPersonal()
+                db.MsgPersonal.Add(new MsgPersonal()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
 
                 });
-                bsdb.SaveChanges();
+                db.SaveChanges();
             }
             AddSysLog("0", "MsgPersonal", "Import");
             return "success";
@@ -400,7 +406,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("Title", "2"); //标题
             Fields.Add("ReadFlag", "1"); //已读标记
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPersonal", Fields, "Id desc", "0", 1, 20000, "", "", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPersonal", Fields, "Id desc", "0", 1, 20000, "", "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -428,7 +434,7 @@ namespace MySystem.Areas.Admin.Controllers
 
         private void SetRedis(int Id, string EditType = "add")
         {
-            MsgPersonal msg = bsdb.MsgPersonal.FirstOrDefault(m => m.Id == Id);
+            MsgPersonal msg = db.MsgPersonal.FirstOrDefault(m => m.Id == Id);
             if (msg != null)
             {
                 if (EditType == "add")

+ 29 - 23
Areas/Admin/Controllers/BsServer/MsgPlacardController.cs

@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
-using MySystem.BsModels;
+using MySystem.Models;
 using Library;
 using LitJson;
 using MySystemLib;
@@ -25,7 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
     {
         public MsgPlacardController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
         #region 公告消息列表
@@ -50,12 +50,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 公告消息列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(MsgPlacard data, string MsgTypeSelect, string StatusSelect, string PushTypeSelect, string PushFlagSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(MsgPlacard data, string MsgTypeSelect, string StatusSelect, string PushTypeSelect, string PushFlagSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("Title", "2"); //标题
             
             string condition = " and Status>-1";
@@ -79,8 +78,15 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and PushFlag=" + PushFlagSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPlacard", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPlacard", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -154,9 +160,9 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("MsgPlacard", Fields, 0);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MsgPlacard", Fields, 0);
             AddSysLog(Id.ToString(), "MsgPlacard", "add");
-            bsdb.SaveChanges();
+            db.SaveChanges();
 
             SetRedis(Id, true);
 
@@ -185,7 +191,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.right = right;
 
 
-            MsgPlacard editData = bsdb.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
+            MsgPlacard editData = db.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
             ViewBag.data = editData;
             return View();
         }
@@ -222,9 +228,9 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, data.Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "MsgPlacard", "update");
-            bsdb.SaveChanges();
+            db.SaveChanges();
             
             SetRedis(data.Id, true);
 
@@ -240,7 +246,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
 
-            MsgPlacard editData = bsdb.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
+            MsgPlacard editData = db.MsgPlacard.FirstOrDefault(m => m.Id == Id) ?? new MsgPlacard();
             ViewBag.data = editData;
             return View();
         }
@@ -262,10 +268,10 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, id);
                 SetRedis(0, true);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
 
             return "success";
         }
@@ -287,9 +293,9 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
             return "success";
         }
 
@@ -310,9 +316,9 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("MsgPlacard", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MsgPlacard", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
             return "success";
         }
 
@@ -325,7 +331,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("MsgPlacard", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MsgPlacard", Sort, Id);
 
             AddSysLog(Id.ToString(), "MsgPlacard", "sort");
             return "success";
@@ -345,13 +351,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                bsdb.MsgPlacard.Add(new MsgPlacard()
+                db.MsgPlacard.Add(new MsgPlacard()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
 
                 });
-                bsdb.SaveChanges();
+                db.SaveChanges();
             }
             AddSysLog("0", "MsgPlacard", "Import");
             return "success";
@@ -373,7 +379,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("PushType", "1"); //推送类型
             Fields.Add("PushFlag", "1"); //推送标记
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("MsgPlacard", Fields, "Id desc", "0", 1, 20000, "", "", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MsgPlacard", Fields, "Id desc", "0", 1, 20000, "", "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -403,7 +409,7 @@ namespace MySystem.Areas.Admin.Controllers
             if (All)
             {
                 RedisDbconn.Instance.Clear("MsgPlacardList");
-                var msgs = bsdb.MsgPlacard.Select(m => new { m.Id, m.Status, m.Sort }).Where(m => m.Status > -1).OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id).ToList();
+                var msgs = db.MsgPlacard.Select(m => new { m.Id, m.Status, m.Sort }).Where(m => m.Status > -1).OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id).ToList();
                 foreach (var msg in msgs)
                 {
                     RedisDbconn.Instance.AddList("MsgPlacardList", msg.Id);
@@ -411,7 +417,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
             if (Id > 0)
             {
-                MsgPlacard edit = bsdb.MsgPlacard.FirstOrDefault(m => m.Id == Id);
+                MsgPlacard edit = db.MsgPlacard.FirstOrDefault(m => m.Id == Id);
                 if (edit != null)
                 {
                     RedisDbconn.Instance.Set("MsgPlacard:" + Id, edit);

+ 0 - 339
Areas/Admin/Controllers/BsServer/RightDicController.cs

@@ -1,339 +0,0 @@
-/*
- * 单页内容
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.BsModels;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class RightDicController : BaseController
-    {
-        public RightDicController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
-        }
-
-        #region 单页内容列表
-
-        /// <summary>
-        /// 根据条件查询单页内容列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(RightDic data, string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询单页内容列表
-
-        /// <summary>
-        /// 单页内容列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(RightDic data, int page = 1, int limit = 30)
-        {
-            List<RightDic> diclist = bsdb.RightDic.OrderBy(m => m.Id).ToList();
-            foreach (RightDic dic in diclist)
-            {
-                int nameLength = dic.Id.Split('_').Length;
-                for (int i = 1; i < nameLength; i++)
-                {
-                    dic.Name = "  " + dic.Name;
-                }
-            }
-            Dictionary<string, object> obj = new Dictionary<string, object>();
-            obj.Add("code", 0);
-            obj.Add("msg", "");
-            obj.Add("count", diclist.Count);
-            obj.Add("data", diclist);
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 修改
-
-        /// <summary>
-        /// 修改
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string Id = "")
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            RightDic editData = bsdb.RightDic.FirstOrDefault(m => m.Id == Id) ?? new RightDic();
-            ViewBag.data = editData;
-
-            string PColId = "";
-            if (editData.Id.Contains("_"))
-            { 
-                PColId = editData.Id.Substring(0, editData.Id.LastIndexOf("_"));
-            }
-            else
-            {
-                PColId = editData.Id;
-            }
-            ViewBag.OldPColId = PColId;
-            ViewBag.PColId = PColId;
-            return View();
-        }
-
-        [HttpPost]
-        public string EditPost(RightDic data, string OldPColId, string PColId)
-        {
-            RightDic adddic = new RightDic();
-            bool op = false;
-            RightDic dic = bsdb.RightDic.FirstOrDefault(m => m.Id == data.Id);
-            if (dic != null)
-            {
-                if (OldPColId != PColId)
-                {
-                    string words = "123456789abcdefghijklmnopqrstuvwxyz";
-                    if (!string.IsNullOrEmpty(PColId))
-                    {
-                        int Len = PColId.Length + 2;
-                        int checkcount = bsdb.RightDic.Count(m => m.Id.StartsWith(PColId) && m.Id.Length == Len);
-                        if (checkcount > 0)
-                        {
-                            RightDic checkdic = bsdb.RightDic.Where(m => m.Id.StartsWith(PColId) && m.Id.Length == Len).OrderByDescending(m => m.Id).FirstOrDefault();
-                            string last_id = "";
-                            string[] idlist = checkdic.Id.Split('_');
-                            last_id = idlist[idlist.Length - 1];
-                            last_id = words.Substring(words.IndexOf(last_id) + 1, 1);
-                            adddic.Id = PColId + "_" + last_id;
-                        }
-                        else
-                        {
-                            adddic.Id = PColId + "_1";
-                        }
-                    }
-                    else
-                    {
-                        int checkcount = bsdb.RightDic.Count(m => m.Id.Length == 1);
-                        if (checkcount > 0)
-                        {
-                            RightDic checkdic = bsdb.RightDic.Where(m => m.Id.Length == 1).OrderByDescending(m => m.Id).FirstOrDefault();
-                            string last_id = words.Substring(words.IndexOf(checkdic.Id) + 1, 1);
-                            adddic.Id = PColId + "_" + last_id;
-                        }
-                        else
-                        {
-                            adddic.Id = "1";
-                        }
-                    }
-                    adddic.Name = data.Name;
-                    adddic.MainMenu = data.MainMenu;
-                    adddic.MainStat = data.MainStat;
-                    adddic.MainDataList = data.MainDataList;
-                    adddic.Url = dic.Url;
-                    adddic.RightLevel = dic.RightLevel;
-                    bsdb.RightDic.Remove(dic);
-                    op = true;
-                }
-                else
-                {
-                    dic.Name = data.Name;
-                    dic.MainMenu = data.MainMenu;
-                    dic.MainStat = data.MainStat;
-                    dic.MainDataList = data.MainDataList;
-                }
-            }
-            AddSysLog(data.Id.ToString(), "RightDic", "update");
-            bsdb.SaveChanges();
-            if (op)
-            {
-                bsdb.RightDic.Add(adddic);
-                bsdb.SaveChanges();
-            }
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改
-
-        /// <summary>
-        /// 修改
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult RightSet(string Id = "")
-        {
-            List<OperateRightList> rights = bsdb.OperateRightList.ToList();
-            ViewBag.rights = rights;
-            ViewBag.Id = Id;
-
-            List<string> RightList = new List<string>();
-            List<MenuRight> MenuRights = bsdb.MenuRight.Where(m => m.MenuId.StartsWith(Id)).ToList();
-            foreach (MenuRight sub in MenuRights)
-            {
-                RightList.Add(sub.MenuId.Replace(Id + "_", "") + "_" + sub.Name);
-            }
-            ViewBag.RightList = RightList;
-
-            RightDic editData = bsdb.RightDic.FirstOrDefault(m => m.Id == Id) ?? new RightDic();
-            ViewBag.OtherRight = editData.OtherRight;
-            return View();
-        }
-
-        [HttpPost]
-        public string RightSetPost(string Id, string OtherRight, string RightList)
-        {
-            IQueryable<MenuRight> MenuRights = bsdb.MenuRight.Where(m => m.MenuId.StartsWith(Id));
-            foreach (MenuRight sub in MenuRights)
-            {
-                bsdb.MenuRight.Remove(sub);
-            }
-            bsdb.SaveChanges();
-            if (!string.IsNullOrEmpty(RightList))
-            {
-                string[] Rights = RightList.TrimEnd(',').Split(',');
-                foreach (string Right in Rights)
-                {
-                    string[] list = Right.Split('_');
-                    bsdb.MenuRight.Add(new MenuRight()
-                    {
-                        MenuId = Id + "_" + list[0],
-                        Name = list[1],
-                    });
-                }
-            }
-            RightDic edit = bsdb.RightDic.FirstOrDefault(m => m.Id == Id);
-            if(edit != null)
-            {
-                edit.OtherRight = OtherRight;
-            }
-            bsdb.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(string Id, int Sort)
-        {
-            RightDic edit = bsdb.RightDic.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            { 
-                edit.Sort = Sort;
-                bsdb.SaveChanges();
-            }
-            return "success";
-        }
-        #endregion
-
-        #region 设置快捷方式
-        /// <summary>
-        /// 设置快捷方式
-        /// </summary>
-        /// <param name="Id"></param>
-        public string SetMainMenu(string Id, bool value)
-        {
-            RightDic edit = bsdb.RightDic.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                if (value)
-                {
-                    edit.MainMenu = 1;
-                }
-                else
-                { 
-                    edit.MainMenu = 0;
-                }
-                bsdb.SaveChanges();
-            }
-            return "success";
-        }
-        #endregion
-
-        #region 统计
-        /// <summary>
-        /// 统计
-        /// </summary>
-        /// <param name="Id"></param>
-        public string SetMainStat(string Id, bool value)
-        {
-            RightDic edit = bsdb.RightDic.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                if (value)
-                {
-                    edit.MainStat = 1;
-                }
-                else
-                { 
-                    edit.MainStat = 0;
-                }
-                bsdb.SaveChanges();
-            }
-            return "success";
-        }
-        #endregion
-
-        #region 主界面数据列表
-        /// <summary>
-        /// 主界面数据列表
-        /// </summary>
-        /// <param name="Id"></param>
-        public string SetMainDataList(string Id, bool value)
-        {
-            RightDic edit = bsdb.RightDic.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                if (value)
-                {
-                    edit.MainDataList = 1;
-                }
-                else
-                { 
-                    edit.MainDataList = 0;
-                }
-                bsdb.SaveChanges();
-            }
-            return "success";
-        }
-        #endregion
-
-        #region 设置图标
-        /// <summary>
-        /// 设置图标
-        /// </summary>
-        /// <param name="Id"></param>
-        public string SetIcon(string Id, string value)
-        {
-            RightDic edit = bsdb.RightDic.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                edit.Icon = value;
-                bsdb.SaveChanges();
-            }
-            return "success";
-        }
-        #endregion
-
-    }
-}

+ 0 - 339
Areas/Admin/Controllers/BsServer/UploadParamsController.cs

@@ -1,339 +0,0 @@
-/*
- * 上传配置项
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.BsModels;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class UploadParamsController : BaseController
-    {
-        public UploadParamsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
-        }
-
-        #region 上传配置项列表
-
-        /// <summary>
-        /// 根据条件查询上传配置项列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(UploadParams data, string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            string Condition = "";
-            Condition += "TableName:\"" + data.TableName + "\",";
-            Condition += "ColumnName:\"" + data.ColumnName + "\",";
-            Condition += "ColumnEnName:\"" + data.ColumnEnName + "\",";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询上传配置项列表
-
-        /// <summary>
-        /// 上传配置项列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(UploadParams data, int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Fields.Add("TableName", "2"); //表名
-            Fields.Add("ColumnName", "2"); //字段名
-            Fields.Add("ColumnEnName", "2"); //字段英文明
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("UploadParams", Fields, "Id desc", "0", page, limit);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加上传配置项
-
-        /// <summary>
-        /// 增加或修改上传配置项信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加上传配置项
-
-        /// <summary>
-        /// 增加或修改上传配置项信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(UploadParams data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-            Fields.Add("TableName", data.TableName); //表名
-            Fields.Add("TableEnName", data.TableEnName);
-            Fields.Add("ColumnName", data.ColumnName); //字段名
-            Fields.Add("ColumnEnName", data.ColumnEnName); //字段英文明
-            Fields.Add("ParamString", data.ParamString); //参数
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("UploadParams", Fields, 0);
-            AddSysLog(data.Id.ToString(), "UploadParams", "add");
-            bsdb.SaveChanges();
-
-            RedisDbconn.Instance.Set("btn:" + function.MD5_16(data.TableEnName + data.ColumnEnName), data.ParamString);
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改上传配置项
-
-        /// <summary>
-        /// 增加或修改上传配置项信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            UploadParams editData = bsdb.UploadParams.FirstOrDefault(m => m.Id == Id) ?? new UploadParams();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改上传配置项
-
-        /// <summary>
-        /// 增加或修改上传配置项信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(UploadParams data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-            Fields.Add("TableName", data.TableName); //表名
-            Fields.Add("TableEnName", data.TableEnName);
-            Fields.Add("ColumnName", data.ColumnName); //字段名
-            Fields.Add("ColumnEnName", data.ColumnEnName); //字段英文明
-            Fields.Add("ParamString", data.ParamString); //参数
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("UploadParams", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "UploadParams", "update");
-            bsdb.SaveChanges();
-            
-            RedisDbconn.Instance.Set("btn:" + function.MD5_16(data.TableEnName + data.ColumnEnName), data.ParamString);
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除上传配置项信息
-
-        /// <summary>
-        /// 删除上传配置项信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "UploadParams", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Delete("UploadParams", id);
-            }
-            bsdb.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "UploadParams", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("UploadParams", Fields, id);
-            }
-            bsdb.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "UploadParams", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("UploadParams", Fields, id);
-            }
-            bsdb.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("UploadParams", Sort, Id);
-
-            AddSysLog(Id.ToString(), "UploadParams", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                bsdb.UploadParams.Add(new UploadParams()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-
-                });
-                bsdb.SaveChanges();
-            }
-            AddSysLog("0", "UploadParams", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(UploadParams data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("TableName", "2"); //表名
-            Fields.Add("ColumnName", "2"); //字段名
-            Fields.Add("ColumnEnName", "2"); //字段英文明
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("UploadParams", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "UploadParams", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-        #region 生成配置
-
-        /// <summary>
-        /// 生成配置
-        /// </summary>
-        /// <returns></returns>
-        public string MakeParams()
-        {
-            AddSysLog(0, "UploadParams", "MakeParam");
-            List<UploadParams> paramlist = bsdb.UploadParams.ToList();
-            foreach (UploadParams param in paramlist)
-            {
-                RedisDbconn.Instance.Set("btn:" + function.MD5_16(param.TableEnName + param.ColumnEnName), param.ParamString);
-            }
-            return "success";
-        }
-
-        #endregion
-    }
-}

+ 369 - 0
Areas/Admin/Controllers/CashServer/UserIdentityController.cs

@@ -0,0 +1,369 @@
+/*
+ * 创客信息
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.CashModels;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class UserIdentityController : BaseController
+    {
+        public UserIdentityController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["CashSqlConnStr"].ToString();
+        }
+
+        #region 创客信息列表
+
+        /// <summary>
+        /// 根据条件查询创客信息列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(UserIdentity data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询创客信息列表
+
+        /// <summary>
+        /// 创客信息列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(UserIdentity data, string CheckStatusSelect, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("BuddyNo", "1"); //创客编号
+            Fields.Add("BuddyName", "1"); //创客名称
+            Fields.Add("IdCardNo", "1"); //身份证号
+            Fields.Add("UserMobile", "1"); //手机号
+            Fields.Add("BankCardNo", "1"); //银行卡号
+
+
+            string condition = " and Status>-1";
+            //验证和同步账户
+            if (!string.IsNullOrEmpty(CheckStatusSelect))
+            {
+                condition += " and CheckStatus=" + CheckStatusSelect;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).IndexData("UserIdentity", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //验证和同步账户
+                int CheckStatus = int.Parse(dic["CheckStatus"].ToString());
+                if (CheckStatus == 0) dic["CheckStatus"] = "初始";
+                if (CheckStatus == 1) dic["CheckStatus"] = "进件成功";
+                if (CheckStatus == 2) dic["CheckStatus"] = "签约成功";
+                if (CheckStatus == 3) dic["CheckStatus"] = "进件失败";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加创客信息
+
+        /// <summary>
+        /// 增加或修改创客信息信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加创客信息
+
+        /// <summary>
+        /// 增加或修改创客信息信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(UserIdentity data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("BuddyNo", data.BuddyNo); //创客编号
+            Fields.Add("BuddyName", data.BuddyName); //创客名称
+            Fields.Add("IdCardNo", data.IdCardNo); //身份证号
+            Fields.Add("UserMobile", data.UserMobile); //手机号
+            Fields.Add("BankCardNo", data.BankCardNo); //银行卡号
+            Fields.Add("CertFrontImage", data.CertFrontImage); //身份证正面照
+            Fields.Add("CertReverseImage", data.CertReverseImage); //身份证反面照
+            Fields.Add("LivingScore", data.LivingScore); //活体得分
+            Fields.Add("FaceVideo", data.FaceVideo); //活体视频
+            Fields.Add("LivingImage", data.LivingImage); //活体照
+            Fields.Add("SignImageUrl", data.SignImageUrl); //签名照片地址
+            Fields.Add("CheckStatus", data.CheckStatus); //验证和同步账户
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Add("UserIdentity", Fields, 0);
+            AddSysLog(data.Id.ToString(), "UserIdentity", "add");
+            cashdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改创客信息
+
+        /// <summary>
+        /// 增加或修改创客信息信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            UserIdentity editData = cashdb.UserIdentity.FirstOrDefault(m => m.Id == Id) ?? new UserIdentity();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改创客信息
+
+        /// <summary>
+        /// 增加或修改创客信息信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(UserIdentity data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("BuddyNo", data.BuddyNo); //创客编号
+            Fields.Add("BuddyName", data.BuddyName); //创客名称
+            Fields.Add("IdCardNo", data.IdCardNo); //身份证号
+            Fields.Add("UserMobile", data.UserMobile); //手机号
+            Fields.Add("BankCardNo", data.BankCardNo); //银行卡号
+            Fields.Add("CertFrontImage", data.CertFrontImage); //身份证正面照
+            Fields.Add("CertReverseImage", data.CertReverseImage); //身份证反面照
+            Fields.Add("LivingScore", data.LivingScore); //活体得分
+            Fields.Add("FaceVideo", data.FaceVideo); //活体视频
+            Fields.Add("LivingImage", data.LivingImage); //活体照
+            Fields.Add("SignImageUrl", data.SignImageUrl); //签名照片地址
+            Fields.Add("CheckStatus", data.CheckStatus); //验证和同步账户
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("UserIdentity", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "UserIdentity", "update");
+            cashdb.SaveChanges();
+            RedisDbconn.Instance.AddList("CashPersonalCreateQueue", data.Id);
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除创客信息信息
+
+        /// <summary>
+        /// 删除创客信息信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "UserIdentity", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("UserIdentity", Fields, id);
+            }
+            cashdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "UserIdentity", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("UserIdentity", Fields, id);
+            }
+            cashdb.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "UserIdentity", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("UserIdentity", Fields, id);
+            }
+            cashdb.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Sort("UserIdentity", Sort, Id);
+
+            AddSysLog(Id.ToString(), "UserIdentity", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                cashdb.UserIdentity.Add(new UserIdentity()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                cashdb.SaveChanges();
+            }
+            AddSysLog("0", "UserIdentity", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(UserIdentity data, string CheckStatusSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("BuddyNo", "1"); //创客编号
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("BuddyName", "1"); //创客名称
+            Fields.Add("IdCardNo", "1"); //身份证号
+            Fields.Add("UserMobile", "1"); //手机号
+            Fields.Add("BankCardNo", "1"); //银行卡号
+
+
+            string condition = " and Status>-1";
+            //验证和同步账户
+            if (!string.IsNullOrEmpty(CheckStatusSelect))
+            {
+                condition += " and CheckStatus=" + CheckStatusSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).IndexData("UserIdentity", Fields, "Id desc", "0", 1, 20000, condition, "Remark", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //验证和同步账户
+                int CheckStatus = int.Parse(dic["CheckStatus"].ToString());
+                if (CheckStatus == 0) dic["CheckStatus"] = "初始";
+                if (CheckStatus == 1) dic["CheckStatus"] = "进件成功";
+                if (CheckStatus == 2) dic["CheckStatus"] = "签约成功";
+                if (CheckStatus == 3) dic["CheckStatus"] = "进件失败";
+
+            }
+
+            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>();
+            ReturnFields.Add("Remark", "注释");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "UserIdentity", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 394 - 0
Areas/Admin/Controllers/CashServer/WithdrawRecordController.cs

@@ -0,0 +1,394 @@
+/*
+ * 提现记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.CashModels;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class WithdrawRecordController : BaseController
+    {
+        public WithdrawRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["CashSqlConnStr"].ToString();
+        }
+
+        #region 提现记录列表
+
+        /// <summary>
+        /// 根据条件查询提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(WithdrawRecord data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询提现记录列表
+
+        /// <summary>
+        /// 提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(WithdrawRecord data, string TradeStatusSelect, string CashChannelSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("CashRecNo", "1"); //提现单号
+            Fields.Add("PartnerTradeNo", "1"); //业务单号
+            Fields.Add("UserMobile", "1"); //用户手机号
+            Fields.Add("BizTime", "3"); //业务时间
+            Fields.Add("ChannelCode", "1"); //渠道编号
+            Fields.Add("TransCompleteTime", "3"); //交易完成时间
+
+
+            string condition = " and Status>-1";
+            //订单状态
+            if (!string.IsNullOrEmpty(TradeStatusSelect))
+            {
+                condition += " and TradeStatus=" + TradeStatusSelect;
+            }
+            //代付渠道
+            if (!string.IsNullOrEmpty(CashChannelSelect))
+            {
+                condition += " and CashChannel=" + CashChannelSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).IndexData("WithdrawRecord", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //订单状态
+                int TradeStatus = int.Parse(dic["TradeStatus"].ToString());
+                if (TradeStatus == 0) dic["TradeStatusName"] = "初始化";
+                if (TradeStatus == 1) dic["TradeStatusName"] = "未审核,待打款";
+                if (TradeStatus == 2) dic["TradeStatusName"] = "审核通过,待打款";
+                if (TradeStatus == 3) dic["TradeStatusName"] = "审核不通过,已解冻";
+                if (TradeStatus == 4) dic["TradeStatusName"] = "冻结失败(预留)";
+                if (TradeStatus == 5) dic["TradeStatusName"] = "代付成功";
+                if (TradeStatus == 6) dic["TradeStatusName"] = "代付失败,待核实";
+                if (TradeStatus == 7) dic["TradeStatusName"] = "代付失败,已解冻";
+                if (TradeStatus == 8) dic["TradeStatusName"] = "代付处理中";
+                //代付渠道
+                dic["CashChannel"] = "云汇算";
+                // string CashChannel = dic["CashChannel"].ToString();
+                // if (CashChannel == "CloudAcc") dic["CashChannel"] = "云账户";
+                // if (CashChannel == "KuaiQian") dic["CashChannel"] = "快钱";
+                // if (CashChannel == "CloudPay") dic["CashChannel"] = "云银付";
+                // if (CashChannel == "CloudPayAF") dic["CashChannel"] = "安福灵新";
+                // if (CashChannel == "JuHeBa") dic["CashChannel"] = "聚合吧云慧算";
+                // if (CashChannel == "") dic["CashChannel"] = "";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加提现记录
+
+        /// <summary>
+        /// 增加或修改提现记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加提现记录
+
+        /// <summary>
+        /// 增加或修改提现记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(WithdrawRecord data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("AuditResult", data.AuditResult); //审核结果
+            Fields.Add("AuditRemark", data.AuditRemark); //审核备注
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Add("WithdrawRecord", Fields, 0);
+            AddSysLog(data.Id.ToString(), "WithdrawRecord", "add");
+            cashdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改提现记录
+
+        /// <summary>
+        /// 增加或修改提现记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            WithdrawRecord editData = cashdb.WithdrawRecord.FirstOrDefault(m => m.Id == Id) ?? new WithdrawRecord();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改提现记录
+
+        /// <summary>
+        /// 增加或修改提现记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(WithdrawRecord data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("AuditResult", data.AuditResult); //审核结果
+            Fields.Add("AuditRemark", data.AuditRemark); //审核备注
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("WithdrawRecord", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "WithdrawRecord", "update");
+            cashdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除提现记录信息
+
+        /// <summary>
+        /// 删除提现记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "WithdrawRecord", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("WithdrawRecord", Fields, id);
+            }
+            cashdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "WithdrawRecord", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("WithdrawRecord", Fields, id);
+            }
+            cashdb.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "WithdrawRecord", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Edit("WithdrawRecord", Fields, id);
+            }
+            cashdb.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).Sort("WithdrawRecord", Sort, Id);
+
+            AddSysLog(Id.ToString(), "WithdrawRecord", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                cashdb.WithdrawRecord.Add(new WithdrawRecord()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                cashdb.SaveChanges();
+            }
+            AddSysLog("0", "WithdrawRecord", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(WithdrawRecord data, string TradeStatusSelect, string CashChannelSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashRecNo", "1"); //提现单号
+            Fields.Add("PartnerTradeNo", "1"); //业务单号
+            Fields.Add("UserMobile", "1"); //用户手机号
+            Fields.Add("BizTime", "3"); //业务时间
+            Fields.Add("ChannelCode", "1"); //渠道编号
+            Fields.Add("TransCompleteTime", "3"); //交易完成时间
+
+
+            string condition = " and Status>-1";
+            //订单状态
+            if (!string.IsNullOrEmpty(TradeStatusSelect))
+            {
+                condition += " and TradeStatus=" + TradeStatusSelect;
+            }
+            //代付渠道
+            if (!string.IsNullOrEmpty(CashChannelSelect))
+            {
+                condition += " and CashChannel=" + CashChannelSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.CashTables).IndexData("WithdrawRecord", Fields, "Id desc", "0", 1, 20000, condition, "CashRecNo,UserId,UserMobile,UserName,IdcardNo,BankCardNo,ChannelCode,ChannelName,TradeAmount,TradeFee,ManageFee,TradeStatus,TransCompleteTime,CashChannel", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //订单状态
+                int TradeStatus = int.Parse(dic["TradeStatus"].ToString());
+                if (TradeStatus == 0) dic["TradeStatus"] = "初始化";
+                if (TradeStatus == 1) dic["TradeStatus"] = "未审核,待打款";
+                if (TradeStatus == 2) dic["TradeStatus"] = "审核通过,待打款";
+                if (TradeStatus == 3) dic["TradeStatus"] = "审核不通过,已解冻";
+                if (TradeStatus == 4) dic["TradeStatus"] = "冻结失败(预留)";
+                if (TradeStatus == 5) dic["TradeStatus"] = "代付成功";
+                if (TradeStatus == 6) dic["TradeStatus"] = "代付失败,待核实";
+                if (TradeStatus == 7) dic["TradeStatus"] = "代付失败,已解冻";
+                if (TradeStatus == 8) dic["TradeStatus"] = "代付处理中";
+                //代付渠道
+                string CashChannel = dic["CashChannel"].ToString();
+                if (CashChannel == "CloudAcc") dic["CashChannel"] = "云账户";
+                if (CashChannel == "KuaiQian") dic["CashChannel"] = "快钱";
+                if (CashChannel == "CloudPay") dic["CashChannel"] = "云银付";
+                if (CashChannel == "CloudPayAF") dic["CashChannel"] = "安福灵新";
+                if (CashChannel == "JuHeBa") dic["CashChannel"] = "聚合吧云慧算";
+                if (CashChannel == "") dic["CashChannel"] = "";
+
+            }
+
+            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>();
+            ReturnFields.Add("CashRecNo", "提现单号");
+            ReturnFields.Add("UserId", "创客");
+            ReturnFields.Add("UserMobile", "用户手机号");
+            ReturnFields.Add("UserName", "用户姓名");
+            ReturnFields.Add("IdcardNo", "身份证号");
+            ReturnFields.Add("BankCardNo", "提现卡号");
+            ReturnFields.Add("ChannelCode", "渠道编号");
+            ReturnFields.Add("ChannelName", "渠道名称");
+            ReturnFields.Add("TradeAmount", "交易金额");
+            ReturnFields.Add("TradeFee", "交易渠道手续费");
+            ReturnFields.Add("ManageFee", "交易平台管理");
+            ReturnFields.Add("TradeStatus", "订单状态");
+            ReturnFields.Add("TransCompleteTime", "交易完成时间");
+            ReturnFields.Add("CashChannel", "代付渠道");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "WithdrawRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
+    }
+}

+ 21 - 3
Areas/Admin/Controllers/MainServer/ActiveRewardController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -50,7 +51,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 激活奖励记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(ActiveReward data, string MerchantNo, string MerchantName, string MakerCode, string RealName, string MerMakerCode, string MerRealName, string ParentMakerCode, string ParentRealName, string ParentParentMakerCode, string ParentParentRealName, string StoreNo, string StoreName, string SnTypeSelect, string ActTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(ActiveReward data, string right, string BrandId, string MerchantNo, string MerchantName, string MakerCode, string RealName, string MerMakerCode, string MerRealName, string ParentMakerCode, string ParentRealName, string ParentParentMakerCode, string ParentParentRealName, string StoreNo, string StoreName, string SnTypeSelect, string ActTypeSelect, string ActDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -58,9 +59,12 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("BrandId", "1");
             Fields.Add("KqMerNo", "1"); //快钱商户编号
             Fields.Add("KqSnNo", "1"); //快钱SN号
-            Fields.Add("ActDate", "3"); //激活时间
             Fields.Add("TopUserId", "0"); //顶级创客
 
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.BrandId = BrandId;
+
             string condition = " and Status>-1";
             //商户编号
             if (!string.IsNullOrEmpty(MerchantNo))
@@ -133,6 +137,14 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and ActType=" + ActTypeSelect;
             }
 
+            if(!string.IsNullOrEmpty(ActDateData))
+            {
+                string[] datelist = ActDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and ActDate>='" + start + " 00:00:00' and ActDate<='" + end + " 23:59:59'";
+            }
+
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ActiveReward", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
@@ -189,7 +201,13 @@ namespace MySystem.Areas.Admin.Controllers
                 if(ActType == 3) dic["ActType"] = "循环机划拨激活";
             }            
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("RewardAmount", 0);
+            string RewardAmount = "0.00";//奖励金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(RewardAmount) from ActiveReward where BrandId='" + ViewBag.BrandId + "'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                RewardAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("RewardAmount", RewardAmount);
             obj.Add("other", other);
             return Json(obj);
         }

+ 87 - 87
Areas/Admin/Controllers/MainServer/ConsumerOrdersController.cs

@@ -37,7 +37,7 @@ namespace MySystem.Areas.Admin.Controllers
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            
+
             return View();
         }
 
@@ -51,35 +51,35 @@ namespace MySystem.Areas.Admin.Controllers
         /// <returns></returns>
         public JsonResult IndexData(ConsumerOrders data, string MerchantIdSelect, string ConsumerIdNickName, string ConsumerIdMobile, string PayModeSelect, int page = 1, int limit = 30)
         {
-            
+
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            
+
             Fields.Add("CreateDate", "3"); //时间
-Fields.Add("OrderNo", "1"); //订单号
-Fields.Add("SnNo", "1"); //SN号
+            Fields.Add("OrderNo", "1"); //订单号
+            Fields.Add("SnNo", "1"); //SN号
 
 
             string condition = " and Status>-1";
             //商户
-if (!string.IsNullOrEmpty(MerchantIdSelect))
-{
-condition += " and MerchantId=" + MerchantIdSelect;
-}
-//消费者昵称
-if (!string.IsNullOrEmpty(ConsumerIdNickName))
-{
-condition += " and ConsumerId in (select ConsumerId from ConsumersForNickName where NickName='" + ConsumerIdNickName + "')";
-}
-//消费者手机号
-if (!string.IsNullOrEmpty(ConsumerIdMobile))
-{
-condition += " and ConsumerId in (select ConsumerId from ConsumersForMobile where Mobile='" + ConsumerIdMobile + "')";
-}
-//支付方式
-if (!string.IsNullOrEmpty(PayModeSelect))
-{
-condition += " and PayMode=" + PayModeSelect;
-}
+            if (!string.IsNullOrEmpty(MerchantIdSelect))
+            {
+                condition += " and MerchantId=" + MerchantIdSelect;
+            }
+            //消费者昵称
+            if (!string.IsNullOrEmpty(ConsumerIdNickName))
+            {
+                condition += " and ConsumerId in (select ConsumerId from ConsumersForNickName where NickName='" + ConsumerIdNickName + "')";
+            }
+            //消费者手机号
+            if (!string.IsNullOrEmpty(ConsumerIdMobile))
+            {
+                condition += " and ConsumerId in (select ConsumerId from ConsumersForMobile where Mobile='" + ConsumerIdMobile + "')";
+            }
+            //支付方式
+            if (!string.IsNullOrEmpty(PayModeSelect))
+            {
+                condition += " and PayMode=" + PayModeSelect;
+            }
 
 
             Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ConsumerOrders", Fields, "Id desc", "0", page, limit, condition);
@@ -87,18 +87,18 @@ condition += " and PayMode=" + PayModeSelect;
             foreach (Dictionary<string, object> dic in diclist)
             {
                 //商户
-dic["MerchantId"] = RelationClass.GetMerchantInfoInfo(int.Parse(dic["MerchantId"].ToString()));
-//消费者
-int ConsumerId = int.Parse(function.CheckInt(dic["ConsumerId"].ToString()));
-Consumers consumerid_Consumers = db.Consumers.FirstOrDefault(m => m.Id == ConsumerId) ?? new Consumers();
-dic["ConsumerIdNickName"] = consumerid_Consumers.NickName;
-dic["ConsumerIdMobile"] = consumerid_Consumers.Mobile;
-dic.Remove("ConsumerId");
-//支付方式
-int PayMode = int.Parse(dic["PayMode"].ToString());
-if(PayMode == 1) dic["PayMode"] = "支付宝";
-if(PayMode == 2) dic["PayMode"] = "微信";
-if(PayMode == 0) dic["PayMode"] = "";
+                dic["MerchantId"] = RelationClass.GetMerchantInfoInfo(int.Parse(dic["MerchantId"].ToString()));
+                //消费者
+                int ConsumerId = int.Parse(function.CheckInt(dic["ConsumerId"].ToString()));
+                Consumers consumerid_Consumers = db.Consumers.FirstOrDefault(m => m.Id == ConsumerId) ?? new Consumers();
+                dic["ConsumerIdNickName"] = consumerid_Consumers.NickName;
+                dic["ConsumerIdMobile"] = consumerid_Consumers.Mobile;
+                dic.Remove("ConsumerId");
+                //支付方式
+                int PayMode = int.Parse(dic["PayMode"].ToString());
+                if (PayMode == 1) dic["PayMode"] = "支付宝";
+                if (PayMode == 2) dic["PayMode"] = "微信";
+                if (PayMode == 0) dic["PayMode"] = "";
 
             }
             return Json(obj);
@@ -116,7 +116,7 @@ if(PayMode == 0) dic["PayMode"] = "";
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            
+
 
             return View();
         }
@@ -133,15 +133,15 @@ if(PayMode == 0) dic["PayMode"] = "";
         public string Add(ConsumerOrders data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            
-            
+
+
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
             int Id = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Add("ConsumerOrders", Fields, 0);
             AddSysLog(data.Id.ToString(), "ConsumerOrders", "add");
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -157,7 +157,7 @@ if(PayMode == 0) dic["PayMode"] = "";
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            
+
 
             ConsumerOrders editData = db.ConsumerOrders.FirstOrDefault(m => m.Id == Id) ?? new ConsumerOrders();
             ViewBag.data = editData;
@@ -176,15 +176,15 @@ if(PayMode == 0) dic["PayMode"] = "";
         public string Edit(ConsumerOrders data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            
-            
+
+
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
             new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("ConsumerOrders", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"ConsumerOrders","update");
+            AddSysLog(data.Id.ToString(), "ConsumerOrders", "update");
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -199,7 +199,7 @@ if(PayMode == 0) dic["PayMode"] = "";
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ConsumerOrders","del");
+            AddSysLog(Id, "ConsumerOrders", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
@@ -208,7 +208,7 @@ if(PayMode == 0) dic["PayMode"] = "";
                 new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("ConsumerOrders", Fields, id);
             }
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -223,7 +223,7 @@ if(PayMode == 0) dic["PayMode"] = "";
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ConsumerOrders","open");
+            AddSysLog(Id, "ConsumerOrders", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
@@ -246,7 +246,7 @@ if(PayMode == 0) dic["PayMode"] = "";
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ConsumerOrders","close");
+            AddSysLog(Id, "ConsumerOrders", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
@@ -268,7 +268,7 @@ if(PayMode == 0) dic["PayMode"] = "";
         public string Sort(int Id, int Sort)
         {
             new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Sort("ConsumerOrders", Sort, Id);
-            
+
             AddSysLog(Id.ToString(), "ConsumerOrders", "sort");
             return "success";
         }
@@ -283,15 +283,15 @@ if(PayMode == 0) dic["PayMode"] = "";
         {
             ExcelData = HttpUtility.UrlDecode(ExcelData);
             JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
+            for (int i = 1; i < list.Count; i++)
             {
                 JsonData dr = list[i];
-                
+
                 db.ConsumerOrders.Add(new ConsumerOrders()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
-                    
+
                 });
                 db.SaveChanges();
             }
@@ -310,31 +310,31 @@ if(PayMode == 0) dic["PayMode"] = "";
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("CreateDate", "3"); //时间
-Fields.Add("OrderNo", "1"); //订单号
-Fields.Add("SnNo", "1"); //SN号
+            Fields.Add("OrderNo", "1"); //订单号
+            Fields.Add("SnNo", "1"); //SN号
 
 
             string condition = " and Status>-1";
             //商户
-if (!string.IsNullOrEmpty(MerchantIdSelect))
-{
-condition += " and MerchantId=" + MerchantIdSelect;
-}
-//消费者昵称
-if (!string.IsNullOrEmpty(ConsumerIdNickName))
-{
-condition += " and ConsumerId in (select ConsumerId from ConsumersForNickName where NickName='" + ConsumerIdNickName + "')";
-}
-//消费者手机号
-if (!string.IsNullOrEmpty(ConsumerIdMobile))
-{
-condition += " and ConsumerId in (select ConsumerId from ConsumersForMobile where Mobile='" + ConsumerIdMobile + "')";
-}
-//支付方式
-if (!string.IsNullOrEmpty(PayModeSelect))
-{
-condition += " and PayMode=" + PayModeSelect;
-}
+            if (!string.IsNullOrEmpty(MerchantIdSelect))
+            {
+                condition += " and MerchantId=" + MerchantIdSelect;
+            }
+            //消费者昵称
+            if (!string.IsNullOrEmpty(ConsumerIdNickName))
+            {
+                condition += " and ConsumerId in (select ConsumerId from ConsumersForNickName where NickName='" + ConsumerIdNickName + "')";
+            }
+            //消费者手机号
+            if (!string.IsNullOrEmpty(ConsumerIdMobile))
+            {
+                condition += " and ConsumerId in (select ConsumerId from ConsumersForMobile where Mobile='" + ConsumerIdMobile + "')";
+            }
+            //支付方式
+            if (!string.IsNullOrEmpty(PayModeSelect))
+            {
+                condition += " and PayMode=" + PayModeSelect;
+            }
 
 
             Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ConsumerOrders", Fields, "Id desc", "0", 1, 20000, condition, "", false);
@@ -342,18 +342,18 @@ condition += " and PayMode=" + PayModeSelect;
             foreach (Dictionary<string, object> dic in diclist)
             {
                 //商户
-dic["MerchantId"] = RelationClass.GetMerchantInfoInfo(int.Parse(dic["MerchantId"].ToString()));
-//消费者
-int ConsumerId = int.Parse(function.CheckInt(dic["ConsumerId"].ToString()));
-Consumers consumerid_Consumers = db.Consumers.FirstOrDefault(m => m.Id == ConsumerId) ?? new Consumers();
-dic["ConsumerIdNickName"] = consumerid_Consumers.NickName;
-dic["ConsumerIdMobile"] = consumerid_Consumers.Mobile;
-dic.Remove("ConsumerId");
-//支付方式
-int PayMode = int.Parse(dic["PayMode"].ToString());
-if(PayMode == 1) dic["PayMode"] = "支付宝";
-if(PayMode == 2) dic["PayMode"] = "微信";
-if(PayMode == 0) dic["PayMode"] = "";
+                dic["MerchantId"] = RelationClass.GetMerchantInfoInfo(int.Parse(dic["MerchantId"].ToString()));
+                //消费者
+                int ConsumerId = int.Parse(function.CheckInt(dic["ConsumerId"].ToString()));
+                Consumers consumerid_Consumers = db.Consumers.FirstOrDefault(m => m.Id == ConsumerId) ?? new Consumers();
+                dic["ConsumerIdNickName"] = consumerid_Consumers.NickName;
+                dic["ConsumerIdMobile"] = consumerid_Consumers.Mobile;
+                dic.Remove("ConsumerId");
+                //支付方式
+                int PayMode = int.Parse(dic["PayMode"].ToString());
+                if (PayMode == 1) dic["PayMode"] = "支付宝";
+                if (PayMode == 2) dic["PayMode"] = "微信";
+                if (PayMode == 0) dic["PayMode"] = "";
 
             }
 
@@ -362,7 +362,7 @@ if(PayMode == 0) dic["PayMode"] = "";
             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);
             AddSysLog("0", "ConsumerOrders", "ExportExcel");
             return Json(result);

+ 0 - 397
Areas/Admin/Controllers/MainServer/FileUpdateInfoController.cs

@@ -1,397 +0,0 @@
-/*
- * 资源文件更新信息
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class FileUpdateInfoController : BaseController
-    {
-        public FileUpdateInfoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 资源文件更新信息列表
-
-        /// <summary>
-        /// 根据条件查询资源文件更新信息列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(FileUpdateInfo data, string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            string Condition = "";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询资源文件更新信息列表
-
-        /// <summary>
-        /// 资源文件更新信息列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(FileUpdateInfo data, string Kind = "default", int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            string condition = " and SeoKeyword='" + Kind + "'";
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("FileUpdateInfo", Fields, "Path asc,FileName asc", "False", page, limit, condition);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加资源文件更新信息
-
-        /// <summary>
-        /// 增加或修改资源文件更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加资源文件更新信息
-
-        /// <summary>
-        /// 增加或修改资源文件更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(FileUpdateInfo data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("Version", data.VersionNum); //更新版本
-            Fields.Add("Path", data.Path); //路径
-            Fields.Add("FileName", data.FileName); //文件名
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            // Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("FileUpdateInfo", Fields, 0);
-            AddSysLog(data.Id.ToString(), "FileUpdateInfo", "add");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改资源文件更新信息
-
-        /// <summary>
-        /// 增加或修改资源文件更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            FileUpdateInfo editData = db.FileUpdateInfo.FirstOrDefault(m => m.Id == Id) ?? new FileUpdateInfo();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改资源文件更新信息
-
-        /// <summary>
-        /// 增加或修改资源文件更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(FileUpdateInfo data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("Version", data.VersionNum); //更新版本
-            Fields.Add("Path", data.Path); //路径
-            Fields.Add("FileName", data.FileName); //文件名
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            // Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("FileUpdateInfo", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "FileUpdateInfo", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除资源文件更新信息信息
-
-        /// <summary>
-        /// 删除资源文件更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "FileUpdateInfo", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("FileUpdateInfo", id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "FileUpdateInfo", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("FileUpdateInfo", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "FileUpdateInfo", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("FileUpdateInfo", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("FileUpdateInfo", Sort, Id);
-
-            AddSysLog(Id.ToString(), "FileUpdateInfo", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                db.FileUpdateInfo.Add(new FileUpdateInfo()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "FileUpdateInfo", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(FileUpdateInfo data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("FileUpdateInfo", Fields, "Id desc", "False", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "FileUpdateInfo", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-        #region 更新版本
-
-        /// <summary>
-        /// 更新版本
-        /// </summary>
-        /// <returns></returns>
-        public string UpdateVersion(int Id)
-        {
-            FileUpdateInfo info = db.FileUpdateInfo.FirstOrDefault(m => m.Id == Id);
-            if (info != null)
-            {
-                info.VersionNum += 1;
-                db.SaveChanges();
-            }
-            return "success";
-        }
-
-        #endregion
-
-        #region 更新文件
-
-        /// <summary>
-        /// 更新文件
-        /// </summary>
-        /// <returns></returns>
-        public string UpdateFile(string Kind = "default")
-        {
-            SystemSet set = db.SystemSet.FirstOrDefault() ?? new SystemSet();
-            GetSystemFiles(set, Kind);
-            foreach (string filename in SystemFiles)
-            {
-                string Path = filename.Substring(0, filename.LastIndexOf("/") + 1);
-                string template = filename.Substring(filename.LastIndexOf("/") + 1);
-                if (!template.EndsWith(".html") && !template.EndsWith(".DS_Store") && !template.EndsWith("LICENSE") && !template.EndsWith("Thumbs.db"))
-                {
-                    FileUpdateInfo check = db.FileUpdateInfo.FirstOrDefault(m => m.Path == Path && m.FileName == template && m.SeoKeyword == Kind);
-                    if (check == null)
-                    {
-                        check = db.FileUpdateInfo.Add(new FileUpdateInfo()
-                        {
-                            CreateDate = DateTime.Now,
-                            UpdateDate = DateTime.Now,
-                            FileName = template,
-                            Path = Path,
-                            VersionNum = 0,
-                            SeoKeyword = Kind,
-                        }).Entity;
-                        db.SaveChanges();
-                    }
-                }
-            }
-            List<FileUpdateInfo> list = db.FileUpdateInfo.OrderBy(m => m.Path).OrderBy(m => m.FileName).ToList();
-            RedisDbconn.Instance.AddList("FileUpdateInfo", list.ToArray());
-            return "success";
-        }
-        List<string> SystemFiles;
-        private void GetSystemFiles(SystemSet set, string Kind = "default")
-        {
-            SystemFiles = new List<string>();
-            string dataFilePath = function.ReadInstance("/WebRootPath.txt") + "/skin/app/" + Kind + "/";
-            System.IO.FileSystemInfo info = new System.IO.DirectoryInfo(dataFilePath);
-            scan(info, set, Kind);
-        }
-        private void scan(System.IO.FileSystemInfo info, SystemSet set, string Kind = "default")
-        {
-            if (!info.Exists) return;
-            string sPath = "/skin/app/" + Kind + "/";
-            System.IO.DirectoryInfo dir = info as System.IO.DirectoryInfo;
-            //不是目录
-            if (dir == null) return;
-            System.IO.FileSystemInfo[] files = dir.GetFileSystemInfos();
-            for (int i = 0; i < files.Length; i++)
-            {
-                System.IO.FileInfo file = files[i] as System.IO.FileInfo;
-                //是文件
-                if (file != null)
-                {
-                    SystemFiles.Add(file.FullName.Substring(file.FullName.IndexOf(sPath) + sPath.Length).Replace("\\", "/"));
-                }
-                else scan(files[i], set, Kind);
-            }
-        }
-
-        #endregion
-    
-        #region 同步数据到redis
-
-        public string SyncAll(string Kind = "default")
-        {
-            List<FileUpdateInfo> files = db.FileUpdateInfo.Where(m => m.SeoKeyword == Kind).ToList();
-            RedisDbconn.Instance.Clear("FileUpdateInfo:" + Kind + "");
-            // RedisDbconn.Instance.AddList("FileUpdateInfo:" + Kind + "", files.ToArray());
-            return "success";
-        }
-
-        #endregion
-    
-    
-    }
-}

+ 28 - 3
Areas/Admin/Controllers/MainServer/FluxProfitDetailController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -39,6 +40,9 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
 
+            List<KqProducts> Brands = db.KqProducts.OrderBy(m => m.Id).ToList();
+            ViewBag.Brands = Brands;
+
             return View();
         }
 
@@ -50,14 +54,14 @@ namespace MySystem.Areas.Admin.Controllers
         /// 流量分佣明细列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(FluxProfitDetail data, string MakerCode, string RealName, string TopMakerCode, string TopRealName, string MerUserTypeSelect, string ProfitTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(FluxProfitDetail data, string MakerCode, string RealName, string TopMakerCode, string TopRealName, string CreateDateData, string MerUserTypeSelect, string ProfitTypeSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("MerNo", "1"); //渠道商户编号
             Fields.Add("SnNo", "1"); //渠道SN号
+            Fields.Add("BrandId", "1"); //渠道SN号
             Fields.Add("FluxOrderNo", "1"); //流量扣费单号
             Fields.Add("TradeOrderNo", "1"); //交易流水号
 
@@ -72,6 +76,10 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
+            if (data.BrandId > 0)
+            { 
+                condition += " and BrandId=" + data.BrandId;
+            }
             //顶级创客编号
             if (!string.IsNullOrEmpty(TopMakerCode))
             {
@@ -92,6 +100,14 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and ProfitType=" + ProfitTypeSelect;
             }
+            //交易时间
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+               string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0].Replace("-", "");
+                string end = datelist[1].Replace("-", "");
+                condition += " and TradeDate >= '" + start + "' and TradeDate <= '" + end + "' ";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("FluxProfitDetail", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -107,6 +123,9 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["TopMakerCode"] = tuser.MakerCode;
                 dic["TopRealName"] = tuser.RealName;
 
+                int BrandId = int.Parse(dic["BrandId"].ToString());
+                dic["BrandName"] = RelationClass.GetKqProductBrandInfo(BrandId);
+
                 int MerchantId = int.Parse(dic["MerchantId"].ToString());
                 MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId) ?? new MerchantInfo();
                 dic["MerchantMobile"] = merchant.Mobile;
@@ -122,7 +141,13 @@ namespace MySystem.Areas.Admin.Controllers
 
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("ProfitAmt", 0);
+            string ProfitAmt = "0.00";//分佣总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(FluxProfitAmt) from FluxProfitDetail where 1=1" + condition);
+            if(dt.Rows.Count > 0)
+            {
+                ProfitAmt = dt.Rows[0][0].ToString();
+            }
+            other.Add("ProfitAmt", ProfitAmt);
             obj.Add("other", other);
             return Json(obj);
         }

+ 15 - 2
Areas/Admin/Controllers/MainServer/FluxProfitSummaryController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -110,8 +111,20 @@ namespace MySystem.Areas.Admin.Controllers
                 if (CheckStatus == 1) dic["CheckStatus"] = "已验证和同步";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("TradeCount", 0);
-            other.Add("FluxProfit", 0);
+            string TradeCount = "0.00";//流量费交易笔数
+            string FluxProfit = "0.00";//分佣总金额
+            DataTable dt = OtherMySqlConn.dtable("select count(0) from FluxProfitSummary where BrandId=3 or BrandId=5" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                TradeCount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(FluxProfitAmt) from FluxProfitSummary where BrandId=3 or BrandId=5" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                FluxProfit = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("TradeCount", TradeCount);
+            other.Add("FluxProfit", FluxProfit);
             obj.Add("other", other);
             return Json(obj);
         }

+ 388 - 0
Areas/Admin/Controllers/MainServer/HelpProfitAccountRecordController.cs

@@ -0,0 +1,388 @@
+/*
+ * 助利宝账户变动记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class HelpProfitAccountRecordController : BaseController
+    {
+        public HelpProfitAccountRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 助利宝账户变动记录列表
+
+        /// <summary>
+        /// 根据条件查询助利宝账户变动记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(HelpProfitAccountRecord data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询助利宝账户变动记录列表
+
+        /// <summary>
+        /// 助利宝账户变动记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(HelpProfitAccountRecord data, string ChangeTypeSelect, string ProductTypeSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("TransRecordNo", "1"); //交易流水编号
+
+
+            string condition = " and Status>-1";
+            //变动类型
+            if (!string.IsNullOrEmpty(ChangeTypeSelect))
+            {
+                condition += " and ChangeType=" + ChangeTypeSelect;
+            }
+            //产品类型
+            if (!string.IsNullOrEmpty(ProductTypeSelect))
+            {
+                condition += " and ProductType=" + ProductTypeSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitAccountRecord", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //变动类型
+                int ChangeType = int.Parse(dic["ChangeType"].ToString());
+                if (ChangeType == 0) dic["ChangeType"] = " 激活奖励";
+                if (ChangeType == 1) dic["ChangeType"] = " 交易分润";
+                if (ChangeType == 2) dic["ChangeType"] = " 提现申请";
+                if (ChangeType == 3) dic["ChangeType"] = " 提现代付";
+                if (ChangeType == 4) dic["ChangeType"] = " 提现手续费";
+                if (ChangeType == 5) dic["ChangeType"] = " 提现税点扣除";
+                if (ChangeType == 6) dic["ChangeType"] = " 提现失败,解冻";
+                if (ChangeType == 7) dic["ChangeType"] = " 系统扣除";
+                if (ChangeType == 10) dic["ChangeType"] = " 办卡奖励";
+                if (ChangeType == 20) dic["ChangeType"] = " 余额支付";
+                if (ChangeType == 21) dic["ChangeType"] = " 余额支付退款";
+                if (ChangeType == 22) dic["ChangeType"] = " 余额支付退款手续费";
+                if (ChangeType == 30) dic["ChangeType"] = " 签到红包";
+                if (ChangeType == 31) dic["ChangeType"] = " 系统红包奖励";
+                //产品类型
+                int ProductType = int.Parse(dic["ProductType"].ToString());
+                if (ProductType == 0) dic["ProductType"] = "星支付";
+                if (ProductType == 1) dic["ProductType"] = "在线办卡";
+                if (ProductType == 2) dic["ProductType"] = "环迅大POS";
+                if (ProductType == 3) dic["ProductType"] = "系统奖励";
+                if (ProductType == 4) dic["ProductType"] = "灵动商城";
+                if (ProductType == 99) dic["ProductType"] = "提现";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加助利宝账户变动记录
+
+        /// <summary>
+        /// 增加或修改助利宝账户变动记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加助利宝账户变动记录
+
+        /// <summary>
+        /// 增加或修改助利宝账户变动记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(HelpProfitAccountRecord data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("HelpProfitAccountRecord", Fields, 0);
+            AddSysLog(data.Id.ToString(), "HelpProfitAccountRecord", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改助利宝账户变动记录
+
+        /// <summary>
+        /// 增加或修改助利宝账户变动记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            HelpProfitAccountRecord editData = db.HelpProfitAccountRecord.FirstOrDefault(m => m.Id == Id) ?? new HelpProfitAccountRecord();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改助利宝账户变动记录
+
+        /// <summary>
+        /// 增加或修改助利宝账户变动记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(HelpProfitAccountRecord data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitAccountRecord", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "HelpProfitAccountRecord", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除助利宝账户变动记录信息
+
+        /// <summary>
+        /// 删除助利宝账户变动记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitAccountRecord", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitAccountRecord", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitAccountRecord", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitAccountRecord", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitAccountRecord", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitAccountRecord", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("HelpProfitAccountRecord", Sort, Id);
+
+            AddSysLog(Id.ToString(), "HelpProfitAccountRecord", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.HelpProfitAccountRecord.Add(new HelpProfitAccountRecord()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "HelpProfitAccountRecord", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(HelpProfitAccountRecord data, string ChangeTypeSelect, string ProductTypeSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("TransRecordNo", "1"); //交易流水编号
+
+
+            string condition = " and Status>-1";
+            //变动类型
+            if (!string.IsNullOrEmpty(ChangeTypeSelect))
+            {
+                condition += " and ChangeType=" + ChangeTypeSelect;
+            }
+            //产品类型
+            if (!string.IsNullOrEmpty(ProductTypeSelect))
+            {
+                condition += " and ProductType=" + ProductTypeSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitAccountRecord", Fields, "Id desc", "0", 1, 20000, condition, "UserId,ChangeType,ProductType,ChangeAmount,BeforeTotalAmount,AfterTotalAmount,BeforeFreezeAmount,AfterFreezeAmount,BeforeBalanceAmount,AfterBalanceAmount,Remark,TransRecordNo", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //变动类型
+                int ChangeType = int.Parse(dic["ChangeType"].ToString());
+                if (ChangeType == 0) dic["ChangeType"] = " 激活奖励";
+                if (ChangeType == 1) dic["ChangeType"] = " 交易分润";
+                if (ChangeType == 2) dic["ChangeType"] = " 提现申请";
+                if (ChangeType == 3) dic["ChangeType"] = " 提现代付";
+                if (ChangeType == 4) dic["ChangeType"] = " 提现手续费";
+                if (ChangeType == 5) dic["ChangeType"] = " 提现税点扣除";
+                if (ChangeType == 6) dic["ChangeType"] = " 提现失败,解冻";
+                if (ChangeType == 7) dic["ChangeType"] = " 系统扣除";
+                if (ChangeType == 10) dic["ChangeType"] = " 办卡奖励";
+                if (ChangeType == 20) dic["ChangeType"] = " 余额支付";
+                if (ChangeType == 21) dic["ChangeType"] = " 余额支付退款";
+                if (ChangeType == 22) dic["ChangeType"] = " 余额支付退款手续费";
+                if (ChangeType == 30) dic["ChangeType"] = " 签到红包";
+                if (ChangeType == 31) dic["ChangeType"] = " 系统红包奖励";
+                //产品类型
+                int ProductType = int.Parse(dic["ProductType"].ToString());
+                if (ProductType == 0) dic["ProductType"] = "星支付";
+                if (ProductType == 1) dic["ProductType"] = "在线办卡";
+                if (ProductType == 2) dic["ProductType"] = "环迅大POS";
+                if (ProductType == 3) dic["ProductType"] = "系统奖励";
+                if (ProductType == 4) dic["ProductType"] = "灵动商城";
+                if (ProductType == 99) dic["ProductType"] = "提现";
+
+            }
+
+            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>();
+            ReturnFields.Add("UserId", "创客");
+            ReturnFields.Add("ChangeType", "变动类型");
+            ReturnFields.Add("ProductType", "产品类型");
+            ReturnFields.Add("ChangeAmount", "变更金额");
+            ReturnFields.Add("BeforeTotalAmount", "变更前总金额");
+            ReturnFields.Add("AfterTotalAmount", "变更后总金额");
+            ReturnFields.Add("BeforeFreezeAmount", "变更前冻结金额");
+            ReturnFields.Add("AfterFreezeAmount", "变更后冻结金额");
+            ReturnFields.Add("BeforeBalanceAmount", "变更前余额");
+            ReturnFields.Add("AfterBalanceAmount", "变更后余额");
+            ReturnFields.Add("Remark", "账户变动明细备注信息");
+            ReturnFields.Add("TransRecordNo", "交易流水编号");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "HelpProfitAccountRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 349 - 0
Areas/Admin/Controllers/MainServer/HelpProfitExchangeController.cs

@@ -0,0 +1,349 @@
+/*
+ * 助利宝兑换记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class HelpProfitExchangeController : BaseController
+    {
+        public HelpProfitExchangeController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 助利宝兑换记录列表
+
+        /// <summary>
+        /// 根据条件查询助利宝兑换记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(HelpProfitExchange data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询助利宝兑换记录列表
+
+        /// <summary>
+        /// 助利宝兑换记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(HelpProfitExchange data, string UserIdMakerCode, string UserIdRealName, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitExchange", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic.Remove("UserId");
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加助利宝兑换记录
+
+        /// <summary>
+        /// 增加或修改助利宝兑换记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加助利宝兑换记录
+
+        /// <summary>
+        /// 增加或修改助利宝兑换记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(HelpProfitExchange data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("ExchangeCount", data.ExchangeCount); //兑换数量
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("HelpProfitExchange", Fields, 0);
+            AddSysLog(data.Id.ToString(), "HelpProfitExchange", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改助利宝兑换记录
+
+        /// <summary>
+        /// 增加或修改助利宝兑换记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            HelpProfitExchange editData = db.HelpProfitExchange.FirstOrDefault(m => m.Id == Id) ?? new HelpProfitExchange();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改助利宝兑换记录
+
+        /// <summary>
+        /// 增加或修改助利宝兑换记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(HelpProfitExchange data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("ExchangeCount", data.ExchangeCount); //兑换数量
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchange", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "HelpProfitExchange", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除助利宝兑换记录信息
+
+        /// <summary>
+        /// 删除助利宝兑换记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitExchange", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchange", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitExchange", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchange", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitExchange", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchange", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("HelpProfitExchange", Sort, Id);
+
+            AddSysLog(Id.ToString(), "HelpProfitExchange", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.HelpProfitExchange.Add(new HelpProfitExchange()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "HelpProfitExchange", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(HelpProfitExchange data, string UserIdMakerCode, string UserIdRealName)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+
+
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitExchange", Fields, "Id desc", "0", 1, 20000, condition, "UserId,ExchangeCount", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic.Remove("UserId");
+
+            }
+
+            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>();
+            ReturnFields.Add("UserIdMakerCode", "创客创客编号");
+            ReturnFields.Add("UserIdRealName", "创客真实姓名");
+            ReturnFields.Add("ExchangeCount", "兑换数量");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "HelpProfitExchange", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 369 - 0
Areas/Admin/Controllers/MainServer/HelpProfitExchangeDetailController.cs

@@ -0,0 +1,369 @@
+/*
+ * 助利宝兑换明细
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class HelpProfitExchangeDetailController : BaseController
+    {
+        public HelpProfitExchangeDetailController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 助利宝兑换明细列表
+
+        /// <summary>
+        /// 根据条件查询助利宝兑换明细列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(HelpProfitExchangeDetail data, string right, string RecordId)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.RecordId = RecordId;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询助利宝兑换明细列表
+
+        /// <summary>
+        /// 助利宝兑换明细列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(HelpProfitExchangeDetail data, string UserIdMakerCode, string UserIdRealName, string PosCouponIdSelect, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //券码
+            if (!string.IsNullOrEmpty(PosCouponIdSelect))
+            {
+                condition += " and PosCouponId=" + PosCouponIdSelect;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitExchangeDetail", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic.Remove("UserId");
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加助利宝兑换明细
+
+        /// <summary>
+        /// 增加或修改助利宝兑换明细信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right, string RecordId)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.RecordId = RecordId;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加助利宝兑换明细
+
+        /// <summary>
+        /// 增加或修改助利宝兑换明细信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(HelpProfitExchangeDetail data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("RecordId", data.RecordId);
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("PosCouponId", data.PosCouponId); //券码
+            Fields.Add("ExchangeCode", data.ExchangeCode); //兑换券码
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("HelpProfitExchangeDetail", Fields, 0);
+            AddSysLog(data.Id.ToString(), "HelpProfitExchangeDetail", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改助利宝兑换明细
+
+        /// <summary>
+        /// 增加或修改助利宝兑换明细信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, string RecordId, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.RecordId = RecordId;
+
+
+            HelpProfitExchangeDetail editData = db.HelpProfitExchangeDetail.FirstOrDefault(m => m.Id == Id) ?? new HelpProfitExchangeDetail();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改助利宝兑换明细
+
+        /// <summary>
+        /// 增加或修改助利宝兑换明细信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(HelpProfitExchangeDetail data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("RecordId", data.RecordId);
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("PosCouponId", data.PosCouponId); //券码
+            Fields.Add("ExchangeCode", data.ExchangeCode); //兑换券码
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchangeDetail", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "HelpProfitExchangeDetail", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除助利宝兑换明细信息
+
+        /// <summary>
+        /// 删除助利宝兑换明细信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitExchangeDetail", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchangeDetail", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitExchangeDetail", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchangeDetail", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitExchangeDetail", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitExchangeDetail", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("HelpProfitExchangeDetail", Sort, Id);
+
+            AddSysLog(Id.ToString(), "HelpProfitExchangeDetail", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.HelpProfitExchangeDetail.Add(new HelpProfitExchangeDetail()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "HelpProfitExchangeDetail", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(HelpProfitExchangeDetail data, string UserIdMakerCode, string UserIdRealName, string PosCouponIdSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("ExchangeCode", "1"); //兑换券码
+
+
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //券码
+            if (!string.IsNullOrEmpty(PosCouponIdSelect))
+            {
+                condition += " and PosCouponId=" + PosCouponIdSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitExchangeDetail", Fields, "Id desc", "0", 1, 20000, condition, "UserId,PosCouponId,ExchangeCode", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic.Remove("UserId");
+                //券码
+                dic["PosCouponId"] = RelationClass.GetPosCouponsInfo(int.Parse(dic["PosCouponId"].ToString()));
+
+            }
+
+            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>();
+            ReturnFields.Add("UserIdMakerCode", "创客创客编号");
+            ReturnFields.Add("UserIdRealName", "创客真实姓名");
+            ReturnFields.Add("PosCouponId", "券码");
+            ReturnFields.Add("ExchangeCode", "兑换券码");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "HelpProfitExchangeDetail", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 98 - 59
Areas/Admin/Controllers/BsServer/OperateRightListController.cs → Areas/Admin/Controllers/MainServer/HelpProfitMerTradeSummayController.cs

@@ -1,5 +1,5 @@
 /*
- * 操作权限
+ * 助利宝商户交易额统计
  */
 
 using System;
@@ -7,12 +7,13 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
-using MySystem.BsModels;
+using MySystem.Models;
 using Library;
 using LitJson;
 using MySystemLib;
@@ -21,62 +22,96 @@ namespace MySystem.Areas.Admin.Controllers
 {
     [Area("Admin")]
     [Route("Admin/[controller]/[action]")]
-    public class OperateRightListController : BaseController
+    public class HelpProfitMerTradeSummayController : BaseController
     {
-        public OperateRightListController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        public HelpProfitMerTradeSummayController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
-        #region 操作权限列表
+        #region 助利宝商户交易额统计列表
 
         /// <summary>
-        /// 根据条件查询操作权限列表
+        /// 根据条件查询助利宝商户交易额统计列表
         /// </summary>
         /// <returns></returns>
-        public IActionResult Index(OperateRightList data, string right)
+        public IActionResult Index(HelpProfitMerTradeSummay data, string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
 
+
             return View();
         }
 
         #endregion
 
-        #region 根据条件查询操作权限列表
+        #region 根据条件查询助利宝商户交易额统计列表
 
         /// <summary>
-        /// 操作权限列表
+        /// 助利宝商户交易额统计列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(OperateRightList data, int page = 1, int limit = 30)
+        public JsonResult IndexData(HelpProfitMerTradeSummay data, string CreateDateData, string MerchantId, string BrandId, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("Name", "1"); //名称
-            Fields.Add("EnName", "1"); //英文名
-
-
             string condition = " and Status>-1";
+            //商户
+            if (!string.IsNullOrEmpty(MerchantId))
+            {
+                var posInfo = db.PosMerchantInfo.FirstOrDefault(m => m.MerchantNo == MerchantId);
+                condition += " and MerchantId=" + posInfo.Id;
+            }
+            //品牌
+            if (!string.IsNullOrEmpty(BrandId))
+            {
+                condition += " and BrandId=" + BrandId;
+            }
+            //交易时间
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+               string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0].Replace("-", "");
+                string end = datelist[1].Replace("-", "");
+                condition += " and TradeDate >= '" + start + "' and TradeDate <= '" + end + "' ";
+            }
 
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("OperateRightList", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitMerTradeSummay", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
+                //品牌信息
+                int Brand = int.Parse(function.CheckInt(dic["BrandId"].ToString()));
+                KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == Brand) ?? new KqProducts();
+                dic["BrandName"] = kqProducts.Name;
+
+                //商户信息
+                int Merchant = int.Parse(function.CheckInt(dic["MerchantId"].ToString()));
+                PosMerchantInfo posMerchantInfo = db.PosMerchantInfo.FirstOrDefault(m => m.Id == Merchant) ?? new PosMerchantInfo();
+                dic["posMerchantInfo"] = posMerchantInfo.MerchantNo + "--" + posMerchantInfo.MerchantName;
+            }
 
+            Dictionary<string, object> other = new Dictionary<string, object>();
+
+            decimal DAmount = 0;//总交易额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from HelpProfitMerTradeSummay where Status>-1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                DAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
             }
+            other.Add("DAmount", DAmount);
+            obj.Add("other", other);
             return Json(obj);
         }
 
         #endregion
 
-        #region 增加操作权限
+        #region 增加助利宝商户交易额统计
 
         /// <summary>
-        /// 增加或修改操作权限信息
+        /// 增加或修改助利宝商户交易额统计信息
         /// </summary>
         /// <returns></returns>
         public IActionResult Add(string right)
@@ -90,36 +125,34 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 增加操作权限
+        #region 增加助利宝商户交易额统计
 
         /// <summary>
-        /// 增加或修改操作权限信息
+        /// 增加或修改助利宝商户交易额统计信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Add(OperateRightList data)
+        public string Add(HelpProfitMerTradeSummay data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
 
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("EnName", data.EnName); //英文名
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("OperateRightList", Fields, 0);
-            AddSysLog(data.Id.ToString(), "OperateRightList", "add");
-            bsdb.SaveChanges();
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("HelpProfitMerTradeSummay", Fields, 0);
+            AddSysLog(data.Id.ToString(), "HelpProfitMerTradeSummay", "add");
+            db.SaveChanges();
 
             return "success";
         }
 
         #endregion
 
-        #region 修改操作权限
+        #region 修改助利宝商户交易额统计
 
         /// <summary>
-        /// 增加或修改操作权限信息
+        /// 增加或修改助利宝商户交易额统计信息
         /// </summary>
         /// <returns></returns>
         public IActionResult Edit(string right, int Id = 0)
@@ -128,57 +161,55 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.right = right;
 
 
-            OperateRightList editData = bsdb.OperateRightList.FirstOrDefault(m => m.Id == Id) ?? new OperateRightList();
+            HelpProfitMerTradeSummay editData = db.HelpProfitMerTradeSummay.FirstOrDefault(m => m.Id == Id) ?? new HelpProfitMerTradeSummay();
             ViewBag.data = editData;
             return View();
         }
 
         #endregion
 
-        #region 修改操作权限
+        #region 修改助利宝商户交易额统计
 
         /// <summary>
-        /// 增加或修改操作权限信息
+        /// 增加或修改助利宝商户交易额统计信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Edit(OperateRightList data)
+        public string Edit(HelpProfitMerTradeSummay data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
 
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("EnName", data.EnName); //英文名
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("OperateRightList", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "OperateRightList", "update");
-            bsdb.SaveChanges();
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerTradeSummay", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "HelpProfitMerTradeSummay", "update");
+            db.SaveChanges();
 
             return "success";
         }
 
         #endregion
 
-        #region 删除操作权限信息
+        #region 删除助利宝商户交易额统计信息
 
         /// <summary>
-        /// 删除操作权限信息
+        /// 删除助利宝商户交易额统计信息
         /// </summary>
         /// <returns></returns>
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "OperateRightList", "del");
+            AddSysLog(Id, "HelpProfitMerTradeSummay", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("OperateRightList", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerTradeSummay", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
 
             return "success";
         }
@@ -194,15 +225,15 @@ namespace MySystem.Areas.Admin.Controllers
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "OperateRightList", "open");
+            AddSysLog(Id, "HelpProfitMerTradeSummay", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("OperateRightList", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerTradeSummay", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
             return "success";
         }
 
@@ -217,15 +248,15 @@ namespace MySystem.Areas.Admin.Controllers
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "OperateRightList", "close");
+            AddSysLog(Id, "HelpProfitMerTradeSummay", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("OperateRightList", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerTradeSummay", Fields, id);
             }
-            bsdb.SaveChanges();
+            db.SaveChanges();
             return "success";
         }
 
@@ -238,9 +269,9 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("OperateRightList", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("HelpProfitMerTradeSummay", Sort, Id);
 
-            AddSysLog(Id.ToString(), "OperateRightList", "sort");
+            AddSysLog(Id.ToString(), "HelpProfitMerTradeSummay", "sort");
             return "success";
         }
         #endregion
@@ -258,15 +289,15 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                bsdb.OperateRightList.Add(new OperateRightList()
+                db.HelpProfitMerTradeSummay.Add(new HelpProfitMerTradeSummay()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
 
                 });
-                bsdb.SaveChanges();
+                db.SaveChanges();
             }
-            AddSysLog("0", "OperateRightList", "Import");
+            AddSysLog("0", "HelpProfitMerTradeSummay", "Import");
             return "success";
         }
         #endregion
@@ -277,17 +308,25 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(OperateRightList data)
+        public JsonResult ExportExcel(HelpProfitMerTradeSummay data, string MerchantIdSelect, string BrandIdSelect)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "1"); //名称
-            Fields.Add("EnName", "1"); //英文名
 
 
             string condition = " and Status>-1";
+            //商户
+            if (!string.IsNullOrEmpty(MerchantIdSelect))
+            {
+                condition += " and MerchantId=" + MerchantIdSelect;
+            }
+            //品牌
+            if (!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
 
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("OperateRightList", Fields, "Id desc", "0", 1, 20000, condition, "", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitMerTradeSummay", Fields, "Id desc", "0", 1, 20000, condition, "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -301,7 +340,7 @@ namespace MySystem.Areas.Admin.Controllers
             Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
 
             result.Add("Fields", ReturnFields);
-            AddSysLog("0", "OperateRightList", "ExportExcel");
+            AddSysLog("0", "HelpProfitMerTradeSummay", "ExportExcel");
             return Json(result);
         }
 

+ 352 - 0
Areas/Admin/Controllers/MainServer/HelpProfitMerchantForUserController.cs

@@ -0,0 +1,352 @@
+/*
+ * 助利宝商户关联表
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class HelpProfitMerchantForUserController : BaseController
+    {
+        public HelpProfitMerchantForUserController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 助利宝商户关联表列表
+
+        /// <summary>
+        /// 根据条件查询助利宝商户关联表列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(HelpProfitMerchantForUser data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询助利宝商户关联表列表
+
+        /// <summary>
+        /// 助利宝商户关联表列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(HelpProfitMerchantForUser data, string UserIdMakerCode, string UserIdRealName, string MerchantIdSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("MerNo", "1"); //商户编号
+
+
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //商户
+            if (!string.IsNullOrEmpty(MerchantIdSelect))
+            {
+                condition += " and MerchantId=" + MerchantIdSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitMerchantForUser", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic.Remove("UserId");
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加助利宝商户关联表
+
+        /// <summary>
+        /// 增加或修改助利宝商户关联表信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加助利宝商户关联表
+
+        /// <summary>
+        /// 增加或修改助利宝商户关联表信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(HelpProfitMerchantForUser data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("HelpProfitMerchantForUser", Fields, 0);
+            AddSysLog(data.Id.ToString(), "HelpProfitMerchantForUser", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改助利宝商户关联表
+
+        /// <summary>
+        /// 增加或修改助利宝商户关联表信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            HelpProfitMerchantForUser editData = db.HelpProfitMerchantForUser.FirstOrDefault(m => m.Id == Id) ?? new HelpProfitMerchantForUser();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改助利宝商户关联表
+
+        /// <summary>
+        /// 增加或修改助利宝商户关联表信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(HelpProfitMerchantForUser data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerchantForUser", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "HelpProfitMerchantForUser", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除助利宝商户关联表信息
+
+        /// <summary>
+        /// 删除助利宝商户关联表信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitMerchantForUser", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerchantForUser", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitMerchantForUser", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerchantForUser", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "HelpProfitMerchantForUser", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitMerchantForUser", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("HelpProfitMerchantForUser", Sort, Id);
+
+            AddSysLog(Id.ToString(), "HelpProfitMerchantForUser", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.HelpProfitMerchantForUser.Add(new HelpProfitMerchantForUser()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "HelpProfitMerchantForUser", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(HelpProfitMerchantForUser data, string UserIdMakerCode, string UserIdRealName, string MerchantIdSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("MerNo", "1"); //商户编号
+
+
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //商户
+            if (!string.IsNullOrEmpty(MerchantIdSelect))
+            {
+                condition += " and MerchantId=" + MerchantIdSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitMerchantForUser", Fields, "Id desc", "0", 1, 20000, condition, "UserId,MerchantId,MerNo", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic.Remove("UserId");
+
+            }
+
+            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>();
+            ReturnFields.Add("UserIdMakerCode", "创客创客编号");
+            ReturnFields.Add("UserIdRealName", "创客真实姓名");
+            ReturnFields.Add("MerchantId", "商户");
+            ReturnFields.Add("MerNo", "商户编号");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "HelpProfitMerchantForUser", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 89 - 76
Areas/Admin/Controllers/MainServer/ProfitObjectsActiveParamsController.cs → Areas/Admin/Controllers/MainServer/HelpProfitRebateDetailController.cs

@@ -1,5 +1,5 @@
 /*
- * 分润对象活动参数
+ * 助利宝返利明细表
  */
 
 using System;
@@ -21,76 +21,80 @@ namespace MySystem.Areas.Admin.Controllers
 {
     [Area("Admin")]
     [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectsActiveParamsController : BaseController
+    public class HelpProfitRebateDetailController : BaseController
     {
-        public ProfitObjectsActiveParamsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        public HelpProfitRebateDetailController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
-        #region 分润对象活动参数列表
+        #region 助利宝返利明细表列表
 
         /// <summary>
-        /// 根据条件查询分润对象活动参数列表
+        /// 根据条件查询助利宝返利明细表列表
         /// </summary>
         /// <returns></returns>
-        public IActionResult Index(ProfitObjectsActiveParams data, string right, string ProfitObjectsActiveId)
+        public IActionResult Index(HelpProfitRebateDetail data, string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.ProfitObjectsActiveId = ProfitObjectsActiveId;
 
 
-            string Condition = "";
-            Condition += "Name:\"" + data.Name + "\",";
-
-            if (!string.IsNullOrEmpty(Condition))
-            { 
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
             return View();
         }
 
         #endregion
 
-        #region 根据条件查询分润对象活动参数列表
+        #region 根据条件查询助利宝返利明细表列表
 
         /// <summary>
-        /// 分润对象活动参数列表
+        /// 助利宝返利明细表列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectsActiveParams data, int page = 1, int limit = 30)
+        public JsonResult IndexData(HelpProfitRebateDetail data, string ProductTypeSelect, int page = 1, int limit = 30)
         {
-            
+
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ProfitObjectsActiveId", "1");
 
-            Fields.Add("Name", "2"); //参数名称
+            Fields.Add("CreateDate", "3"); //时间
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsActiveParams", Fields, "Id desc", "0", page, limit, " and Status>-1");
+
+            string condition = " and Status>-1";
+            //产品类型
+            if (!string.IsNullOrEmpty(ProductTypeSelect))
+            {
+                condition += " and ProductType=" + ProductTypeSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitRebateDetail", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
-                
+                //产品类型
+                int ProductType = int.Parse(dic["ProductType"].ToString());
+                if (ProductType == 1) dic["ProductType"] = "在线办卡";
+                if (ProductType == 3) dic["ProductType"] = "系统奖励";
+                if (ProductType == 4) dic["ProductType"] = "灵动商城";
+                if (ProductType == 5) dic["ProductType"] = "快钱Mpos";
+                if (ProductType == 0) dic["ProductType"] = "";
+
             }
             return Json(obj);
         }
 
         #endregion
 
-        #region 增加分润对象活动参数
+        #region 增加助利宝返利明细表
 
         /// <summary>
-        /// 增加或修改分润对象活动参数信息
+        /// 增加或修改助利宝返利明细表信息
         /// </summary>
         /// <returns></returns>
-        public IActionResult Add(string right, string ProfitObjectsActiveId)
+        public IActionResult Add(string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.ProfitObjectsActiveId = ProfitObjectsActiveId;
 
 
             return View();
@@ -98,101 +102,94 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 增加分润对象活动参数
+        #region 增加助利宝返利明细表
 
         /// <summary>
-        /// 增加或修改分润对象活动参数信息
+        /// 增加或修改助利宝返利明细表信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Add(ProfitObjectsActiveParams data)
+        public string Add(HelpProfitRebateDetail data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ProfitObjectsActiveId", data.ProfitObjectsActiveId);
 
-            Fields.Add("Name", data.Name); //参数名称
-Fields.Add("TextValue", data.TextValue); //参数值
-Fields.Add("Remark", data.Remark); //参数说明
+            Fields.Add("Remark", data.Remark); //备注
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectsActiveParams", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectsActiveParams", "add");
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("HelpProfitRebateDetail", Fields, 0);
+            AddSysLog(data.Id.ToString(), "HelpProfitRebateDetail", "add");
             db.SaveChanges();
-            
+
             return "success";
         }
 
         #endregion
 
-        #region 修改分润对象活动参数
+        #region 修改助利宝返利明细表
 
         /// <summary>
-        /// 增加或修改分润对象活动参数信息
+        /// 增加或修改助利宝返利明细表信息
         /// </summary>
         /// <returns></returns>
-        public IActionResult Edit(string right, string ProfitObjectsActiveId, int Id = 0)
+        public IActionResult Edit(string right, int Id = 0)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.ProfitObjectsActiveId = ProfitObjectsActiveId;
 
 
-            ProfitObjectsActiveParams editData = db.ProfitObjectsActiveParams.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectsActiveParams();
+            HelpProfitRebateDetail editData = db.HelpProfitRebateDetail.FirstOrDefault(m => m.Id == Id) ?? new HelpProfitRebateDetail();
             ViewBag.data = editData;
             return View();
         }
 
         #endregion
 
-        #region 修改分润对象活动参数
+        #region 修改助利宝返利明细表
 
         /// <summary>
-        /// 增加或修改分润对象活动参数信息
+        /// 增加或修改助利宝返利明细表信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Edit(ProfitObjectsActiveParams data)
+        public string Edit(HelpProfitRebateDetail data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ProfitObjectsActiveId", data.ProfitObjectsActiveId);
 
-            Fields.Add("Name", data.Name); //参数名称
-Fields.Add("TextValue", data.TextValue); //参数值
-Fields.Add("Remark", data.Remark); //参数说明
+            Fields.Add("Remark", data.Remark); //备注
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActiveParams", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"ProfitObjectsActiveParams","update");
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitRebateDetail", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "HelpProfitRebateDetail", "update");
             db.SaveChanges();
-            
+
             return "success";
         }
 
         #endregion
 
-        #region 删除分润对象活动参数信息
+        #region 删除助利宝返利明细表信息
 
         /// <summary>
-        /// 删除分润对象活动参数信息
+        /// 删除助利宝返利明细表信息
         /// </summary>
         /// <returns></returns>
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectsActiveParams","del");
+            AddSysLog(Id, "HelpProfitRebateDetail", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActiveParams", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitRebateDetail", Fields, id);
             }
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -207,13 +204,13 @@ Fields.Add("Remark", data.Remark); //参数说明
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectsActiveParams","open");
+            AddSysLog(Id, "HelpProfitRebateDetail", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActiveParams", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitRebateDetail", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -230,13 +227,13 @@ Fields.Add("Remark", data.Remark); //参数说明
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectsActiveParams","close");
+            AddSysLog(Id, "HelpProfitRebateDetail", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActiveParams", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("HelpProfitRebateDetail", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -251,9 +248,9 @@ Fields.Add("Remark", data.Remark); //参数说明
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectsActiveParams", Sort, Id);
-            
-            AddSysLog(Id.ToString(), "ProfitObjectsActiveParams", "sort");
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("HelpProfitRebateDetail", Sort, Id);
+
+            AddSysLog(Id.ToString(), "HelpProfitRebateDetail", "sort");
             return "success";
         }
         #endregion
@@ -267,19 +264,19 @@ Fields.Add("Remark", data.Remark); //参数说明
         {
             ExcelData = HttpUtility.UrlDecode(ExcelData);
             JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
+            for (int i = 1; i < list.Count; i++)
             {
                 JsonData dr = list[i];
-                
-                db.ProfitObjectsActiveParams.Add(new ProfitObjectsActiveParams()
+
+                db.HelpProfitRebateDetail.Add(new HelpProfitRebateDetail()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
-                    
+
                 });
                 db.SaveChanges();
             }
-            AddSysLog("0", "ProfitObjectsActiveParams", "Import");
+            AddSysLog("0", "HelpProfitRebateDetail", "Import");
             return "success";
         }
         #endregion
@@ -290,16 +287,32 @@ Fields.Add("Remark", data.Remark); //参数说明
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectsActiveParams data)
+        public JsonResult ExportExcel(HelpProfitRebateDetail data, string ProductTypeSelect)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "2"); //参数名称
+            Fields.Add("CreateDate", "3"); //时间
+
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsActiveParams", Fields, "Id desc", "0", 1, 20000, "", "", false);
+            string condition = " and Status>-1";
+            //产品类型
+            if (!string.IsNullOrEmpty(ProductTypeSelect))
+            {
+                condition += " and ProductType=" + ProductTypeSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("HelpProfitRebateDetail", Fields, "Id desc", "0", 1, 20000, condition, "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
-                
+                //产品类型
+                int ProductType = int.Parse(dic["ProductType"].ToString());
+                if (ProductType == 1) dic["ProductType"] = "在线办卡";
+                if (ProductType == 3) dic["ProductType"] = "系统奖励";
+                if (ProductType == 4) dic["ProductType"] = "灵动商城";
+                if (ProductType == 5) dic["ProductType"] = "快钱Mpos";
+                if (ProductType == 0) dic["ProductType"] = "";
+
             }
 
             Dictionary<string, object> result = new Dictionary<string, object>();
@@ -307,9 +320,9 @@ Fields.Add("Remark", data.Remark); //参数说明
             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);
-            AddSysLog("0", "ProfitObjectsActiveParams", "ExportExcel");
+            AddSysLog("0", "HelpProfitRebateDetail", "ExportExcel");
             return Json(result);
         }
 

+ 41 - 9
Areas/Admin/Controllers/MainServer/MachineApplyController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -50,23 +51,26 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具申请订单列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(MachineApply data, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string SendStatusSelect, string StoreTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(MachineApply data,string ApplyNo, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string ApplyTimeData, string SendDateData, string SendStatusSelect, string StoreTypeSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
             Fields.Add("ApplyNo", "1"); //申请单号
             Fields.Add("BrandId", "1"); //品牌
-            Fields.Add("ApplyTime", "3"); //申请时间
             Fields.Add("ExpressNo", "1"); //快递单号
             Fields.Add("DeliveryType", "0"); //提货类型
             Fields.Add("StoreManager", "1"); //仓库联系人
-            Fields.Add("SendDate", "3"); //发货时间
             Fields.Add("TopUserId", "0"); //顶级创客
             Fields.Add("SwapSnExpand", "1"); //兑换SN
             Fields.Add("SendSn", "1"); //发货SN
 
             string condition = " and Status>-1";
+            //申请单号
+            if (!string.IsNullOrEmpty(ApplyNo))
+            {
+                condition += " and ApplyNo like'" + ApplyNo + "' " ;
+            }
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -107,6 +111,22 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and StoreType=" + StoreTypeSelect;
             }
+            //申请时间
+            if(!string.IsNullOrEmpty(ApplyTimeData))
+            {
+                string[] datelist = ApplyTimeData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and ApplyTime>='" + start + " 00:00:00' and ApplyTime<='" + end + " 23:59:59'";
+            }
+
+            if(!string.IsNullOrEmpty(SendDateData))
+            {
+                string[] datelist = SendDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and SendDate>='" + start + " 00:00:00' and SendDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineApply", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -146,9 +166,9 @@ namespace MySystem.Areas.Admin.Controllers
 
                 //订单状态
                 int Status = int.Parse(dic["Status"].ToString());
-                if(Status == 0) dic["Status"] = "待审核";
-                if(Status == 1) dic["Status"] = "申请成功";
-                if(Status == 2) dic["Status"] = "申请失败";
+                if(Status == 0) dic["StatusName"] = "待审核";
+                if(Status == 1) dic["StatusName"] = "申请成功";
+                if(Status == 2) dic["StatusName"] = "申请失败";
 
                 //提货方式
                 int DeliveryType = int.Parse(dic["DeliveryType"].ToString());
@@ -157,7 +177,7 @@ namespace MySystem.Areas.Admin.Controllers
                 if(DeliveryType == 2) dic["DeliveryType"] = "上门自提";
 
                 //发货状态
-                int SendStatus = int.Parse(dic["SendStatus"].ToString());
+                int SendStatus = int.Parse(dic["Status"].ToString());
                 if(SendStatus == 0) dic["SendStatus"] = "未发货";
                 if(SendStatus == 1) dic["SendStatus"] = "已发货";
                 
@@ -165,8 +185,20 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["ExpressInfo"] = dic["ExpressName"].ToString() + "<br />" + dic["ExpressNo"].ToString();
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("ApplyCount", 0);
-            other.Add("SendCount", 0);
+            int ApplyCount = 0;//申请机具数
+            int SendCount = 0;//发货机具数
+            DataTable dt = OtherMySqlConn.dtable("select sum(ApplyDeviceNum) from MachineApply where SendStatus=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                ApplyCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select sum(ApplyDeviceNum) from MachineApply where SendStatus=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                SendCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            other.Add("ApplyCount", ApplyCount);
+            other.Add("SendCount", SendCount);
             obj.Add("other", other);
             return Json(obj);
         }

+ 17 - 10
Areas/Admin/Controllers/MainServer/MachineChangeController.cs

@@ -25,6 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
     {
         public MachineChangeController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
         #region 机具转换订单列表
@@ -50,13 +51,12 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具转换订单列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(MachineChange data, string UserIdRealName, string UserIdMakerCode, string BackProductTypeSelect, string AuditResultSelect, string BackStoreIdStoreName, string BackStoreIdStoreNo, string BackStoreUserIdMakerCode, string BackStoreUserIdRealName, string OutProductTypeSelect, string OutStoreIdStoreName, string OutStoreIdStoreNo, int page = 1, int limit = 30)
+        public JsonResult IndexData(MachineChange data, string UserIdRealName, string UserIdMakerCode, string BackProductTypeSelect, string AuditResultSelect, string BackStoreIdStoreName, string BackStoreIdStoreNo, string BackStoreUserIdMakerCode, string BackStoreUserIdRealName, string OutProductTypeSelect, string OutStoreIdStoreName, string OutStoreIdStoreNo, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
             Fields.Add("ChangeNo", "1"); //转换单号
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("OutStoreManagerMobile", "1"); //出库仓库联系人手机号
 
 
@@ -116,9 +116,16 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and OutStoreId in (select OutStoreId from StoreHouseForStoreNo where StoreNo='" + OutStoreIdStoreNo + "')";
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
 
-            Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).IndexData("MachineChange", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineChange", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -196,7 +203,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Add("MachineChange", Fields, 0);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MachineChange", Fields, 0);
             AddSysLog(data.Id.ToString(), "MachineChange", "add");
             db.SaveChanges();
 
@@ -241,7 +248,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("MachineChange", Fields, data.Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineChange", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "MachineChange", "update");
             db.SaveChanges();
 
@@ -265,7 +272,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("MachineChange", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineChange", Fields, id);
             }
             db.SaveChanges();
 
@@ -289,7 +296,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("MachineChange", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineChange", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -312,7 +319,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("MachineChange", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineChange", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -327,7 +334,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Sort("MachineChange", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MachineChange", Sort, Id);
 
             AddSysLog(Id.ToString(), "MachineChange", "sort");
             return "success";
@@ -432,7 +439,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
 
 
-            Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).IndexData("MachineChange", Fields, "Id desc", "0", 1, 20000, condition, "ChangeNo,UserId,BackProductType,ChangeDeviceNum,ChangeTime,AuditBy,AuditResult,AuditRemark,ChangeSnExpand,BackStoreId,Remark,BackStoreUserId,OutProductType,OutStoreId,OutStoreManagerMobile", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineChange", Fields, "Id desc", "0", 1, 20000, condition, "ChangeNo,UserId,BackProductType,ChangeDeviceNum,ChangeTime,AuditBy,AuditResult,AuditRemark,ChangeSnExpand,BackStoreId,Remark,BackStoreUserId,OutProductType,OutStoreId,OutStoreManagerMobile", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {

+ 26 - 26
Areas/Admin/Controllers/MainServer/MachineChangeDetailController.cs

@@ -43,11 +43,11 @@ namespace MySystem.Areas.Admin.Controllers
 
             string Condition = "";
             Condition += "ChangeNo:\"" + data.ChangeNo + "\",";
-Condition += "BackProductType:\"" + data.BackProductType + "\",";
-Condition += "BackDeviceStatus:\"" + data.BackDeviceStatus + "\",";
+            Condition += "BackProductType:\"" + data.BackProductType + "\",";
+            Condition += "BackDeviceStatus:\"" + data.BackDeviceStatus + "\",";
 
             if (!string.IsNullOrEmpty(Condition))
-            { 
+            {
                 Condition = Condition.TrimEnd(',');
                 Condition = ", where: {" + Condition + "}";
             }
@@ -65,20 +65,20 @@ Condition += "BackDeviceStatus:\"" + data.BackDeviceStatus + "\",";
         /// <returns></returns>
         public JsonResult IndexData(MachineChangeDetail data, int page = 1, int limit = 30)
         {
-            
+
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("ChangeId", "1");
 
             Fields.Add("ChangeNo", "2"); //订单号
-Fields.Add("CreateDate", "3"); //时间
-Fields.Add("BackProductType", "1"); //退回产品类型
-Fields.Add("BackDeviceStatus", "1"); //设备状态
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("BackProductType", "1"); //退回产品类型
+            Fields.Add("BackDeviceStatus", "1"); //设备状态
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineChangeDetail", Fields, "Id desc", "0", page, limit, " and Status>-1");
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
-                
+
             }
             return Json(obj);
         }
@@ -116,7 +116,7 @@ Fields.Add("BackDeviceStatus", "1"); //设备状态
             Fields.Add("ChangeId", data.ChangeId);
 
             Fields.Add("BackProductType", data.BackProductType); //退回产品类型
-Fields.Add("Remark", data.Remark); //备注
+            Fields.Add("Remark", data.Remark); //备注
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
@@ -124,7 +124,7 @@ Fields.Add("Remark", data.Remark); //备注
             int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MachineChangeDetail", Fields, 0);
             AddSysLog(data.Id.ToString(), "MachineChangeDetail", "add");
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -163,15 +163,15 @@ Fields.Add("Remark", data.Remark); //备注
             Fields.Add("ChangeId", data.ChangeId);
 
             Fields.Add("BackProductType", data.BackProductType); //退回产品类型
-Fields.Add("Remark", data.Remark); //备注
+            Fields.Add("Remark", data.Remark); //备注
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineChangeDetail", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"MachineChangeDetail","update");
+            AddSysLog(data.Id.ToString(), "MachineChangeDetail", "update");
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -186,7 +186,7 @@ Fields.Add("Remark", data.Remark); //备注
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"MachineChangeDetail","del");
+            AddSysLog(Id, "MachineChangeDetail", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
@@ -195,7 +195,7 @@ Fields.Add("Remark", data.Remark); //备注
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineChangeDetail", Fields, id);
             }
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -210,7 +210,7 @@ Fields.Add("Remark", data.Remark); //备注
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"MachineChangeDetail","open");
+            AddSysLog(Id, "MachineChangeDetail", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
@@ -233,7 +233,7 @@ Fields.Add("Remark", data.Remark); //备注
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"MachineChangeDetail","close");
+            AddSysLog(Id, "MachineChangeDetail", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
@@ -255,7 +255,7 @@ Fields.Add("Remark", data.Remark); //备注
         public string Sort(int Id, int Sort)
         {
             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MachineChangeDetail", Sort, Id);
-            
+
             AddSysLog(Id.ToString(), "MachineChangeDetail", "sort");
             return "success";
         }
@@ -270,15 +270,15 @@ Fields.Add("Remark", data.Remark); //备注
         {
             ExcelData = HttpUtility.UrlDecode(ExcelData);
             JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
+            for (int i = 1; i < list.Count; i++)
             {
                 JsonData dr = list[i];
-                
+
                 db.MachineChangeDetail.Add(new MachineChangeDetail()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
-                    
+
                 });
                 db.SaveChanges();
             }
@@ -297,15 +297,15 @@ Fields.Add("Remark", data.Remark); //备注
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("ChangeNo", "2"); //订单号
-Fields.Add("CreateDate", "3"); //时间
-Fields.Add("BackProductType", "1"); //退回产品类型
-Fields.Add("BackDeviceStatus", "1"); //设备状态
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("BackProductType", "1"); //退回产品类型
+            Fields.Add("BackDeviceStatus", "1"); //设备状态
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineChangeDetail", Fields, "Id desc", "0", 1, 20000, "", "", 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>();
@@ -313,7 +313,7 @@ Fields.Add("BackDeviceStatus", "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);
             AddSysLog("0", "MachineChangeDetail", "ExportExcel");
             return Json(result);

+ 407 - 0
Areas/Admin/Controllers/MainServer/MachineUnBindController.cs

@@ -0,0 +1,407 @@
+/*
+ * 机具解绑记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class MachineUnBindController : BaseController
+    {
+        public MachineUnBindController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 机具解绑记录列表
+
+        /// <summary>
+        /// 根据条件查询机具解绑记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(MachineUnBind data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询机具解绑记录列表
+
+        /// <summary>
+        /// 机具解绑记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(MachineUnBind data, string BrandIdSelect, string AuditStatusSelect, string MerchantIdMerchantName, string MerchantIdKqMerNo, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("SnNo", "1"); //机具SN
+            Fields.Add("AuditDate", "3"); //审核时间
+
+
+            string condition = " and Status>-1";
+            //机具产品类型
+            if (!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
+            //审核状态
+            if (!string.IsNullOrEmpty(AuditStatusSelect))
+            {
+                condition += " and AuditStatus=" + AuditStatusSelect;
+            }
+            //解绑商户商户姓名
+            if (!string.IsNullOrEmpty(MerchantIdMerchantName))
+            {
+                condition += " and MerchantId in (select MerchantId from PosMerchantInfoForMerchantName where MerchantName='" + MerchantIdMerchantName + "')";
+            }
+            //解绑商户渠道商户编码
+            if (!string.IsNullOrEmpty(MerchantIdKqMerNo))
+            {
+                condition += " and MerchantId in (select MerchantId from PosMerchantInfoForKqMerNo where KqMerNo='" + MerchantIdKqMerNo + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineUnBind", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdMobile"] = userid_Users.Mobile;
+                dic.Remove("UserId");
+                //机具产品类型
+                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+                //审核状态
+                int AuditStatus = int.Parse(dic["AuditStatus"].ToString());
+                if (AuditStatus == 0) dic["AuditStatus"] = "未审核";
+                if (AuditStatus == 1) dic["AuditStatus"] = "审核通过,处理成功";
+                if (AuditStatus == 2) dic["AuditStatus"] = "审核失败";
+                //解绑商户
+                int MerchantId = int.Parse(function.CheckInt(dic["MerchantId"].ToString()));
+                PosMerchantInfo merchantid_PosMerchantInfo = db.PosMerchantInfo.FirstOrDefault(m => m.Id == MerchantId) ?? new PosMerchantInfo();
+                dic["MerchantIdMerchantName"] = merchantid_PosMerchantInfo.MerchantName;
+                dic["MerchantIdKqMerNo"] = merchantid_PosMerchantInfo.KqMerNo;
+                dic.Remove("MerchantId");
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加机具解绑记录
+
+        /// <summary>
+        /// 增加或修改机具解绑记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加机具解绑记录
+
+        /// <summary>
+        /// 增加或修改机具解绑记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(MachineUnBind data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("BrandId", data.BrandId); //机具产品类型
+            Fields.Add("SnNo", data.SnNo); //机具SN
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("MachineUnBind", Fields, 0);
+            AddSysLog(data.Id.ToString(), "MachineUnBind", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改机具解绑记录
+
+        /// <summary>
+        /// 增加或修改机具解绑记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            MachineUnBind editData = db.MachineUnBind.FirstOrDefault(m => m.Id == Id) ?? new MachineUnBind();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改机具解绑记录
+
+        /// <summary>
+        /// 增加或修改机具解绑记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(MachineUnBind data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("BrandId", data.BrandId); //机具产品类型
+            Fields.Add("SnNo", data.SnNo); //机具SN
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineUnBind", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "MachineUnBind", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除机具解绑记录信息
+
+        /// <summary>
+        /// 删除机具解绑记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "MachineUnBind", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineUnBind", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "MachineUnBind", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineUnBind", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "MachineUnBind", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("MachineUnBind", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("MachineUnBind", Sort, Id);
+
+            AddSysLog(Id.ToString(), "MachineUnBind", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.MachineUnBind.Add(new MachineUnBind()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "MachineUnBind", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(MachineUnBind data, string BrandIdSelect, string AuditStatusSelect, string MerchantIdMerchantName, string MerchantIdKqMerNo)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("SnNo", "1"); //机具SN
+            Fields.Add("AuditDate", "3"); //审核时间
+
+
+            string condition = " and Status>-1";
+            //机具产品类型
+            if (!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
+            //审核状态
+            if (!string.IsNullOrEmpty(AuditStatusSelect))
+            {
+                condition += " and AuditStatus=" + AuditStatusSelect;
+            }
+            //解绑商户商户姓名
+            if (!string.IsNullOrEmpty(MerchantIdMerchantName))
+            {
+                condition += " and MerchantId in (select MerchantId from PosMerchantInfoForMerchantName where MerchantName='" + MerchantIdMerchantName + "')";
+            }
+            //解绑商户渠道商户编码
+            if (!string.IsNullOrEmpty(MerchantIdKqMerNo))
+            {
+                condition += " and MerchantId in (select MerchantId from PosMerchantInfoForKqMerNo where KqMerNo='" + MerchantIdKqMerNo + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineUnBind", Fields, "Id desc", "0", 1, 20000, condition, "ApplyNo,UserId,BrandId,SnNo,AuditStatus,AuditDesc,AuditDate,MerchantId", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic["UserIdMobile"] = userid_Users.Mobile;
+                dic.Remove("UserId");
+                //机具产品类型
+                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+                //审核状态
+                int AuditStatus = int.Parse(dic["AuditStatus"].ToString());
+                if (AuditStatus == 0) dic["AuditStatus"] = "未审核";
+                if (AuditStatus == 1) dic["AuditStatus"] = "审核通过,处理成功";
+                if (AuditStatus == 2) dic["AuditStatus"] = "审核失败";
+                //解绑商户
+                int MerchantId = int.Parse(function.CheckInt(dic["MerchantId"].ToString()));
+                PosMerchantInfo merchantid_PosMerchantInfo = db.PosMerchantInfo.FirstOrDefault(m => m.Id == MerchantId) ?? new PosMerchantInfo();
+                dic["MerchantIdMerchantName"] = merchantid_PosMerchantInfo.MerchantName;
+                dic["MerchantIdKqMerNo"] = merchantid_PosMerchantInfo.KqMerNo;
+                dic.Remove("MerchantId");
+
+            }
+
+            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>();
+            ReturnFields.Add("ApplyNo", "解绑申请单号");
+            ReturnFields.Add("UserIdRealName", "创客真实姓名");
+            ReturnFields.Add("UserIdMakerCode", "创客创客编号");
+            ReturnFields.Add("UserIdMobile", "创客手机号");
+            ReturnFields.Add("BrandId", "机具产品类型");
+            ReturnFields.Add("SnNo", "机具SN");
+            ReturnFields.Add("AuditStatus", "审核状态");
+            ReturnFields.Add("AuditDesc", "审核描述");
+            ReturnFields.Add("AuditDate", "审核时间");
+            ReturnFields.Add("MerchantIdMerchantName", "解绑商户商户姓名");
+            ReturnFields.Add("MerchantIdKqMerNo", "解绑商户渠道商户编码");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "MachineUnBind", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 1 - 1
Areas/Admin/Controllers/MainServer/MerchantAddInfoController.cs

@@ -331,7 +331,7 @@ namespace MySystem.Areas.Admin.Controllers
 
             MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantInfo();
             MerchantAddInfo merchantadd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
-            string result = new WeChatFunction(_accessor.HttpContext).MerchantCreate(merchantadd, merchant);
+            string result = ""; //new WeChatFunction(_accessor.HttpContext).MerchantCreate(merchantadd, merchant);
             if (result.Contains("\"applyment_id\":"))
             {
                 JsonData jsonObj = JsonMapper.ToObject(result);

+ 14 - 4
Areas/Admin/Controllers/MainServer/MerchantRebateDetailController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -98,10 +99,19 @@ namespace MySystem.Areas.Admin.Controllers
                 // if (SyncStatus == 1) dic["SyncStatus"] = "已验证和同步";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("CreditTradeAmt", 0);
-            other.Add("DebitTradeAmt", 0);
-            other.Add("CreditPrizeAmt", 0);
-            other.Add("DebitPrizeAmt", 0);
+            string CreditTradeAmt = "0.00", DebitTradeAmt = "0.00", CreditPrizeAmt = "0.00", DebitPrizeAmt = "0.00";
+            DataTable dt = OtherMySqlConn.dtable("select sum(CreditTradeAmt),sum(DebitTradeAmt),sum(CreditPrizeAmt),sum(DebitPrizeAmt) from MerchantRebateDetail where 1=1" + condition);
+            if(dt.Rows.Count > 0)
+            {
+                CreditTradeAmt = dt.Rows[0][0].ToString();
+                DebitTradeAmt = dt.Rows[0][1].ToString();
+                CreditPrizeAmt = dt.Rows[0][2].ToString();
+                DebitPrizeAmt = dt.Rows[0][3].ToString();
+            }
+            other.Add("CreditTradeAmt", CreditTradeAmt);
+            other.Add("DebitTradeAmt", DebitTradeAmt);
+            other.Add("CreditPrizeAmt", CreditPrizeAmt);
+            other.Add("DebitPrizeAmt", DebitPrizeAmt);
             obj.Add("other", other);
             return Json(obj);
         }

+ 8 - 2
Areas/Admin/Controllers/MainServer/OpenRewardController.cs

@@ -50,12 +50,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 开机奖励列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(OpenReward data, string MakerCode, string RealName, string CheckStatusSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(OpenReward data, string MakerCode, string RealName, string CheckStatusSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //交易时间
             Fields.Add("BrandId", "0"); //品牌
             Fields.Add("TopUserId", "0"); //顶级创客
 
@@ -75,6 +74,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and CheckStatus=" + CheckStatusSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("OpenReward", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;

+ 24 - 6
Areas/Admin/Controllers/MainServer/OpenRewardDetailController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -50,12 +51,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 开机奖励明细列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(OpenRewardDetail data, string MakerCode, string RealName, string MerchantNo, string MerchantName, int page = 1, int limit = 30)
+        public JsonResult IndexData(OpenRewardDetail data, string MakerCode, string RealName, string MerchantNo, string MerchantName, string TradeDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("TradeDate", "3"); //达标日期
             Fields.Add("BrandId", "0"); //品牌
             Fields.Add("SnNo", "1"); //SN号
             Fields.Add("MerNo", "1"); //渠道商户号
@@ -82,6 +82,14 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and MerchantId in (select MerchantId from MerchantForName where Name='" + MerchantName + "')";
             }
+            // 交易时间
+            if(!string.IsNullOrEmpty(TradeDateData))
+            {
+                string[] datelist = TradeDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and TradeDate>='" + start + " 00:00:00' and TradeDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("OpenRewardDetail", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -138,10 +146,20 @@ namespace MySystem.Areas.Admin.Controllers
                 
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("CreditTradeAmt", 0);
-            other.Add("DebitTradeAmt", 0);
-            other.Add("CreditPrizeAmt", 0);
-            other.Add("DebitPrizeAmt", 0);
+            string CreditTradeAmt = "0.00", DebitTradeAmt = "0.00", CreditRewardAmount = "0.00", DebitRewardAmount = "0.00";//贷记卡交易总额 借记卡交易总额 贷记卡交易奖励金额 借记记卡交易奖励金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(CreditTradeAmt),sum(DebitTradeAmt),sum(CreditRewardAmount),sum(DebitRewardAmount) from OpenRewardDetail where 1=1" + condition);
+            if(dt.Rows.Count > 0)
+            {
+                CreditTradeAmt = dt.Rows[0][0].ToString();
+                DebitTradeAmt = dt.Rows[0][1].ToString();
+                CreditRewardAmount = dt.Rows[0][2].ToString();
+                DebitRewardAmount = dt.Rows[0][3].ToString();
+
+            }
+            other.Add("CreditTradeAmt", CreditTradeAmt);
+            other.Add("DebitTradeAmt", DebitTradeAmt);
+            other.Add("CreditRewardAmount", CreditRewardAmount);
+            other.Add("DebitRewardAmount", DebitRewardAmount);
             obj.Add("other", other);
             return Json(obj);
         }

+ 9 - 0
Areas/Admin/Controllers/MainServer/OpenSnSnapshotController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -121,6 +122,14 @@ namespace MySystem.Areas.Admin.Controllers
                 if (Status == 1) dic["Status"] = "成功";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
+            string PrizeAmt = "0.00", BuyPosCount = "0.00", StadardBuyPosCount = "0.00";//奖励金额 购买机数量 标准购买机数量
+            DataTable dt = OtherMySqlConn.dtable("select sum(PrizeAmt),sum(BuyPosCount),sum(StadardBuyPosCount) from OpenSnSnapshot where 1=1" + condition);
+            if(dt.Rows.Count > 0)
+            {
+                PrizeAmt = dt.Rows[0][0].ToString();
+                BuyPosCount = dt.Rows[0][1].ToString();
+                StadardBuyPosCount = dt.Rows[0][2].ToString();
+            }
             other.Add("PrizeAmt", 0);
             other.Add("BuyPosCount", 0);
             other.Add("StadardBuyPosCount", 0);

+ 166 - 20
Areas/Admin/Controllers/MainServer/OrdersController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -54,17 +55,15 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客订单列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(Orders data, string UserIdMakerCode, string UserIdRealName, string PayModeSelect, string StoreIdStoreNo, string StoreIdStoreName, string RefundStatusSelect, string DeliveryTypeSelect, string SendStatusSelect, string ProductIdSelect, string StoreTypeSelect, string StoreUserIdMakerCode, string StoreUserIdRealName, string PayStatusSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(Orders data, string OrderNo, string TradeNo, string RealName, string Mobile, string StoreContact, string ErpCode, string SnNos, string CreateDateData, string SendDateData, string UserIdMakerCode, string UserIdRealName, string PayModeSelect, string StoreIdStoreNo, string StoreIdStoreName, string RefundStatusSelect, string DeliveryTypeSelect, string SendStatusSelect, string ProductIdSelect, string StoreTypeSelect, string StoreUserIdMakerCode, string StoreUserIdRealName, string PayStatusSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("OrderNo", "1"); //订单号
             Fields.Add("RealName", "1"); //姓名
             Fields.Add("Mobile", "1"); //手机号
             Fields.Add("ErpCode", "1"); //运单号
-            Fields.Add("SendDate", "3"); //发货时间
             Fields.Add("TradeNo", "1"); //支付交易号
             Fields.Add("StoreContact", "1"); //仓库联系人
             Fields.Add("SnNos", "2"); //SN编号
@@ -72,7 +71,28 @@ namespace MySystem.Areas.Admin.Controllers
 
 
             string condition = " and Status>-1";
-            //创客创客编号
+            //平台订单号
+            if (!string.IsNullOrEmpty(OrderNo))
+            {
+                condition += " and OrderNo like '" + OrderNo + "'";
+            }
+            //渠道订单号
+            if (!string.IsNullOrEmpty(TradeNo))
+            {
+                condition += " and TradeNo=" + TradeNo;
+            }
+            //收件人姓名
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and RealName=" + RealName;
+            }
+            //收件人电话
+            if (!string.IsNullOrEmpty(Mobile))
+            {
+                condition += " and Mobile=" + Mobile;
+            }
+
+            //创客编号
             if (!string.IsNullOrEmpty(UserIdMakerCode))
             {
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
@@ -87,16 +107,59 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and PayMode=" + PayModeSelect;
             }
-            //仓库仓库编号
+            //仓库编号
             if (!string.IsNullOrEmpty(StoreIdStoreNo))
             {
                 condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreIdStoreNo + "')";
             }
-            //仓库仓库名称
+            //仓库名称
             if (!string.IsNullOrEmpty(StoreIdStoreName))
             {
                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreIdStoreName + "')";
             }
+            //仓库联系人
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+
+            //仓库归属创客创客编号
+            if (!string.IsNullOrEmpty(StoreUserIdMakerCode))
+            {
+                condition += " and StoreUserId in (select StoreUserId from UserForMakerCode where MakerCode='" + StoreUserIdMakerCode + "')";
+            }
+            //仓库归属创客真实姓名
+            if (!string.IsNullOrEmpty(StoreUserIdRealName))
+            {
+                condition += " and StoreUserId in (select StoreUserId from UserForRealName where RealName='" + StoreUserIdRealName + "')";
+            }
+            //快递单号
+            if (!string.IsNullOrEmpty(ErpCode))
+            {
+                condition += " and ErpCode=" + ErpCode;
+            }
+            //SN
+            if (!string.IsNullOrEmpty(SnNos))
+            {
+                condition += " and SnNos=" + SnNos;
+            }
+            //下单时间
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            //发货时间
+            if (!string.IsNullOrEmpty(SendDateData))
+            {
+                string[] datelist = SendDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
             //退款状态
             if (!string.IsNullOrEmpty(RefundStatusSelect))
             {
@@ -112,26 +175,16 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and SendStatus=" + SendStatusSelect;
             }
-            //商品名称
+            //商品类型名称
             if (!string.IsNullOrEmpty(ProductIdSelect))
             {
-                condition += " and ProductId=" + ProductIdSelect;
+                condition += " and Id in (select OrderId from OrderProduct where ProductId="+ProductIdSelect+")";//表数据量过大时不适用
             }
             //仓库类型
             if (!string.IsNullOrEmpty(StoreTypeSelect))
             {
                 condition += " and StoreType=" + StoreTypeSelect;
             }
-            //仓库归属创客创客编号
-            if (!string.IsNullOrEmpty(StoreUserIdMakerCode))
-            {
-                condition += " and StoreUserId in (select StoreUserId from UserForMakerCode where MakerCode='" + StoreUserIdMakerCode + "')";
-            }
-            //仓库归属创客真实姓名
-            if (!string.IsNullOrEmpty(StoreUserIdRealName))
-            {
-                condition += " and StoreUserId in (select StoreUserId from UserForRealName where RealName='" + StoreUserIdRealName + "')";
-            }
             //支付状态
             if (!string.IsNullOrEmpty(PayStatusSelect))
             {
@@ -194,6 +247,12 @@ namespace MySystem.Areas.Admin.Controllers
                 }
                 //商品名称
                 dic["ProductId"] = RelationClass.GetProductsInfo(int.Parse(dic["ProductId"].ToString()));
+
+                //商品名称
+                int Id = int.Parse(function.CheckInt(dic["Id"].ToString()));
+                OrderProduct orderProducts = db.OrderProduct.FirstOrDefault(m => m.OrderId == Id) ?? new OrderProduct();
+                dic["ProductName"] = orderProducts.ProductName;
+
                 //仓库归属创客
                 int StoreUserId = int.Parse(function.CheckInt(dic["StoreUserId"].ToString()));
                 Users storeuserid_Users = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
@@ -214,12 +273,99 @@ namespace MySystem.Areas.Admin.Controllers
 
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("SuccessAmount", 0);
-            other.Add("FailAmount", 0);
+            string SuccessAmount = "0.00";//支付成功总金额
+            string FailAmount = "0.00";//支付失败总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TotalPrice) from Orders where PayStatus=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                SuccessAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TotalPrice) from Orders where PayStatus=2" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                FailAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("SuccessAmount", SuccessAmount);
+            other.Add("FailAmount", FailAmount);
             obj.Add("other", other);
             return Json(obj);
         }
 
+
+        public JsonResult IndexDatas(string UserIdMakerCode, string UserIdRealName, string PayModeSelect, string StoreIdStoreNo, string StoreIdStoreName, string RefundStatusSelect, string DeliveryTypeSelect, string SendStatusSelect, string ProductIdSelect, string StoreTypeSelect, string StoreUserIdMakerCode, string StoreUserIdRealName, string PayStatusSelect, int page = 1, int limit = 30)
+        {
+            string condition = " and Status>-1";
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //支付方式
+            if (!string.IsNullOrEmpty(PayModeSelect))
+            {
+                condition += " and PayMode=" + PayModeSelect;
+            }
+            //仓库仓库编号
+            if (!string.IsNullOrEmpty(StoreIdStoreNo))
+            {
+                condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreIdStoreNo + "')";
+            }
+            //仓库仓库名称
+            if (!string.IsNullOrEmpty(StoreIdStoreName))
+            {
+                condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreIdStoreName + "')";
+            }
+            //退款状态
+            if (!string.IsNullOrEmpty(RefundStatusSelect))
+            {
+                condition += " and RefundStatus=" + RefundStatusSelect;
+            }
+            //提货类型
+            if (!string.IsNullOrEmpty(DeliveryTypeSelect))
+            {
+                condition += " and DeliveryType=" + DeliveryTypeSelect;
+            }
+            //发货状态
+            if (!string.IsNullOrEmpty(SendStatusSelect))
+            {
+                condition += " and SendStatus=" + SendStatusSelect;
+            }
+            //商品名称
+            if (!string.IsNullOrEmpty(ProductIdSelect))
+            {
+                condition += " and ProductId=" + ProductIdSelect;
+            }
+            //仓库类型
+            if (!string.IsNullOrEmpty(StoreTypeSelect))
+            {
+                condition += " and StoreType=" + StoreTypeSelect;
+            }
+            //仓库归属创客创客编号
+            if (!string.IsNullOrEmpty(StoreUserIdMakerCode))
+            {
+                condition += " and StoreUserId in (select StoreUserId from UserForMakerCode where MakerCode='" + StoreUserIdMakerCode + "')";
+            }
+            //仓库归属创客真实姓名
+            if (!string.IsNullOrEmpty(StoreUserIdRealName))
+            {
+                condition += " and StoreUserId in (select StoreUserId from UserForRealName where RealName='" + StoreUserIdRealName + "')";
+            }
+            //支付状态
+            if (!string.IsNullOrEmpty(PayStatusSelect))
+            {
+                condition += " and PayStatus=" + PayStatusSelect;
+            }
+            List<Dictionary<string, object>> other = new List<Dictionary<string, object>>();
+            Dictionary<string, object> obj = new Dictionary<string, object>();
+            DataTable dt = OtherMySqlConn.dtable("select sum(TotalPrice) from Orders where PayStatus=0" + condition);
+            return null;
+        }
+
         #endregion
 
         #region 增加创客订单

+ 0 - 456
Areas/Admin/Controllers/MainServer/PageUpdateInfoController.cs

@@ -1,456 +0,0 @@
-/*
- * 页面模板更新信息
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class PageUpdateInfoController : BaseController
-    {
-        public PageUpdateInfoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 页面模板更新信息列表
-
-        /// <summary>
-        /// 根据条件查询页面模板更新信息列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(PageUpdateInfo data, string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            string Condition = "";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询页面模板更新信息列表
-
-        /// <summary>
-        /// 页面模板更新信息列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(PageUpdateInfo data, string Kind = "default", int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            string condition = " and SeoKeyword='" + Kind + "'";
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PageUpdateInfo", Fields, "ModulePath asc, Id desc", "False", page, limit, condition);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加页面模板更新信息
-
-        /// <summary>
-        /// 增加或修改页面模板更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add()
-        {
-            ViewBag.right = _accessor.HttpContext.Request.Query["right"];
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加页面模板更新信息
-
-        /// <summary>
-        /// 增加或修改页面模板更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(PageUpdateInfo data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ModuleVersion", data.ModuleVersion); //模板更新版本
-            Fields.Add("ModulePath", data.ModulePath); //模板路径
-            Fields.Add("BgColor", data.BgColor); //背景色
-            Fields.Add("TextColor", data.TextColor); //前景色
-            Fields.Add("StatusBarStyle", data.StatusBarStyle); //苹果状态栏
-            Fields.Add("ShowTitle", data.ShowTitle); //是否显示头部
-            Fields.Add("Title", data.Title); //顶部标题
-            Fields.Add("IsScrollBar", data.IsScrollBar); //是否显示滚动条
-            Fields.Add("IsSkid", data.IsSkid); //是否侧滑返回
-            Fields.Add("LeftBtn1", data.LeftBtn1); //左侧按钮1
-            Fields.Add("LeftBtn2", data.LeftBtn2); //左侧按钮2
-            Fields.Add("RightBtn1", data.RightBtn1); //右侧按钮1
-            Fields.Add("RightBtn2", data.RightBtn2); //右侧按钮2
-            Fields.Add("LeftAction1", data.LeftAction1); //左侧按钮1点击事件
-            Fields.Add("LeftAction2", data.LeftAction2); //左侧按钮2点击事件
-            Fields.Add("RightAction1", data.RightAction1); //右侧按钮1点击事件
-            Fields.Add("RightAction2", data.RightAction2); //右侧按钮2点击事件
-            Fields.Add("GotoPages", data.GotoPages); //下级页面
-            Fields.Add("MustUpdate", data.MustUpdate); //是否强制更新
-            Fields.Add("SeoTitle", data.SeoTitle);
-            // Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("PageUpdateInfo", Fields, 0);
-            AddSysLog(data.Id.ToString(), "PageUpdateInfo", "add");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改页面模板更新信息
-
-        /// <summary>
-        /// 增加或修改页面模板更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(int Id = 0)
-        {
-            ViewBag.right = _accessor.HttpContext.Request.Query["right"];
-
-            PageUpdateInfo editData = db.PageUpdateInfo.FirstOrDefault(m => m.Id == Id) ?? new PageUpdateInfo();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改页面模板更新信息
-
-        /// <summary>
-        /// 增加或修改页面模板更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(PageUpdateInfo data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ModuleVersion", data.ModuleVersion); //模板更新版本
-            Fields.Add("ModulePath", data.ModulePath); //模板路径
-            Fields.Add("BgColor", data.BgColor); //背景色
-            Fields.Add("TextColor", data.TextColor); //前景色
-            Fields.Add("StatusBarStyle", data.StatusBarStyle); //苹果状态栏
-            Fields.Add("ShowTitle", data.ShowTitle); //是否显示头部
-            Fields.Add("Title", data.Title); //顶部标题
-            Fields.Add("IsScrollBar", data.IsScrollBar); //是否显示滚动条
-            Fields.Add("IsSkid", data.IsSkid); //是否侧滑返回
-            Fields.Add("LeftBtn1", data.LeftBtn1); //左侧按钮1
-            Fields.Add("LeftBtn2", data.LeftBtn2); //左侧按钮2
-            Fields.Add("RightBtn1", data.RightBtn1); //右侧按钮1
-            Fields.Add("RightBtn2", data.RightBtn2); //右侧按钮2
-            Fields.Add("LeftAction1", data.LeftAction1); //左侧按钮1点击事件
-            Fields.Add("LeftAction2", data.LeftAction2); //左侧按钮2点击事件
-            Fields.Add("RightAction1", data.RightAction1); //右侧按钮1点击事件
-            Fields.Add("RightAction2", data.RightAction2); //右侧按钮2点击事件
-            Fields.Add("GotoPages", data.GotoPages); //下级页面
-            Fields.Add("MustUpdate", data.MustUpdate); //是否强制更新
-            Fields.Add("SeoTitle", data.SeoTitle);
-            // Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PageUpdateInfo", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "PageUpdateInfo", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除页面模板更新信息信息
-
-        /// <summary>
-        /// 删除页面模板更新信息信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "PageUpdateInfo", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("PageUpdateInfo", id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "PageUpdateInfo", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PageUpdateInfo", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "PageUpdateInfo", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PageUpdateInfo", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("PageUpdateInfo", Sort, Id);
-
-            AddSysLog(Id.ToString(), "PageUpdateInfo", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                db.PageUpdateInfo.Add(new PageUpdateInfo()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "PageUpdateInfo", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(PageUpdateInfo data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PageUpdateInfo", Fields, "Id desc", "False", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "PageUpdateInfo", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-        #region 更新版本
-        /// <summary>
-        /// 更新版本
-        /// </summary>
-        /// <returns></returns>
-        public string UpdateVersion(int Id)
-        {
-            PageUpdateInfo info = db.PageUpdateInfo.FirstOrDefault(m => m.Id == Id);
-            if (info != null)
-            {
-                info.ModuleVersion += 1;
-                db.SaveChanges();
-            }
-            return "success";
-        }
-
-        #endregion
-
-        #region 刷新文件
-
-        /// <summary>
-        /// 刷新文件
-        /// </summary>
-        /// <returns></returns>
-        public string UpdateTemplate(string Kind = "default")
-        {
-            SystemSet set = db.SystemSet.FirstOrDefault() ?? new SystemSet();
-            GetSystemFiles(set, Kind);
-            foreach (string filename in SystemFiles)
-            {
-                string template = filename.Substring(filename.LastIndexOf("/") + 1);
-                if (template.EndsWith(".html"))
-                {
-                    PageUpdateInfo check = db.PageUpdateInfo.FirstOrDefault(m => m.ModulePath == template && m.SeoKeyword == Kind);
-                    if (check == null)
-                    {
-                        string ModuleContent = function.ReadInstanceByFull(function.ReadInstance("/WebRootPath.txt") + "/template/app/" + Kind + "/" + template);
-                        if (!string.IsNullOrEmpty(ModuleContent))
-                        {
-                            string admintitle = "";
-                            string title = "";
-                            Match match = Regex.Match(ModuleContent, "<title>.*?</title>", RegexOptions.IgnoreCase);
-                            if (match.Success)
-                            {
-                                admintitle = match.Value.Replace("<title>", "").Replace("</title>", "");
-                                if (admintitle.Contains("-"))
-                                {
-                                    title = admintitle.Substring(admintitle.LastIndexOf("-") + 1);
-                                }
-                                else
-                                {
-                                    title = admintitle;
-                                }
-                            }
-                            check = db.PageUpdateInfo.Add(new PageUpdateInfo()
-                            {
-                                CreateDate = DateTime.Now,
-                                UpdateDate = DateTime.Now,
-                                SeoTitle = admintitle,
-                                SeoKeyword = Kind,
-                                LeftAction1 = "{\"Url\":\"GoBack#{\\\"Level\\\":\\\"1\\\"}\",\"Jump\":\"1\",\"Kind\":\"2\"}",
-                                LeftBtn1 = "static/images/left.png",
-                                IsSkid = 1,
-                                IsScrollBar = 0,
-                                Title = title,
-                                ShowTitle = 1,
-                                StatusBarStyle = "default",
-                                TextColor = "FFFFFF",
-                                BgColor = "FD7538",
-                                ModulePath = template,
-                                ModuleVersion = 1,
-                            }).Entity;
-                            db.SaveChanges();
-                        }
-                    }
-                }
-            }
-            return "success";
-        }
-        List<string> SystemFiles;
-        private void GetSystemFiles(SystemSet set, string Kind = "default")
-        {
-            SystemFiles = new List<string>();
-            string dataFilePath = function.ReadInstance("/WebRootPath.txt") + "/template/app/" + Kind + "/";
-            System.IO.FileSystemInfo info = new System.IO.DirectoryInfo(dataFilePath);
-            scan(info);
-        }
-        private void scan(System.IO.FileSystemInfo info)
-        {
-            if (!info.Exists) return;
-            System.IO.DirectoryInfo dir = info as System.IO.DirectoryInfo;
-            //不是目录
-            if (dir == null) return;
-            System.IO.FileSystemInfo[] files = dir.GetFileSystemInfos();
-            for (int i = 0; i < files.Length; i++)
-            {
-                System.IO.FileInfo file = files[i] as System.IO.FileInfo;
-                //是文件
-                if (file != null)
-                {
-                    SystemFiles.Add(file.FullName.Substring(file.FullName.IndexOf("template")).Replace("\\", "/"));
-                }
-                else scan(files[i]);
-            }
-        }
-
-        #endregion
-
-        #region 同步数据到redis
-
-        public string SyncAll(string Kind = "default")
-        {
-
-            SystemSet set = db.SystemSet.FirstOrDefault() ?? new SystemSet();
-            RedisDbconn.Instance.Set("SystemSet", set);
-            List<PageUpdateInfo> pages = db.PageUpdateInfo.Where(m => m.SeoKeyword == Kind).ToList();
-            RedisDbconn.Instance.Clear("PageUpdateInfo:" + Kind + "*");
-            // RedisDbconn.Instance.AddList("PageUpdateInfo:" + Kind + "", pages.ToArray());
-            // foreach (PageUpdateInfo page in pages)
-            // {
-            //     RedisDbconn.Instance.Set("PageUpdateInfo:" + Kind + ":" + page.ModulePath.Split('.')[0], page);
-            // }
-            return "success";
-        }
-
-        #endregion
-
-
-    }
-}

+ 12 - 6
Areas/Admin/Controllers/MainServer/PosCouponOrdersController.cs

@@ -51,12 +51,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具券变更记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(PosCouponOrders data, string FromUserIdMakerCode, string FromUserIdRealName, string ToUserIdMakerCode, string ToUserIdRealName, string ChangeKindSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(PosCouponOrders data, string FromUserIdMakerCode, string FromUserIdRealName, string ToUserIdMakerCode, string ToUserIdRealName, string ChangeKindSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("OrderNo", "1"); //单号
 
 
@@ -64,28 +63,35 @@ namespace MySystem.Areas.Admin.Controllers
             //来源创客创客编号
             if (!string.IsNullOrEmpty(FromUserIdMakerCode))
             {
-                condition += " and FromUserId in (select FromUserId from UserForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
+                condition += " and FromUserId in (select UserId from UserForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
             }
             //来源创客真实姓名
             if (!string.IsNullOrEmpty(FromUserIdRealName))
             {
-                condition += " and FromUserId in (select FromUserId from UserForRealName where RealName='" + FromUserIdRealName + "')";
+                condition += " and FromUserId in (select UserId from UserForRealName where RealName='" + FromUserIdRealName + "')";
             }
             //目标创客创客编号
             if (!string.IsNullOrEmpty(ToUserIdMakerCode))
             {
-                condition += " and ToUserId in (select ToUserId from UserForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
+                condition += " and ToUserId in (select UserId from UserForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
             }
             //目标创客真实姓名
             if (!string.IsNullOrEmpty(ToUserIdRealName))
             {
-                condition += " and ToUserId in (select ToUserId from UserForRealName where RealName='" + ToUserIdRealName + "')";
+                condition += " and ToUserId in (select UserId from UserForRealName where RealName='" + ToUserIdRealName + "')";
             }
             //变更类型
             if (!string.IsNullOrEmpty(ChangeKindSelect))
             {
                 condition += " and ChangeKind=" + ChangeKindSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosCouponOrders", Fields, "Id desc", "0", page, limit, condition);

+ 0 - 1
Areas/Admin/Controllers/MainServer/PosCouponRecordController.cs

@@ -58,7 +58,6 @@ namespace MySystem.Areas.Admin.Controllers
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("OrderNo", "1");
 
-            Fields.Add("CreateDate", "3"); //时间
 
 
             string condition = " and Status>-1";

+ 527 - 0
Areas/Admin/Controllers/MainServer/PosCouponsController.cs

@@ -0,0 +1,527 @@
+/*
+ * 机具券变更记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class PosCouponsController : BaseController
+    {
+        public PosCouponsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 机具券列表
+
+        /// <summary>
+        /// 根据条件查询机具券列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(PosCoupons data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询机具券列表
+
+        /// <summary>
+        /// 机具券列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(PosCoupons data, string UseDateData, string UserIdMakerCode, string LeaderIdMakerCode, string ExchangeCode, string IsUseSelect, string IsLockSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("OrderNo", "1"); //单号
+
+
+            string condition = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //盟主创客编号
+            if (!string.IsNullOrEmpty(LeaderIdMakerCode))
+            {
+                condition += " and LeaderUserId in (select UserId from UserForMakerCode where MakerCode='" + LeaderIdMakerCode + "')";
+            }
+            //兑换码
+            if (!string.IsNullOrEmpty(ExchangeCode))
+            {
+                condition += " and ExchangeCode =" + ExchangeCode;
+            }
+            //是否使用
+            if (!string.IsNullOrEmpty(IsUseSelect))
+            {
+                condition += " and IsUse =" + IsUseSelect;
+            }
+            //是否锁定
+            if (!string.IsNullOrEmpty(IsLockSelect))
+            {
+                condition += " and IsLock=" + IsLockSelect;
+            }
+
+            if (!string.IsNullOrEmpty(UseDateData))
+            {
+                string[] datelist = UseDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and UseDate >='" + start + " 00:00:00' and UseDate <='" + end + " 23:59:59'";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosCoupons", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客信息
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["UserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("UserId");
+
+                //盟主创客信息
+                int LeaderUserId = int.Parse(function.CheckInt(dic["LeaderUserId"].ToString()));
+                Users leaderuserid_Users = db.Users.FirstOrDefault(m => m.Id == LeaderUserId) ?? new Users();
+                dic["LeaderUserIdMakerCode"] = leaderuserid_Users.MakerCode;
+                dic["LeaderUserIdRealName"] = leaderuserid_Users.RealName;
+                dic.Remove("LeaderUserId");
+
+                //是否使用
+                int IsUse = int.Parse(dic["IsUse"].ToString());
+                if (IsUse == 0) dic["IsUseName"] = "否";
+                if (IsUse == 1) dic["IsUseName"] = "是";
+
+                //是否锁定
+                int IsLock = int.Parse(dic["IsLock"].ToString());
+                if (IsLock == 0) dic["IsLockName"] = "否";
+                if (IsLock == 1) dic["IsLockName"] = "是";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+
+        #region 商机券列表
+
+        /// <summary>
+        /// 根据条件查询商机券列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult SJQ(PosCoupons data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询商机券列表
+
+        /// <summary>
+        /// 商机券列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult SJQData(PosCoupons data, string UseDateData, string UserIdMakerCode, string ExchangeCode, string IsUseSelect, string IsLockSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("OrderNo", "1"); //单号
+
+
+            string condition = " and Status>-1 and HelpProfitFlag=1";
+            //创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //兑换码
+            if (!string.IsNullOrEmpty(ExchangeCode))
+            {
+                condition += " and ExchangeCode =" + ExchangeCode;
+            }
+            //是否使用
+            if (!string.IsNullOrEmpty(IsUseSelect))
+            {
+                condition += " and IsUse =" + IsUseSelect;
+            }
+            //是否锁定
+            if (!string.IsNullOrEmpty(IsLockSelect))
+            {
+                condition += " and IsLock=" + IsLockSelect;
+            }
+
+            if (!string.IsNullOrEmpty(UseDateData))
+            {
+                string[] datelist = UseDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and UseDate >='" + start + "' and UseDate <='" + end + " 23:59:59'";
+
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosCoupons", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客信息
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["UserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("UserId");
+
+                //盟主创客信息
+                int LeaderUserId = int.Parse(function.CheckInt(dic["LeaderUserId"].ToString()));
+                Users leaderuserid_Users = db.Users.FirstOrDefault(m => m.Id == LeaderUserId) ?? new Users();
+                dic["LeaderUserIdMakerCode"] = leaderuserid_Users.MakerCode;
+                dic["LeaderUserIdRealName"] = leaderuserid_Users.RealName;
+                dic.Remove("LeaderUserId");
+
+                //是否使用
+                int IsUse = int.Parse(dic["IsUse"].ToString());
+                if (IsUse == 0) dic["IsUseName"] = "否";
+                if (IsUse == 1) dic["IsUseName"] = "是";
+
+                //是否锁定
+                int IsLock = int.Parse(dic["IsLock"].ToString());
+                if (IsLock == 0) dic["IsLockName"] = "否";
+                if (IsLock == 1) dic["IsLockName"] = "是";
+
+                //是否是商机券
+                int HelpProfitFlag = int.Parse(dic["HelpProfitFlag"].ToString());
+                if (HelpProfitFlag == 0) dic["IsSJName"] = "否";
+                if (HelpProfitFlag == 1) dic["IsSJName"] = "是";
+
+                //是否使用商机券
+                int HelpProfitStatus = int.Parse(dic["HelpProfitStatus"].ToString());
+                if (HelpProfitStatus == 0) dic["SJUseName"] = "否";
+                if (HelpProfitStatus == 1) dic["SJUseName"] = "是";
+
+                //助利宝商户信息
+                int HelpProfitMerchantId = int.Parse(function.CheckInt(dic["HelpProfitMerchantId"].ToString()));
+                PosMerchantInfo posMerchantInfo = db.PosMerchantInfo.FirstOrDefault(m => m.Id == HelpProfitMerchantId) ?? new PosMerchantInfo();
+                dic["posMerchantInfo"] = posMerchantInfo.MerchantNo + "<br />" + posMerchantInfo.MerchantName;
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+
+        #region 增加机具券变更记录
+
+        /// <summary>
+        /// 增加或修改机具券变更记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加机具券变更记录
+
+        /// <summary>
+        /// 增加或修改机具券变更记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(PosCoupons data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("PosCoupons", Fields, 0);
+            AddSysLog(data.Id.ToString(), "PosCoupons", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改机具券变更记录
+
+        /// <summary>
+        /// 增加或修改机具券变更记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            PosCoupons editData = db.PosCoupons.FirstOrDefault(m => m.Id == Id) ?? new PosCoupons();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改机具券变更记录
+
+        /// <summary>
+        /// 增加或修改机具券变更记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(PosCoupons data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosCoupons", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "PosCoupons", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除机具券变更记录信息
+
+        /// <summary>
+        /// 删除机具券变更记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PosCoupons", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosCoupons", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PosCoupons", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosCoupons", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PosCoupons", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosCoupons", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("PosCoupons", Sort, Id);
+
+            AddSysLog(Id.ToString(), "PosCoupons", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.PosCoupons.Add(new PosCoupons()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "PosCoupons", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(PosCoupons data, string FromUserIdMakerCode, string FromUserIdRealName, string ToUserIdMakerCode, string ToUserIdRealName, string ChangeKindSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("OrderNo", "1"); //单号
+
+
+            string condition = " and Status>-1";
+            //来源创客创客编号
+            if (!string.IsNullOrEmpty(FromUserIdMakerCode))
+            {
+                condition += " and FromUserId in (select FromUserId from UserForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
+            }
+            //来源创客真实姓名
+            if (!string.IsNullOrEmpty(FromUserIdRealName))
+            {
+                condition += " and FromUserId in (select FromUserId from UserForRealName where RealName='" + FromUserIdRealName + "')";
+            }
+            //目标创客创客编号
+            if (!string.IsNullOrEmpty(ToUserIdMakerCode))
+            {
+                condition += " and ToUserId in (select ToUserId from UserForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
+            }
+            //目标创客真实姓名
+            if (!string.IsNullOrEmpty(ToUserIdRealName))
+            {
+                condition += " and ToUserId in (select ToUserId from UserForRealName where RealName='" + ToUserIdRealName + "')";
+            }
+            //变更类型
+            if (!string.IsNullOrEmpty(ChangeKindSelect))
+            {
+                condition += " and ChangeKind=" + ChangeKindSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosCoupons", Fields, "Id desc", "0", 1, 20000, condition, "FromUserId,ToUserId,OrderNo,BeforeStock,BeforeTotal,BeforeOut,AfterStock,AfterTotal,AfterOut,ChangeCount,ChangeKind", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //来源创客
+                int FromUserId = int.Parse(function.CheckInt(dic["FromUserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == FromUserId) ?? new Users();
+                dic["FromUserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["FromUserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("FromUserId");
+                //目标创客
+                int ToUserId = int.Parse(function.CheckInt(dic["ToUserId"].ToString()));
+                Users touserid_Users = db.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
+                dic["ToUserIdMakerCode"] = touserid_Users.MakerCode;
+                dic["ToUserIdRealName"] = touserid_Users.RealName;
+                dic.Remove("ToUserId");
+
+            }
+
+            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>();
+            ReturnFields.Add("FromUserIdMakerCode", "来源创客创客编号");
+            ReturnFields.Add("FromUserIdRealName", "来源创客真实姓名");
+            ReturnFields.Add("ToUserIdMakerCode", "目标创客创客编号");
+            ReturnFields.Add("ToUserIdRealName", "目标创客真实姓名");
+            ReturnFields.Add("OrderNo", "单号");
+            ReturnFields.Add("BeforeStock", "变更前机具券库存");
+            ReturnFields.Add("BeforeTotal", "变更前机具券总数");
+            ReturnFields.Add("BeforeOut", "变更前机具券使用数");
+            ReturnFields.Add("AfterStock", "变更后机具券库存");
+            ReturnFields.Add("AfterTotal", "变更后机具券总数");
+            ReturnFields.Add("AfterOut", "变更后机具券使用数");
+            ReturnFields.Add("ChangeCount", "变更数量");
+            ReturnFields.Add("ChangeKind", "变更类型");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "PosCoupons", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 116 - 4
Areas/Admin/Controllers/MainServer/PosMachinesTwoController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -50,7 +51,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具库列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(PosMachinesTwo data, string BindingStateSelect, string ActivationStateSelect, string UserIdMakerCode, string UserIdRealName, string StoreIdCode, string StoreIdName, int page = 1, int limit = 30)
+        public JsonResult IndexData(PosMachinesTwo data, string BindingStateSelect, string ActivationStateSelect, string UserIdMakerCode, string UserIdRealName, string StoreIdCode, string StoreIdName, string BrandId, string ActivationDateData, string BindingDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -70,7 +71,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and ActivationState=" + ActivationStateSelect;
             }
-            //所属创客创客编号
+            //所属创客编号
             if (!string.IsNullOrEmpty(UserIdMakerCode))
             {
                 condition += " and BuyUserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
@@ -90,7 +91,27 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreIdName + "')";
             }
+            //品牌
+            if (!string.IsNullOrEmpty(BrandId))
+            {
+                condition += " and BrandId =" + BrandId;
+            }
 
+            if (!string.IsNullOrEmpty(ActivationDateData))
+            {
+                string[] datelist = ActivationDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and ActivationTime>='" + start + " 00:00:00' and ActivationTime<='" + end + " 23:59:59'";
+            }
+
+            if (!string.IsNullOrEmpty(BindingDateData))
+            {
+                string[] datelist = BindingDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and BindingTime>='" + start + " 00:00:00' and BindingTime<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesTwo", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -136,9 +157,37 @@ namespace MySystem.Areas.Admin.Controllers
                 if (DeviceType == "KssSignPos") dic["DeviceType"] = "快闪刷电签POS";
                 if (DeviceType == "") dic["DeviceType"] = "";
 
+                //盟主信息
+                int LeaderUserId = int.Parse(function.CheckInt(dic["LeaderUserId"].ToString()));
+                if (LeaderUserId != 0)
+                {
+                    Users users = db.Users.FirstOrDefault(m => m.Id == LeaderUserId) ?? new Users();
+                    dic["UserInfo"] = users.MakerCode + "_" + users.RealName;
+                }
+
+                //是否为第一台机具
+                int IsFirst = int.Parse(dic["IsFirst"].ToString());
+                if (IsFirst == 0) dic["IsFirst"] = "否";
+                if (IsFirst == 1) dic["IsFirst"] = "是";
+
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("TotalCount", 0);
+            int TotalCount = 0;//总机具数
+            string KysCount99 = "0.00";
+            string KssCount99 = "0.00";
+            string KssCoun198 = "0.00";
+            string KssCount298 = "0.00";
+            DataTable dt = OtherMySqlConn.dtable("select count(0) from PosMachinesTwo where 1=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                TotalCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            // dt = OtherMySqlConn.dtable("select sum(TotalPrice) from Orders where PayStatus=1" + condition);
+            // if (dt.Rows.Count > 0)
+            // {
+            //     FailAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            // }
+            other.Add("TotalCount", TotalCount);
             other.Add("KysCount99", 0);
             other.Add("KssCount99", 0);
             other.Add("KssCoun198", 0);
@@ -229,6 +278,49 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 未使用机具归位总仓
+
+        /// <summary>
+        /// 未使用机具归位总仓
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Home(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            PosMachinesTwo editData = db.PosMachinesTwo.FirstOrDefault(m => m.Id == Id) ?? new PosMachinesTwo();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 未使用机具归位总仓
+
+        /// <summary>
+        /// 未使用机具归位总仓
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Home(PosMachinesTwo data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("SeoTitle", "");
+            Fields.Add("SeoKeyword", "");
+            Fields.Add("PosSnType", 0);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "PosMachinesTwo", "home");
+            db.SaveChanges();
+            RedisDbconn.Instance.Clear("PosMachinesTwo:" + data.Id);
+            return "success";
+        }
+
+        #endregion
+
+
         #region 删除机具库信息
 
         /// <summary>
@@ -384,7 +476,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
 
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesTwo", Fields, "Id desc", "0", 1, 20000, condition, "BindingState,ActivationState,UserId,StoreId,PosSn,BrandId,ActivityList,BindMerchantId,PosSnType,DeviceType", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMachinesTwo", Fields, "Id desc", "0", 1, 20000, condition, "BindingState,ActivationState,UserId,StoreId,PosSn,BrandId,ActivityList,BindMerchantId,PosSnType,DeviceType,BindingTime,ActivationTime,TransferTime", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -392,10 +484,27 @@ namespace MySystem.Areas.Admin.Controllers
                 int BindingState = int.Parse(dic["BindingState"].ToString());
                 if (BindingState == 0) dic["BindingState"] = "未绑定";
                 if (BindingState == 1) dic["BindingState"] = "已绑定";
+                //绑定时间
+                if (!string.IsNullOrEmpty(dic["BindingTime"].ToString()))
+                {
+                    DateTime BindingTime = Convert.ToDateTime(dic["BindingTime"].ToString());
+                }
+
                 //激活状态
                 int ActivationState = int.Parse(dic["ActivationState"].ToString());
                 if (ActivationState == 0) dic["ActivationState"] = "未激活";
                 if (ActivationState == 1) dic["ActivationState"] = "已激活";
+                //激活时间
+                if (!string.IsNullOrEmpty(dic["ActivationTime"].ToString()))
+                {
+                    DateTime ActivationTime = Convert.ToDateTime(dic["ActivationTime"].ToString());
+                }
+
+                //划拨时间
+                if (!string.IsNullOrEmpty(dic["TransferTime"].ToString()))
+                {
+                    DateTime TransferTime = Convert.ToDateTime(dic["TransferTime"].ToString());
+                }
                 //所属创客
                 int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
                 Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
@@ -447,7 +556,10 @@ namespace MySystem.Areas.Admin.Controllers
             ReturnFields.Add("BindMerchantIdMerchantName", "绑定商户姓名");
             ReturnFields.Add("DeviceType", "设备类型");
             ReturnFields.Add("BindingState", "绑定状态");
+            ReturnFields.Add("BindingTime", "绑定时间");
             ReturnFields.Add("ActivationState", "激活状态");
+            ReturnFields.Add("ActivationTime", "激活时间");
+            ReturnFields.Add("TransferTime", "划拨时间");
 
             result.Add("Fields", ReturnFields);
             AddSysLog("0", "PosMachinesTwo", "ExportExcel");

+ 195 - 39
Areas/Admin/Controllers/MainServer/PosMerchantInfoController.cs

@@ -51,7 +51,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 商户列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(PosMerchantInfo data, string MakerCode, string RealName, string MerMakerCode, string StoreNo, string StoreName, string MerStatusSelect, string ActiveStatusSelect, string ActTypeSelect, string MerUserTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(PosMerchantInfo data, string MerIdcardNo, string MerchantName, string MakerCode, string RealName, string MerMakerCode, string StoreNo, string StoreName, string MerStatusSelect, string ActiveStatusSelect, string ActTypeSelect, string MerUserTypeSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -66,6 +66,161 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("TopUserId", "0"); //顶级创客
 
             string condition = " and Status>-1";
+            //身份证号
+            if (!string.IsNullOrEmpty(MerIdcardNo))
+            {
+                condition += " and MerchantName like '%" + MerIdcardNo + "%'";
+            }
+            //商户姓名
+            if (!string.IsNullOrEmpty(MerchantName))
+            {
+                condition += " and MerchantName like '%" + MerchantName + "%'";
+            }
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+            }
+            //商户创客编号
+            if (!string.IsNullOrEmpty(MerMakerCode))
+            {
+                condition += " and MerUserId in (select UserId from UserForMakerCode where MakerCode='" + MerMakerCode + "')";
+            }
+            //仓库编号
+            if (!string.IsNullOrEmpty(StoreNo))
+            {
+                condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreNo + "')";
+            }
+            //仓库名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreName + "')";
+            }
+            //商户状态
+            if (!string.IsNullOrEmpty(MerStatusSelect))
+            {
+                condition += " and MerStatus=" + MerStatusSelect;
+            }
+            //商户激活状态
+            if (!string.IsNullOrEmpty(ActiveStatusSelect))
+            {
+                condition += " and ActiveStatus=" + ActiveStatusSelect;
+            }
+            //激活类型
+            if (!string.IsNullOrEmpty(ActTypeSelect))
+            {
+                condition += " and ActType=" + ActTypeSelect;
+            }
+            //商户创客类型
+            if (!string.IsNullOrEmpty(MerUserTypeSelect))
+            {
+                condition += " and MerUserType=" + MerUserTypeSelect;
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMerchantInfo", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //直属创客
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = puser.MakerCode;
+                dic["RealName"] = puser.RealName;
+                //顶级创客
+                int TopUserId = int.Parse(dic["TopUserId"].ToString());
+                Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
+                dic["TopMakerCode"] = tuser.MakerCode;
+                dic["TopRealName"] = tuser.RealName;
+                //商户创客
+                int MerUserId = int.Parse(dic["MerUserId"].ToString());
+                Users muser = db.Users.FirstOrDefault(m => m.Id == MerUserId) ?? new Users();
+                dic["MerMakerCode"] = muser.MakerCode;
+                dic["MerRealName"] = muser.RealName;
+                //申请创客
+                int SnApplyUserId = int.Parse(dic["SnApplyUserId"].ToString());
+                Users snuser = db.Users.FirstOrDefault(m => m.Id == SnApplyUserId) ?? new Users();
+                dic["SnApplyMakerCode"] = snuser.MakerCode;
+                dic["SnApplyRealName"] = snuser.RealName;
+                //SN仓库
+                int SnStoreId = int.Parse(dic["SnStoreId"].ToString());
+                StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == SnStoreId) ?? new StoreHouse();
+                dic["StoreNo"] = store.StoreNo;
+                dic["StoreName"] = store.StoreName;
+                //机具类型
+                int SnType = int.Parse(dic["SnType"].ToString());
+                if (SnType == 0) dic["SnType"] = "购买机具";
+                if (SnType == 1) dic["SnType"] = "赠送机具";
+                //返利资格
+                dic["RebateQual"] = dic["RebateQual"].ToString() == "1" ? "是" : "否";
+                //激活类型
+                int ActType = int.Parse(dic["ActType"].ToString());
+                if (ActType == 0) dic["ActType"] = "正常激活";
+                if (ActType == 1) dic["ActType"] = "首次已激活MPOS";
+                if (ActType == 2) dic["ActType"] = "首次已激活KPOS";
+                if (ActType == 3) dic["ActType"] = "循环机划拨激活";
+                //商户状态
+                int MerStatus = int.Parse(dic["MerStatus"].ToString());
+                if (MerStatus == 0) dic["MerStatus"] = "正常";
+                if (MerStatus == 1) dic["MerStatus"] = "冻结";
+                if (MerStatus == 2) dic["MerStatus"] = "关闭";
+                //商户激活状态
+                int ActiveStatus = int.Parse(dic["ActiveStatus"].ToString());
+                if (ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
+                if (ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
+                if (ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
+                //商户创客类型
+                int MerUserType = int.Parse(dic["MerUserType"].ToString());
+                if (MerUserType == 0) dic["MerUserType"] = "非商户型创客";
+                if (MerUserType == 1) dic["MerUserType"] = "商户型创客";
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+
+        #region 列表
+        public IActionResult List(PosMerchantInfo data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 列表
+        public JsonResult ListData(PosMerchantInfo data, string MerIdcardNo, string MerchantName, string MakerCode, string RealName, string MerMakerCode, string StoreNo, string StoreName, string MerStatusSelect, string ActiveStatusSelect, string ActTypeSelect, string MerUserTypeSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("BrandId", "1");
+            Fields.Add("MerchantNo", "1"); //商户编号
+            Fields.Add("MerchantName", "1"); //商户姓名
+            Fields.Add("MerchantMobile", "1"); //商户手机号
+            Fields.Add("KqMerNo", "1"); //快钱商户编码
+            Fields.Add("KqSnNo", "1"); //快钱SN号
+            Fields.Add("KqRegTime", "3"); //渠道注册时间
+            Fields.Add("TopUserId", "0"); //顶级创客
+
+            string condition = " and Status>-1";
+            //身份证号
+            if (!string.IsNullOrEmpty(MerIdcardNo))
+            {
+                condition += " and MerchantName like '%" + MerIdcardNo + "%'";
+            }
+            //商户姓名
+            if (!string.IsNullOrEmpty(MerchantName))
+            {
+                condition += " and MerchantName like '%" + MerchantName + "%'";
+            }
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -92,22 +247,22 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreName + "')";
             }
             //商户状态
-            if(!string.IsNullOrEmpty(MerStatusSelect))
+            if (!string.IsNullOrEmpty(MerStatusSelect))
             {
                 condition += " and MerStatus=" + MerStatusSelect;
             }
             //商户激活状态
-            if(!string.IsNullOrEmpty(ActiveStatusSelect))
+            if (!string.IsNullOrEmpty(ActiveStatusSelect))
             {
                 condition += " and ActiveStatus=" + ActiveStatusSelect;
             }
             //激活类型
-            if(!string.IsNullOrEmpty(ActTypeSelect))
+            if (!string.IsNullOrEmpty(ActTypeSelect))
             {
                 condition += " and ActType=" + ActTypeSelect;
             }
             //商户创客类型
-            if(!string.IsNullOrEmpty(MerUserTypeSelect))
+            if (!string.IsNullOrEmpty(MerUserTypeSelect))
             {
                 condition += " and MerUserType=" + MerUserTypeSelect;
             }
@@ -143,36 +298,37 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["StoreName"] = store.StoreName;
                 //机具类型
                 int SnType = int.Parse(dic["SnType"].ToString());
-                if(SnType == 0) dic["SnType"] = "购买机具";
-                if(SnType == 1) dic["SnType"] = "赠送机具";
+                if (SnType == 0) dic["SnType"] = "购买机具";
+                if (SnType == 1) dic["SnType"] = "赠送机具";
                 //返利资格
                 dic["RebateQual"] = dic["RebateQual"].ToString() == "1" ? "是" : "否";
                 //激活类型
                 int ActType = int.Parse(dic["ActType"].ToString());
-                if(ActType == 0) dic["ActType"] = "正常激活";
-                if(ActType == 1) dic["ActType"] = "首次已激活MPOS";
-                if(ActType == 2) dic["ActType"] = "首次已激活KPOS";
-                if(ActType == 3) dic["ActType"] = "循环机划拨激活";
+                if (ActType == 0) dic["ActType"] = "正常激活";
+                if (ActType == 1) dic["ActType"] = "首次已激活MPOS";
+                if (ActType == 2) dic["ActType"] = "首次已激活KPOS";
+                if (ActType == 3) dic["ActType"] = "循环机划拨激活";
                 //商户状态
                 int MerStatus = int.Parse(dic["MerStatus"].ToString());
-                if(MerStatus == 0) dic["MerStatus"] = "正常";
-                if(MerStatus == 1) dic["MerStatus"] = "冻结";
-                if(MerStatus == 2) dic["MerStatus"] = "关闭";
+                if (MerStatus == 0) dic["MerStatus"] = "正常";
+                if (MerStatus == 1) dic["MerStatus"] = "冻结";
+                if (MerStatus == 2) dic["MerStatus"] = "关闭";
                 //商户激活状态
                 int ActiveStatus = int.Parse(dic["ActiveStatus"].ToString());
-                if(ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
-                if(ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
-                if(ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
+                if (ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
+                if (ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
+                if (ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
                 //商户创客类型
                 int MerUserType = int.Parse(dic["MerUserType"].ToString());
-                if(MerUserType == 0) dic["MerUserType"] = "非商户型创客";
-                if(MerUserType == 1) dic["MerUserType"] = "商户型创客";
+                if (MerUserType == 0) dic["MerUserType"] = "非商户型创客";
+                if (MerUserType == 1) dic["MerUserType"] = "商户型创客";
             }
             return Json(obj);
         }
 
         #endregion
 
+
         #region 增加商户
 
         /// <summary>
@@ -413,22 +569,22 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreName + "')";
             }
             //商户状态
-            if(!string.IsNullOrEmpty(MerStatusSelect))
+            if (!string.IsNullOrEmpty(MerStatusSelect))
             {
                 condition += " and MerStatus=" + MerStatusSelect;
             }
             //商户激活状态
-            if(!string.IsNullOrEmpty(ActiveStatusSelect))
+            if (!string.IsNullOrEmpty(ActiveStatusSelect))
             {
                 condition += " and ActiveStatus=" + ActiveStatusSelect;
             }
             //激活类型
-            if(!string.IsNullOrEmpty(ActTypeSelect))
+            if (!string.IsNullOrEmpty(ActTypeSelect))
             {
                 condition += " and ActType=" + ActTypeSelect;
             }
             //商户创客类型
-            if(!string.IsNullOrEmpty(MerUserTypeSelect))
+            if (!string.IsNullOrEmpty(MerUserTypeSelect))
             {
                 condition += " and MerUserType=" + MerUserTypeSelect;
             }
@@ -464,30 +620,30 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["StoreName"] = store.StoreName;
                 //机具类型
                 int SnType = int.Parse(dic["SnType"].ToString());
-                if(SnType == 0) dic["SnType"] = "购买机具";
-                if(SnType == 1) dic["SnType"] = "赠送机具";
+                if (SnType == 0) dic["SnType"] = "购买机具";
+                if (SnType == 1) dic["SnType"] = "赠送机具";
                 //返利资格
                 dic["RebateQual"] = dic["RebateQual"].ToString() == "1" ? "是" : "否";
                 //激活类型
                 int ActType = int.Parse(dic["ActType"].ToString());
-                if(ActType == 0) dic["ActType"] = "正常激活";
-                if(ActType == 1) dic["ActType"] = "首次已激活MPOS";
-                if(ActType == 2) dic["ActType"] = "首次已激活KPOS";
-                if(ActType == 3) dic["ActType"] = "循环机划拨激活";
+                if (ActType == 0) dic["ActType"] = "正常激活";
+                if (ActType == 1) dic["ActType"] = "首次已激活MPOS";
+                if (ActType == 2) dic["ActType"] = "首次已激活KPOS";
+                if (ActType == 3) dic["ActType"] = "循环机划拨激活";
                 //商户状态
                 int MerStatus = int.Parse(dic["MerStatus"].ToString());
-                if(MerStatus == 0) dic["MerStatus"] = "正常";
-                if(MerStatus == 1) dic["MerStatus"] = "冻结";
-                if(MerStatus == 2) dic["MerStatus"] = "关闭";
+                if (MerStatus == 0) dic["MerStatus"] = "正常";
+                if (MerStatus == 1) dic["MerStatus"] = "冻结";
+                if (MerStatus == 2) dic["MerStatus"] = "关闭";
                 //商户激活状态
                 int ActiveStatus = int.Parse(dic["ActiveStatus"].ToString());
-                if(ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
-                if(ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
-                if(ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
+                if (ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
+                if (ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
+                if (ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
                 //商户创客类型
                 int MerUserType = int.Parse(dic["MerUserType"].ToString());
-                if(MerUserType == 0) dic["MerUserType"] = "非商户型创客";
-                if(MerUserType == 1) dic["MerUserType"] = "商户型创客";
+                if (MerUserType == 0) dic["MerUserType"] = "非商户型创客";
+                if (MerUserType == 1) dic["MerUserType"] = "商户型创客";
                 dic.Remove("UserId");
                 dic.Remove("TopUserId");
                 dic.Remove("MerUserId");
@@ -548,7 +704,7 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
         #region 同步交易额
-        
+
         [HttpPost]
         public string SycnTradeAmountDo(DateTime sdate, DateTime edate, int MerchantId)
         {
@@ -557,7 +713,7 @@ namespace MySystem.Areas.Admin.Controllers
                 return "时间间隔不能超过1个月";
             }
             if (edate >= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"))
-            { 
+            {
                 return "结束时间只能是今天之前";
             }
             string check = RedisDbconn.Instance.Get<string>("ResetMerchantTradeQueue:" + MerchantId);

+ 541 - 0
Areas/Admin/Controllers/MainServer/PosMerchantInfoListController.cs

@@ -0,0 +1,541 @@
+/*
+ * 商户
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class PosMerchantInfoListController : BaseController
+    {
+        public PosMerchantInfoListController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 商户列表
+
+        /// <summary>
+        /// 根据条件查询商户列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(PosMerchantInfo data, string right, string BrandId)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.BrandId = BrandId;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询商户列表
+
+        /// <summary>
+        /// 商户列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(PosMerchantInfo data, string MerIdcardNo, string MerchantName, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            string condition = " and Status>-1";
+            //身份证号
+            if (!string.IsNullOrEmpty(MerIdcardNo))
+            {
+                condition += " and MerIdcardNo like '%" + MerIdcardNo + "%'";
+            }
+            //商户姓名
+            if (!string.IsNullOrEmpty(MerchantName))
+            {
+                condition += " and MerchantName like '%" + MerchantName + "%'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMerchantInfo", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //直属创客
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = puser.MakerCode;
+                dic["RealName"] = puser.RealName;
+                //顶级创客
+                int TopUserId = int.Parse(dic["TopUserId"].ToString());
+                Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
+                dic["TopMakerCode"] = tuser.MakerCode;
+                dic["TopRealName"] = tuser.RealName;
+                //商户创客
+                int MerUserId = int.Parse(dic["MerUserId"].ToString());
+                Users muser = db.Users.FirstOrDefault(m => m.Id == MerUserId) ?? new Users();
+                dic["MerMakerCode"] = muser.MakerCode;
+                dic["MerRealName"] = muser.RealName;
+                //申请创客
+                int SnApplyUserId = int.Parse(dic["SnApplyUserId"].ToString());
+                Users snuser = db.Users.FirstOrDefault(m => m.Id == SnApplyUserId) ?? new Users();
+                dic["SnApplyMakerCode"] = snuser.MakerCode;
+                dic["SnApplyRealName"] = snuser.RealName;
+                //SN仓库
+                int SnStoreId = int.Parse(dic["SnStoreId"].ToString());
+                StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == SnStoreId) ?? new StoreHouse();
+                dic["StoreNo"] = store.StoreNo;
+                dic["StoreName"] = store.StoreName;
+                //机具类型
+                int SnType = int.Parse(dic["SnType"].ToString());
+                if (SnType == 0) dic["SnType"] = "购买机具";
+                if (SnType == 1) dic["SnType"] = "赠送机具";
+                //返利资格
+                dic["RebateQual"] = dic["RebateQual"].ToString() == "1" ? "是" : "否";
+                //激活类型
+                int ActType = int.Parse(dic["ActType"].ToString());
+                if (ActType == 0) dic["ActType"] = "正常激活";
+                if (ActType == 1) dic["ActType"] = "首次已激活MPOS";
+                if (ActType == 2) dic["ActType"] = "首次已激活KPOS";
+                if (ActType == 3) dic["ActType"] = "循环机划拨激活";
+                //商户状态
+                int MerStatus = int.Parse(dic["MerStatus"].ToString());
+                if (MerStatus == 0) dic["MerStatus"] = "正常";
+                if (MerStatus == 1) dic["MerStatus"] = "冻结";
+                if (MerStatus == 2) dic["MerStatus"] = "关闭";
+                //商户激活状态
+                int ActiveStatus = int.Parse(dic["ActiveStatus"].ToString());
+                if (ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
+                if (ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
+                if (ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
+                //商户创客类型
+                int MerUserType = int.Parse(dic["MerUserType"].ToString());
+                if (MerUserType == 0) dic["MerUserType"] = "非商户型创客";
+                if (MerUserType == 1) dic["MerUserType"] = "商户型创客";
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+
+        #region 增加商户
+
+        /// <summary>
+        /// 增加或修改商户信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加商户
+
+        /// <summary>
+        /// 增加或修改商户信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(PosMerchantInfo data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("PosMerchantInfo", Fields, 0);
+            AddSysLog(data.Id.ToString(), "PosMerchantInfo", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改商户
+
+        /// <summary>
+        /// 增加或修改商户信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            PosMerchantInfo editData = db.PosMerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new PosMerchantInfo();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改商户
+
+        /// <summary>
+        /// 增加或修改商户信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(PosMerchantInfo data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMerchantInfo", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "PosMerchantInfo", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除商户信息
+
+        /// <summary>
+        /// 删除商户信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PosMerchantInfo", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMerchantInfo", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PosMerchantInfo", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMerchantInfo", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PosMerchantInfo", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMerchantInfo", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("PosMerchantInfo", Sort, Id);
+
+            AddSysLog(Id.ToString(), "PosMerchantInfo", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.PosMerchantInfo.Add(new PosMerchantInfo()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "PosMerchantInfo", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(PosMerchantInfo data, string MakerCode, string RealName, string MerMakerCode, string StoreNo, string StoreName, string MerStatusSelect, string ActiveStatusSelect, string ActTypeSelect, string MerUserTypeSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("BrandId", "1");
+            Fields.Add("MerchantNo", "1"); //商户编号
+            Fields.Add("MerchantName", "1"); //商户姓名
+            Fields.Add("MerchantMobile", "1"); //商户手机号
+            Fields.Add("KqMerNo", "1"); //快钱商户编码
+            Fields.Add("KqSnNo", "1"); //快钱SN号
+            Fields.Add("KqRegTime", "3"); //渠道注册时间
+            Fields.Add("TopUserId", "0"); //顶级创客
+
+            string condition = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+            }
+            //商户创客编号
+            if (!string.IsNullOrEmpty(MerMakerCode))
+            {
+                condition += " and MerUserId in (select UserId from UserForMakerCode where MakerCode='" + MerMakerCode + "')";
+            }
+            //仓库编号
+            if (!string.IsNullOrEmpty(StoreNo))
+            {
+                condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreNo + "')";
+            }
+            //仓库名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreName + "')";
+            }
+            //商户状态
+            if (!string.IsNullOrEmpty(MerStatusSelect))
+            {
+                condition += " and MerStatus=" + MerStatusSelect;
+            }
+            //商户激活状态
+            if (!string.IsNullOrEmpty(ActiveStatusSelect))
+            {
+                condition += " and ActiveStatus=" + ActiveStatusSelect;
+            }
+            //激活类型
+            if (!string.IsNullOrEmpty(ActTypeSelect))
+            {
+                condition += " and ActType=" + ActTypeSelect;
+            }
+            //商户创客类型
+            if (!string.IsNullOrEmpty(MerUserTypeSelect))
+            {
+                condition += " and MerUserType=" + MerUserTypeSelect;
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PosMerchantInfo", Fields, "Id desc", "0", 1, 20000, condition, "MerchantNo,MerchantName,MerchantMobile,KqMerNo,KqSnNo,MerStatus,ActiveStatus,UserId,MerUserId,SnType,SnApplyUserId,KqRegTime,ActType,SnStoreId,TopUserId,MerUserType,RebateQual", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //直属创客
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = puser.MakerCode;
+                dic["RealName"] = puser.RealName;
+                //顶级创客
+                int TopUserId = int.Parse(dic["TopUserId"].ToString());
+                Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
+                dic["TopMakerCode"] = tuser.MakerCode;
+                dic["TopRealName"] = tuser.RealName;
+                //商户创客
+                int MerUserId = int.Parse(dic["MerUserId"].ToString());
+                Users muser = db.Users.FirstOrDefault(m => m.Id == MerUserId) ?? new Users();
+                dic["MerMakerCode"] = muser.MakerCode;
+                dic["MerRealName"] = muser.RealName;
+                //申请创客
+                int SnApplyUserId = int.Parse(dic["SnApplyUserId"].ToString());
+                Users snuser = db.Users.FirstOrDefault(m => m.Id == SnApplyUserId) ?? new Users();
+                dic["SnApplyMakerCode"] = snuser.MakerCode;
+                dic["SnApplyRealName"] = snuser.RealName;
+                //SN仓库
+                int SnStoreId = int.Parse(dic["SnStoreId"].ToString());
+                StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == SnStoreId) ?? new StoreHouse();
+                dic["StoreNo"] = store.StoreNo;
+                dic["StoreName"] = store.StoreName;
+                //机具类型
+                int SnType = int.Parse(dic["SnType"].ToString());
+                if (SnType == 0) dic["SnType"] = "购买机具";
+                if (SnType == 1) dic["SnType"] = "赠送机具";
+                //返利资格
+                dic["RebateQual"] = dic["RebateQual"].ToString() == "1" ? "是" : "否";
+                //激活类型
+                int ActType = int.Parse(dic["ActType"].ToString());
+                if (ActType == 0) dic["ActType"] = "正常激活";
+                if (ActType == 1) dic["ActType"] = "首次已激活MPOS";
+                if (ActType == 2) dic["ActType"] = "首次已激活KPOS";
+                if (ActType == 3) dic["ActType"] = "循环机划拨激活";
+                //商户状态
+                int MerStatus = int.Parse(dic["MerStatus"].ToString());
+                if (MerStatus == 0) dic["MerStatus"] = "正常";
+                if (MerStatus == 1) dic["MerStatus"] = "冻结";
+                if (MerStatus == 2) dic["MerStatus"] = "关闭";
+                //商户激活状态
+                int ActiveStatus = int.Parse(dic["ActiveStatus"].ToString());
+                if (ActiveStatus == 0) dic["ActiveStatus"] = "未激活";
+                if (ActiveStatus == 1) dic["ActiveStatus"] = "已激活";
+                if (ActiveStatus == 2) dic["ActiveStatus"] = "SN已返现";
+                //商户创客类型
+                int MerUserType = int.Parse(dic["MerUserType"].ToString());
+                if (MerUserType == 0) dic["MerUserType"] = "非商户型创客";
+                if (MerUserType == 1) dic["MerUserType"] = "商户型创客";
+                dic.Remove("UserId");
+                dic.Remove("TopUserId");
+                dic.Remove("MerUserId");
+                dic.Remove("SnApplyUserId");
+                dic.Remove("SnStoreId");
+            }
+
+            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>();
+            ReturnFields.Add("MerchantNo", "商户编号");
+            ReturnFields.Add("MerchantName", "商户名称");
+            ReturnFields.Add("MerchantMobile", "商户手机号");
+            ReturnFields.Add("KqMerNo", "快钱商户编码");
+            ReturnFields.Add("KqSnNo", "快钱SN号");
+            ReturnFields.Add("SnType", "机具类型");
+            ReturnFields.Add("RebateQual", "返利资格");
+            ReturnFields.Add("ActType", "激活类型");
+            ReturnFields.Add("MerStatus", "商户状态");
+            ReturnFields.Add("ActiveStatus", "商户激活状态");
+            ReturnFields.Add("MerMakerCode", "商户创客编码");
+            ReturnFields.Add("MerRealName", "商户创客名称");
+            ReturnFields.Add("MerUserType", "商户创客类型");
+            ReturnFields.Add("MakerCode", "直属创客编号");
+            ReturnFields.Add("RealName", "直属创客姓名");
+            ReturnFields.Add("TopMakerCode", "顶级创客编码");
+            ReturnFields.Add("TopRealName", "顶级创客名称");
+            ReturnFields.Add("StoreNo", "SN仓库编号");
+            ReturnFields.Add("StoreName", "SN仓库名称");
+            ReturnFields.Add("SnApplyMakerCode", "申请创客编号");
+            ReturnFields.Add("SnApplyRealName", "申请创客姓名");
+            ReturnFields.Add("KqRegTime", "注册时间");
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "PosMerchantInfo", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
+
+
+
+        #region 同步交易额
+
+        public IActionResult SycnTradeAmount(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            PosMerchantInfo editData = db.PosMerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new PosMerchantInfo();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 同步交易额
+
+        [HttpPost]
+        public string SycnTradeAmountDo(DateTime sdate, DateTime edate, int MerchantId)
+        {
+            if (sdate.AddMonths(1) < edate)
+            {
+                return "时间间隔不能超过1个月";
+            }
+            if (edate >= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"))
+            {
+                return "结束时间只能是今天之前";
+            }
+            string check = RedisDbconn.Instance.Get<string>("ResetMerchantTradeQueue:" + MerchantId);
+            if (!string.IsNullOrEmpty(check))
+            {
+                return "请稍后再试";
+            }
+            try
+            {
+                RedisDbconn.Instance.AddList("ResetMerchantTradeQueue", MerchantId + "#cut#" + sdate.ToString("yyyy-MM-dd HH:mm:ss") + "#cut#" + edate.ToString("yyyy-MM-dd HH:mm:ss"));
+                RedisDbconn.Instance.Set("ResetMerchantTradeQueue:" + MerchantId, "wait");
+                RedisDbconn.Instance.SetExpire("ResetMerchantTradeQueue:" + MerchantId, 3600);
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "统计商户的交易额异常");
+                return "同步异常";
+            }
+            return "success";
+        }
+
+        #endregion
+    }
+}

+ 573 - 0
Areas/Admin/Controllers/MainServer/PreSendStockDetailController.cs

@@ -0,0 +1,573 @@
+/*
+ * 预发货库存明细
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class PreSendStockDetailController : BaseController
+    {
+        public PreSendStockDetailController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 预发货库存明细列表
+
+        /// <summary>
+        /// 根据条件查询预发货库存明细列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(PreSendStockDetail data, string right, string StoreId)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.StoreId = StoreId;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询预发货库存明细列表
+
+        /// <summary>
+        /// 预发货库存明细列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(PreSendStockDetail data, string StoreIdStoreName, string StoreIdStoreNo, string BrandIdSelect, string ToUserIdMakerCode, string ToUserIdRealName, string ToStoreIdStoreNo, string ToStoreIdStoreName, string SourceStoreIdStoreNo, string SourceStoreIdStoreName, string FromUserIdMakerCode, string FromUserIdRealName, string FromStoreIdStoreNo, string FromStoreIdStoreName, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("StoreId", "1");
+
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("SnNo", "1"); //SN编号
+            Fields.Add("ApplyDate", "3"); //申请时间
+
+
+            string condition = " and Status>-1";
+            //仓库仓库名称
+            if (!string.IsNullOrEmpty(StoreIdStoreName))
+            {
+                condition += " and StoreId in (select StoreId from SmallStoreHouseForStoreName where StoreName='" + StoreIdStoreName + "')";
+            }
+            //仓库仓库编号
+            if (!string.IsNullOrEmpty(StoreIdStoreNo))
+            {
+                condition += " and StoreId in (select StoreId from SmallStoreHouseForStoreNo where StoreNo='" + StoreIdStoreNo + "')";
+            }
+            //产品类型
+            if (!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
+            //收货人创客编号
+            if (!string.IsNullOrEmpty(ToUserIdMakerCode))
+            {
+                condition += " and ToUserId in (select ToUserId from UsersForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
+            }
+            //收货人真实姓名
+            if (!string.IsNullOrEmpty(ToUserIdRealName))
+            {
+                condition += " and ToUserId in (select ToUserId from UsersForRealName where RealName='" + ToUserIdRealName + "')";
+            }
+            //收货仓库仓库编号
+            if (!string.IsNullOrEmpty(ToStoreIdStoreNo))
+            {
+                condition += " and ToStoreId in (select ToStoreId from StoreHouseForStoreNo where StoreNo='" + ToStoreIdStoreNo + "')";
+            }
+            //收货仓库仓库名称
+            if (!string.IsNullOrEmpty(ToStoreIdStoreName))
+            {
+                condition += " and ToStoreId in (select ToStoreId from StoreHouseForStoreName where StoreName='" + ToStoreIdStoreName + "')";
+            }
+            //源仓库编号仓库编号
+            if (!string.IsNullOrEmpty(SourceStoreIdStoreNo))
+            {
+                condition += " and SourceStoreId in (select SourceStoreId from StoreHouseForStoreNo where StoreNo='" + SourceStoreIdStoreNo + "')";
+            }
+            //源仓库编号仓库名称
+            if (!string.IsNullOrEmpty(SourceStoreIdStoreName))
+            {
+                condition += " and SourceStoreId in (select SourceStoreId from StoreHouseForStoreName where StoreName='" + SourceStoreIdStoreName + "')";
+            }
+            //出货创客创客编号
+            if (!string.IsNullOrEmpty(FromUserIdMakerCode))
+            {
+                condition += " and FromUserId in (select FromUserId from UsersForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
+            }
+            //出货创客真实姓名
+            if (!string.IsNullOrEmpty(FromUserIdRealName))
+            {
+                condition += " and FromUserId in (select FromUserId from UsersForRealName where RealName='" + FromUserIdRealName + "')";
+            }
+            //出货仓库仓库编号
+            if (!string.IsNullOrEmpty(FromStoreIdStoreNo))
+            {
+                condition += " and FromStoreId in (select FromStoreId from StoreHouseForStoreNo where StoreNo='" + FromStoreIdStoreNo + "')";
+            }
+            //出货仓库仓库名称
+            if (!string.IsNullOrEmpty(FromStoreIdStoreName))
+            {
+                condition += " and FromStoreId in (select FromStoreId from StoreHouseForStoreName where StoreName='" + FromStoreIdStoreName + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PreSendStockDetail", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //仓库
+                int StoreId = int.Parse(function.CheckInt(dic["StoreId"].ToString()));
+                SmallStoreHouse storeid_SmallStoreHouse = db.SmallStoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new SmallStoreHouse();
+                dic["StoreIdStoreName"] = storeid_SmallStoreHouse.StoreName;
+                dic["StoreIdStoreNo"] = storeid_SmallStoreHouse.StoreNo;
+                dic.Remove("StoreId");
+                //产品类型
+                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+                //SNID
+                dic["SnId"] = RelationClass.GetPosMachinesTwoInfo(int.Parse(dic["SnId"].ToString()));
+                //收货人
+                int ToUserId = int.Parse(function.CheckInt(dic["ToUserId"].ToString()));
+                Users touserid_Users = db.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
+                dic["ToUserIdMakerCode"] = touserid_Users.MakerCode;
+                dic["ToUserIdRealName"] = touserid_Users.RealName;
+                dic.Remove("ToUserId");
+                //收货仓库
+                int ToStoreId = int.Parse(function.CheckInt(dic["ToStoreId"].ToString()));
+                StoreHouse tostoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == ToStoreId) ?? new StoreHouse();
+                dic["ToStoreIdStoreNo"] = tostoreid_StoreHouse.StoreNo;
+                dic["ToStoreIdStoreName"] = tostoreid_StoreHouse.StoreName;
+                dic.Remove("ToStoreId");
+                //源仓库编号
+                int SourceStoreId = int.Parse(function.CheckInt(dic["SourceStoreId"].ToString()));
+                StoreHouse sourcestoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == SourceStoreId) ?? new StoreHouse();
+                dic["SourceStoreIdStoreNo"] = sourcestoreid_StoreHouse.StoreNo;
+                dic["SourceStoreIdStoreName"] = sourcestoreid_StoreHouse.StoreName;
+                dic.Remove("SourceStoreId");
+                dic["ApplyFlagName"] = dic["ApplyFlag"].ToString() == "1" ? "是" : "否";
+                //出货创客
+                int FromUserId = int.Parse(function.CheckInt(dic["FromUserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == FromUserId) ?? new Users();
+                dic["FromUserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["FromUserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("FromUserId");
+                //出货仓库
+                int FromStoreId = int.Parse(function.CheckInt(dic["FromStoreId"].ToString()));
+                StoreHouse fromstoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId) ?? new StoreHouse();
+                dic["FromStoreIdStoreNo"] = fromstoreid_StoreHouse.StoreNo;
+                dic["FromStoreIdStoreName"] = fromstoreid_StoreHouse.StoreName;
+                dic.Remove("FromStoreId");
+                dic["CancelFlagName"] = dic["CancelFlag"].ToString() == "1" ? "是" : "否";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加预发货库存明细
+
+        /// <summary>
+        /// 增加或修改预发货库存明细信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right, string StoreId)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.StoreId = StoreId;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加预发货库存明细
+
+        /// <summary>
+        /// 增加或修改预发货库存明细信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(PreSendStockDetail data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("StoreId", data.StoreId);
+
+            Fields.Add("StoreId", data.StoreId); //仓库
+            Fields.Add("BrandId", data.BrandId); //产品类型
+            Fields.Add("SnId", data.SnId); //SNID
+            Fields.Add("ToUserId", data.ToUserId); //收货人
+            Fields.Add("ToStoreId", data.ToStoreId); //收货仓库
+            Fields.Add("SourceStoreId", data.SourceStoreId); //源仓库编号
+            Fields.Add("ApplyFlag", data.ApplyFlag); //申请标记
+            Fields.Add("ApplyDate", data.ApplyDate); //申请时间
+            Fields.Add("FromUserId", data.FromUserId); //出货创客
+            Fields.Add("FromStoreId", data.FromStoreId); //出货仓库
+            Fields.Add("CancelFlag", data.CancelFlag); //撤回标记
+            Fields.Add("CancelDate", data.CancelDate); //撤回时间
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("PreSendStockDetail", Fields, 0);
+            AddSysLog(data.Id.ToString(), "PreSendStockDetail", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改预发货库存明细
+
+        /// <summary>
+        /// 增加或修改预发货库存明细信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, string StoreId, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.StoreId = StoreId;
+
+
+            PreSendStockDetail editData = db.PreSendStockDetail.FirstOrDefault(m => m.Id == Id) ?? new PreSendStockDetail();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改预发货库存明细
+
+        /// <summary>
+        /// 增加或修改预发货库存明细信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(PreSendStockDetail data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("StoreId", data.StoreId);
+
+            Fields.Add("StoreId", data.StoreId); //仓库
+            Fields.Add("BrandId", data.BrandId); //产品类型
+            Fields.Add("SnId", data.SnId); //SNID
+            Fields.Add("ToUserId", data.ToUserId); //收货人
+            Fields.Add("ToStoreId", data.ToStoreId); //收货仓库
+            Fields.Add("SourceStoreId", data.SourceStoreId); //源仓库编号
+            Fields.Add("ApplyFlag", data.ApplyFlag); //申请标记
+            Fields.Add("ApplyDate", data.ApplyDate); //申请时间
+            Fields.Add("FromUserId", data.FromUserId); //出货创客
+            Fields.Add("FromStoreId", data.FromStoreId); //出货仓库
+            Fields.Add("CancelFlag", data.CancelFlag); //撤回标记
+            Fields.Add("CancelDate", data.CancelDate); //撤回时间
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PreSendStockDetail", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "PreSendStockDetail", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除预发货库存明细信息
+
+        /// <summary>
+        /// 删除预发货库存明细信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PreSendStockDetail", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PreSendStockDetail", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PreSendStockDetail", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PreSendStockDetail", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "PreSendStockDetail", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PreSendStockDetail", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("PreSendStockDetail", Sort, Id);
+
+            AddSysLog(Id.ToString(), "PreSendStockDetail", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.PreSendStockDetail.Add(new PreSendStockDetail()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "PreSendStockDetail", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(PreSendStockDetail data, string StoreIdStoreName, string StoreIdStoreNo, string BrandIdSelect, string ToUserIdMakerCode, string ToUserIdRealName, string ToStoreIdStoreNo, string ToStoreIdStoreName, string SourceStoreIdStoreNo, string SourceStoreIdStoreName, string FromUserIdMakerCode, string FromUserIdRealName, string FromStoreIdStoreNo, string FromStoreIdStoreName)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("SnNo", "1"); //SN编号
+            Fields.Add("ApplyDate", "3"); //申请时间
+
+
+            string condition = " and Status>-1";
+            //仓库仓库名称
+            if (!string.IsNullOrEmpty(StoreIdStoreName))
+            {
+                condition += " and StoreId in (select StoreId from SmallStoreHouseForStoreName where StoreName='" + StoreIdStoreName + "')";
+            }
+            //仓库仓库编号
+            if (!string.IsNullOrEmpty(StoreIdStoreNo))
+            {
+                condition += " and StoreId in (select StoreId from SmallStoreHouseForStoreNo where StoreNo='" + StoreIdStoreNo + "')";
+            }
+            //产品类型
+            if (!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
+            //收货人创客编号
+            if (!string.IsNullOrEmpty(ToUserIdMakerCode))
+            {
+                condition += " and ToUserId in (select ToUserId from UsersForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
+            }
+            //收货人真实姓名
+            if (!string.IsNullOrEmpty(ToUserIdRealName))
+            {
+                condition += " and ToUserId in (select ToUserId from UsersForRealName where RealName='" + ToUserIdRealName + "')";
+            }
+            //收货仓库仓库编号
+            if (!string.IsNullOrEmpty(ToStoreIdStoreNo))
+            {
+                condition += " and ToStoreId in (select ToStoreId from StoreHouseForStoreNo where StoreNo='" + ToStoreIdStoreNo + "')";
+            }
+            //收货仓库仓库名称
+            if (!string.IsNullOrEmpty(ToStoreIdStoreName))
+            {
+                condition += " and ToStoreId in (select ToStoreId from StoreHouseForStoreName where StoreName='" + ToStoreIdStoreName + "')";
+            }
+            //源仓库编号仓库编号
+            if (!string.IsNullOrEmpty(SourceStoreIdStoreNo))
+            {
+                condition += " and SourceStoreId in (select SourceStoreId from StoreHouseForStoreNo where StoreNo='" + SourceStoreIdStoreNo + "')";
+            }
+            //源仓库编号仓库名称
+            if (!string.IsNullOrEmpty(SourceStoreIdStoreName))
+            {
+                condition += " and SourceStoreId in (select SourceStoreId from StoreHouseForStoreName where StoreName='" + SourceStoreIdStoreName + "')";
+            }
+            //出货创客创客编号
+            if (!string.IsNullOrEmpty(FromUserIdMakerCode))
+            {
+                condition += " and FromUserId in (select FromUserId from UsersForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
+            }
+            //出货创客真实姓名
+            if (!string.IsNullOrEmpty(FromUserIdRealName))
+            {
+                condition += " and FromUserId in (select FromUserId from UsersForRealName where RealName='" + FromUserIdRealName + "')";
+            }
+            //出货仓库仓库编号
+            if (!string.IsNullOrEmpty(FromStoreIdStoreNo))
+            {
+                condition += " and FromStoreId in (select FromStoreId from StoreHouseForStoreNo where StoreNo='" + FromStoreIdStoreNo + "')";
+            }
+            //出货仓库仓库名称
+            if (!string.IsNullOrEmpty(FromStoreIdStoreName))
+            {
+                condition += " and FromStoreId in (select FromStoreId from StoreHouseForStoreName where StoreName='" + FromStoreIdStoreName + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("PreSendStockDetail", Fields, "Id desc", "0", 1, 20000, condition, "StoreId,BrandId,SnNo,SnId,ToUserId,ToStoreId,SourceStoreId,ApplyFlag,ApplyDate,FromUserId,FromStoreId,CancelFlag,CancelDate", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //仓库
+                int StoreId = int.Parse(function.CheckInt(dic["StoreId"].ToString()));
+                SmallStoreHouse storeid_SmallStoreHouse = db.SmallStoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new SmallStoreHouse();
+                dic["StoreIdStoreName"] = storeid_SmallStoreHouse.StoreName;
+                dic["StoreIdStoreNo"] = storeid_SmallStoreHouse.StoreNo;
+                dic.Remove("StoreId");
+                //产品类型
+                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+                //SNID
+                dic["SnId"] = RelationClass.GetPosMachinesTwoInfo(int.Parse(dic["SnId"].ToString()));
+                //收货人
+                int ToUserId = int.Parse(function.CheckInt(dic["ToUserId"].ToString()));
+                Users touserid_Users = db.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
+                dic["ToUserIdMakerCode"] = touserid_Users.MakerCode;
+                dic["ToUserIdRealName"] = touserid_Users.RealName;
+                dic.Remove("ToUserId");
+                //收货仓库
+                int ToStoreId = int.Parse(function.CheckInt(dic["ToStoreId"].ToString()));
+                StoreHouse tostoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == ToStoreId) ?? new StoreHouse();
+                dic["ToStoreIdStoreNo"] = tostoreid_StoreHouse.StoreNo;
+                dic["ToStoreIdStoreName"] = tostoreid_StoreHouse.StoreName;
+                dic.Remove("ToStoreId");
+                //源仓库编号
+                int SourceStoreId = int.Parse(function.CheckInt(dic["SourceStoreId"].ToString()));
+                StoreHouse sourcestoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == SourceStoreId) ?? new StoreHouse();
+                dic["SourceStoreIdStoreNo"] = sourcestoreid_StoreHouse.StoreNo;
+                dic["SourceStoreIdStoreName"] = sourcestoreid_StoreHouse.StoreName;
+                dic.Remove("SourceStoreId");
+                dic["ApplyFlagName"] = dic["ApplyFlag"].ToString() == "1" ? "是" : "否";
+                //出货创客
+                int FromUserId = int.Parse(function.CheckInt(dic["FromUserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == FromUserId) ?? new Users();
+                dic["FromUserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["FromUserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("FromUserId");
+                //出货仓库
+                int FromStoreId = int.Parse(function.CheckInt(dic["FromStoreId"].ToString()));
+                StoreHouse fromstoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId) ?? new StoreHouse();
+                dic["FromStoreIdStoreNo"] = fromstoreid_StoreHouse.StoreNo;
+                dic["FromStoreIdStoreName"] = fromstoreid_StoreHouse.StoreName;
+                dic.Remove("FromStoreId");
+                dic["CancelFlagName"] = dic["CancelFlag"].ToString() == "1" ? "是" : "否";
+
+            }
+
+            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>();
+            ReturnFields.Add("StoreIdStoreName", "仓库仓库名称");
+            ReturnFields.Add("StoreIdStoreNo", "仓库仓库编号");
+            ReturnFields.Add("BrandId", "产品类型");
+            ReturnFields.Add("SnNo", "SN编号");
+            ReturnFields.Add("SnId", "SNID");
+            ReturnFields.Add("ToUserIdMakerCode", "收货人创客编号");
+            ReturnFields.Add("ToUserIdRealName", "收货人真实姓名");
+            ReturnFields.Add("ToStoreIdStoreNo", "收货仓库仓库编号");
+            ReturnFields.Add("ToStoreIdStoreName", "收货仓库仓库名称");
+            ReturnFields.Add("SourceStoreIdStoreNo", "源仓库编号仓库编号");
+            ReturnFields.Add("SourceStoreIdStoreName", "源仓库编号仓库名称");
+            ReturnFields.Add("ApplyFlag", "申请标记");
+            ReturnFields.Add("ApplyDate", "申请时间");
+            ReturnFields.Add("FromUserIdMakerCode", "出货创客创客编号");
+            ReturnFields.Add("FromUserIdRealName", "出货创客真实姓名");
+            ReturnFields.Add("FromStoreIdStoreNo", "出货仓库仓库编号");
+            ReturnFields.Add("FromStoreIdStoreName", "出货仓库仓库名称");
+            ReturnFields.Add("CancelFlag", "撤回标记");
+            ReturnFields.Add("CancelDate", "撤回时间");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "PreSendStockDetail", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 0 - 326
Areas/Admin/Controllers/MainServer/ProfitObjectActivationsController.cs

@@ -1,326 +0,0 @@
-/*
- * 激活奖励设置
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectActivationsController : BaseController
-    {
-        public ProfitObjectActivationsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 激活奖励设置列表
-
-        /// <summary>
-        /// 根据条件查询激活奖励设置列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjectActivations data, string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            string Condition = "";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询激活奖励设置列表
-
-        /// <summary>
-        /// 激活奖励设置列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectActivations data, int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ObjectId", "1");
-
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectActivations", Fields, "Id desc", "0", page, limit);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            foreach (Dictionary<string, object> dic in diclist)
-            {
-                int LimitDateKind = int.Parse(dic["LimitDateKind"].ToString());
-                if (LimitDateKind == 1) dic["LimitDateKind"] = "天";
-                if (LimitDateKind == 2) dic["LimitDateKind"] = "月";
-                if (LimitDateKind == 3) dic["LimitDateKind"] = "年";
-                if (LimitDateKind == 4) dic["LimitDateKind"] = "自定义";
-            }
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加激活奖励设置
-
-        /// <summary>
-        /// 增加或修改激活奖励设置信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加激活奖励设置
-
-        /// <summary>
-        /// 增加或修改激活奖励设置信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjectActivations data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("LimitDateKind", data.LimitDateKind); //限制时间类型
-            Fields.Add("LimitDateVal", data.LimitDateVal); //限制时间值
-            Fields.Add("LimitCustomerDate", data.LimitCustomerDate); //自定时间限制
-            Fields.Add("ExpiredNumber", data.ExpiredNumber); //过期收益值
-            Fields.Add("ProfitNumber", data.ProfitNumber); //获得收益值
-            Fields.Add("MachineCount", data.MachineCount); //赠机台数
-            Fields.Add("StartDate", data.StartDate); //开始时间
-            Fields.Add("EndDate", data.EndDate); //结束时间
-            Fields.Add("Code", data.Code); //编号
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectActivations", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectActivations", "add");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改激活奖励设置
-
-        /// <summary>
-        /// 增加或修改激活奖励设置信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string ObjectId, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            ProfitObjectActivations editData = db.ProfitObjectActivations.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectActivations();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改激活奖励设置
-
-        /// <summary>
-        /// 增加或修改激活奖励设置信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjectActivations data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("LimitDateKind", data.LimitDateKind); //限制时间类型
-            Fields.Add("LimitDateVal", data.LimitDateVal); //限制时间值
-            Fields.Add("LimitCustomerDate", data.LimitCustomerDate); //自定时间限制
-            Fields.Add("ExpiredNumber", data.ExpiredNumber); //过期收益值
-            Fields.Add("ProfitNumber", data.ProfitNumber); //获得收益值
-            Fields.Add("MachineCount", data.MachineCount); //赠机台数
-            Fields.Add("StartDate", data.StartDate); //开始时间
-            Fields.Add("EndDate", data.EndDate); //结束时间
-            Fields.Add("Code", data.Code); //编号
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectActivations", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "ProfitObjectActivations", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除激活奖励设置信息
-
-        /// <summary>
-        /// 删除激活奖励设置信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectActivations", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjectActivations", id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectActivations", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectActivations", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectActivations", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectActivations", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectActivations", Sort, Id);
-
-            AddSysLog(Id.ToString(), "ProfitObjectActivations", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                db.ProfitObjectActivations.Add(new ProfitObjectActivations()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjectActivations", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectActivations data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectActivations", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjectActivations", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 310
Areas/Admin/Controllers/MainServer/ProfitObjectContinueFloorsController.cs

@@ -1,310 +0,0 @@
-/*
- * 继续分润层级
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectContinueFloorsController : BaseController
-    {
-        public ProfitObjectContinueFloorsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 继续分润层级列表
-
-        /// <summary>
-        /// 根据条件查询继续分润层级列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjectContinueFloors data, string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            string Condition = "";
-            
-            if (!string.IsNullOrEmpty(Condition))
-            { 
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询继续分润层级列表
-
-        /// <summary>
-        /// 继续分润层级列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectContinueFloors data, int page = 1, int limit = 30)
-        {
-            
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ObjectId", "1");
-
-            
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectContinueFloors", Fields, "Id desc", "0", page, limit);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-                
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加继续分润层级
-
-        /// <summary>
-        /// 增加或修改继续分润层级信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加继续分润层级
-
-        /// <summary>
-        /// 增加或修改继续分润层级信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjectContinueFloors data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("FloorNumber", data.FloorNumber); //层级
-Fields.Add("Percents", data.Percents); //分润比例
-Fields.Add("AddProfitVal", data.AddProfitVal); //附加分润值
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectContinueFloors", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectContinueFloors", "add");
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改继续分润层级
-
-        /// <summary>
-        /// 增加或修改继续分润层级信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string ObjectId, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            ProfitObjectContinueFloors editData = db.ProfitObjectContinueFloors.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectContinueFloors();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改继续分润层级
-
-        /// <summary>
-        /// 增加或修改继续分润层级信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjectContinueFloors data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("FloorNumber", data.FloorNumber); //层级
-Fields.Add("Percents", data.Percents); //分润比例
-Fields.Add("AddProfitVal", data.AddProfitVal); //附加分润值
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectContinueFloors", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"ProfitObjectContinueFloors","update");
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除继续分润层级信息
-
-        /// <summary>
-        /// 删除继续分润层级信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectContinueFloors","del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjectContinueFloors", id);
-            }
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectContinueFloors","open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectContinueFloors", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectContinueFloors","close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectContinueFloors", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectContinueFloors", Sort, Id);
-            
-            AddSysLog(Id.ToString(), "ProfitObjectContinueFloors", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
-            {
-                JsonData dr = list[i];
-                
-                db.ProfitObjectContinueFloors.Add(new ProfitObjectContinueFloors()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-                    
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjectContinueFloors", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectContinueFloors data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectContinueFloors", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjectContinueFloors", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 312
Areas/Admin/Controllers/MainServer/ProfitObjectFloorsController.cs

@@ -1,312 +0,0 @@
-/*
- * 分润对象层级
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectFloorsController : BaseController
-    {
-        public ProfitObjectFloorsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 分润对象层级列表
-
-        /// <summary>
-        /// 根据条件查询分润对象层级列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjectFloors data, string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            string Condition = "";
-            
-            if (!string.IsNullOrEmpty(Condition))
-            { 
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询分润对象层级列表
-
-        /// <summary>
-        /// 分润对象层级列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectFloors data, int page = 1, int limit = 30)
-        {
-            
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ObjectId", "1");
-
-            
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectFloors", Fields, "Id desc", "0", page, limit);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-                
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加分润对象层级
-
-        /// <summary>
-        /// 增加或修改分润对象层级信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加分润对象层级
-
-        /// <summary>
-        /// 增加或修改分润对象层级信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjectFloors data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("FloorNumber", data.FloorNumber); //层级
-Fields.Add("Percents", data.Percents); //分润比例
-Fields.Add("AddProfitVal", data.AddProfitVal); //附加分润值
-Fields.Add("FloorDiff", data.FloorDiff); //级差
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectFloors", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectFloors", "add");
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改分润对象层级
-
-        /// <summary>
-        /// 增加或修改分润对象层级信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string ObjectId, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            ProfitObjectFloors editData = db.ProfitObjectFloors.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectFloors();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改分润对象层级
-
-        /// <summary>
-        /// 增加或修改分润对象层级信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjectFloors data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("FloorNumber", data.FloorNumber); //层级
-Fields.Add("Percents", data.Percents); //分润比例
-Fields.Add("AddProfitVal", data.AddProfitVal); //附加分润值
-Fields.Add("FloorDiff", data.FloorDiff); //级差
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectFloors", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"ProfitObjectFloors","update");
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除分润对象层级信息
-
-        /// <summary>
-        /// 删除分润对象层级信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectFloors","del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjectFloors", id);
-            }
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectFloors","open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectFloors", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectFloors","close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectFloors", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectFloors", Sort, Id);
-            
-            AddSysLog(Id.ToString(), "ProfitObjectFloors", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
-            {
-                JsonData dr = list[i];
-                
-                db.ProfitObjectFloors.Add(new ProfitObjectFloors()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-                    
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjectFloors", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectFloors data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectFloors", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjectFloors", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 318
Areas/Admin/Controllers/MainServer/ProfitObjectLevelKindsController.cs

@@ -1,318 +0,0 @@
-/*
- * 分润对象等级分类
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectLevelKindsController : BaseController
-    {
-        public ProfitObjectLevelKindsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 分润对象等级分类列表
-
-        /// <summary>
-        /// 根据条件查询分润对象等级分类列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjectLevelKinds data, string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            string Condition = "";
-            Condition += "Name:\"" + data.Name + "\",";
-
-            if (!string.IsNullOrEmpty(Condition))
-            { 
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询分润对象等级分类列表
-
-        /// <summary>
-        /// 分润对象等级分类列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectLevelKinds data, int page = 1, int limit = 30)
-        {
-            
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ObjectId", "1");
-
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectLevelKinds", Fields, "Id desc", "0", page, limit);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-                
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加分润对象等级分类
-
-        /// <summary>
-        /// 增加或修改分润对象等级分类信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加分润对象等级分类
-
-        /// <summary>
-        /// 增加或修改分润对象等级分类信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjectLevelKinds data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("IsHelp", data.IsHelp); //是否扶持期
-            Fields.Add("BankCardType", data.BankCardType); //卡类型
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectLevelKinds", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectLevelKinds", "add");
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改分润对象等级分类
-
-        /// <summary>
-        /// 增加或修改分润对象等级分类信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string ObjectId, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            ProfitObjectLevelKinds editData = db.ProfitObjectLevelKinds.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectLevelKinds();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改分润对象等级分类
-
-        /// <summary>
-        /// 增加或修改分润对象等级分类信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjectLevelKinds data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("IsHelp", data.IsHelp); //是否扶持期
-            Fields.Add("BankCardType", data.BankCardType); //卡类型
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectLevelKinds", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"ProfitObjectLevelKinds","update");
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除分润对象等级分类信息
-
-        /// <summary>
-        /// 删除分润对象等级分类信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectLevelKinds","del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjectLevelKinds", id);
-                ProfitObjectLevels edit = db.ProfitObjectLevels.FirstOrDefault(m => m.KindId == id);
-                if (edit != null)
-                {
-                    db.ProfitObjectLevels.Remove(edit);
-                }
-            }
-            db.SaveChanges();
-            
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectLevelKinds","open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectLevelKinds", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectLevelKinds","close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectLevelKinds", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectLevelKinds", Sort, Id);
-            
-            AddSysLog(Id.ToString(), "ProfitObjectLevelKinds", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
-            {
-                JsonData dr = list[i];
-                
-                db.ProfitObjectLevelKinds.Add(new ProfitObjectLevelKinds()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-                    
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjectLevelKinds", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectLevelKinds data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectLevelKinds", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjectLevelKinds", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 353
Areas/Admin/Controllers/MainServer/ProfitObjectLevelsController.cs

@@ -1,353 +0,0 @@
-/*
- * 分润对象等级
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectLevelsController : BaseController
-    {
-        public ProfitObjectLevelsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 分润对象等级列表
-
-        /// <summary>
-        /// 根据条件查询分润对象等级列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjectLevels data, string right, string KindId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.KindId = KindId;
-
-
-            string Condition = "";
-            Condition += "Name:\"" + data.Name + "\",";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询分润对象等级列表
-
-        /// <summary>
-        /// 分润对象等级列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectLevels data, int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("KindId", "1");
-
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectLevels", Fields, "Id desc", "0", page, limit);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加分润对象等级
-
-        /// <summary>
-        /// 增加或修改分润对象等级信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right, string KindId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.KindId = KindId;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加分润对象等级
-
-        /// <summary>
-        /// 增加或修改分润对象等级信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjectLevels data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("KindId", data.KindId);
-
-            Fields.Add("LevelNumber", data.LevelNumber); //级别
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("Percents", data.Percents); //分润比例
-            Fields.Add("AddProfitVal", data.AddProfitVal); //附加分润值
-            Fields.Add("LevelDiff", data.LevelDiff); //级差
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectLevels", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectLevels", "add");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改分润对象等级
-
-        /// <summary>
-        /// 增加或修改分润对象等级信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string KindId, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.KindId = KindId;
-
-
-            ProfitObjectLevels editData = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectLevels();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改分润对象等级
-
-        /// <summary>
-        /// 增加或修改分润对象等级信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjectLevels data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("KindId", data.KindId);
-
-            Fields.Add("LevelNumber", data.LevelNumber); //级别
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("Percents", data.Percents); //分润比例
-            Fields.Add("AddProfitVal", data.AddProfitVal); //附加分润值
-            Fields.Add("LevelDiff", data.LevelDiff); //级差
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectLevels", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "ProfitObjectLevels", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除分润对象等级信息
-
-        /// <summary>
-        /// 删除分润对象等级信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectLevels", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjectLevels", id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectLevels", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectLevels", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectLevels", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectLevels", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectLevels", Sort, Id);
-
-            AddSysLog(Id.ToString(), "ProfitObjectLevels", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                db.ProfitObjectLevels.Add(new ProfitObjectLevels()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjectLevels", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectLevels data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectLevels", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjectLevels", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-        #region 编辑字段
-
-        public string Percents(int Id, decimal Percents)
-        {
-            ProfitObjectLevels edit = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                edit.Percents = Percents;
-                db.SaveChanges();
-            }
-            AddSysLog(Id.ToString(), "ProfitObjectLevels", "Percents");
-            return "success";
-        }
-        public string AddProfitVal(int Id, decimal AddProfitVal)
-        {
-            ProfitObjectLevels edit = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                edit.AddProfitVal = AddProfitVal;
-                db.SaveChanges();
-            }
-            AddSysLog(Id.ToString(), "ProfitObjectLevels", "AddProfitVal");
-            return "success";
-        }
-        public string LevelDiff(int Id, ulong LevelDiff)
-        {
-            ProfitObjectLevels edit = db.ProfitObjectLevels.FirstOrDefault(m => m.Id == Id);
-            if (edit != null)
-            {
-                edit.LevelDiff = LevelDiff;
-                db.SaveChanges();
-            }
-            AddSysLog(Id.ToString(), "ProfitObjectLevels", "LevelDiff");
-            return "success";
-        }
-        #endregion
-    }
-}

+ 0 - 329
Areas/Admin/Controllers/MainServer/ProfitObjectsActivesController.cs

@@ -1,329 +0,0 @@
-/*
- * 分润对象活动奖
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectsActivesController : BaseController
-    {
-        public ProfitObjectsActivesController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 分润对象活动奖列表
-
-        /// <summary>
-        /// 根据条件查询分润对象活动奖列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjectsActives data, string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            string Condition = "";
-            Condition += "Name:\"" + data.Name + "\",";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询分润对象活动奖列表
-
-        /// <summary>
-        /// 分润对象活动奖列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectsActives data, int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ObjectId", "1");
-
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsActives", Fields, "Id desc", "0", page, limit);
-            //List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            //foreach (Dictionary<string, object> dic in diclist)
-            //{
-
-            //}
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加分润对象活动奖
-
-        /// <summary>
-        /// 增加或修改分润对象活动奖信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right, string ObjectId)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加分润对象活动奖
-
-        /// <summary>
-        /// 增加或修改分润对象活动奖信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjectsActives data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("LimitDateKind", data.LimitDateKind); //限制时间类型
-            Fields.Add("LimitDateVal", data.LimitDateVal); //限制时间值
-            Fields.Add("LimitCustomerDate", data.LimitCustomerDate); //自定时间限制
-            Fields.Add("FinishNumber", data.FinishNumber); //满足条件的数值
-            Fields.Add("ProfitNumber", data.ProfitNumber); //获得收益值
-            Fields.Add("StartDate", data.StartDate); //活动开始时间
-            Fields.Add("EndDate", data.EndDate); //活动结束时间
-            Fields.Add("MachineCount", data.MachineCount); //赠机台数
-            Fields.Add("CardType", data.CardType); //卡类型
-            Fields.Add("ProfitNumber2", data.ProfitNumber2); //获得收益值2
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectsActives", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectsActives", "add");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改分润对象活动奖
-
-        /// <summary>
-        /// 增加或修改分润对象活动奖信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, string ObjectId, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
-
-
-            ProfitObjectsActives editData = db.ProfitObjectsActives.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectsActives();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改分润对象活动奖
-
-        /// <summary>
-        /// 增加或修改分润对象活动奖信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjectsActives data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
-
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("LimitDateKind", data.LimitDateKind); //限制时间类型
-            Fields.Add("LimitDateVal", data.LimitDateVal); //限制时间值
-            Fields.Add("LimitCustomerDate", data.LimitCustomerDate); //自定时间限制
-            Fields.Add("FinishNumber", data.FinishNumber); //满足条件的数值
-            Fields.Add("ProfitNumber", data.ProfitNumber); //获得收益值
-            Fields.Add("StartDate", data.StartDate); //活动开始时间
-            Fields.Add("EndDate", data.EndDate); //活动结束时间
-            Fields.Add("MachineCount", data.MachineCount); //赠机台数
-            Fields.Add("CardType", data.CardType); //卡类型
-            Fields.Add("ProfitNumber2", data.ProfitNumber2); //获得收益值2
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActives", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "ProfitObjectsActives", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除分润对象活动奖信息
-
-        /// <summary>
-        /// 删除分润对象活动奖信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectsActives", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjectsActives", id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectsActives", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActives", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectsActives", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsActives", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectsActives", Sort, Id);
-
-            AddSysLog(Id.ToString(), "ProfitObjectsActives", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                db.ProfitObjectsActives.Add(new ProfitObjectsActives()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjectsActives", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectsActives data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsActives", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjectsActives", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 427
Areas/Admin/Controllers/MainServer/ProfitObjectsController.cs

@@ -1,427 +0,0 @@
-/*
- * 分润对象
- */
-
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectsController : BaseController
-    {
-        public ProfitObjectsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 分润对象列表
-
-        /// <summary>
-        /// 根据条件查询分润对象列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(ProfitObjects data, string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            string Condition = "";
-            Condition += "Name:\"" + data.Name + "\",";
-
-            if (!string.IsNullOrEmpty(Condition))
-            {
-                Condition = Condition.TrimEnd(',');
-                Condition = ", where: {" + Condition + "}";
-            }
-            ViewBag.Condition = Condition;
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询分润对象列表
-
-        /// <summary>
-        /// 分润对象列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(ProfitObjects data, int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjects", Fields, "Id desc", "0", page, limit);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            foreach (Dictionary<string, object> dic in diclist)
-            {
-                dic["Status"] = dic["Status"].ToString() == "1" ? "开启" : "关闭";
-            }
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加分润对象
-
-        /// <summary>
-        /// 增加或修改分润对象信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            List<ProfitObjects> objs = db.ProfitObjects.OrderBy(m => m.Id).ToList();
-            ViewBag.objs = objs;
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加分润对象
-
-        /// <summary>
-        /// 增加或修改分润对象信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(ProfitObjects data, int CopyId)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("MaxFloor", data.MaxFloor); //最大层级
-            Fields.Add("MaxLevel", data.MaxLevel); //最大等级
-            Fields.Add("MaxLevelContinue", data.MaxLevelContinue); //到顶级是否继续
-            Fields.Add("MinProfitVal", data.MinProfitVal); //最小分润值
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjects", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjects", "add");
-            db.SaveChanges();
-
-            if (CopyId > 0)
-            {
-                List<ProfitObjectLevelKinds> objlevelkinds = db.ProfitObjectLevelKinds.Where(m => m.ObjectId == CopyId).ToList();
-                foreach (ProfitObjectLevelKinds objlevelkind in objlevelkinds)
-                {
-                    List<ProfitObjectLevels> objlevels = db.ProfitObjectLevels.Where(m => m.KindId == objlevelkind.Id).ToList();
-                    objlevelkind.Id = 0;
-                    objlevelkind.CreateDate = DateTime.Now;
-                    objlevelkind.ObjectId = Id;
-                    ProfitObjectLevelKinds add = db.ProfitObjectLevelKinds.Add(objlevelkind).Entity;
-                    db.SaveChanges();
-                    foreach (ProfitObjectLevels objlevel in objlevels)
-                    {
-                        objlevel.Id = 0;
-                        objlevel.CreateDate = DateTime.Now;                    
-                        objlevel.KindId = add.Id;
-                        db.ProfitObjectLevels.Add(objlevel);
-                        db.SaveChanges();
-                    }
-                }
-                List<ProfitObjectFloors> objfloors = db.ProfitObjectFloors.Where(m => m.ObjectId == CopyId).ToList();
-                foreach (ProfitObjectFloors objfloor in objfloors)
-                {
-                    objfloor.Id = 0;
-                    objfloor.CreateDate = DateTime.Now;
-                    objfloor.ObjectId = Id;
-                    db.ProfitObjectFloors.Add(objfloor);
-                    db.SaveChanges();
-                }
-                List<ProfitObjectContinueFloors> objcontinuefloors = db.ProfitObjectContinueFloors.Where(m => m.ObjectId == CopyId).ToList();
-                foreach (ProfitObjectContinueFloors objcontinuefloor in objcontinuefloors)
-                {
-                    objcontinuefloor.Id = 0;
-                    objcontinuefloor.CreateDate = DateTime.Now;                    
-                    objcontinuefloor.ObjectId = Id;
-                    db.ProfitObjectContinueFloors.Add(objcontinuefloor);
-                    db.SaveChanges();
-                }
-                List<ProfitObjectsActives> objactives = db.ProfitObjectsActives.Where(m => m.ObjectId == CopyId).ToList();                
-                foreach (ProfitObjectsActives objactive in objactives)
-                {
-                    objactive.Id = 0;
-                    objactive.CreateDate = DateTime.Now;                    
-                    objactive.ObjectId = Id;
-                    db.ProfitObjectsActives.Add(objactive);
-                    db.SaveChanges();
-                }
-                List<ProfitObjectActivations> objactivations = db.ProfitObjectActivations.Where(m => m.ObjectId == CopyId).ToList();
-                foreach (ProfitObjectActivations objactivation in objactivations)
-                {
-                    objactivation.Id = 0;
-                    objactivation.CreateDate = DateTime.Now;                    
-                    objactivation.ObjectId = Id;
-                    db.ProfitObjectActivations.Add(objactivation);
-                    db.SaveChanges();
-                }
-            }
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改分润对象
-
-        /// <summary>
-        /// 增加或修改分润对象信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            ProfitObjects editData = db.ProfitObjects.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjects();
-            ViewBag.data = editData;
-            return View();
-        }
-
-        #endregion
-
-        #region 修改分润对象
-
-        /// <summary>
-        /// 增加或修改分润对象信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(ProfitObjects data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("MaxFloor", data.MaxFloor); //最大层级
-            Fields.Add("MaxLevel", data.MaxLevel); //最大等级
-            Fields.Add("MaxLevelContinue", data.MaxLevelContinue); //到顶级是否继续
-            Fields.Add("MinProfitVal", data.MinProfitVal); //最小分润值
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjects", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "ProfitObjects", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除分润对象信息
-
-        /// <summary>
-        /// 删除分润对象信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjects", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Delete("ProfitObjects", id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjects", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjects", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjects", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjects", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjects", Sort, Id);
-
-            AddSysLog(Id.ToString(), "ProfitObjects", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        public string Import(string ExcelData)
-        {
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-
-                db.ProfitObjects.Add(new ProfitObjects()
-                {
-                    CreateDate = DateTime.Now,
-                    UpdateDate = DateTime.Now,
-
-                });
-                db.SaveChanges();
-            }
-            AddSysLog("0", "ProfitObjects", "Import");
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjects data)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "2"); //名称
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjects", Fields, "Id desc", "0", 1, 20000, "", "", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<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);
-            AddSysLog("0", "ProfitObjects", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-        #region 同步redis
-
-        public string SyncRedis()
-        {
-            List<ProfitObjects> objs = db.ProfitObjects.ToList();
-            foreach (ProfitObjects obj in objs)
-            {
-                RedisDbconn.Instance.Set("pobj" + obj.Id, obj);
-                RedisDbconn.Instance.Set("pobjconc" + obj.Id, db.ProfitObjectContinueFloors.Count(m => m.ObjectId == obj.Id));
-                List<ProfitObjectsRule> rules = db.ProfitObjectsRule.Where(m => m.ObjectId == obj.Id).ToList();
-                foreach (ProfitObjectsRule rule in rules)
-                {
-                    RedisDbconn.Instance.Set("pobjrule:" + obj.Id + ":" + rule.Code, rule);
-                    List<ProfitObjectsRuleDetails> details = db.ProfitObjectsRuleDetails.Where(m => m.RuleId == rule.Id).ToList();
-                    foreach (ProfitObjectsRuleDetails detail in details)
-                    {
-                        RedisDbconn.Instance.Set("pobjrule:" + obj.Id + ":" + rule.Code + ":" + detail.Code, detail.DataValue);
-                    }
-                }
-            }
-            List<ProfitObjectLevels> objlevels = db.ProfitObjectLevels.ToList();
-            foreach (ProfitObjectLevels objlevel in objlevels)
-            {
-                RedisDbconn.Instance.Set("pobjlv" + objlevel.KindId + ":" + objlevel.LevelNumber, objlevel);
-            }
-            List<ProfitObjectLevelKinds> objlevelkinds = db.ProfitObjectLevelKinds.ToList();
-            foreach (ProfitObjectLevelKinds objlevelkind in objlevelkinds)
-            {
-                RedisDbconn.Instance.Set("pobjlv:kid:" + objlevelkind.ObjectId + ":" + objlevelkind.IsHelp + ":" + objlevelkind.BankCardType, objlevelkind.Id);
-            }
-            List<ProfitObjectFloors> objfloors = db.ProfitObjectFloors.ToList();
-            foreach (ProfitObjectFloors objfloor in objfloors)
-            {
-                RedisDbconn.Instance.Set("pobjfl" + objfloor.ObjectId + ":" + objfloor.FloorNumber, objfloor);
-            }
-            List<ProfitObjectContinueFloors> objcontinuefloors = db.ProfitObjectContinueFloors.ToList();
-            foreach (ProfitObjectContinueFloors objcontinuefloor in objcontinuefloors)
-            {
-                RedisDbconn.Instance.Set("pobjcon" + objcontinuefloor.ObjectId + ":" + objcontinuefloor.FloorNumber, objcontinuefloor);
-            }
-            List<ProfitObjectsActives> objactives = db.ProfitObjectsActives.ToList();
-            RedisDbconn.Instance.Clear("pobjact*");
-            foreach (ProfitObjectsActives objactive in objactives)
-            {
-                RedisDbconn.Instance.AddList("pobjact" + objactive.ObjectId, objactive);
-            }
-            List<ProfitObjectActivations> objactivations = db.ProfitObjectActivations.ToList();
-            foreach (ProfitObjectActivations objactivation in objactivations)
-            {
-                RedisDbconn.Instance.Set("pobjacti" + objactivation.ObjectId, objactivation);
-            }
-            return "success";
-        }
-
-        #endregion
-
-    }
-}

+ 55 - 11
Areas/Admin/Controllers/MainServer/ProfitRewardRecordController.cs

@@ -64,14 +64,16 @@ namespace MySystem.Areas.Admin.Controllers
         /// 分润奖励记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(ProfitRewardRecord data, string MakerCode, string RealName, string ProfitTypeSelect, string CheckStatusSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(ProfitRewardRecord data, string right, string BrandId, string MakerCode, string RealName, string ProfitTypeSelect, string CheckStatusSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
             Fields.Add("BrandId", "1");
-            Fields.Add("CreateDate", "3"); //交易时间
             Fields.Add("TopUserId", "0"); //顶级创客
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.BrandId = BrandId;
 
             string condition = " and Status>-1";
             //创客编号
@@ -94,6 +96,14 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and CheckStatus=" + CheckStatusSelect;
             }
+            //交易时间
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitRewardRecord", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -162,10 +172,34 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["DebitProfitAmt"] = DebitProfitAmt;
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("MerchantTradeAmount", 0);
-            other.Add("CreditTradeAmount", 0);
-            other.Add("MerchantProfitAmount", 0);
-            other.Add("CreditProfitAmount", 0);
+            string MerchantTradeAmount = "0.00";//商户交易总额
+            string CreditTradeAmount = "0.00";//贷记卡交易总金额
+            string MerchantProfitAmount = "0.00";//商户交易分润总金额
+            string CreditProfitAmount = "0.00";//贷记卡分润总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmt) from ProfitRewardRecord where BrandId='" + ViewBag.BrandId + "'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                MerchantTradeAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString();
+            }
+            dt = OtherMySqlConn.dtable("select sum(CreditTradeAmt) from ProfitRewardRecord where BrandId='" + ViewBag.BrandId + "'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                CreditTradeAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString();
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeProfit) from ProfitRewardRecord where BrandId='" + ViewBag.BrandId + "'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                MerchantProfitAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString();
+            }
+            dt = OtherMySqlConn.dtable("select sum(CreditTradeProfit) from ProfitRewardRecord where BrandId='" + ViewBag.BrandId + "'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                CreditProfitAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString();
+            }
+            other.Add("MerchantTradeAmount", MerchantTradeAmount);
+            other.Add("CreditTradeAmount", CreditTradeAmount);
+            other.Add("MerchantProfitAmount", MerchantProfitAmount);
+            other.Add("CreditProfitAmount", CreditProfitAmount);
             obj.Add("other", other);
             return Json(obj);
         }
@@ -480,13 +514,18 @@ namespace MySystem.Areas.Admin.Controllers
         public string SycnData(int BrandId, int OpType = 0)
         {
             string date = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
-            string check = function.ReadInstance("/Balance/" + BrandId + "/" + date + ".txt");
+            string OpTypeString = "";
+            if(OpType > 0)
+            {
+                OpTypeString += "-" + OpType;
+            }
+            string check = function.ReadInstance("/Balance/" + BrandId + "/" + date + OpTypeString + ".txt");
             if (string.IsNullOrEmpty(check))
             {
-                function.WritePage("/Balance/" + BrandId + "/", date + ".txt", DateTime.Now.ToString());
+                function.WritePage("/Balance/" + BrandId + "/", date + OpTypeString + ".txt", DateTime.Now.ToString());
                 // DoTradeProfit(BrandId, date, OpType);
                 // DoSubsidyProfit(BrandId, date, OpType);
-                RedisDbconn.Instance.AddList("SycnProfitQueue", BrandId + "#cut#" + date + "#cut#" + OpType + "#cut#" + SysUserName);
+                RedisDbconn.Instance.AddList("SycnProfitQueue2", BrandId + "#cut#" + date + "#cut#" + OpType + "#cut#" + SysUserName);
                 return "success";
             }
             return date + "分润已同步,请勿重复操作";
@@ -495,10 +534,15 @@ namespace MySystem.Areas.Admin.Controllers
         public string SycnDataByCondi(int BrandId, string MakerCode, int OpType = 0)
         {
             string date = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
-            string check = function.ReadInstance("/Balance/" + BrandId + "/" + MakerCode + "/" + date + ".txt");
+            string OpTypeString = "";
+            if(OpType > 0)
+            {
+                OpTypeString += "-" + OpType;
+            }
+            string check = function.ReadInstance("/Balance/" + BrandId + "/" + MakerCode + "/" + date + OpTypeString + ".txt");
             if (string.IsNullOrEmpty(check))
             {
-                function.WritePage("/Balance/" + BrandId + "/" + MakerCode + "/", date + ".txt", DateTime.Now.ToString());
+                function.WritePage("/Balance/" + BrandId + "/" + MakerCode + "/", date + OpTypeString + ".txt", DateTime.Now.ToString());
                 UserForMakerCode forMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
                 DoTradeProfitByCondi(forMakerCode.UserId, BrandId, date, OpType);
                 DoSubsidyProfitByCondi(forMakerCode.UserId, BrandId, date, OpType);

+ 14 - 2
Areas/Admin/Controllers/MainServer/ProfitSubsidyDetailController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -53,7 +54,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 分润补贴明细列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(ProfitSubsidyDetail data, string MerchantNo, string MerchantName, string MakerCode, string RealName, string TradeMonthSelect, string SubsidyTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(ProfitSubsidyDetail data, string MerchantNo, string MerchantName, string MakerCode, string RealName, string TradeMonthSelect, string BrandIdSelect, string SubsidyTypeSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -93,6 +94,11 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and TradeMonth=" + TradeMonthSelect.Replace("-", "");
             }
+            //产品类型
+            if(!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitSubsidyDetail", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -112,7 +118,13 @@ namespace MySystem.Areas.Admin.Controllers
                 if (SubsidyType == 1) dic["SubsidyType"] = "下级商户交易分润补贴";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("SubsidyProfit", 0);
+            string SubsidyProfit = "0.00";//分润补贴金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(SubsidyProfit) from ProfitSubsidyDetail where 1=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                SubsidyProfit = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("SubsidyProfit", SubsidyProfit);
             obj.Add("other", other);
             return Json(obj);
         }

+ 59 - 58
Areas/Admin/Controllers/MainServer/ProfitObjectsRuleDetailsController.cs → Areas/Admin/Controllers/MainServer/SchoolMakerStudyController.cs

@@ -1,5 +1,5 @@
 /*
- * 分润对象规则
+ * 商学院创客学堂
  */
 
 using System;
@@ -21,53 +21,53 @@ namespace MySystem.Areas.Admin.Controllers
 {
     [Area("Admin")]
     [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectsRuleDetailsController : BaseController
+    public class SchoolMakerStudyController : BaseController
     {
-        public ProfitObjectsRuleDetailsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        public SchoolMakerStudyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
-        #region 分润对象规则列表
+        #region 商学院创客学堂列表
 
         /// <summary>
-        /// 根据条件查询分润对象规则列表
+        /// 根据条件查询商学院创客学堂列表
         /// </summary>
         /// <returns></returns>
-        public IActionResult Index(ProfitObjectsRuleDetails data, string right, string RuleId)
+        public IActionResult Index(SchoolMakerStudy data, string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.RuleId = RuleId;
+
 
             return View();
         }
 
         #endregion
 
-        #region 根据条件查询分润对象规则列表
+        #region 根据条件查询商学院创客学堂列表
 
         /// <summary>
-        /// 分润对象规则列表
+        /// 商学院创客学堂列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectsRuleDetails data, int page = 1, int limit = 30)
+        public JsonResult IndexData(SchoolMakerStudy data, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("RuleId", "1");
 
-            Fields.Add("Name", "1"); //名称
-            Fields.Add("Code", "1"); //编号
+            Fields.Add("Title", "1"); //标题
+            Fields.Add("CreateDate", "3"); //时间
 
 
             string condition = " and Status>-1";
 
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsRuleDetails", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SchoolMakerStudy", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
+                dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
 
             }
             return Json(obj);
@@ -75,17 +75,16 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 增加分润对象规则
+        #region 增加商学院创客学堂
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院创客学堂信息
         /// </summary>
         /// <returns></returns>
-        public IActionResult Add(string right, string RuleId)
+        public IActionResult Add(string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.RuleId = RuleId;
 
 
             return View();
@@ -93,27 +92,28 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 增加分润对象规则
+        #region 增加商学院创客学堂
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院创客学堂信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Add(ProfitObjectsRuleDetails data)
+        public string Add(SchoolMakerStudy data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("RuleId", data.RuleId);
 
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("Code", data.Code); //编号
-            Fields.Add("DataValue", data.DataValue); //设置值
+            Fields.Add("Title", data.Title); //标题
+            Fields.Add("Detail", data.Detail); //介绍
+            Fields.Add("ListPic", data.ListPic); //列表图片
+            Fields.Add("Contents", data.Contents); //内容
+            Fields.Add("Url", data.Url); //外链
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectsRuleDetails", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectsRuleDetails", "add");
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("SchoolMakerStudy", Fields, 0);
+            AddSysLog(data.Id.ToString(), "SchoolMakerStudy", "add");
             db.SaveChanges();
 
             return "success";
@@ -121,47 +121,47 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 修改分润对象规则
+        #region 修改商学院创客学堂
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院创客学堂信息
         /// </summary>
         /// <returns></returns>
-        public IActionResult Edit(string right, string RuleId, int Id = 0)
+        public IActionResult Edit(string right, int Id = 0)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.RuleId = RuleId;
 
 
-            ProfitObjectsRuleDetails editData = db.ProfitObjectsRuleDetails.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectsRuleDetails();
+            SchoolMakerStudy editData = db.SchoolMakerStudy.FirstOrDefault(m => m.Id == Id) ?? new SchoolMakerStudy();
             ViewBag.data = editData;
             return View();
         }
 
         #endregion
 
-        #region 修改分润对象规则
+        #region 修改商学院创客学堂
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院创客学堂信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Edit(ProfitObjectsRuleDetails data)
+        public string Edit(SchoolMakerStudy data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("RuleId", data.RuleId);
 
-            Fields.Add("Name", data.Name); //名称
-            Fields.Add("Code", data.Code); //编号
-            Fields.Add("DataValue", data.DataValue); //设置值
+            Fields.Add("Title", data.Title); //标题
+            Fields.Add("Detail", data.Detail); //介绍
+            Fields.Add("ListPic", data.ListPic); //列表图片
+            Fields.Add("Contents", data.Contents); //内容
+            Fields.Add("Url", data.Url); //外链
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRuleDetails", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "ProfitObjectsRuleDetails", "update");
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMakerStudy", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "SchoolMakerStudy", "update");
             db.SaveChanges();
 
             return "success";
@@ -169,22 +169,22 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 删除分润对象规则信息
+        #region 删除商学院创客学堂信息
 
         /// <summary>
-        /// 删除分润对象规则信息
+        /// 删除商学院创客学堂信息
         /// </summary>
         /// <returns></returns>
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectsRuleDetails", "del");
+            AddSysLog(Id, "SchoolMakerStudy", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRuleDetails", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMakerStudy", Fields, id);
             }
             db.SaveChanges();
 
@@ -202,13 +202,13 @@ namespace MySystem.Areas.Admin.Controllers
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectsRuleDetails", "open");
+            AddSysLog(Id, "SchoolMakerStudy", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRuleDetails", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMakerStudy", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -225,13 +225,13 @@ namespace MySystem.Areas.Admin.Controllers
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "ProfitObjectsRuleDetails", "close");
+            AddSysLog(Id, "SchoolMakerStudy", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRuleDetails", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMakerStudy", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -246,9 +246,9 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectsRuleDetails", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("SchoolMakerStudy", Sort, Id);
 
-            AddSysLog(Id.ToString(), "ProfitObjectsRuleDetails", "sort");
+            AddSysLog(Id.ToString(), "SchoolMakerStudy", "sort");
             return "success";
         }
         #endregion
@@ -266,7 +266,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                db.ProfitObjectsRuleDetails.Add(new ProfitObjectsRuleDetails()
+                db.SchoolMakerStudy.Add(new SchoolMakerStudy()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
@@ -274,7 +274,7 @@ namespace MySystem.Areas.Admin.Controllers
                 });
                 db.SaveChanges();
             }
-            AddSysLog("0", "ProfitObjectsRuleDetails", "Import");
+            AddSysLog("0", "SchoolMakerStudy", "Import");
             return "success";
         }
         #endregion
@@ -285,20 +285,21 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectsRuleDetails data)
+        public JsonResult ExportExcel(SchoolMakerStudy data)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "1"); //名称
-            Fields.Add("Code", "1"); //编号
+            Fields.Add("Title", "1"); //标题
+            Fields.Add("CreateDate", "3"); //时间
 
 
             string condition = " and Status>-1";
 
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsRuleDetails", Fields, "Id desc", "0", 1, 20000, condition, "", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SchoolMakerStudy", Fields, "Id desc", "0", 1, 20000, condition, "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
+                dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
 
             }
 
@@ -309,7 +310,7 @@ namespace MySystem.Areas.Admin.Controllers
             Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
 
             result.Add("Fields", ReturnFields);
-            AddSysLog("0", "ProfitObjectsRuleDetails", "ExportExcel");
+            AddSysLog("0", "SchoolMakerStudy", "ExportExcel");
             return Json(result);
         }
 

+ 77 - 73
Areas/Admin/Controllers/MainServer/ProfitObjectsRuleController.cs → Areas/Admin/Controllers/MainServer/SchoolMorningMeetController.cs

@@ -1,5 +1,5 @@
 /*
- * 分润对象规则
+ * 商学院每日晨会
  */
 
 using System;
@@ -21,70 +21,71 @@ namespace MySystem.Areas.Admin.Controllers
 {
     [Area("Admin")]
     [Route("Admin/[controller]/[action]")]
-    public class ProfitObjectsRuleController : BaseController
+    public class SchoolMorningMeetController : BaseController
     {
-        public ProfitObjectsRuleController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        public SchoolMorningMeetController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
         {
             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
         }
 
-        #region 分润对象规则列表
+        #region 商学院每日晨会列表
 
         /// <summary>
-        /// 根据条件查询分润对象规则列表
+        /// 根据条件查询商学院每日晨会列表
         /// </summary>
         /// <returns></returns>
-        public IActionResult Index(ProfitObjectsRule data, string right, string ObjectId)
+        public IActionResult Index(SchoolMorningMeet data, string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            
+
+
             return View();
         }
 
         #endregion
 
-        #region 根据条件查询分润对象规则列表
+        #region 根据条件查询商学院每日晨会列表
 
         /// <summary>
-        /// 分润对象规则列表
+        /// 商学院每日晨会列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(ProfitObjectsRule data, int page = 1, int limit = 30)
+        public JsonResult IndexData(SchoolMorningMeet data, int page = 1, int limit = 30)
         {
-            
+
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ObjectId", "1");
 
-            Fields.Add("Name", "1"); //名称
-Fields.Add("Code", "1"); //编号
+            Fields.Add("Title", "1"); //标题
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("Lecturer", "1"); //主讲
 
 
             string condition = " and Status>-1";
-            
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsRule", Fields, "Id desc", "0", page, limit, condition);
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SchoolMorningMeet", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
-                
+                dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
+
             }
             return Json(obj);
         }
 
         #endregion
 
-        #region 增加分润对象规则
+        #region 增加商学院每日晨会
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院每日晨会信息
         /// </summary>
         /// <returns></returns>
-        public IActionResult Add(string right, string ObjectId)
+        public IActionResult Add(string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
 
 
             return View();
@@ -92,103 +93,104 @@ Fields.Add("Code", "1"); //编号
 
         #endregion
 
-        #region 增加分润对象规则
+        #region 增加商学院每日晨会
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院每日晨会信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Add(ProfitObjectsRule data)
+        public string Add(SchoolMorningMeet data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
 
-            Fields.Add("Name", data.Name); //名称
-Fields.Add("StartDate", data.StartDate); //活动开始时间
-Fields.Add("EndDate", data.EndDate); //活动结束时间
-Fields.Add("Code", data.Code); //编号
+            Fields.Add("Title", data.Title); //标题
+            Fields.Add("Lecturer", data.Lecturer); //主讲
+            Fields.Add("Photo", data.Photo); //照片
+            Fields.Add("StudyPerson", data.StudyPerson); //学习人数
+            Fields.Add("Url", data.Url); //外链
+            Fields.Add("Contents", data.Contents); //内容
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ProfitObjectsRule", Fields, 0);
-            AddSysLog(data.Id.ToString(), "ProfitObjectsRule", "add");
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("SchoolMorningMeet", Fields, 0);
+            AddSysLog(data.Id.ToString(), "SchoolMorningMeet", "add");
             db.SaveChanges();
-            
+
             return "success";
         }
 
         #endregion
 
-        #region 修改分润对象规则
+        #region 修改商学院每日晨会
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院每日晨会信息
         /// </summary>
         /// <returns></returns>
-        public IActionResult Edit(string right, string ObjectId, int Id = 0)
+        public IActionResult Edit(string right, int Id = 0)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            ViewBag.ObjectId = ObjectId;
 
 
-            ProfitObjectsRule editData = db.ProfitObjectsRule.FirstOrDefault(m => m.Id == Id) ?? new ProfitObjectsRule();
+            SchoolMorningMeet editData = db.SchoolMorningMeet.FirstOrDefault(m => m.Id == Id) ?? new SchoolMorningMeet();
             ViewBag.data = editData;
             return View();
         }
 
         #endregion
 
-        #region 修改分润对象规则
+        #region 修改商学院每日晨会
 
         /// <summary>
-        /// 增加或修改分润对象规则信息
+        /// 增加或修改商学院每日晨会信息
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Edit(ProfitObjectsRule data)
+        public string Edit(SchoolMorningMeet data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ObjectId", data.ObjectId);
 
-            Fields.Add("Name", data.Name); //名称
-Fields.Add("StartDate", data.StartDate); //活动开始时间
-Fields.Add("EndDate", data.EndDate); //活动结束时间
-Fields.Add("Code", data.Code); //编号
+            Fields.Add("Title", data.Title); //标题
+            Fields.Add("Lecturer", data.Lecturer); //主讲
+            Fields.Add("Photo", data.Photo); //照片
+            Fields.Add("StudyPerson", data.StudyPerson); //学习人数
+            Fields.Add("Url", data.Url); //外链
+            Fields.Add("Contents", data.Contents); //内容
 
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRule", Fields, data.Id);
-            AddSysLog(data.Id.ToString(),"ProfitObjectsRule","update");
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMorningMeet", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "SchoolMorningMeet", "update");
             db.SaveChanges();
-            
+
             return "success";
         }
 
         #endregion
 
-        #region 删除分润对象规则信息
+        #region 删除商学院每日晨会信息
 
         /// <summary>
-        /// 删除分润对象规则信息
+        /// 删除商学院每日晨会信息
         /// </summary>
         /// <returns></returns>
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectsRule","del");
+            AddSysLog(Id, "SchoolMorningMeet", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRule", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMorningMeet", Fields, id);
             }
             db.SaveChanges();
-            
+
             return "success";
         }
 
@@ -203,13 +205,13 @@ Fields.Add("Code", data.Code); //编号
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectsRule","open");
+            AddSysLog(Id, "SchoolMorningMeet", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRule", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMorningMeet", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -226,13 +228,13 @@ Fields.Add("Code", data.Code); //编号
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id,"ProfitObjectsRule","close");
+            AddSysLog(Id, "SchoolMorningMeet", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ProfitObjectsRule", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SchoolMorningMeet", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -247,9 +249,9 @@ Fields.Add("Code", data.Code); //编号
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ProfitObjectsRule", Sort, Id);
-            
-            AddSysLog(Id.ToString(), "ProfitObjectsRule", "sort");
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("SchoolMorningMeet", Sort, Id);
+
+            AddSysLog(Id.ToString(), "SchoolMorningMeet", "sort");
             return "success";
         }
         #endregion
@@ -263,19 +265,19 @@ Fields.Add("Code", data.Code); //编号
         {
             ExcelData = HttpUtility.UrlDecode(ExcelData);
             JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count;i++ )
+            for (int i = 1; i < list.Count; i++)
             {
                 JsonData dr = list[i];
-                
-                db.ProfitObjectsRule.Add(new ProfitObjectsRule()
+
+                db.SchoolMorningMeet.Add(new SchoolMorningMeet()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
-                    
+
                 });
                 db.SaveChanges();
             }
-            AddSysLog("0", "ProfitObjectsRule", "Import");
+            AddSysLog("0", "SchoolMorningMeet", "Import");
             return "success";
         }
         #endregion
@@ -286,21 +288,23 @@ Fields.Add("Code", data.Code); //编号
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(ProfitObjectsRule data)
+        public JsonResult ExportExcel(SchoolMorningMeet data)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("Name", "1"); //名称
-Fields.Add("Code", "1"); //编号
+            Fields.Add("Title", "1"); //标题
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("Lecturer", "1"); //主讲
 
 
             string condition = " and Status>-1";
-            
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ProfitObjectsRule", Fields, "Id desc", "0", 1, 20000, condition, "", false);
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SchoolMorningMeet", Fields, "Id desc", "0", 1, 20000, condition, "", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
-                
+                dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
+
             }
 
             Dictionary<string, object> result = new Dictionary<string, object>();
@@ -308,9 +312,9 @@ Fields.Add("Code", "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);
-            AddSysLog("0", "ProfitObjectsRule", "ExportExcel");
+            AddSysLog("0", "SchoolMorningMeet", "ExportExcel");
             return Json(result);
         }
 

+ 375 - 0
Areas/Admin/Controllers/MainServer/SmallStoreHouseController.cs

@@ -0,0 +1,375 @@
+/*
+ * 小仓库
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class SmallStoreHouseController : BaseController
+    {
+        public SmallStoreHouseController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 小仓库列表
+
+        /// <summary>
+        /// 根据条件查询小仓库列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(SmallStoreHouse data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询小仓库列表
+
+        /// <summary>
+        /// 小仓库列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(SmallStoreHouse data, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("StoreNo", "1"); //仓库编号
+            // Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("StoreName", "1"); //仓库名称
+            Fields.Add("Mobile", "1"); //仓库归属人手机号
+
+
+            string condition = " and Status>-1";
+            //创建时间
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SmallStoreHouse", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //出货仓库
+                int FromStoreId = int.Parse(function.CheckInt(dic["FromStoreId"].ToString()));
+                StoreHouse fromstoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId) ?? new StoreHouse();
+                dic["FromStoreIdStoreNo"] = fromstoreid_StoreHouse.StoreNo;
+                dic["FromStoreIdStoreName"] = fromstoreid_StoreHouse.StoreName;
+                dic.Remove("FromStoreId");
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加小仓库
+
+        /// <summary>
+        /// 增加或修改小仓库信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加小仓库
+
+        /// <summary>
+        /// 增加或修改小仓库信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(SmallStoreHouse data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("StoreNo", data.StoreNo); //仓库编号
+            Fields.Add("StoreName", data.StoreName); //仓库名称
+            Fields.Add("UserId", data.UserId); //仓库归属人
+            Fields.Add("BrandId", data.BrandId); //产品类型
+            Fields.Add("TotalNum", data.TotalNum); //总库存数
+            Fields.Add("LaveNum", data.LaveNum); //剩余库存数
+            Fields.Add("Remark", data.Remark); //备注
+            Fields.Add("Mobile", data.Mobile); //仓库归属人手机号
+            Fields.Add("FromStoreId", data.FromStoreId); //出货仓库
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("SmallStoreHouse", Fields, 0);
+            AddSysLog(data.Id.ToString(), "SmallStoreHouse", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改小仓库
+
+        /// <summary>
+        /// 增加或修改小仓库信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            SmallStoreHouse editData = db.SmallStoreHouse.FirstOrDefault(m => m.Id == Id) ?? new SmallStoreHouse();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改小仓库
+
+        /// <summary>
+        /// 增加或修改小仓库信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(SmallStoreHouse data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("StoreNo", data.StoreNo); //仓库编号
+            Fields.Add("StoreName", data.StoreName); //仓库名称
+            Fields.Add("UserId", data.UserId); //仓库归属人
+            Fields.Add("BrandId", data.BrandId); //产品类型
+            Fields.Add("TotalNum", data.TotalNum); //总库存数
+            Fields.Add("LaveNum", data.LaveNum); //剩余库存数
+            Fields.Add("Remark", data.Remark); //备注
+            Fields.Add("Mobile", data.Mobile); //仓库归属人手机号
+            Fields.Add("FromStoreId", data.FromStoreId); //出货仓库
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SmallStoreHouse", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "SmallStoreHouse", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除小仓库信息
+
+        /// <summary>
+        /// 删除小仓库信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "SmallStoreHouse", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SmallStoreHouse", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "SmallStoreHouse", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SmallStoreHouse", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "SmallStoreHouse", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("SmallStoreHouse", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("SmallStoreHouse", Sort, Id);
+
+            AddSysLog(Id.ToString(), "SmallStoreHouse", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.SmallStoreHouse.Add(new SmallStoreHouse()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "SmallStoreHouse", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(SmallStoreHouse data, string UserIdSelect, string FromStoreIdStoreNo, string FromStoreIdStoreName)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("StoreNo", "1"); //仓库编号
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("StoreName", "1"); //仓库名称
+            Fields.Add("BrandId", "2"); //产品类型
+            Fields.Add("Mobile", "1"); //仓库归属人手机号
+
+
+            string condition = " and Status>-1";
+            //仓库归属人
+            if (!string.IsNullOrEmpty(UserIdSelect))
+            {
+                condition += " and UserId=" + UserIdSelect;
+            }
+            //出货仓库仓库编号
+            if (!string.IsNullOrEmpty(FromStoreIdStoreNo))
+            {
+                condition += " and FromStoreId in (select FromStoreId from StoreHouseForStoreNo where StoreNo='" + FromStoreIdStoreNo + "')";
+            }
+            //出货仓库仓库名称
+            if (!string.IsNullOrEmpty(FromStoreIdStoreName))
+            {
+                condition += " and FromStoreId in (select FromStoreId from StoreHouseForStoreName where StoreName='" + FromStoreIdStoreName + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SmallStoreHouse", Fields, "Id desc", "0", 1, 20000, condition, "StoreNo,StoreName,UserId,BrandId,TotalNum,LaveNum,Mobile,FromStoreId", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //出货仓库
+                int FromStoreId = int.Parse(function.CheckInt(dic["FromStoreId"].ToString()));
+                StoreHouse fromstoreid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId) ?? new StoreHouse();
+                dic["FromStoreIdStoreNo"] = fromstoreid_StoreHouse.StoreNo;
+                dic["FromStoreIdStoreName"] = fromstoreid_StoreHouse.StoreName;
+                dic.Remove("FromStoreId");
+
+            }
+
+            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>();
+            ReturnFields.Add("StoreNo", "仓库编号");
+            ReturnFields.Add("StoreName", "仓库名称");
+            ReturnFields.Add("UserId", "仓库归属人");
+            ReturnFields.Add("BrandId", "产品类型");
+            ReturnFields.Add("TotalNum", "总库存数");
+            ReturnFields.Add("LaveNum", "剩余库存数");
+            ReturnFields.Add("Mobile", "仓库归属人手机号");
+            ReturnFields.Add("FromStoreIdStoreNo", "出货仓库仓库编号");
+            ReturnFields.Add("FromStoreIdStoreName", "出货仓库仓库名称");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "SmallStoreHouse", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 40 - 8
Areas/Admin/Controllers/MainServer/StoreBalanceController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -50,12 +51,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 仓库库存变动信息列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(StoreBalance data, string StoreIdStoreNo, string StoreIdStoreName, string TransTypeSelect, string BrandIdSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(StoreBalance data, string StoreIdStoreNo, string StoreIdStoreName, string TransTypeSelect, string CreateDateData, string BrandIdSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("TransRecordNo", "1"); //交易流水编号
 
 
@@ -63,12 +63,20 @@ namespace MySystem.Areas.Admin.Controllers
             //仓库仓库编号
             if (!string.IsNullOrEmpty(StoreIdStoreNo))
             {
-                condition += " and StoreId in (select StoreId from StoreForStoreNo where StoreNo='" + StoreIdStoreNo + "')";
+                condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreIdStoreNo + "')";
             }
             //仓库仓库名称
             if (!string.IsNullOrEmpty(StoreIdStoreName))
             {
-                condition += " and StoreId in (select StoreId from StoreForStoreName where StoreName='" + StoreIdStoreName + "')";
+                condition += " and StoreId in (select StoreId from StoreForStoreName where Name='" + StoreIdStoreName + "')";
+            }
+            //操作时间
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
             }
             //交易类型
             if (!string.IsNullOrEmpty(TransTypeSelect))
@@ -107,10 +115,34 @@ namespace MySystem.Areas.Admin.Controllers
 
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("InCount", 0);
-            other.Add("MoveInCount", 0);
-            other.Add("MoveOutCount", 0);
-            other.Add("OutCount", 0);
+            int InCount = 0;//入库
+            int MoveInCount = 0;//调拨入库
+            int MoveOutCount = 0;//调拨出库
+            int OutCount = 0;//出库
+            DataTable dt = OtherMySqlConn.dtable("select sum(OpStoreNum) from StoreBalance where TransType=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                InCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select sum(OpStoreNum) from StoreBalance where TransType=1 and OpSymbol='+'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                MoveInCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select sum(OpStoreNum) from StoreBalance where TransType=1 and OpSymbol='-'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                MoveOutCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select sum(OpStoreNum) from StoreBalance where TransType=2" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                OutCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            other.Add("InCount", InCount);
+            other.Add("MoveInCount", MoveInCount);
+            other.Add("MoveOutCount", MoveOutCount);
+            other.Add("OutCount", OutCount);
             obj.Add("other", other);
             return Json(obj);
         }

+ 8 - 2
Areas/Admin/Controllers/MainServer/StoreChangeHistoryController.cs

@@ -50,12 +50,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具变动历史列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(StoreChangeHistory data, string UserIdMakerCode, string UserIdRealName, string BrandIdSelect, string TransTypeSelect, string SnTypeSelect, string StockOpDirectSelect, string StoreIdStoreNo, string StoreIdStoreName, int page = 1, int limit = 30)
+        public JsonResult IndexData(StoreChangeHistory data, string UserIdMakerCode, string UserIdRealName, string BrandIdSelect, string TransTypeSelect, string SnTypeSelect, string StockOpDirectSelect, string StoreIdStoreNo, string StoreIdStoreName, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("SnNo", "1"); //SN编号
 
 
@@ -100,6 +99,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreIdStoreName + "')";
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreChangeHistory", Fields, "Id desc", "0", page, limit, condition);

+ 445 - 0
Areas/Admin/Controllers/MainServer/StoreHouseAmountPromissController.cs

@@ -0,0 +1,445 @@
+/*
+ * 分仓额度担保记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class StoreHouseAmountPromissController : BaseController
+    {
+        public StoreHouseAmountPromissController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 分仓额度担保记录列表
+
+        /// <summary>
+        /// 根据条件查询分仓额度担保记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(StoreHouseAmountPromiss data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询分仓额度担保记录列表
+
+        /// <summary>
+        /// 分仓额度担保记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(StoreHouseAmountPromiss data, string FromUserIdMakerCode, string FromUserIdRealName, string ToUserIdMakerCode, string ToUserIdRealName, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("CreateDate", "3"); //时间
+
+
+            string condition = " and Status>-1";
+            //担保人创客编号
+            if (!string.IsNullOrEmpty(FromUserIdMakerCode))
+            {
+                condition += " and FromUserId in (select UserId from UserForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
+            }
+            //担保人真实姓名
+            if (!string.IsNullOrEmpty(FromUserIdRealName))
+            {
+                condition += " and FromUserId in (select UserId from UserForRealName where RealName='" + FromUserIdRealName + "')";
+            }
+            //担保对象创客编号
+            if (!string.IsNullOrEmpty(ToUserIdMakerCode))
+            {
+                condition += " and ToUserId in (select UserId from UserForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
+            }
+            //担保对象真实姓名
+            if (!string.IsNullOrEmpty(ToUserIdRealName))
+            {
+                condition += " and ToUserId in (select UserId from UserForRealName where RealName='" + ToUserIdRealName + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreHouseAmountPromiss", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //担保人
+                int FromUserId = int.Parse(function.CheckInt(dic["FromUserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == FromUserId) ?? new Users();
+                dic["FromUserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["FromUserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("FromUserId");
+                //担保对象
+                int ToUserId = int.Parse(function.CheckInt(dic["ToUserId"].ToString()));
+                Users touserid_Users = db.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
+                dic["ToUserIdMakerCode"] = touserid_Users.MakerCode;
+                dic["ToUserIdRealName"] = touserid_Users.RealName;
+                dic.Remove("ToUserId");
+
+                //是否使用
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "确认中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加分仓额度担保记录
+
+        /// <summary>
+        /// 增加或修改分仓额度担保记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加分仓额度担保记录
+
+        /// <summary>
+        /// 增加或修改分仓额度担保记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(string FromUserId, string ToUserId, decimal PromissAmount, string SeoDescription)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            var FromUserIdInfo = db.Users.FirstOrDefault(m => m.MakerCode == FromUserId);
+            var ToUserIdInfo = db.Users.FirstOrDefault(m => m.MakerCode == ToUserId);
+            // ToUserIdInfo.ValidAmount += PromissAmount;//添加担保金
+
+            db.StoreHouseAmountPromiss.Add(new StoreHouseAmountPromiss()
+            {
+                CreateDate = DateTime.Now,
+                FromUserId = FromUserIdInfo.Id,
+                ToUserId = ToUserIdInfo.Id,
+                PromissAmount = PromissAmount,
+                SeoDescription = SeoDescription
+            });
+            db.SaveChanges();
+            // RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+            // {
+            //     UserId = FromUserIdInfo.Id, //接收创客
+            //     Title = "仓库担保通知", //标题
+            //     Content = "<div class='f16'>已经为创客 <br/>" + ToUserIdInfo.RealName + ' ' + ToUserIdInfo.MakerCode + "进行分仓额度担保<br/>担保金额:" + PromissAmount + " </div>", //内容
+            //     Summary = "已经为创客" + ToUserIdInfo.RealName + ' ' + ToUserIdInfo.MakerCode + "进行分仓额度担保,担保金额:" + PromissAmount,
+            //     CreateDate = DateTime.Now,
+            // }));
+
+            return "success";
+        }
+
+
+        public string Adds(StoreHouseAmountPromiss data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            var FromUserId = db.Users.FirstOrDefault(m => m.MakerCode == data.FromUserId.ToString());
+            var ToUserId = db.Users.FirstOrDefault(m => m.MakerCode == data.ToUserId.ToString());
+
+            Fields.Add("FromUserId", FromUserId); //担保人
+            Fields.Add("ToUserId", ToUserId); //担保对象
+            Fields.Add("PromissAmount", data.PromissAmount); //担保金额
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreHouseAmountPromiss", Fields, 0);
+            AddSysLog(data.Id.ToString(), "StoreHouseAmountPromiss", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改分仓额度担保记录
+
+        /// <summary>
+        /// 增加或修改分仓额度担保记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            StoreHouseAmountPromiss editData = db.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == Id) ?? new StoreHouseAmountPromiss();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改分仓额度担保记录
+
+        /// <summary>
+        /// 增加或修改分仓额度担保记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(StoreHouseAmountPromiss data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            StoreHouseAmountPromiss storeHouseAmountPromiss = db.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == data.Id);
+            Fields.Add("FromUserId", storeHouseAmountPromiss.FromUserId); //担保人
+            Fields.Add("ToUserId", storeHouseAmountPromiss.ToUserId); //担保对象
+            if (data.PromissAmount > storeHouseAmountPromiss.PromissAmount)
+            {
+                return "修改保证金不可高于原保证金额度!";
+            }
+            else
+            {
+                Fields.Add("PromissAmount", data.PromissAmount); //担保金额
+            }
+
+            Fields.Add("SeoTitle", storeHouseAmountPromiss.SeoTitle);
+            Fields.Add("SeoKeyword", storeHouseAmountPromiss.SeoKeyword);
+            Fields.Add("SeoDescription", storeHouseAmountPromiss.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountPromiss", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "StoreHouseAmountPromiss", "update");
+            UserAccount userAccount = db.UserAccount.FirstOrDefault(m => m.Id == data.ToUserId) ?? new UserAccount();
+            userAccount.ValidAmount = userAccount.ValidAmount - (storeHouseAmountPromiss.PromissAmount - data.PromissAmount);//减去担保金调整差额
+            db.SaveChanges();
+            var storeA = db.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == data.Id);
+            var ToUserId = db.Users.FirstOrDefault(m => m.Id == storeHouseAmountPromiss.ToUserId);
+            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+            {
+                UserId = storeHouseAmountPromiss.FromUserId, //接收创客
+                Title = "仓库担保调低", //标题
+                Content = "<div class='f16'>已经为创客 <br/>" + ToUserId.RealName + ' ' + ToUserId.MakerCode + "进行分仓额度担保调低<br/>担保金额:" + storeA.PromissAmount + " </div>", //内容
+                Summary = "已经为创客" + ToUserId.RealName + ' ' + ToUserId.MakerCode + "进行分仓额度担保调低,担保金额:" + storeA.PromissAmount,
+                CreateDate = DateTime.Now,
+            }));
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除分仓额度担保记录信息
+
+        /// <summary>
+        /// 删除分仓额度担保记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreHouseAmountPromiss", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                StoreHouseAmountPromiss storeHouseAmountPromiss = db.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == id);
+                Fields.Add("Status", -1);
+                var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == storeHouseAmountPromiss.ToUserId);
+                userAccount.ValidAmount -= storeHouseAmountPromiss.PromissAmount;//减除保证金
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountPromiss", Fields, id);
+            }
+            db.SaveChanges();
+            StoreHouseAmountPromiss storep = db.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == Convert.ToInt32(Id));
+            var ToUserInfo = db.Users.FirstOrDefault(m => m.Id == storep.ToUserId);
+            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+            {
+                UserId = storep.FromUserId, //接收创客
+                Title = "取消仓库担保", //标题
+                Content = "<div class='f16'>已取消为创客 <br/>" + ToUserInfo.RealName + ' ' + ToUserInfo.MakerCode + "的仓库担保金额 " + storep.PromissAmount + "元</div>", //内容
+                Summary = "已取消为创客 " + ToUserInfo.RealName + ' ' + ToUserInfo.MakerCode + "的仓库担保金额 " + storep.PromissAmount + "元",
+                CreateDate = DateTime.Now,
+            }));
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreHouseAmountPromiss", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountPromiss", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreHouseAmountPromiss", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountPromiss", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("StoreHouseAmountPromiss", Sort, Id);
+
+            AddSysLog(Id.ToString(), "StoreHouseAmountPromiss", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.StoreHouseAmountPromiss.Add(new StoreHouseAmountPromiss()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "StoreHouseAmountPromiss", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(StoreHouseAmountPromiss data, string FromUserIdMakerCode, string FromUserIdRealName, string ToUserIdMakerCode, string ToUserIdRealName)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+
+
+            string condition = " and Status>-1";
+            //担保人创客编号
+            if (!string.IsNullOrEmpty(FromUserIdMakerCode))
+            {
+                condition += " and FromUserId in (select UserId from UserForMakerCode where MakerCode='" + FromUserIdMakerCode + "')";
+            }
+            //担保人真实姓名
+            if (!string.IsNullOrEmpty(FromUserIdRealName))
+            {
+                condition += " and FromUserId in (select UserId from UserForRealName where RealName='" + FromUserIdRealName + "')";
+            }
+            //担保对象创客编号
+            if (!string.IsNullOrEmpty(ToUserIdMakerCode))
+            {
+                condition += " and ToUserId in (select UserId from UserForMakerCode where MakerCode='" + ToUserIdMakerCode + "')";
+            }
+            //担保对象真实姓名
+            if (!string.IsNullOrEmpty(ToUserIdRealName))
+            {
+                condition += " and ToUserId in (select UserId from UserForRealName where RealName='" + ToUserIdRealName + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreHouseAmountPromiss", Fields, "Id desc", "0", 1, 20000, condition, "FromUserId,ToUserId,PromissAmount", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //担保人
+                int FromUserId = int.Parse(function.CheckInt(dic["FromUserId"].ToString()));
+                Users fromuserid_Users = db.Users.FirstOrDefault(m => m.Id == FromUserId) ?? new Users();
+                dic["FromUserIdMakerCode"] = fromuserid_Users.MakerCode;
+                dic["FromUserIdRealName"] = fromuserid_Users.RealName;
+                dic.Remove("FromUserId");
+                //担保对象
+                int ToUserId = int.Parse(function.CheckInt(dic["ToUserId"].ToString()));
+                Users touserid_Users = db.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
+                dic["ToUserIdMakerCode"] = touserid_Users.MakerCode;
+                dic["ToUserIdRealName"] = touserid_Users.RealName;
+                dic.Remove("ToUserId");
+
+            }
+
+            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>();
+            ReturnFields.Add("FromUserIdMakerCode", "担保人创客编号");
+            ReturnFields.Add("FromUserIdRealName", "担保人真实姓名");
+            ReturnFields.Add("ToUserIdMakerCode", "担保对象创客编号");
+            ReturnFields.Add("ToUserIdRealName", "担保对象真实姓名");
+            ReturnFields.Add("PromissAmount", "担保金额");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "StoreHouseAmountPromiss", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 390 - 0
Areas/Admin/Controllers/MainServer/StoreHouseAmountRecordController.cs

@@ -0,0 +1,390 @@
+/*
+ * 分仓机具额度记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class StoreHouseAmountRecordController : BaseController
+    {
+        public StoreHouseAmountRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 分仓机具额度记录列表
+
+        /// <summary>
+        /// 根据条件查询分仓机具额度记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(StoreHouseAmountRecord data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询分仓机具额度记录列表
+
+        /// <summary>
+        /// 分仓机具额度记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(StoreHouseAmountRecord data, string UserIdRealName, string UserIdMakerCode, string AmountTypeSelect, string OperateTypeSelect, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("CreateDate", "3"); //时间
+
+
+            string condition = " and Status>-1";
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //额度类别
+            if (!string.IsNullOrEmpty(AmountTypeSelect))
+            {
+                condition += " and AmountType=" + AmountTypeSelect;
+            }
+            //操作类别
+            if (!string.IsNullOrEmpty(OperateTypeSelect))
+            {
+                condition += " and OperateType=" + OperateTypeSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreHouseAmountRecord", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic.Remove("UserId");
+                //申请单
+                dic["ApplyId"] = RelationClass.GetStoreMachineApplyInfo(int.Parse(dic["ApplyId"].ToString()));
+                //额度类别
+                int AmountType = int.Parse(dic["AmountType"].ToString());
+                if (AmountType == 0) dic["AmountType"] = "固定额度";
+                if (AmountType == 1) dic["AmountType"] = "临时额度";
+                //操作类别
+                int OperateType = int.Parse(dic["OperateType"].ToString());
+                if (OperateType == 1) dic["OperateType"] = "增加";
+                if (OperateType == 2) dic["OperateType"] = "减少";
+                if (OperateType == 0) dic["OperateType"] = "";
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加分仓机具额度记录
+
+        /// <summary>
+        /// 增加或修改分仓机具额度记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加分仓机具额度记录
+
+        /// <summary>
+        /// 增加或修改分仓机具额度记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(StoreHouseAmountRecord data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("OperateType", data.OperateType); //操作类别
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreHouseAmountRecord", Fields, 0);
+            AddSysLog(data.Id.ToString(), "StoreHouseAmountRecord", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改分仓机具额度记录
+
+        /// <summary>
+        /// 增加或修改分仓机具额度记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            StoreHouseAmountRecord editData = db.StoreHouseAmountRecord.FirstOrDefault(m => m.Id == Id) ?? new StoreHouseAmountRecord();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改分仓机具额度记录
+
+        /// <summary>
+        /// 增加或修改分仓机具额度记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(StoreHouseAmountRecord data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("OperateType", data.OperateType); //操作类别
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountRecord", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "StoreHouseAmountRecord", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除分仓机具额度记录信息
+
+        /// <summary>
+        /// 删除分仓机具额度记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreHouseAmountRecord", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountRecord", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreHouseAmountRecord", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountRecord", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreHouseAmountRecord", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouseAmountRecord", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Sort("StoreHouseAmountRecord", Sort, Id);
+
+            AddSysLog(Id.ToString(), "StoreHouseAmountRecord", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.StoreHouseAmountRecord.Add(new StoreHouseAmountRecord()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "StoreHouseAmountRecord", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(StoreHouseAmountRecord data, string UserIdRealName, string UserIdMakerCode, string AmountTypeSelect, string OperateTypeSelect)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+
+
+            string condition = " and Status>-1";
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //额度类别
+            if (!string.IsNullOrEmpty(AmountTypeSelect))
+            {
+                condition += " and AmountType=" + AmountTypeSelect;
+            }
+            //操作类别
+            if (!string.IsNullOrEmpty(OperateTypeSelect))
+            {
+                condition += " and OperateType=" + OperateTypeSelect;
+            }
+
+
+            Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreHouseAmountRecord", Fields, "Id desc", "0", 1, 20000, condition, "UserId,ApplyId,UseAmount,BeforeAmount,AfterAmount,AmountType,OperateType", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic.Remove("UserId");
+                //申请单
+                dic["ApplyId"] = RelationClass.GetStoreMachineApplyInfo(int.Parse(dic["ApplyId"].ToString()));
+                //额度类别
+                int AmountType = int.Parse(dic["AmountType"].ToString());
+                if (AmountType == 0) dic["AmountType"] = "固定额度";
+                if (AmountType == 1) dic["AmountType"] = "临时额度";
+                //操作类别
+                int OperateType = int.Parse(dic["OperateType"].ToString());
+                if (OperateType == 1) dic["OperateType"] = "增加";
+                if (OperateType == 2) dic["OperateType"] = "减少";
+                if (OperateType == 0) dic["OperateType"] = "";
+
+            }
+
+            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>();
+            ReturnFields.Add("UserIdRealName", "创客真实姓名");
+            ReturnFields.Add("UserIdMakerCode", "创客创客编号");
+            ReturnFields.Add("ApplyId", "申请单");
+            ReturnFields.Add("UseAmount", "使用额度");
+            ReturnFields.Add("BeforeAmount", "使用前剩余额度");
+            ReturnFields.Add("AfterAmount", "使用后剩余额度");
+            ReturnFields.Add("AmountType", "额度类别");
+            ReturnFields.Add("OperateType", "操作类别");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "StoreHouseAmountRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

+ 474 - 13
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -52,13 +52,12 @@ namespace MySystem.Areas.Admin.Controllers
         /// 仓库列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(StoreHouse data, string UserIdMakerCode, string UserIdRealName, string ManageUserIdRealName, string ManageUserIdMobile, string ManageUserIdMakerCode, string StoreStatusSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(StoreHouse data, string UserIdMakerCode, string UserIdRealName, string ManageUserIdRealName, string ManageUserIdMobile, string ManageUserIdMakerCode, string StoreStatusSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
             Fields.Add("StoreNo", "1"); //仓库编号
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("StoreName", "1"); //仓库名称
             Fields.Add("ManagerEmail", "1"); //管理者邮箱
 
@@ -94,6 +93,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and StoreStatus=" + StoreStatusSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreHouse", Fields, "Id desc", "0", page, limit, condition);
@@ -125,7 +131,10 @@ namespace MySystem.Areas.Admin.Controllers
                 int StoreKind = int.Parse(dic["StoreKind"].ToString());
                 if (StoreKind == 0) dic["StoreKind"] = "分仓";
                 if (StoreKind == 1) dic["StoreKind"] = "总仓";
-
+                //小分仓
+                int Id = int.Parse(function.CheckInt(dic["Id"].ToString()));
+                int PreCount = db.PreSendStockDetail.Count(m => m.FromStoreId == Id && m.ApplyFlag == 0 && m.Status >= 0 && m.Status <= 1);
+                dic["PreNum"] = PreCount.ToString();
             }
             return Json(obj);
         }
@@ -165,7 +174,7 @@ namespace MySystem.Areas.Admin.Controllers
                 foreach (string BrandId in BrandIdList)
                 {
                     Dictionary<string, object> Fields = new Dictionary<string, object>();
-
+                    Fields.Add("CreateMan", SysUserName); //创建人
                     Fields.Add("StoreName", data.StoreName); //仓库名称
                     UserForMakerCode user = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
                     if (user == null)
@@ -193,6 +202,12 @@ namespace MySystem.Areas.Admin.Controllers
                     Fields.Add("StoreStatus", 1);
                     Fields.Add("Status", 1);
 
+                    var name = db.StoreHouse.FirstOrDefault(m => m.UserId == user.UserId && m.BrandId == BrandId && m.StoreName == data.StoreName);
+                    if (name != null)
+                    {
+                        return "您的仓库名重复,请重新填写";
+                    }
+
                     int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreHouse", Fields, 0);
                     StoreHouse edit = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
                     if (edit != null)
@@ -213,9 +228,23 @@ namespace MySystem.Areas.Admin.Controllers
                     }
                     db.StoreForName.Add(new StoreForName()
                     {
-                        Name = data.StoreName,
+                        Name = data.StoreName + "-" + pro.Name,
                         StoreId = Id,
                     });
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == user.UserId);
+                    if (account == null)
+                    {
+                        account = db.UserAccount.Add(new UserAccount()
+                        {
+                            Id = user.UserId,
+                            UserId = user.UserId,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    if (account.FixedAmount == 0)
+                    {
+                        account.FixedAmount = 20000;
+                    }
                     RedisDbconn.Instance.Set("StoreForName:" + data.StoreName, Id);
                     AddSysLog(data.Id.ToString(), "StoreHouse", "add");
                     db.SaveChanges();
@@ -263,7 +292,7 @@ namespace MySystem.Areas.Admin.Controllers
         public string Edit(StoreHouse data, string ManageMakerCode, string MakerCode)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
-
+            Fields.Add("CreateMan", SysUserName); //创建人
             Fields.Add("StoreName", data.StoreName); //仓库名称
             UserForMakerCode user = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
             if (user == null)
@@ -298,6 +327,115 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 一键添加仓库
+
+        /// <summary>
+        /// 一件添加仓库
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edits(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            StoreHouse editData = db.StoreHouse.FirstOrDefault(m => m.Id == Id) ?? new StoreHouse();
+            ViewBag.data = editData;
+
+            Users manage = db.Users.FirstOrDefault(m => m.Id == editData.ManageUserId) ?? new Users();
+            ViewBag.ManageMakerCode = manage.MakerCode;
+            ViewBag.ManageRealName = manage.RealName;
+
+            Users user = db.Users.FirstOrDefault(m => m.Id == editData.ManageUserId) ?? new Users();
+            ViewBag.MakerCode = user.MakerCode;
+            return View();
+        }
+
+        #endregion
+
+        #region 一键添加仓库
+
+        /// <summary>
+        /// 一键添加仓库
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edits(StoreHouse data, string ManageMakerCode, string MakerCode)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            StoreHouse storeHouse = db.StoreHouse.FirstOrDefault(m => m.Id == data.Id);
+            var brand = db.StoreHouse.FirstOrDefault(m => m.UserId == storeHouse.UserId && m.BrandId == data.BrandId);
+            if (brand != null)
+            {
+                return "您已有该品牌类型的仓库,请重新选择";
+            }
+            var name = db.StoreHouse.FirstOrDefault(m => m.UserId == storeHouse.UserId && m.StoreName == data.StoreName);
+            if (name != null)
+            {
+                return "您的仓库名重复,请重新填写";
+            }
+            Fields.Add("StoreName", data.StoreName); //仓库名称
+            UserForMakerCode user = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+            if (user == null)
+            {
+                return "您输入的仓库归属创客编号不存在,请重新输入正确的仓库归属创客编号";
+            }
+            Fields.Add("UserId", user.UserId); //仓库归属人
+            Fields.Add("Areas", data.Areas); //所属地区
+            Fields.Add("Address", data.Address); //仓库地址
+            UserForMakerCode manage = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == ManageMakerCode);
+            if (manage == null)
+            {
+                return "您输入的仓库负责人编号不存在,请重新输入正确的仓库负责人编号";
+            }
+            Fields.Add("CreateMan", SysUserName); //创建人
+            Fields.Add("ManageUserId", manage.UserId); //仓库管理员
+            Fields.Add("ManagerEmail", data.ManagerEmail); //管理者邮箱
+            Fields.Add("ManageMobile", data.ManageMobile);
+            Fields.Add("Remark", data.Remark); //备注
+            Fields.Add("LimitTopUserId", data.LimitTopUserId); //限制创客特殊仓库
+            Fields.Add("StoreKind", data.StoreKind); //仓库归属类型
+            int bid = Convert.ToInt32(data.BrandId);
+            KqProducts pro = db.KqProducts.FirstOrDefault(m => m.Id == bid) ?? new KqProducts();
+            Fields.Add("BrandId", data.BrandId);
+            Fields.Add("ProductName", pro.Name);
+            Fields.Add("StoreStatus", 1);
+            Fields.Add("Status", 1);
+
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreHouse", Fields, 0);
+            StoreHouse edit = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
+            if (edit != null)
+            {
+                string No = Id.ToString();
+                for (int i = 0; i < 7 - Id.ToString().Length; i++)
+                {
+                    No = "0" + No;
+                }
+                No = "S" + No;
+                edit.StoreNo = No;
+                db.StoreForCode.Add(new StoreForCode()
+                {
+                    Code = No,
+                    StoreId = Id,
+                });
+                RedisDbconn.Instance.Set("StoreForCode:" + No, Id);
+            }
+            db.StoreForName.Add(new StoreForName()
+            {
+                Name = data.StoreName,
+                StoreId = Id,
+            });
+            RedisDbconn.Instance.Set("StoreForName:" + data.StoreName, Id);
+            AddSysLog(data.Id.ToString(), "StoreHouse", "add");
+            db.SaveChanges();
+
+            SetRedis(Id, user.UserId);
+            return "success";
+        }
+
+        #endregion
+
+
         #region 删除仓库信息
 
         /// <summary>
@@ -313,6 +451,20 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
+                StoreHouse edit = db.StoreHouse.FirstOrDefault(m => m.Id == id);
+                if (edit != null)
+                {
+                    StoreForCode code = db.StoreForCode.FirstOrDefault(m => m.Code == edit.StoreNo);
+                    if (code != null)
+                    {
+                        db.StoreForCode.Remove(code);
+                    }
+                    StoreForName name = db.StoreForName.FirstOrDefault(m => m.Name == edit.StoreName);
+                    if (name != null)
+                    {
+                        db.StoreForName.Remove(name);
+                    }
+                }
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreHouse", Fields, id);
             }
             db.SaveChanges();
@@ -400,9 +552,21 @@ namespace MySystem.Areas.Admin.Controllers
         {
             // RedisDbconn.Instance.AddList("ExcelImport", ExcelPath + "#cut#" + Kind);
             string key = function.MD5_16(Guid.NewGuid().ToString());
-            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key);
+            RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
             return "success|" + key;
         }
+
+        // [HttpPost]
+        // public Dictionary<string, object> ImportPostV2(string ExcelPath, int Kind = 0)
+        // {
+        //     Dictionary<string, object> Obj = new Dictionary<string, object>();
+        //     string key = function.MD5_16(Guid.NewGuid().ToString());
+        //     RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key);
+        //     Obj.Add("status", "success");
+        //     Obj.Add("key", key);
+        //     Obj.Add("errlist", RedisDbconn.Instance.GetList<string>("ErrList" + key));
+        //     return Obj;
+        // }
         public string CheckImport(string key)
         {
             string result = RedisDbconn.Instance.Get<string>("CheckImport:" + key);
@@ -417,6 +581,36 @@ namespace MySystem.Areas.Admin.Controllers
             }
             return "0";
         }
+        public Dictionary<string, object> CheckImportV2(string key)
+        {
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            string result = RedisDbconn.Instance.Get<string>("CheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    List<string> errList = RedisDbconn.Instance.GetList<string>("ErrList" + key);
+                    if (errList.Count > 0)
+                    {
+                        Obj.Add("status", 2);
+                        Obj.Add("errList", errList);
+                    }
+                    else
+                    {
+                        Obj.Add("status", 1);
+                        Obj.Add("data", result);
+                    }
+                    return Obj;
+                }
+                Obj.Add("status", 0);
+                Obj.Add("data", datalist[0]);
+                return Obj;
+            }
+            Obj.Add("status", -1);
+            Obj.Add("data", "执行中...");
+            return Obj;
+        }
         #endregion
 
         #region 导出Excel
@@ -532,6 +726,275 @@ namespace MySystem.Areas.Admin.Controllers
 
 
 
+
+        #region 仓库列表
+
+        /// <summary>
+        /// 根据条件查询仓库列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Stat(StoreHouse data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询仓库列表
+
+        /// <summary>
+        /// 仓库列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult StatDo(string CreateDateData, int page = 1, int limit = 30)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
+            string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
+            string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                sCreateDate = datelist[0] + " 00:00:00";
+                eCreateDate = datelist[1] + " 23:59:59";
+            }
+            else
+            {
+                Dictionary<string, object> nodata = new Dictionary<string, object>();
+                nodata.Add("code", 0);
+                nodata.Add("msg", "");
+                nodata.Add("count", 0);
+                nodata.Add("data", new List<Dictionary<string, object>>());
+
+                return Json(nodata);
+            }
+            string minId = "0";
+            string maxId = "0";
+            string minPosId = "0";
+            string maxPosId = "0";
+            DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
+            if (startDt.Rows.Count > 0)
+            {
+                minId = function.CheckInt(startDt.Rows[0][0].ToString());
+                if (minId == "0")
+                {
+                    startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
+                    if (startDt.Rows.Count > 0)
+                    {
+                        minId = function.CheckInt(startDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
+            if (endDt.Rows.Count > 0)
+            {
+                maxId = function.CheckInt(endDt.Rows[0][0].ToString());
+                if (minId == "0")
+                {
+                    endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
+                    if (endDt.Rows.Count > 0)
+                    {
+                        maxId = function.CheckInt(endDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
+            if (startPosDt.Rows.Count > 0)
+            {
+                minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
+                if (minPosId == "0")
+                {
+                    startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
+                    if (startPosDt.Rows.Count > 0)
+                    {
+                        minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
+            if (endPosDt.Rows.Count > 0)
+            {
+                maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
+                if (maxPosId == "0")
+                {
+                    endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
+                    if (endPosDt.Rows.Count > 0)
+                    {
+                        maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where Id>=" + minPosId + " and Id<=" + maxPosId + " and ActivationState=1 and ActivationTime>='" + sCreateDate + "' and ActivationTime<='" + eCreateDate + "' and StoreId=s.Id) as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where c1>0 or c2>0 or c3>0");
+
+            int recordcount = list.Rows.Count;
+            List<Dictionary<string, object>> diclist = new List<Dictionary<string, object>>();
+            foreach (DataRow sub in list.Rows)
+            {
+                Dictionary<string, object> row = new Dictionary<string, object>();
+                row.Add("StoreName", sub["StoreName"].ToString());
+                row.Add("StoreNo", sub["StoreNo"].ToString());
+                row.Add("Mobile", sub["Mobile"].ToString());
+                row.Add("RealName", sub["RealName"].ToString());
+                row.Add("Name", sub["Name"].ToString());
+                row.Add("LaveNum", sub["LaveNum"].ToString());
+                row.Add("c1", sub["c1"].ToString());
+                row.Add("c2", sub["c2"].ToString());
+                row.Add("c3", sub["c3"].ToString());
+                diclist.Add(row);
+            }
+
+            Dictionary<string, object> obj = new Dictionary<string, object>();
+            obj.Add("code", 0);
+            obj.Add("msg", "");
+            obj.Add("count", recordcount);
+            obj.Add("data", diclist);
+
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult StatExportExcel(string CreateDateData)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
+            string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
+            string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                sCreateDate = datelist[0] + " 00:00:00";
+                eCreateDate = datelist[1] + " 23:59:59";
+            }
+            else
+            {
+                Dictionary<string, object> nodata = new Dictionary<string, object>();
+                nodata.Add("Status", "1");
+                nodata.Add("Info", "分仓统计数据报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+                nodata.Add("Obj", new List<Dictionary<string, object>>());
+                Dictionary<string, object> NoDataReturnFields = new Dictionary<string, object>();
+                NoDataReturnFields.Add("StoreName", "仓库名称");
+                NoDataReturnFields.Add("StoreNo", "仓库编号");
+                NoDataReturnFields.Add("Mobile", "仓库所属人手机号");
+                NoDataReturnFields.Add("RealName", "仓库所属人名称");
+                NoDataReturnFields.Add("MakerCode", "仓库所属人编码");
+                NoDataReturnFields.Add("ManageMakerCode", "仓库管理员编码");
+                NoDataReturnFields.Add("Name", "品牌");
+                NoDataReturnFields.Add("LaveNum", "当前库存");
+                NoDataReturnFields.Add("c1", "出库(调拨)量");
+                NoDataReturnFields.Add("c2", "出货(发货到创客)量");
+                NoDataReturnFields.Add("c3", "激活量");
+                nodata.Add("Fields", NoDataReturnFields);
+                return Json(nodata);
+            }
+            string minId = "0";
+            string maxId = "0";
+            string minPosId = "0";
+            string maxPosId = "0";
+            DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
+            if (startDt.Rows.Count > 0)
+            {
+                minId = function.CheckInt(startDt.Rows[0][0].ToString());
+                if (minId == "0")
+                {
+                    startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
+                    if (startDt.Rows.Count > 0)
+                    {
+                        minId = function.CheckInt(startDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
+            if (endDt.Rows.Count > 0)
+            {
+                maxId = function.CheckInt(endDt.Rows[0][0].ToString());
+                if (minId == "0")
+                {
+                    endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
+                    if (endDt.Rows.Count > 0)
+                    {
+                        maxId = function.CheckInt(endDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
+            if (startPosDt.Rows.Count > 0)
+            {
+                minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
+                if (minPosId == "0")
+                {
+                    startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
+                    if (startPosDt.Rows.Count > 0)
+                    {
+                        minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
+            if (endPosDt.Rows.Count > 0)
+            {
+                maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
+                if (maxPosId == "0")
+                {
+                    endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
+                    if (endPosDt.Rows.Count > 0)
+                    {
+                        maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
+                    }
+                }
+            }
+            DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,u.MakerCode,(select MakerCode from Users where Id=s.ManageUserId) as ManageMakerCode,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where Id>=" + minPosId + " and Id<=" + maxPosId + " and ActivationState=1 and ActivationTime>='" + sCreateDate + "' and ActivationTime<='" + eCreateDate + "' and StoreId=s.Id) as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where c1>0 or c2>0 or c3>0");
+
+            int recordcount = list.Rows.Count;
+            List<Dictionary<string, object>> diclist = new List<Dictionary<string, object>>();
+            foreach (DataRow sub in list.Rows)
+            {
+                Dictionary<string, object> row = new Dictionary<string, object>();
+                row.Add("StoreName", sub["StoreName"].ToString());
+                row.Add("StoreNo", sub["StoreNo"].ToString());
+                row.Add("Mobile", sub["Mobile"].ToString());
+                row.Add("RealName", sub["RealName"].ToString());
+                row.Add("MakerCode", sub["MakerCode"].ToString());
+                row.Add("ManageMakerCode", sub["ManageMakerCode"].ToString());
+                row.Add("Name", sub["Name"].ToString());
+                row.Add("LaveNum", sub["LaveNum"].ToString());
+                row.Add("c1", sub["c1"].ToString());
+                row.Add("c2", sub["c2"].ToString());
+                row.Add("c3", sub["c3"].ToString());
+                diclist.Add(row);
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "分仓统计数据报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+            ReturnFields.Add("StoreName", "仓库名称");
+            ReturnFields.Add("StoreNo", "仓库编号");
+            ReturnFields.Add("Mobile", "仓库所属人手机号");
+            ReturnFields.Add("RealName", "仓库所属人名称");
+            ReturnFields.Add("MakerCode", "仓库所属人编码");
+            ReturnFields.Add("ManageMakerCode", "仓库管理员编码");
+            ReturnFields.Add("Name", "品牌");
+            ReturnFields.Add("LaveNum", "当前库存");
+            ReturnFields.Add("c1", "出库(调拨)量");
+            ReturnFields.Add("c2", "出货(发货到创客)量");
+            ReturnFields.Add("c3", "激活量");
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "StoreHouse", "StatExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
         #region 同步数据
 
         /// <summary>
@@ -542,7 +1005,7 @@ namespace MySystem.Areas.Admin.Controllers
         {
             if (Id > 0)
             {
-                DataTable dt = OtherMySqlConn.dtable("select Id,(select count(Id) from PosMachinesTwo where StoreId=s.Id and UserId=0) as CurLaveNum from StoreHouse s where Id=" + Id);
+                DataTable dt = OtherMySqlConn.dtable("select Id,(select count(Id) from PosMachinesTwo where StoreId=s.Id and BuyUserId=0 and PreUserId=0 and Status>-1) as CurLaveNum from StoreHouse s where Id=" + Id);
                 if (dt.Rows.Count > 0)
                 {
                     int CurLaveNum = int.Parse(function.CheckInt(dt.Rows[0]["CurLaveNum"].ToString()));
@@ -551,13 +1014,12 @@ namespace MySystem.Areas.Admin.Controllers
                     {
                         store.LaveNum = CurLaveNum;
                         db.SaveChanges();
-                        RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
                     }
                 }
             }
             else
-            { 
-                DataTable dt = OtherMySqlConn.dtable("select s.Id,LaveNum,count(p.Id) as CurLaveNum from StoreHouse s left join PosMachinesTwo p on s.Id=p.StoreId and s.BrandId=p.BrandId and p.UserId=0 group by s.Id HAVING LaveNum!=count(p.Id)");
+            {
+                DataTable dt = OtherMySqlConn.dtable("select s.Id,LaveNum,count(p.Id) as CurLaveNum from StoreHouse s left join PosMachinesTwo p on s.Id=p.StoreId and s.BrandId=p.BrandId and p.BuyUserId=0 and p.PreUserId=0 and p.Status>-1 group by s.Id HAVING LaveNum!=count(p.Id)");
                 foreach (DataRow dr in dt.Rows)
                 {
                     int StoreId = int.Parse(function.CheckInt(dr["Id"].ToString()));
@@ -567,7 +1029,6 @@ namespace MySystem.Areas.Admin.Controllers
                     {
                         store.LaveNum = CurLaveNum;
                         db.SaveChanges();
-                        RedisDbconn.Instance.Set("StoreHouse:" + StoreId, store);
                     }
                 }
             }
@@ -586,7 +1047,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 RedisDbconn.Instance.Clear("StoreHouseList:" + UserId);
                 List<StoreHouse> stores = db.StoreHouse.Where(m => m.Status > -1 && m.UserId == UserId).OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id).ToList();
-                
+
                 RedisDbconn.Instance.Clear("StoreHouse");
                 stores = db.StoreHouse.Where(m => m.Status > -1).OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id).ToList();
             }

+ 713 - 0
Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs

@@ -0,0 +1,713 @@
+/*
+ * 分仓机具申请记录
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class StoreMachineApplyController : BaseController
+    {
+        public StoreMachineApplyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region 分仓机具申请记录列表
+
+        /// <summary>
+        /// 根据条件查询分仓机具申请记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(StoreMachineApply data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询分仓机具申请记录列表
+
+        /// <summary>
+        /// 分仓机具申请记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(StoreMachineApply data, string UserIdRealName, string UserIdMakerCode, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            Fields.Add("ApplyNo", "1"); //申请单号
+            Fields.Add("SendMode", "1"); //发货方式
+
+
+            string condition = " and Status>-1";
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreMachineApply", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //品牌
+                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "待配货";
+                if (Status == 1) dic["StatusName"] = "已发货";
+                if (Status == 2) dic["StatusName"] = "已驳回";
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic.Remove("UserId");
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加分仓机具申请记录
+
+        /// <summary>
+        /// 增加或修改分仓机具申请记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加分仓机具申请记录
+
+        /// <summary>
+        /// 增加或修改分仓机具申请记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(StoreMachineApply data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("BrandId", data.BrandId); //品牌
+            Fields.Add("ApplyNo", data.ApplyNo); //申请单号
+            Fields.Add("ApplyNum", data.ApplyNum); //申请台数
+            Fields.Add("SendNum", data.SendNum); //发货台数
+            Fields.Add("UseAmount", data.UseAmount); //使用额度
+            Fields.Add("SendMode", data.SendMode); //发货方式
+            Fields.Add("ErpCode", data.ErpCode); //快递单号
+            Fields.Add("SendSn", data.SendSn); //发货SN数据
+            Fields.Add("UserId", data.UserId); //创客
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreMachineApply", Fields, 0);
+            AddSysLog(data.Id.ToString(), "StoreMachineApply", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改分仓机具申请记录
+
+        /// <summary>
+        /// 增加或修改分仓机具申请记录信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
+            ViewBag.data = editData;
+
+            Users users = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
+            ViewBag.UserId = users.Id;
+            ViewBag.RealName = users.RealName;
+            ViewBag.UseAmount = editData.UseAmount;
+            JsonData SendSnList = new JsonData();
+            SendSnList = JsonMapper.ToObject(editData.SendSn);//申请数据
+            List<Dictionary<string, object>> KsProductList = new List<Dictionary<string, object>>();
+            for (int i = 0; i < SendSnList.Count; i++)
+            {
+                int BrandId = Convert.ToInt32(SendSnList[i]["BrandId"].ToString());
+                int Num = Convert.ToInt32(SendSnList[i]["ApplyNum"].ToString());
+                List<KqProducts> products = db.KqProducts.Where(m => m.Id == BrandId).ToList();
+                foreach (KqProducts product in products)
+                {
+                    Dictionary<string, object> item = new Dictionary<string, object>();
+                    item.Add("BrandId", BrandId);  //商品Id
+                    item.Add("Name", product.Name);  //商品名称
+                    item.Add("Num", Num);  //商品数量
+                    KsProductList.Add(item);
+                }
+            }
+            ViewBag.KsProductList = KsProductList;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 修改分仓机具申请记录
+
+        /// <summary>
+        /// 增加或修改分仓机具申请记录信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(StoreMachineApply data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("SendSn", data.SendSn); //发货SN数据
+            JsonData SendSnList = new JsonData();
+            SendSnList = JsonMapper.ToObject(data.SendSn);//申请数据
+            int ApplyNum = 0;
+            for (int i = 0; i < SendSnList.Count; i++)
+            {
+                int num = Convert.ToInt32(SendSnList[i]["ApplyNum"].ToString());
+                ApplyNum += num;
+            }
+            Fields.Add("BrandId", data.BrandId); //品牌
+            Fields.Add("ApplyNo", data.ApplyNo); //申请单号
+            Fields.Add("ApplyNum", ApplyNum); //申请台数
+            Fields.Add("SendNum", data.SendNum); //发货台数
+            Fields.Add("UseAmount", data.UseAmount); //使用额度
+            Fields.Add("SendMode", data.SendMode); //发货方式
+            Fields.Add("ErpCode", data.ErpCode); //快递单号
+            Fields.Add("UserId", data.UserId); //创客
+
+            Fields.Add("SeoTitle", SysUserName + '-' + SysRealName);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "StoreMachineApply", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除分仓机具申请记录信息
+
+        /// <summary>
+        /// 删除分仓机具申请记录信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreMachineApply", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreMachineApply", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "StoreMachineApply", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 2);
+                var query = db.StoreMachineApply.FirstOrDefault(m => m.Id == id);
+                var users = db.UserAccount.FirstOrDefault(m => m.Id == query.UserId);
+                users.ValidAmount += query.UseAmount;
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("StoreMachineApply", Sort, Id);
+
+            AddSysLog(Id.ToString(), "StoreMachineApply", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.StoreMachineApply.Add(new StoreMachineApply()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "StoreMachineApply", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(StoreMachineApply data, string BrandIdSelect, string UserIdRealName, string UserIdMakerCode)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("ApplyNo", "1"); //申请单号
+            Fields.Add("SendMode", "1"); //发货方式
+
+
+            string condition = " and Status>-1";
+            //品牌
+            if (!string.IsNullOrEmpty(BrandIdSelect))
+            {
+                condition += " and BrandId=" + BrandIdSelect;
+            }
+            //创客真实姓名
+            if (!string.IsNullOrEmpty(UserIdRealName))
+            {
+                condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
+            }
+            //创客创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreMachineApply", Fields, "Id desc", "0", 1, 20000, condition, "BrandId,ApplyNo,ApplyNum,SendNum,UseAmount,SendMode,ErpCode,UserId", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                //品牌
+                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+                dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
+                //创客
+                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["UserIdRealName"] = userid_Users.RealName;
+                dic["UserIdMakerCode"] = userid_Users.MakerCode;
+                dic.Remove("UserId");
+
+            }
+
+            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>();
+            ReturnFields.Add("BrandId", "品牌");
+            ReturnFields.Add("ApplyNo", "申请单号");
+            ReturnFields.Add("ApplyNum", "申请台数");
+            ReturnFields.Add("SendNum", "发货台数");
+            ReturnFields.Add("UseAmount", "使用额度");
+            ReturnFields.Add("SendMode", "发货方式");
+            ReturnFields.Add("ErpCode", "快递单号");
+            ReturnFields.Add("UserIdRealName", "创客真实姓名");
+            ReturnFields.Add("UserIdMakerCode", "创客创客编号");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "StoreMachineApply", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
+        #region 审核发货
+
+        public IActionResult AuditSend(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
+            ViewBag.data = editData;
+
+            Users users = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
+            ViewBag.MakerCode = users.MakerCode;
+            ViewBag.RealName = users.RealName;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 审核发货
+
+        [HttpPost]
+        public string AuditSend(StoreMachineApply data, string ExcelData)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            Fields.Add("ApplyNum", data.ApplyNum); //申请数
+            Fields.Add("SendNum", data.ApplyNum); //发货数
+            Fields.Add("ErpCode", data.ErpCode); //快递单号
+            Fields.Add("SendMode", data.SendMode); //发货方式
+            Fields.Add("SeoKeyword", data.SeoKeyword); //申请描述
+            Fields.Add("Status", 1);
+            AddSysLog(data.Id.ToString(), "StoreMachineApply", "AuditSend");
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            List<SendInfo> sendInfos = new List<SendInfo>();
+            StoreMachineApply apply = db.StoreMachineApply.FirstOrDefault(m => m.Id == data.Id) ?? new StoreMachineApply();
+            JsonData ApplyList = JsonMapper.ToObject(apply.SendSn);
+            decimal ApplyAmount = 0;
+            decimal Amount = 0;
+            for (int i = 0; i < ApplyList.Count; i++)
+            {
+                int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
+                int BrandIds = Convert.ToInt32(ApplyList[i]["BrandId"].ToString());
+                if (BrandIds == 1 || BrandIds == 2 || BrandIds == 4 || BrandIds == 6 || BrandIds == 7 || BrandIds == 8)
+                {
+                    ApplyAmount += num * 200;
+                }
+                if (BrandIds == 3 || BrandIds == 5 || BrandIds == 9)
+                {
+                    ApplyAmount += num * 300;
+                }
+            }
+            Amount = apply.UseAmount - ApplyAmount;
+            StoreHouse tostore = new StoreHouse();
+            StoreHouse fromstore = new StoreHouse();
+
+            var BrandId = 0;
+            var FromStoreId = 0;
+            string error = "";
+
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            List<string> PosSnList = new List<string>();
+            for (int index = 1; index < list.Count; index++)
+            {
+                JsonData dr = list[index];
+                string itemJson = dr.ToJson();
+                string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
+                string Brand = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
+                BrandId = Convert.ToInt32(Brand);
+
+                if (BrandId == 1) FromStoreId = 7;
+                if (BrandId == 2) FromStoreId = 721;
+                if (BrandId == 3) FromStoreId = 697;
+                if (BrandId == 4) FromStoreId = 774;
+                if (BrandId == 5) FromStoreId = 775;
+                if (BrandId == 6) FromStoreId = 871;
+                if (BrandId == 7) FromStoreId = 1047;
+                if (BrandId == 8) FromStoreId = 4831;
+                if (BrandId == 9) FromStoreId = 4832;
+                if (PosSnList.Contains(SnNo))
+                {
+                    error += "以下操作失败" + SnNo + ',' + "该机具重复发货" + '\n';
+                }
+                PosSnList.Add(SnNo);
+            }
+            if (!string.IsNullOrEmpty(error))
+            {
+                return "Warning|" + error;
+            }
+            Dictionary<string, int> storeData = new Dictionary<string, int>();
+            Dictionary<string, int> toStoreData = new Dictionary<string, int>();
+            for (int index = 1; index < list.Count; index++)
+            {
+                JsonData dr = list[index];
+                string itemJson = dr.ToJson();
+                string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
+                string Brand = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
+                string BatchNo = itemJson.Contains("\"C\"") ? dr["C"].ToString() : "";
+                string OutNote = itemJson.Contains("\"D\"") ? dr["D"].ToString() : "";
+
+                BrandId = Convert.ToInt32(Brand);
+
+                if (BrandId == 1) FromStoreId = 7;
+                if (BrandId == 2) FromStoreId = 721;
+                if (BrandId == 3) FromStoreId = 697;
+                if (BrandId == 4) FromStoreId = 774;
+                if (BrandId == 5) FromStoreId = 775;
+                if (BrandId == 6) FromStoreId = 871;
+                if (BrandId == 7) FromStoreId = 1047;
+                if (BrandId == 8) FromStoreId = 4831;
+                if (BrandId == 9) FromStoreId = 4832;
+                tostore = db.StoreHouse.FirstOrDefault(m => m.UserId == apply.UserId && m.BrandId == BrandId.ToString());
+                SendInfo item = sendInfos.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandId);
+                if (item == null)
+                {
+                    SendInfo row = new SendInfo()
+                    {
+                        FromStoreId = FromStoreId,
+                        ToStoreId = tostore.Id,
+                        BrandId = BrandId,
+                        Num = 1
+                    };
+                    sendInfos.Add(row);
+                }
+                else
+                {
+                    item.Num += 1;
+                }
+
+                apply.SeoDescription = function.CheckString(SnNo) + ',';
+
+                fromstore = db.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId);
+                tostore = db.StoreHouse.FirstOrDefault(m => m.UserId == apply.UserId && m.BrandId == BrandId.ToString());
+
+                MachineForSnNo machinefor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new MachineForSnNo();
+                PosMachinesTwo machine = db.PosMachinesTwo.FirstOrDefault(m => m.Id == machinefor.SnId && m.BuyUserId == 0 && m.UserId == 0) ?? new PosMachinesTwo();
+                if (machine.Id > 0)
+                {
+                    StoreStockChange stockchange = db.StoreStockChange.Add(new StoreStockChange()
+                    {
+                        CreateDate = DateTime.Now,
+                        Sort = data.Id,//库存变动关联申请记录表
+                        StoreId = FromStoreId, //出货仓库
+                        BrandId = BrandId, //产品类型
+                        ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
+                        BizBatchNo = BatchNo, //业务批次号
+                        TransType = 1, //交易类型
+                        SnNo = SnNo, //SN编号
+                        StockOpDirect = 1, //库存操作方向
+                        SnStatus = 1, //SN状态
+                        DeviceVendor = machine.DeviceName, //设备厂商
+                        DeviceModel = machine.DeviceKind, //设备型号
+                        DeviceType = machine.DeviceType, //设备类型
+                        FromUserId = fromstore.UserId, //出货人
+                        FromDate = DateTime.Now, //出库时间
+                        FromRemark = OutNote, //出库备注
+                        ToUserId = tostore.UserId, //收货人
+                        ToStoreId = fromstore.Id, //退货收货仓库                        
+                        SourceStoreId = machine.SourceStoreId, //源仓库编号
+                        BrandType = machine.DeviceType, //品牌类型
+                    }).Entity;
+
+                    string ChangeNo = "CS";
+                    int StoreStockChangeId = stockchange.Id;
+                    string StoreStockChangeIdString = StoreStockChangeId.ToString();
+                    for (int j = 0; j < 18 - StoreStockChangeId.ToString().Length; j++)
+                    {
+                        StoreStockChangeIdString = "0" + StoreStockChangeIdString;
+                    }
+                    ChangeNo += StoreStockChangeIdString;
+                    stockchange.ChangeNo = ChangeNo; //交易流水编号
+                    machine.StoreId = tostore.Id;
+
+                    db.StoreChangeHistory.Add(new StoreChangeHistory()
+                    {
+                        CreateDate = DateTime.Now,
+                        UserId = fromstore.UserId, //创客
+                        BrandId = BrandId, //产品类型
+                        ChangeRecordNo = ChangeNo, //变更记录单号
+                        BizBatchNo = BatchNo, //业务批次号
+                        TransType = 1, //交易类型
+                        SnNo = SnNo, //SN编号
+                        SnType = machine.PosSnType, //SN机具类型
+                        StockOpDirect = 1, //库存操作方向
+                        DeviceVendor = machine.DeviceName, //设备厂商
+                        DeviceModel = machine.DeviceKind, //设备型号
+                        DeviceType = machine.DeviceType, //设备类型
+                        FromUserId = fromstore.UserId, //出货创客
+                        FromDate = DateTime.Now, //出库时间
+                        FromRemark = OutNote, //出库备注
+                        SourceStoreId = machine.SourceStoreId, //源仓库
+                        StoreId = fromstore.Id, //仓库
+                        ToUserId = tostore.UserId,//收货创客
+                    });
+
+                    //修改机具所属仓库
+                    machine.StoreId = tostore.Id;
+                    machine.UpdateDate = DateTime.Now;
+                }
+                else
+                {
+                    return "总仓无该机具";
+                }
+
+            }
+
+            foreach (var item in sendInfos)
+            {
+                //出货仓库数据调整
+                StoreHouse storeCH = db.StoreHouse.FirstOrDefault(m => m.Id == item.FromStoreId) ?? new StoreHouse();
+                StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
+                {
+                    CreateDate = DateTime.Now,
+                    StoreId = storeCH.Id, //仓库
+                    TransType = 1, //交易类型
+                    BrandId = BrandId, //产品类型
+                    OpStoreNum = item.Num, //操作库存数
+                    OpSymbol = "-", //操作符
+                    BeforeTotalNum = storeCH.TotalNum, //操作前总库存数
+                    AfterTotalNum = storeCH.TotalNum - item.Num, //操作后总库存数
+                    BeforeLaveNum = storeCH.LaveNum, //操作前剩余库存数
+                    AfterLaveNum = storeCH.LaveNum - item.Num, //操作后剩余库存数
+                    BeforeOutNum = storeCH.OutNum, //操作前出库数
+                    AfterOutNum = storeCH.OutNum + item.Num, //操作后出库数
+                }).Entity;
+                string ChangeNo1 = "CS";
+                int StoreStockChangeId1 = balance.Id;
+                string StoreStockChangeId1String = StoreStockChangeId1.ToString();
+                for (int i = 0; i < 18 - StoreStockChangeId1.ToString().Length; i++)
+                {
+                    StoreStockChangeId1String = "0" + StoreStockChangeId1String;
+                }
+                ChangeNo1 += StoreStockChangeId1String;
+                balance.TransRecordNo = ChangeNo1; //交易流水编号
+                storeCH.LaveNum -= item.Num;
+                storeCH.OutNum += item.Num;
+
+                //收货仓库数据调整
+                StoreHouse storeSH = db.StoreHouse.FirstOrDefault(m => m.Id == item.ToStoreId) ?? new StoreHouse();
+                balance = db.StoreBalance.Add(new StoreBalance()
+                {
+                    CreateDate = DateTime.Now,
+                    StoreId = storeSH.Id, //仓库
+                    TransType = 0, //交易类型
+                    BrandId = BrandId, //产品类型
+                    OpStoreNum = item.Num, //操作库存数
+                    OpSymbol = "+", //操作符
+                    BeforeTotalNum = storeSH.TotalNum, //操作前总库存数
+                    AfterTotalNum = storeSH.TotalNum + item.Num, //操作后总库存数
+                    BeforeLaveNum = storeSH.LaveNum, //操作前剩余库存数
+                    AfterLaveNum = storeSH.LaveNum + item.Num, //操作后剩余库存数
+                    BeforeOutNum = storeSH.OutNum, //操作前出库数
+                    AfterOutNum = storeSH.OutNum, //操作后出库数
+                }).Entity;
+                string ChangeNo2 = "CS";
+                int StoreStockChangeId2 = balance.Id;
+                string StoreStockChangeId2String = StoreStockChangeId2.ToString();
+                for (int i = 0; i < 18 - StoreStockChangeId2.ToString().Length; i++)
+                {
+                    StoreStockChangeId2String = "0" + StoreStockChangeId2String;
+                }
+                ChangeNo2 += StoreStockChangeId2String;
+                balance.TransRecordNo = ChangeNo2; //交易流水编号
+                storeSH.TotalNum += item.Num;
+                storeSH.LaveNum += item.Num;
+            }
+            apply.SeoTitle = SysUserName + '-' + SysRealName;//添加操作人信息
+            apply.UseAmount = ApplyAmount;
+
+            db.SaveChanges();
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
+
+            string SendData = "{\"Kind\":\"2\",\"Data\":{\"UserId\":\"" + apply.UserId + "\",\"Amount\":\"" + Amount + "\",\"OperateType\":\"1\"}}";
+            RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
+            return "success";
+
+        }
+        #endregion
+
+        //发货信息实体类
+        private class SendInfo
+        {
+            public int FromStoreId { get; set; }
+            public int ToStoreId { get; set; }
+            public int BrandId { get; set; }
+            public int Num { get; set; }
+        }
+
+    }
+}

+ 8 - 3
Areas/Admin/Controllers/MainServer/StoreSnActivateSummaryController.cs

@@ -50,13 +50,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 仓库SN激活统计列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(StoreSnActivateSummary data, string StoreIdStoreNo, string StoreIdStoreName, string AgentStoreIdStoreNo, string AgentStoreIdStoreName, string BrandIdSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(StoreSnActivateSummary data, string StoreIdStoreNo, string StoreIdStoreName, string AgentStoreIdStoreNo, string AgentStoreIdStoreName, string BrandIdSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
-
 
             string condition = " and Status>-1";
             //仓库仓库编号
@@ -84,6 +82,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and BrandId=" + BrandIdSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreSnActivateSummary", Fields, "Id desc", "0", page, limit, condition);

+ 8 - 2
Areas/Admin/Controllers/MainServer/StoreStockChangeController.cs

@@ -50,12 +50,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 仓库库存变动记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(StoreStockChange data, string StoreIdStoreNo, string StoreIdStoreName, string BrandIdSelect, string TransTypeSelect, string StockOpDirectSelect, string SnStatusSelect, string BindStatusSelect, string BindMerchantMerchantNo, string BindMerchantMerchantName, string ActiveStatusSelect, string BrandTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(StoreStockChange data, string StoreIdStoreNo, string StoreIdStoreName, string BrandIdSelect, string TransTypeSelect, string StockOpDirectSelect, string SnStatusSelect, string BindStatusSelect, string BindMerchantMerchantNo, string BindMerchantMerchantName, string ActiveStatusSelect, string BrandTypeSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("SnNo", "1"); //SN编号
 
 
@@ -115,6 +114,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and BrandType=" + BrandTypeSelect;
             }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreStockChange", Fields, "Id desc", "0", page, limit, condition);

+ 145 - 34
Areas/Admin/Controllers/MainServer/SysRechargeRecordController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -38,7 +39,7 @@ namespace MySystem.Areas.Admin.Controllers
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            
+
             return View();
         }
 
@@ -50,14 +51,14 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客奖励记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(SysRechargeRecord data, string MakerCode, string RealName, string StatusSelect, string SyncStatusSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(SysRechargeRecord data, string MakerCode, string RealName, string RechargeRecNo, string BatchCode, string BizTimeData, string StatusSelect, string SyncStatusSelect, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("RechargeRecNo", "1"); //奖励单号
+            // Fields.Add("RechargeRecNo", "1"); //奖励单号
             Fields.Add("BizType", "0"); //业务类型
-            Fields.Add("BatchCode", "1"); //批次号
-            Fields.Add("BizTime", "3"); //奖励时间
+            // Fields.Add("BatchCode", "1"); //批次号
+            // Fields.Add("BizTime", "3"); //奖励时间
 
             string condition = " and Status>-1";
             //创客编号
@@ -70,16 +71,38 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
+            //奖励单号
+            if (!string.IsNullOrEmpty(RechargeRecNo))
+            {
+                condition += " and RechargeRecNo=" + RechargeRecNo;
+            }
+            //批次号
+            if (!string.IsNullOrEmpty(BatchCode))
+            {
+                condition += " and BatchCode=" + BatchCode;
+            }
+            //业务类型
+            // if (BizType > 0) 
+            // {
+            //     condition += " and BizType=" + BizType;
+            // }
             //状态
-            if(!string.IsNullOrEmpty(StatusSelect))
+            if (!string.IsNullOrEmpty(StatusSelect))
             {
                 condition += " and Status=" + StatusSelect;
             }
             //同步状态
-            if(!string.IsNullOrEmpty(SyncStatusSelect))
+            if (!string.IsNullOrEmpty(SyncStatusSelect))
             {
                 condition += " and SyncStatus=" + SyncStatusSelect;
             }
+            if(!string.IsNullOrEmpty(BizTimeData))
+            {
+                string[] datelist = BizTimeData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and BizTime>='" + start + " 00:00:00' and BizTime<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("SysRechargeRecord", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -89,20 +112,46 @@ namespace MySystem.Areas.Admin.Controllers
                 Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
                 dic["MakerCode"] = user.MakerCode;
                 dic["RealName"] = user.RealName;
-                dic["BizType"] = RelationClassForConst.GetBizTypeInfo(int.Parse(dic["BizType"].ToString()));
+                dic["BizType"] = RelationClassForConst.GetChangeTypeInfo(int.Parse(dic["BizType"].ToString()));
                 dic["ProductType"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["ProductType"].ToString()));
                 int Status = int.Parse(dic["Status"].ToString());
-                if(Status == 0) dic["Status"] = "初始";
-                if(Status == 1) dic["Status"] = "成功";
-                if(Status == 2) dic["Status"] = "失败";
+                if (Status == 0) dic["Status"] = "初始";
+                if (Status == 1) dic["Status"] = "成功";
+                if (Status == 2) dic["Status"] = "失败";
                 int SyncStatus = int.Parse(dic["SyncStatus"].ToString());
-                if(SyncStatus == 0) dic["SyncStatus"] = "未同步";
-                if(SyncStatus == 1) dic["SyncStatus"] = "已同步";
-                if(SyncStatus == 2) dic["SyncStatus"] = "同步中";
+                if (SyncStatus == 0) dic["SyncStatus"] = "未同步";
+                if (SyncStatus == 1) dic["SyncStatus"] = "已同步";
+                if (SyncStatus == 2) dic["SyncStatus"] = "同步中";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("BizAmount30", 0);
-            other.Add("BizAmount31", 0);
+            string BizAmount30 = "0.00";//红包奖励
+            string BizAmount31 = "0.00";//活动奖励
+            string BizAmount114 = "0.00";//私董会分红
+            string BizAmount115 = "0.00";//分仓奖励
+            DataTable dt = OtherMySqlConn.dtable("select sum(Amount) from SysRechargeRecord where BizType=30" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                BizAmount30 = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(Amount) from SysRechargeRecord where BizType=31" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                BizAmount31 = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(Amount) from SysRechargeRecord where BizType=114" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                BizAmount114 = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(Amount) from SysRechargeRecord where BizType=115" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                BizAmount115 = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("BizAmount30", BizAmount30);
+            other.Add("BizAmount31", BizAmount31);
+            other.Add("BizAmount114", BizAmount114);
+            other.Add("BizAmount115", BizAmount115);
             obj.Add("other", other);
             return Json(obj);
         }
@@ -289,17 +338,16 @@ namespace MySystem.Areas.Admin.Controllers
             for (int i = 1; i < list.Count; i++)
             {
                 JsonData dr = list[i];
-                string BatchCode = dr[0].ToString();
-                string RechargeRecNo = dr[1].ToString();
-                int ProductType = int.Parse(dr[5].ToString());
-                string MakerCode = dr[2].ToString();
-                int BizType = int.Parse(dr[4].ToString());
-                decimal Amount = decimal.Parse(dr[6].ToString());
-                string Remark = dr[7].ToString();
-                string Operator = dr[8].ToString();
-
+                string BatchCode = dr[0].ToString(); // 批次号
+                string RechargeRecNo = dr[1].ToString(); // 业务单号
+                string MakerCode = dr[2].ToString(); // 创客编号
+                string RealName = dr[3].ToString(); // 创客名称
+                int BizType = int.Parse(dr[4].ToString()); // 业务类型
+                int ProductType = int.Parse(dr[5].ToString()); // 产品类型
+                decimal Amount = decimal.Parse(dr[6].ToString()); // 金额(元)
+                string Remark = dr[7].ToString(); // 备注信息
+                string Operator = dr[8].ToString(); // 操作人
                 UserForMakerCode user = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
-
                 db.SysRechargeRecord.Add(new SysRechargeRecord()
                 {
                     CreateDate = DateTime.Now,
@@ -312,6 +360,7 @@ namespace MySystem.Areas.Admin.Controllers
                     Amount = Amount,   //奖励金额
                     BatchCode = BatchCode,   //批次号
                     SeoDescription = Remark,
+                    CreateMan = Operator,
                 });
                 db.SaveChanges();
             }
@@ -346,12 +395,12 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
             //状态
-            if(!string.IsNullOrEmpty(StatusSelect))
+            if (!string.IsNullOrEmpty(StatusSelect))
             {
                 condition += " and Status=" + StatusSelect;
             }
             //同步状态
-            if(!string.IsNullOrEmpty(SyncStatusSelect))
+            if (!string.IsNullOrEmpty(SyncStatusSelect))
             {
                 condition += " and SyncStatus=" + SyncStatusSelect;
             }
@@ -367,13 +416,13 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["BizType"] = RelationClassForConst.GetBizTypeInfo(int.Parse(dic["BizType"].ToString()));
                 dic["ProductType"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["ProductType"].ToString()));
                 int Status = int.Parse(dic["Status"].ToString());
-                if(Status == 0) dic["Status"] = "初始";
-                if(Status == 1) dic["Status"] = "成功";
-                if(Status == 2) dic["Status"] = "失败";
+                if (Status == 0) dic["Status"] = "初始";
+                if (Status == 1) dic["Status"] = "成功";
+                if (Status == 2) dic["Status"] = "失败";
                 int SyncStatus = int.Parse(dic["SyncStatus"].ToString());
-                if(SyncStatus == 0) dic["SyncStatus"] = "未同步";
-                if(SyncStatus == 1) dic["SyncStatus"] = "已同步";
-                if(SyncStatus == 2) dic["SyncStatus"] = "同步中";
+                if (SyncStatus == 0) dic["SyncStatus"] = "未同步";
+                if (SyncStatus == 1) dic["SyncStatus"] = "已同步";
+                if (SyncStatus == 2) dic["SyncStatus"] = "同步中";
                 dic.Remove("UserId");
             }
 
@@ -401,5 +450,67 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+
+
+        #region 同步到账户余额
+
+        /// <summary>
+        /// 同步到账户余额
+        /// </summary>
+        /// <returns></returns>
+        public string Sycn(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "SysRechargeRecord", "Sycn");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                SysRechargeRecord edit = db.SysRechargeRecord.FirstOrDefault(m => m.Id == id && m.SyncStatus == 0);
+                if (edit != null)
+                {
+                    edit.Status = 1;
+                    edit.SyncStatus = 1;
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                    if (account == null)
+                    {
+                        account = db.UserAccount.Add(new UserAccount()
+                        {
+                            Id = edit.UserId,
+                            UserId = edit.UserId,
+                        }).Entity;
+                        db.SaveChanges();
+                    }
+                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                    account.TotalAmount += edit.Amount;
+                    account.BalanceAmount += edit.Amount;
+                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                    db.UserAccountRecord.Add(new UserAccountRecord()
+                    {
+                        CreateDate = DateTime.Now,
+                        UpdateDate = DateTime.Now,
+                        UserId = edit.UserId, //创客
+                        ChangeType = edit.BizType, //变动类型
+                        ProductType = edit.ProductType, //产品类型
+                        ChangeAmount = edit.Amount, //变更金额
+                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                        Remark = edit.SeoDescription, //备注
+                    });
+                }
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
     }
 }

Разница между файлами не показана из-за своего большого размера
+ 2005 - 0
Areas/Admin/Controllers/MainServer/SysToolsController.cs


+ 38 - 6
Areas/Admin/Controllers/MainServer/TradeDaySummaryController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -51,13 +52,12 @@ namespace MySystem.Areas.Admin.Controllers
         /// 交易日汇总列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(TradeDaySummary data, string MakerCode, string RealName, string TradeMonthSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(TradeDaySummary data, string MakerCode, string RealName, string TradeMonthSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
             Fields.Add("BrandId", "1");
-            Fields.Add("CreateDate", "3"); //交易时间
             Fields.Add("TopUserId", "0"); //顶级创客
 
             string condition = " and Status>-1";
@@ -71,6 +71,14 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
+            //交易时间
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0].Replace("-", "");
+                string end = datelist[1].Replace("-", "");
+                condition += " and TradeDate >= '" + start + "' and TradeDate <= '" + end + "' ";
+            }
             //交易月份
             if(!string.IsNullOrEmpty(TradeMonthSelect))
             {
@@ -93,10 +101,34 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["TopRealName"] = tuser.RealName;
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("HelpDirectTradeAmt", 0);
-            other.Add("HelpNonDirectTradeAmt", 0);
-            other.Add("NotHelpDirectTradeAmt", 0);
-            other.Add("NotHelpNonDirectTradeAmt", 0);
+            string HelpDirectTradeAmt = "0.00";//扶持期直营商户交易总额
+            string HelpNonDirectTradeAmt = "0.00";//扶持期非直营商户交易总额
+            string NotHelpDirectTradeAmt = "0.00";//非扶持期直营商户交易总额
+            string NotHelpNonDirectTradeAmt = "0.00";//非扶持期非直营商户交易总额
+            DataTable dt = OtherMySqlConn.dtable("select sum(HelpDirectTradeAmt) from TradeDaySummary  where 1=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                HelpDirectTradeAmt = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(HelpNonDirectTradeAmt) from TradeDaySummary  where 1=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                HelpNonDirectTradeAmt = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(NotHelpDirectTradeAmt) from TradeDaySummary  where 1=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                NotHelpDirectTradeAmt = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(NotHelpNonDirectTradeAmt) from TradeDaySummary  where 1=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                NotHelpNonDirectTradeAmt = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("HelpDirectTradeAmt", HelpDirectTradeAmt);
+            other.Add("HelpNonDirectTradeAmt", HelpNonDirectTradeAmt);
+            other.Add("NotHelpDirectTradeAmt", NotHelpDirectTradeAmt);
+            other.Add("NotHelpNonDirectTradeAmt", NotHelpNonDirectTradeAmt);
             obj.Add("other", other);
             return Json(obj);
         }

+ 46 - 6
Areas/Admin/Controllers/MainServer/TradeRecordController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -51,18 +52,25 @@ namespace MySystem.Areas.Admin.Controllers
         /// 交易记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(TradeRecord data, string MerchantNo, string MerchantName, string MakerCode, string RealName, string MerMakerCode, string MerRealName, string BankCardTypeSelect, string MerBuddyTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(TradeRecord data, string right, string BrandId, string MerchantNo, string MerchantName, string MakerCode, string RealName, string MerMakerCode, string MerRealName, string MerNo, string SnNo, string BankCardTypeSelect, string MerBuddyTypeSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.BrandId = BrandId;
 
             Fields.Add("BrandId", "1");
             Fields.Add("MerNo", "2"); //快钱商户编号
             Fields.Add("SnNo", "2"); //快钱SN号
-            Fields.Add("TradeDate", "3"); //交易日期
             Fields.Add("TopUserId", "0"); //顶级创客
 
             string condition = " and Status>-1";
+
+            if(!string.IsNullOrEmpty(ViewBag.BrandId))
+            {
+                condition += " and BrandId=" + ViewBag.BrandId;
+            }
             //商户编号
             if (!string.IsNullOrEmpty(MerchantNo))
             {
@@ -82,6 +90,7 @@ namespace MySystem.Areas.Admin.Controllers
             if (!string.IsNullOrEmpty(RealName))
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+                // condition += " and UserId in (select Id from Users where RealName='" + RealName + "')";
             }
             //商户创客编号
             if (!string.IsNullOrEmpty(MerMakerCode))
@@ -93,6 +102,16 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and MerUserId in (select UserId from UserForRealName where RealName='" + MerRealName + "')";
             }
+            //快钱商户编号
+            if (!string.IsNullOrEmpty(MerNo))
+            {
+                condition += " and MerNo='" + MerNo + "'";
+            }
+            //块钱SN号
+            if (!string.IsNullOrEmpty(SnNo))
+            {
+                condition += " and SnNo='" + SnNo + "'";
+            }
             //银行卡类型
             if(!string.IsNullOrEmpty(BankCardTypeSelect))
             {
@@ -103,6 +122,13 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and MerBuddyType=" + MerBuddyTypeSelect;
             }
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("TradeRecord", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -138,12 +164,26 @@ namespace MySystem.Areas.Admin.Controllers
                 if(MerBuddyType == 1) dic["MerBuddyType"] = "商户型创客";
                 //银行卡类型
                 int BankCardType = int.Parse(dic["BankCardType"].ToString());
-                if(BankCardType == 0) dic["BankCardType"] = "贷记卡";
-                if(BankCardType == 1) dic["BankCardType"] = "借记卡";
+                if(BankCardType == 0) dic["BankCardType"] = "借记卡";
+                if(BankCardType == 1) dic["BankCardType"] = "贷记卡";
+                if(BankCardType == 2) dic["BankCardType"] = "准贷记卡";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("TotalTrade0", 0);
-            other.Add("TotalTrade1", 0);
+            
+            string TotalTrade0 = "0.00";//贷记卡交易总额
+            string TotalTrade1 = "0.00";//借记卡交易总额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from TradeRecord where BankCardType=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                TotalTrade0 = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from TradeRecord where BankCardType=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                TotalTrade1 = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("TotalTrade0", TotalTrade0);
+            other.Add("TotalTrade1", TotalTrade1);
             obj.Add("other", other);
             return Json(obj);
         }

+ 45 - 1
Areas/Admin/Controllers/MainServer/UserAccountController.cs

@@ -112,7 +112,7 @@ namespace MySystem.Areas.Admin.Controllers
                 string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
                 string start = datelist[0];
                 string end = datelist[1];
-                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate>='" + end + " 23:59:59'";
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
             }
             if(sTotalAmount != null)
             {
@@ -239,6 +239,49 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+        #region 冻结创客账户添加备注
+
+        /// <summary>
+        /// 增加或修改创客账户信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult CloseRemark(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            UserAccount editData = db.UserAccount.FirstOrDefault(m => m.Id == Id) ?? new UserAccount();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 冻结创客账户添加备注
+
+        /// <summary>
+        /// 增加或修改创客账户信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string CloseRemark(UserAccount data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("UserId", data.UserId); //创客
+            Fields.Add("AccountStatus", 1); //账户状态
+            Fields.Add("UpdateMan", SysUserName + '-' + SysRealName + "操作冻结该账户"); //操作人信息
+            Fields.Add("SeoDescription", data.SeoDescription); //冻结备注
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("UserAccount", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "UserAccount", "CloseRemark");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
         #region 删除创客账户信息
 
         /// <summary>
@@ -278,6 +321,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("AccountStatus", 0);
+                Fields.Add("SeoDescription", "");
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("UserAccount", Fields, id);
             }
             db.SaveChanges();

+ 33 - 22
Areas/Admin/Controllers/MainServer/UserAccountRecordController.cs

@@ -64,7 +64,6 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("ChangeType", "1"); //交易类型
             Fields.Add("ProductType", "1"); //产品类型
             Fields.Add("TransRecordNo", "3"); //交易流水编号
-            Fields.Add("CreateDate", "3"); //交易时间
 
             string condition = " and Status>-1";
             //创客编号
@@ -86,6 +85,25 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId=" + UserId;
             }
+            if(!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            if (data.ChangeType > 0)
+            { 
+                condition += " and ChangeType=" + data.ChangeType;
+            }
+            if (data.ProductType > 0)
+            { 
+                condition += " and ProductType=" + data.ProductType;
+            }
+            if (!string.IsNullOrEmpty(data.TransRecordNo))
+            { 
+                condition += " and TransRecordNo='" + data.TransRecordNo + "'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserAccountRecord", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -108,32 +126,18 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["ChangeTypeName"] = RelationClassForConst.GetChangeTypeInfo(ChangeType);
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            if(!string.IsNullOrEmpty(CreateDateData))
-            {
-                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
-                string start = datelist[0];
-                string end = datelist[1];
-                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate>='" + end + " 23:59:59'";
-            }
-            if (data.ChangeType > 0)
-            { 
-                condition += " and ChangeType=" + data.ChangeType;
-            }
-            if (data.ProductType > 0)
-            { 
-                condition += " and ProductType=" + data.ProductType;
-            }
-            if (!string.IsNullOrEmpty(data.TransRecordNo))
-            { 
-                condition += " and TransRecordNo='" + data.TransRecordNo + "'";
-            }
-            string ChangeTypeAmount0 = "0.00", ChangeTypeAmount1 = "0.00", ChangeTypeAmount2 = "0.00", ChangeTypeAmount6 = "0.00", ChangeTypeAmount61 = "0.00", ChangeTypeAmount62 = "0.00", ChangeTypeAmount63 = "0.00", ChangeTypeAmount64 = "0.00", ChangeTypeAmount50 = "0.00", ChangeTypeAmount111 = "0.00", ChangeTypeAmount112 = "0.00";
-            DataTable dt = OtherMySqlConn.dtable("select sum(if(ChangeType=0, ChangeAmount, 0)),sum(if(ChangeType=1, ChangeAmount, 0)),sum(if(ChangeType=2, ChangeAmount, 0)),sum(if(ChangeType=6, ChangeAmount, 0)),sum(if(ChangeType=61, ChangeAmount, 0)),sum(if(ChangeType=62, ChangeAmount, 0)),sum(if(ChangeType=63, ChangeAmount, 0)),sum(if(ChangeType=64, ChangeAmount, 0)),sum(if(ChangeType=50, ChangeAmount, 0)),sum(if(ChangeType=111, ChangeAmount, 0)),sum(if(ChangeType=112, ChangeAmount, 0)) from UserAccountRecord where 1=1" + condition);
+            
+            string ChangeTypeAmount0 = "0.00", ChangeTypeAmount1 = "0.00", ChangeTypeAmount2 = "0.00", ChangeTypeAmount3 = "0.00", ChangeTypeAmount4 = "0.00", ChangeTypeAmount5 = "0.00", ChangeTypeAmount6 = "0.00", ChangeTypeAmount61 = "0.00", ChangeTypeAmount62 = "0.00", ChangeTypeAmount63 = "0.00", ChangeTypeAmount64 = "0.00", ChangeTypeAmount50 = "0.00", ChangeTypeAmount111 = "0.00", ChangeTypeAmount112 = "0.00", ChangeTypeAmount60 = "0.00", ChangeTypeAmount31 = "0.00";
+            DataTable dt = OtherMySqlConn.dtable("select sum(if(ChangeType=0, ChangeAmount, 0)),sum(if(ChangeType=1, ChangeAmount, 0)),sum(if(ChangeType=2, ChangeAmount, 0)),sum(if(ChangeType=6, ChangeAmount, 0)),sum(if(ChangeType=61, ChangeAmount, 0)),sum(if(ChangeType=62, ChangeAmount, 0)),sum(if(ChangeType=63, ChangeAmount, 0)),sum(if(ChangeType=64, ChangeAmount, 0)),sum(if(ChangeType=50, ChangeAmount, 0)),sum(if(ChangeType=111, ChangeAmount, 0)),sum(if(ChangeType=112, ChangeAmount, 0)),sum(if(ChangeType=60, ChangeAmount, 0)),sum(if(ChangeType=31, ChangeAmount, 0)),sum(if(ChangeType=3, ChangeAmount, 0)),sum(if(ChangeType=4, ChangeAmount, 0)),sum(if(ChangeType=5, ChangeAmount, 0)) from UserAccountRecord where 1=1" + condition);
+            DataTable dts = OtherMySqlConn.dtable("select SUM(FluxProfitAmt) from FluxProfitDetail where ");
             if(dt.Rows.Count > 0)
             {
                 ChangeTypeAmount0 = dt.Rows[0][0].ToString();
                 ChangeTypeAmount1 = dt.Rows[0][1].ToString();
                 ChangeTypeAmount2 = dt.Rows[0][2].ToString();
+                ChangeTypeAmount3 = dt.Rows[0][13].ToString();
+                ChangeTypeAmount4 = dt.Rows[0][14].ToString();
+                ChangeTypeAmount5 = dt.Rows[0][15].ToString();
                 ChangeTypeAmount6 = dt.Rows[0][3].ToString();
                 ChangeTypeAmount61 = dt.Rows[0][4].ToString();
                 ChangeTypeAmount62 = dt.Rows[0][5].ToString();
@@ -142,10 +146,15 @@ namespace MySystem.Areas.Admin.Controllers
                 ChangeTypeAmount50 = dt.Rows[0][8].ToString();
                 ChangeTypeAmount111 = dt.Rows[0][9].ToString();
                 ChangeTypeAmount112 = dt.Rows[0][10].ToString();
+                ChangeTypeAmount60 = dt.Rows[0][11].ToString();
+                ChangeTypeAmount31 = dt.Rows[0][12].ToString();
             }
             other.Add("ChangeTypeAmount0", ChangeTypeAmount0); //激活奖励
             other.Add("ChangeTypeAmount1", ChangeTypeAmount1); //交易分润
             other.Add("ChangeTypeAmount2", ChangeTypeAmount2); //提现申请
+            other.Add("ChangeTypeAmount3", ChangeTypeAmount3); //提现税点扣除
+            other.Add("ChangeTypeAmount4", ChangeTypeAmount4); //提现税点扣除
+            other.Add("ChangeTypeAmount5", ChangeTypeAmount5); //提现税点扣
             other.Add("ChangeTypeAmount6", ChangeTypeAmount6); //提现失败,解冻
             other.Add("ChangeTypeAmount61", ChangeTypeAmount61); //人工冻结
             other.Add("ChangeTypeAmount62", ChangeTypeAmount62); //人工解冻
@@ -154,6 +163,8 @@ namespace MySystem.Areas.Admin.Controllers
             other.Add("ChangeTypeAmount50", ChangeTypeAmount50); //开机奖励
             other.Add("ChangeTypeAmount111", ChangeTypeAmount111); //分润补贴
             other.Add("ChangeTypeAmount112", ChangeTypeAmount112); //推荐奖励
+            other.Add("ChangeTypeAmount60", ChangeTypeAmount60); //流量卡分佣
+            other.Add("ChangeTypeAmount31", ChangeTypeAmount31); //红包奖励
             obj.Add("other", other);
             return Json(obj);
         }

+ 1 - 1
Areas/Admin/Controllers/MainServer/UserCardForWeChatController.cs

@@ -222,7 +222,7 @@ namespace MySystem.Areas.Admin.Controllers
             db.SaveChanges();
 
             UserCardForWeChat edit = db.UserCardForWeChat.FirstOrDefault(m => m.Id == data.Id) ?? new UserCardForWeChat();
-            new WeChatFunction(_accessor.HttpContext).CardCreate(edit);
+            // new WeChatFunction(_accessor.HttpContext).CardCreate(edit);
         
             return "success";
         }

+ 652 - 37
Areas/Admin/Controllers/MainServer/UserCashRecordController.cs

@@ -62,15 +62,14 @@ namespace MySystem.Areas.Admin.Controllers
         /// 提现记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string CreateDateData, int page = 1, int limit = 30)
+        public JsonResult IndexData(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string QueryCountSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("CashOrderNo", "1"); //提现单号
-            Fields.Add("CreateDate", "3"); //创建时间
             Fields.Add("TradeType", "0"); //交易类型
 
-            string condition = " and Status>-1";
+            string condition = " and Status>-1 and TradeType<3";
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -80,12 +79,33 @@ namespace MySystem.Areas.Admin.Controllers
             if (!string.IsNullOrEmpty(RealName))
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+                // condition += " and UserId in (select Id from Users where RealName='" + RealName + "')";
             }
             //提现状态
-            if(!string.IsNullOrEmpty(StatusSelect))
+            if (!string.IsNullOrEmpty(StatusSelect))
             {
                 condition += " and Status=" + StatusSelect;
             }
+            if (!string.IsNullOrEmpty(data.CashOrderNo))
+            {
+                condition += " and CashOrderNo='" + data.CashOrderNo + "'";
+            }
+            if (data.TradeType > 0)
+            {
+                condition += " and TradeType=" + data.TradeType;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(QueryCountSelect))
+            {
+                condition += " and QueryCount=" + QueryCountSelect;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -97,33 +117,25 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["RealName"] = user.RealName;
                 dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
                 int Status = int.Parse(dic["Status"].ToString());
-                if(Status == 0) dic["StatusName"] = "处理中";
-                if(Status == 1) dic["StatusName"] = "成功";
-                if(Status == 2) dic["StatusName"] = "失败";
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
 
                 int QueryCount = int.Parse(dic["QueryCount"].ToString());
-                if(QueryCount == 0) dic["LockName"] = "待提交";
-                if(QueryCount == 1) dic["LockName"] = "已提交";
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            if(!string.IsNullOrEmpty(data.CashOrderNo))
-            {
-                condition += " and CashOrderNo='" + data.CashOrderNo + "'";
-            }
-            if (data.TradeType > 0)
-            { 
-                condition += " and TradeType=" + data.TradeType;
-            }
-            if(!string.IsNullOrEmpty(CreateDateData))
+
+            string WaitAmount = "0.00";//待处理总金额
+            string SuccessAmount = "0.00";//提现成功总金额
+            string FailAmount = "0.00";//提现失败总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=0" + condition);
+            if (dt.Rows.Count > 0)
             {
-                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
-                string start = datelist[0];
-                string end = datelist[1];
-                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate>='" + end + " 23:59:59'";
+                WaitAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
             }
-            string SuccessAmount = "0.00";
-            string FailAmount = "0.00";
-            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=1" + condition);
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=1" + condition);
             if (dt.Rows.Count > 0)
             {
                 SuccessAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
@@ -133,6 +145,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 FailAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
             }
+            other.Add("WaitAmount", WaitAmount);
             other.Add("SuccessAmount", SuccessAmount);
             other.Add("FailAmount", FailAmount);
             obj.Add("other", other);
@@ -194,7 +207,6 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
 
-
             UserCashRecord editData = db.UserCashRecord.FirstOrDefault(m => m.Id == Id) ?? new UserCashRecord();
             ViewBag.data = editData;
             return View();
@@ -352,14 +364,14 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(UserCashRecord data, string MakerCode, string RealName, string StatusSelect)
+        public JsonResult ExportExcel(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string PayStatus)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("CashOrderNo", "1"); //提现单号
             Fields.Add("CreateDate", "3"); //创建时间
             Fields.Add("TradeType", "0"); //交易类型
 
-            string condition = " and Status>-1";
+            string condition = " and Status>-1 and TradeType<3";
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -371,12 +383,22 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
             //提现状态
-            if(!string.IsNullOrEmpty(StatusSelect))
+            if (!string.IsNullOrEmpty(StatusSelect))
             {
                 condition += " and Status=" + StatusSelect;
             }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(PayStatus))
+            {
+                int QueryCount = int.Parse(function.CheckInt(PayStatus));
+                if (QueryCount == 2)
+                {
+                    QueryCount = 0;
+                }
+                condition += " and QueryCount=" + QueryCount;
+            }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", 1, 20000, condition, "CashOrderNo,UserId,IdCardNo,ActualTradeAmount,Remark", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", 1, 20000, condition, "CashOrderNo,UserId,IdCardNo,ActualTradeAmount,Remark,Status,QueryCount,CreateDate", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -387,12 +409,18 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["Mobile"] = user.Mobile;
                 dic["SettleBankName"] = user.SettleBankName;
                 dic["SettleBankCardNo"] = user.SettleBankCardNo;
-                // dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
-                // int Status = int.Parse(dic["Status"].ToString());
-                // if(Status == 0) dic["Status"] = "处理中";
-                // if(Status == 1) dic["Status"] = "成功";
-                // if(Status == 2) dic["Status"] = "失败";
                 dic.Remove("UserId");
+                // dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+                dic.Remove("Status");
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+                dic.Remove("QueryCount");
             }
 
             Dictionary<string, object> result = new Dictionary<string, object>();
@@ -408,7 +436,10 @@ namespace MySystem.Areas.Admin.Controllers
             ReturnFields.Add("SettleBankName", "开户行名称");
             ReturnFields.Add("SettleBankCardNo", "开户行卡号");
             ReturnFields.Add("ActualTradeAmount", "发佣金额(单位:元)");
+            ReturnFields.Add("LockName", "代付标记");
+            ReturnFields.Add("StatusName", "状态");
             ReturnFields.Add("Remark", "备注");
+            ReturnFields.Add("CreateDate", "创建时间");
 
             // ReturnFields.Add("CashOrderNo", "提现单号");
             // ReturnFields.Add("MakerCode", "创客编码");
@@ -421,7 +452,6 @@ namespace MySystem.Areas.Admin.Controllers
             // ReturnFields.Add("Status", "订单状态");
             // ReturnFields.Add("ReturnCode", "提现服务返回编码");
             // ReturnFields.Add("ReturnMsg", "提现服务返回信息");
-            // ReturnFields.Add("CreateDate", "创建时间");
             result.Add("Fields", ReturnFields);
             AddSysLog("0", "UserCashRecord", "ExportExcel");
             return Json(result);
@@ -432,8 +462,436 @@ namespace MySystem.Areas.Admin.Controllers
 
 
 
+        
+        #region 盟主提现记录列表
+
+        /// <summary>
+        /// 根据条件查询盟主提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult LeaderIndex(UserCashRecord data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            string Condition = "";
+            Condition += "CashOrderNo:\"" + data.CashOrderNo + "\",";
+            Condition += "TradeType:\"" + data.TradeType + "\",";
+
+            if (!string.IsNullOrEmpty(Condition))
+            {
+                Condition = Condition.TrimEnd(',');
+                Condition = ", where: {" + Condition + "}";
+            }
+            ViewBag.Condition = Condition;
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询盟主提现记录列表
+
+        /// <summary>
+        /// 盟主提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult LeaderIndexData(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string QueryCountSelect, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashOrderNo", "1"); //提现单号
+
+            string condition = " and Status>-1 and TradeType=3";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+                // condition += " and UserId in (select Id from Users where RealName='" + RealName + "')";
+            }
+            //提现状态
+            if (!string.IsNullOrEmpty(StatusSelect))
+            {
+                condition += " and Status=" + StatusSelect;
+            }
+            if (!string.IsNullOrEmpty(data.CashOrderNo))
+            {
+                condition += " and CashOrderNo='" + data.CashOrderNo + "'";
+            }
+            if (data.TradeType > 0)
+            {
+                condition += " and TradeType=" + data.TradeType;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(QueryCountSelect))
+            {
+                condition += " and QueryCount=" + QueryCountSelect;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = user.MakerCode;
+                dic["RealName"] = user.RealName;
+                dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+            }
+            Dictionary<string, object> other = new Dictionary<string, object>();
+
+            string WaitAmount = "0.00";//待处理总金额
+            string SuccessAmount = "0.00";//提现成功总金额
+            string FailAmount = "0.00";//提现失败总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                WaitAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                SuccessAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=2" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                FailAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("WaitAmount", WaitAmount);
+            other.Add("SuccessAmount", SuccessAmount);
+            other.Add("FailAmount", FailAmount);
+            obj.Add("other", other);
+            return Json(obj);
+        }
 
+        #endregion
         
+        #region 导出盟主Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult LeaderExportExcel(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string PayStatus)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashOrderNo", "1"); //提现单号
+            Fields.Add("CreateDate", "3"); //创建时间
+
+            string condition = " and Status>-1 and TradeType=3";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+            }
+            //提现状态
+            if (!string.IsNullOrEmpty(StatusSelect))
+            {
+                condition += " and Status=" + StatusSelect;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(PayStatus))
+            {
+                int QueryCount = int.Parse(function.CheckInt(PayStatus));
+                if (QueryCount == 2)
+                {
+                    QueryCount = 0;
+                }
+                condition += " and QueryCount=" + QueryCount;
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", 1, 20000, condition, "CashOrderNo,UserId,IdCardNo,ActualTradeAmount,Remark,Status,QueryCount,CreateDate", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = user.MakerCode;
+                dic["RealName"] = user.RealName;
+                dic["Mobile"] = user.Mobile;
+                dic["SettleBankName"] = user.SettleBankName;
+                dic["SettleBankCardNo"] = user.SettleBankCardNo;
+                dic.Remove("UserId");
+                // dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+                dic.Remove("Status");
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+                dic.Remove("QueryCount");
+            }
+
+            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>();
+            ReturnFields.Add("CashOrderNo", "提现单号");
+            ReturnFields.Add("MakerCode", "创客编号");
+            ReturnFields.Add("RealName", "灵工姓名");
+            ReturnFields.Add("Mobile", "手机号");
+            ReturnFields.Add("IdCardNo", "身份证号");
+            ReturnFields.Add("SettleBankName", "开户行名称");
+            ReturnFields.Add("SettleBankCardNo", "开户行卡号");
+            ReturnFields.Add("ActualTradeAmount", "发佣金额(单位:元)");
+            ReturnFields.Add("LockName", "代付标记");
+            ReturnFields.Add("StatusName", "状态");
+            ReturnFields.Add("Remark", "备注");
+            ReturnFields.Add("CreateDate", "创建时间");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "UserCashRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
+        #region 助利宝提现记录列表
+
+        /// <summary>
+        /// 根据条件查询助利宝提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult HelpProfitIndex(UserCashRecord data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            string Condition = "";
+            Condition += "CashOrderNo:\"" + data.CashOrderNo + "\",";
+            Condition += "TradeType:\"" + data.TradeType + "\",";
+
+            if (!string.IsNullOrEmpty(Condition))
+            {
+                Condition = Condition.TrimEnd(',');
+                Condition = ", where: {" + Condition + "}";
+            }
+            ViewBag.Condition = Condition;
+            return View();
+        }
+
+        #endregion
+
+
+        #region
+
+        /// <summary>
+        /// 助利宝提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult HelpProfitIndexData(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string QueryCountSelect, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashOrderNo", "1"); //提现单号
+
+            string condition = " and Status>-1 and TradeType=4";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+                // condition += " and UserId in (select Id from Users where RealName='" + RealName + "')";
+            }
+            //提现状态
+            if (!string.IsNullOrEmpty(StatusSelect))
+            {
+                condition += " and Status=" + StatusSelect;
+            }
+            if (!string.IsNullOrEmpty(data.CashOrderNo))
+            {
+                condition += " and CashOrderNo='" + data.CashOrderNo + "'";
+            }
+            if (data.TradeType > 0)
+            {
+                condition += " and TradeType=" + data.TradeType;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(QueryCountSelect))
+            {
+                condition += " and QueryCount=" + QueryCountSelect;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = user.MakerCode;
+                dic["RealName"] = user.RealName;
+                dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+            }
+            Dictionary<string, object> other = new Dictionary<string, object>();
+
+            string WaitAmount = "0.00";//待处理总金额
+            string SuccessAmount = "0.00";//提现成功总金额
+            string FailAmount = "0.00";//提现失败总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                WaitAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                SuccessAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=2" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                FailAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("WaitAmount", WaitAmount);
+            other.Add("SuccessAmount", SuccessAmount);
+            other.Add("FailAmount", FailAmount);
+            obj.Add("other", other);
+            return Json(obj);
+        }
+
+        #endregion
+        
+        #region 导出助利宝Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult HelpProfitExportExcel(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string PayStatus)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashOrderNo", "1"); //提现单号
+            Fields.Add("CreateDate", "3"); //创建时间
+
+            string condition = " and Status>-1 and TradeType=4";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+            }
+            //提现状态
+            if (!string.IsNullOrEmpty(StatusSelect))
+            {
+                condition += " and Status=" + StatusSelect;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(PayStatus))
+            {
+                int QueryCount = int.Parse(function.CheckInt(PayStatus));
+                if (QueryCount == 2)
+                {
+                    QueryCount = 0;
+                }
+                condition += " and QueryCount=" + QueryCount;
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", 1, 20000, condition, "CashOrderNo,UserId,IdCardNo,ActualTradeAmount,Remark,Status,QueryCount,CreateDate", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = user.MakerCode;
+                dic["RealName"] = user.RealName;
+                dic["Mobile"] = user.Mobile;
+                dic["SettleBankName"] = user.SettleBankName;
+                dic["SettleBankCardNo"] = user.SettleBankCardNo;
+                dic.Remove("UserId");
+                // dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+                dic.Remove("Status");
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+                dic.Remove("QueryCount");
+            }
+
+            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>();
+            ReturnFields.Add("CashOrderNo", "提现单号");
+            ReturnFields.Add("MakerCode", "创客编号");
+            ReturnFields.Add("RealName", "灵工姓名");
+            ReturnFields.Add("Mobile", "手机号");
+            ReturnFields.Add("IdCardNo", "身份证号");
+            ReturnFields.Add("SettleBankName", "开户行名称");
+            ReturnFields.Add("SettleBankCardNo", "开户行卡号");
+            ReturnFields.Add("ActualTradeAmount", "发佣金额(单位:元)");
+            ReturnFields.Add("LockName", "代付标记");
+            ReturnFields.Add("StatusName", "状态");
+            ReturnFields.Add("Remark", "备注");
+            ReturnFields.Add("CreateDate", "创建时间");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "UserCashRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
         #region 提交代付平台
 
         /// <summary>
@@ -452,6 +910,7 @@ namespace MySystem.Areas.Admin.Controllers
                 if (edit != null)
                 {
                     edit.QueryCount = 1;
+                    edit.UpdateDate = DateTime.Now;
                     db.SaveChanges();
                     RedisDbconn.Instance.AddList("CashPayApplyQueue", Newtonsoft.Json.JsonConvert.SerializeObject(edit));
                 }
@@ -461,5 +920,161 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+        #region 拒绝
+
+        /// <summary>
+        /// 拒绝
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Reduce(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            UserCashRecord editData = db.UserCashRecord.FirstOrDefault(m => m.Id == Id) ?? new UserCashRecord();
+            ViewBag.data = editData;
+
+            return View();
+        }
+
+        #endregion
+
+        #region 拒绝
+
+        /// <summary>
+        /// 拒绝
+        /// </summary>
+        /// <returns></returns>
+        public string ReduceDo(int Id, string Remark)
+        {
+            AddSysLog(Id, "UserCashRecord", "Reduce");
+            UserCashRecord edit = db.UserCashRecord.FirstOrDefault(m => m.Id == Id);
+            if (edit != null)
+            {
+                if (edit.TradeType == 3)
+                {
+                    edit.Status = 2;
+                    edit.Remark = Remark;
+                    edit.UpdateMan = SysUserName;
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                    if (account != null)
+                    {
+                        decimal TradeAmount = edit.TradeAmount;
+                        account.LeaderBalanceAmount += TradeAmount;
+                        db.LeaderAccountRecord.Add(new LeaderAccountRecord()
+                        {
+                            CreateDate = DateTime.Now,
+                            UserId = edit.UserId, //创客
+                            ChangeType = 6, //变动类型
+                            ProductType = 99, //产品类型
+                            ChangeAmount = TradeAmount, //变更金额
+                            BeforeBalanceAmount = account.LeaderBalanceAmount - TradeAmount, //变更前余额
+                            AfterBalanceAmount = account.LeaderBalanceAmount, //变更后余额
+                        });
+                        db.SaveChanges();
+                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                    }
+                }
+                else if (edit.TradeType == 4)
+                {
+                    edit.Status = 2;
+                    edit.Remark = Remark;
+                    edit.UpdateMan = SysUserName;
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                    if (account != null)
+                    {
+                        decimal TradeAmount = edit.TradeAmount;
+                        account.HelpProfitBalanceAmount += TradeAmount;
+                        db.HelpProfitAccountRecord.Add(new HelpProfitAccountRecord()
+                        {
+                            CreateDate = DateTime.Now,
+                            UserId = edit.UserId, //创客
+                            ChangeType = 6, //变动类型
+                            ProductType = 99, //产品类型
+                            ChangeAmount = TradeAmount, //变更金额
+                            BeforeBalanceAmount = account.HelpProfitBalanceAmount - TradeAmount, //变更前余额
+                            AfterBalanceAmount = account.HelpProfitBalanceAmount, //变更后余额
+                        });
+                        db.SaveChanges();
+                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                    }
+                }
+                else
+                {
+                    edit.Status = 2;
+                    edit.Remark = Remark;
+                    edit.UpdateMan = SysUserName;
+                    UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == edit.UserId);
+                    if (account != null)
+                    {
+                        decimal TradeAmount = edit.TradeAmount;
+                        decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                        decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                        decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                        account.BalanceAmount += TradeAmount;
+                        if (account.FreezeAmount >= TradeAmount)
+                        {
+                            account.FreezeAmount -= TradeAmount;
+                        }
+                        else
+                        {
+                            return "冻结金额不足";
+                        }
+                        decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                        decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                        decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                        db.UserAccountRecord.Add(new UserAccountRecord()
+                        {
+                            CreateDate = DateTime.Now,
+                            UpdateDate = DateTime.Now,
+                            UserId = edit.UserId, //创客
+                            ChangeType = 6, //变动类型
+                            ProductType = 99, //产品类型
+                            ChangeAmount = TradeAmount, //变更金额
+                            BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                            AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                            BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                            AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                            BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                            AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                        });
+                        db.SaveChanges();
+                        RedisDbconn.Instance.Set("UserAccount:" + edit.UserId, account);
+                    }
+                }
+
+                db.SaveChanges();
+            }
+            return "success";
+        }
+
+        #endregion
+
+        #region 解除
+
+        /// <summary>
+        /// 解除
+        /// </summary>
+        /// <returns></returns>
+        public string Cancel(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "WithdrawRecord", "Cancel");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                UserCashRecord edit = db.UserCashRecord.FirstOrDefault(m => m.Id == id);
+                if (edit != null)
+                {
+                    edit.QueryCount = 0;
+                    db.SaveChanges();
+                }
+            }
+
+            return "success";
+        }
+
+        #endregion
+
     }
-}
+}

+ 39 - 22
Areas/Admin/Controllers/MainServer/UserStoreChangeController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -50,12 +51,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客库存变动记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(UserStoreChange data, string UserIdMakerCode, string UserIdRealName, string BindMerchantIdMerchantNo, string BindMerchantIdMerchantName, string BrandIdSelect, string TransTypeSelect, string StockOpDirectSelect, string SnStatusSelect, string BindStatusSelect, string ActiveStatusSelect, string BrandTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(UserStoreChange data, string UserIdMakerCode, string UserIdRealName, string BindMerchantIdMerchantNo, string BindMerchantIdMerchantName, string BrandIdSelect, string TransTypeSelect, string StockOpDirectSelect, string SnStatusSelect, string BindStatusSelect, string ActiveStatusSelect, string BrandTypeSelect, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //时间
             Fields.Add("SnNo", "1"); //SN编号
 
 
@@ -115,7 +115,14 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and BrandType=" + BrandTypeSelect;
             }
-
+            //变动时间
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserStoreChange", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -194,25 +201,35 @@ namespace MySystem.Areas.Admin.Controllers
 
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("NotPutNotBindCount", 0);
-            other.Add("NotPutBindCount", 0);
-            other.Add("PutNotBindCount", 0);
-            other.Add("PutBindCount", 0);
-            
-            other.Add("NotPutNotBindCount2", 0);
-            other.Add("NotPutBindCount2", 0);
-            other.Add("PutNotBindCount2", 0);
-            other.Add("PutBindCount2", 0);
-            
-            other.Add("NotPutNotBindCount3", 0);
-            other.Add("NotPutBindCount3", 0);
-            other.Add("PutNotBindCount3", 0);
-            other.Add("PutBindCount3", 0);
-            
-            other.Add("NotPutNotBindCount4", 0);
-            other.Add("NotPutBindCount4", 0);
-            other.Add("PutNotBindCount4", 0);
-            other.Add("PutBindCount4", 0);
+            int NotPutNotBindCount = 0;//未拨出未绑定
+            int NotPutBindCount = 0;//未拨出已绑定
+            int PutNotBindCount = 0;//已拨出未绑定
+            int PutBindCount = 0;//已拨出已绑定
+
+            DataTable dt = OtherMySqlConn.dtable("select count(0) from UserStoreChange where SnStatus=0 and BindStatus=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                NotPutNotBindCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select count(0) from UserStoreChange where SnStatus=0 and BindStatus=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                NotPutBindCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select count(0) from UserStoreChange where SnStatus=1 and BindStatus=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                PutNotBindCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select count(0) from UserStoreChange where SnStatus=1 and BindStatus=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                PutBindCount = int.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            other.Add("NotPutNotBindCount", NotPutNotBindCount);
+            other.Add("NotPutBindCount", NotPutBindCount);
+            other.Add("PutNotBindCount", PutNotBindCount);
+            other.Add("PutBindCount", PutBindCount);
             obj.Add("other", other);
             return Json(obj);
         }

+ 82 - 36
Areas/Admin/Controllers/MainServer/UserTradeDaySummaryController.cs

@@ -7,6 +7,7 @@ using System.Web;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Data;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Http;
@@ -34,7 +35,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 根据条件查询创客交易日汇总列表
         /// </summary>
         /// <returns></returns>
-        public IActionResult Index(UserTradeDaySummary data, string right)
+        public IActionResult Index(TradeDaySummary data, string right)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
@@ -51,12 +52,11 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客交易日汇总列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(UserTradeDaySummary data, string MakerCode, string RealName, string TradeMonthSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(TradeDaySummary data, string MakerCode, string RealName, string TradeMonthSelect, string TradeDateSelect,string BrandId, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
-            Fields.Add("CreateDate", "3"); //交易日期
             Fields.Add("BrandId", "0"); //品牌
 
             string condition = " and Status>-1";
@@ -70,13 +70,26 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
+            // //产品类型
+            if (!string.IsNullOrEmpty(BrandId))
+            {
+                condition += " and BrandId ='" + BrandId +"'";
+            }
             //交易月份
-            if(!string.IsNullOrEmpty(TradeMonthSelect))
+            if (!string.IsNullOrEmpty(TradeMonthSelect))
             {
                 condition += " and TradeMonth=" + TradeMonthSelect.Replace("-", "");
             }
+            //交易日期
+            if (!string.IsNullOrEmpty(TradeDateSelect))
+            {
+                string[] datelist = TradeDateSelect.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0].Replace("-", "");
+                string end = datelist[1].Replace("-", "");
+                condition += " and TradeDate>='" + start + "' and TradeDate<='" + end + "' ";
+            }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserTradeDaySummary", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("TradeDaySummary", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -87,9 +100,39 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("DirectTradeAmt", 0);
-            other.Add("DirectDebitTradeAmt", 0);
-            other.Add("DirectDebitCapNum", 0);
+            string HelpDirectTradeAmt = "0.00"; //扶持期直营贷记卡交易
+            string NotHelpDirectTradeAmt = "0.00"; //稳定期直营贷记卡交易
+            string HelpDirectDebitTradeAmt = "0.00"; //扶持期直营借记卡交易
+            string NotHelpDirectDebitTradeAmt = "0.00"; //稳定期直营借记卡交易
+            string HelpNonDirectTradeAmt = "0.00"; //扶持期非直营贷记卡交易
+            string NotHelpNonDirectTradeAmt = "0.00"; //稳定期非直营贷记卡交易
+            string HelpNonDirectDebitTradeAmt = "0.00"; //扶持期非直营借记卡交易
+            string NotHelpNonDirectDebitTradeAmt = "0.00"; //稳定期非直营借记卡交易
+
+            DataTable dt = OtherMySqlConn.dtable("select sum(HelpDirectTradeAmt),sum(NotHelpDirectTradeAmt),sum(HelpDirectDebitTradeAmt),sum(NotHelpDirectDebitTradeAmt) from TradeDaySummary where SeoTitle='self' " + condition);
+            if(dt.Rows.Count > 0)
+            {
+                HelpDirectTradeAmt = dt.Rows[0][0].ToString();
+                NotHelpDirectTradeAmt = dt.Rows[0][1].ToString();
+                HelpDirectDebitTradeAmt = dt.Rows[0][2].ToString();
+                NotHelpDirectDebitTradeAmt = dt.Rows[0][3].ToString();
+            }
+            dt = OtherMySqlConn.dtable("select sum(HelpNonDirectTradeAmt),sum(NotHelpNonDirectTradeAmt),sum(HelpNonDirectDebitTradeAmt),sum(NotHelpNonDirectDebitTradeAmt) from TradeDaySummary where SeoTitle='team' " + condition);
+            if(dt.Rows.Count > 0)
+            {
+                HelpNonDirectTradeAmt = dt.Rows[0][0].ToString();
+                NotHelpNonDirectTradeAmt = dt.Rows[0][1].ToString();
+                HelpNonDirectDebitTradeAmt = dt.Rows[0][2].ToString();
+                NotHelpNonDirectDebitTradeAmt = dt.Rows[0][3].ToString();
+            }
+            other.Add("HelpDirectTradeAmt", HelpDirectTradeAmt);
+            other.Add("NotHelpDirectTradeAmt", NotHelpDirectTradeAmt);
+            other.Add("HelpDirectDebitTradeAmt", HelpDirectDebitTradeAmt);
+            other.Add("NotHelpDirectDebitTradeAmt", NotHelpDirectDebitTradeAmt);
+            other.Add("HelpNonDirectTradeAmt", HelpNonDirectTradeAmt);
+            other.Add("NotHelpNonDirectTradeAmt", NotHelpNonDirectTradeAmt);
+            other.Add("HelpNonDirectDebitTradeAmt", HelpNonDirectDebitTradeAmt);
+            other.Add("NotHelpNonDirectDebitTradeAmt", NotHelpNonDirectDebitTradeAmt);
             obj.Add("other", other);
             return Json(obj);
         }
@@ -120,7 +163,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Add(UserTradeDaySummary data)
+        public string Add(TradeDaySummary data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
 
@@ -128,8 +171,8 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("UserTradeDaySummary", Fields, 0);
-            AddSysLog(data.Id.ToString(), "UserTradeDaySummary", "add");
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("TradeDaySummary", Fields, 0);
+            AddSysLog(data.Id.ToString(), "TradeDaySummary", "add");
             db.SaveChanges();
 
             return "success";
@@ -149,7 +192,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.right = right;
 
 
-            UserTradeDaySummary editData = db.UserTradeDaySummary.FirstOrDefault(m => m.Id == Id) ?? new UserTradeDaySummary();
+            TradeDaySummary editData = db.TradeDaySummary.FirstOrDefault(m => m.Id == Id) ?? new TradeDaySummary();
             ViewBag.data = editData;
             return View();
         }
@@ -163,7 +206,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// </summary>
         /// <returns></returns>
         [HttpPost]
-        public string Edit(UserTradeDaySummary data)
+        public string Edit(TradeDaySummary data)
         {
             Dictionary<string, object> Fields = new Dictionary<string, object>();
 
@@ -171,8 +214,8 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("SeoTitle", data.SeoTitle);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("UserTradeDaySummary", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "UserTradeDaySummary", "update");
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("TradeDaySummary", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "TradeDaySummary", "update");
             db.SaveChanges();
 
             return "success";
@@ -189,13 +232,13 @@ namespace MySystem.Areas.Admin.Controllers
         public string Delete(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "UserTradeDaySummary", "del");
+            AddSysLog(Id, "TradeDaySummary", "del");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("UserTradeDaySummary", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("TradeDaySummary", Fields, id);
             }
             db.SaveChanges();
 
@@ -213,13 +256,13 @@ namespace MySystem.Areas.Admin.Controllers
         public string Open(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "UserTradeDaySummary", "open");
+            AddSysLog(Id, "TradeDaySummary", "open");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("UserTradeDaySummary", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("TradeDaySummary", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -236,13 +279,13 @@ namespace MySystem.Areas.Admin.Controllers
         public string Close(string Id)
         {
             string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "UserTradeDaySummary", "close");
+            AddSysLog(Id, "TradeDaySummary", "close");
             foreach (string subid in idlist)
             {
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("UserTradeDaySummary", Fields, id);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("TradeDaySummary", Fields, id);
             }
             db.SaveChanges();
             return "success";
@@ -257,9 +300,9 @@ namespace MySystem.Areas.Admin.Controllers
         /// <param name="Id"></param>
         public string Sort(int Id, int Sort)
         {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("UserTradeDaySummary", Sort, Id);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("TradeDaySummary", Sort, Id);
 
-            AddSysLog(Id.ToString(), "UserTradeDaySummary", "sort");
+            AddSysLog(Id.ToString(), "TradeDaySummary", "sort");
             return "success";
         }
         #endregion
@@ -277,7 +320,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 JsonData dr = list[i];
 
-                db.UserTradeDaySummary.Add(new UserTradeDaySummary()
+                db.TradeDaySummary.Add(new TradeDaySummary()
                 {
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
@@ -285,7 +328,7 @@ namespace MySystem.Areas.Admin.Controllers
                 });
                 db.SaveChanges();
             }
-            AddSysLog("0", "UserTradeDaySummary", "Import");
+            AddSysLog("0", "TradeDaySummary", "Import");
             return "success";
         }
         #endregion
@@ -296,7 +339,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(UserTradeDaySummary data, string MakerCode, string RealName, string TradeMonthSelect)
+        public JsonResult ExportExcel(TradeDaySummary data, string MakerCode, string RealName, string TradeMonthSelect)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
@@ -315,12 +358,12 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
             }
             //交易月份
-            if(!string.IsNullOrEmpty(TradeMonthSelect))
+            if (!string.IsNullOrEmpty(TradeMonthSelect))
             {
                 condition += " and TradeMonth=" + TradeMonthSelect.Replace("-", "");
             }
 
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserTradeDaySummary", Fields, "Id desc", "0", 1, 20000, condition, "UserId,TradeDate,TradeMonth,BrandId,DirectTradeAmt,NonDirectTradeAmt,DirectDebitTradeAmt,DirectDebitCapNum,NonDirectDebitTradeAmt,NonDirectDebitCapNum,Remark", false);
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("TradeDaySummary", Fields, "Id desc", "0", 1, 20000, condition, "UserId,TradeDate,TradeMonth,BrandId,HelpDirectTradeAmt,NotHelpDirectTradeAmt,HelpDirectDebitTradeAmt,NotHelpDirectDebitTradeAmt,HelpNonDirectTradeAmt,NotHelpNonDirectTradeAmt,HelpNonDirectDebitTradeAmt,NotHelpNonDirectDebitTradeAmt,SeoTitle", false);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -330,6 +373,7 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["RealName"] = user.RealName;
                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
                 dic.Remove("UserId");
+                dic["SeoTitle"] = dic["SeoTitle"].ToString() == "self" ? "直营" : "非直营";
             }
 
             Dictionary<string, object> result = new Dictionary<string, object>();
@@ -342,16 +386,18 @@ namespace MySystem.Areas.Admin.Controllers
             ReturnFields.Add("TradeDate", "交易日");
             ReturnFields.Add("TradeMonth", "交易月");
             ReturnFields.Add("BrandId", "品牌");
-            ReturnFields.Add("DirectTradeAmt", "直营商户交易总额(万元)");
-            ReturnFields.Add("NonDirectTradeAmt", "非直营商户交易总额(万元)");
-            ReturnFields.Add("DirectDebitTradeAmt", "直营商户借记卡交易总额(万元)");
-            ReturnFields.Add("DirectDebitCapNum", "直营激活商户数(万元)");
-            ReturnFields.Add("NonDirectDebitTradeAmt", "非直营商户借记卡交易总额(万元)");
-            ReturnFields.Add("NonDirectDebitCapNum", "非直营激活商户数");
-            ReturnFields.Add("Remark", "备注");
+            ReturnFields.Add("SeoTitle", "交易类型");
+            ReturnFields.Add("HelpDirectTradeAmt", "扶持期直营贷记卡交易");
+            ReturnFields.Add("NotHelpDirectTradeAmt", "稳定期直营贷记卡交易");
+            ReturnFields.Add("HelpDirectDebitTradeAmt", "扶持期直营借记卡交易");
+            ReturnFields.Add("NotHelpDirectDebitTradeAmt", "稳定期直营借记卡交易");
+            ReturnFields.Add("HelpNonDirectTradeAmt", "扶持期非直营贷记卡交易");
+            ReturnFields.Add("NotHelpNonDirectTradeAmt", "稳定期非直营贷记卡交易");
+            ReturnFields.Add("HelpNonDirectDebitTradeAmt", "扶持期非直营借记卡交易");
+            ReturnFields.Add("NotHelpNonDirectDebitTradeAmt", "稳定期非直营借记卡交易");
 
             result.Add("Fields", ReturnFields);
-            AddSysLog("0", "UserTradeDaySummary", "ExportExcel");
+            AddSysLog("0", "TradeDaySummary", "ExportExcel");
             return Json(result);
         }
 

+ 799 - 50
Areas/Admin/Controllers/MainServer/UsersController.cs

@@ -58,14 +58,13 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(Users data, string ParentMakerCode, string ParentRealName, string AuthFlagSelect, int TopUserId, string RiskFlagSelect, string MerchantTypeSelect, int SelfId = 0, int ParentId = 0, int page = 1, int limit = 30)
+        public JsonResult IndexData(Users data, string ParentMakerCode, string ParentRealName, string AuthFlagSelect, string CreateDateData, int TopUserId, string RiskFlagSelect, string MerchantTypeSelect, int? sSettleAmount, int? eSettleAmount, int? sCashFreezeAmt, int? eCashFreezeAmt, int UserId, int SelfId = 0, int ParentId = 0, int page = 1, int limit = 30)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Fields.Add("MakerCode", "1"); //创客编号
             Fields.Add("RealName", "1"); //创客名称
             Fields.Add("Mobile", "1"); //手机号
             Fields.Add("CertId", "1"); //身份证号码
-            Fields.Add("CreateDate", "3"); //注册时间
             Fields.Add("SettleAmount", "3"); //结算金额
             Fields.Add("CashFreezeAmt", "3"); //冻结金额
             Fields.Add("UserLevel", "0"); //创客等级
@@ -75,33 +74,49 @@ namespace MySystem.Areas.Admin.Controllers
             //直属创客编号
             if (!string.IsNullOrEmpty(ParentMakerCode))
             {
-                condition += " and Id in (select UserId from UserForMakerCode where MakerCode='" + ParentMakerCode + "')";
+                condition += " and ParentUserId in (select UserId from UserForMakerCode where MakerCode='" + ParentMakerCode + "')";
             }
             //直属创客名称
             if (!string.IsNullOrEmpty(ParentRealName))
             {
-                condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
+                condition += " and ParentUserId in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
             }
             //实名状态
-            if(!string.IsNullOrEmpty(AuthFlagSelect))
+            if (!string.IsNullOrEmpty(AuthFlagSelect))
             {
                 condition += " and AuthFlag=" + AuthFlagSelect;
             }
             //顶级创客
-            if(TopUserId > 0)
+            if (TopUserId > 0)
             {
                 condition += " and ParentNav like '," + TopUserId + ",%'";
             }
             //风控标识
-            if(!string.IsNullOrEmpty(RiskFlagSelect))
+            if (!string.IsNullOrEmpty(RiskFlagSelect))
             {
                 condition += " and RiskFlag=" + RiskFlagSelect;
             }
             //商户创客类型
-            if(!string.IsNullOrEmpty(MerchantTypeSelect))
+            if (!string.IsNullOrEmpty(MerchantTypeSelect))
             {
                 condition += " and MerchantType=" + MerchantTypeSelect;
             }
+            if (sSettleAmount != null)
+            {
+                condition += " and SettleAmount>=" + sSettleAmount.Value;
+            }
+            if (eSettleAmount != null)
+            {
+                condition += " and SettleAmount<=" + eSettleAmount.Value;
+            }
+            if (sCashFreezeAmt != null)
+            {
+                condition += " and CashFreezeAmt>=" + sCashFreezeAmt.Value;
+            }
+            if (eCashFreezeAmt != null)
+            {
+                condition += " and CashFreezeAmt<=" + eCashFreezeAmt.Value;
+            }
             if (SelfId > 0)
             {
                 Users self = db.Users.FirstOrDefault(m => m.Id == SelfId);
@@ -113,9 +128,20 @@ namespace MySystem.Areas.Admin.Controllers
                 }
             }
             if (ParentId > 0)
-            { 
+            {
                 condition += " and ParentUserId=" + ParentId;
             }
+            if (UserId > 0)
+            {
+                condition += " and Id=" + UserId;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, sort, "True", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -241,7 +267,7 @@ namespace MySystem.Areas.Admin.Controllers
 
             Users editData = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
             ViewBag.data = editData;
-            
+
             return View();
         }
 
@@ -271,7 +297,7 @@ namespace MySystem.Areas.Admin.Controllers
         }
 
         #endregion
-        
+
         #region 修改结算金额
 
         public IActionResult EditSettleAmount(string right, int Id = 0)
@@ -279,7 +305,7 @@ namespace MySystem.Areas.Admin.Controllers
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
             Users editData = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
-            ViewBag.data = editData;            
+            ViewBag.data = editData;
             return View();
         }
 
@@ -337,24 +363,36 @@ namespace MySystem.Areas.Admin.Controllers
             decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
             decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
             int ChangeType = 0;
-            if (Kind == 1)
+            if (Kind == 1 && data.CashFreezeAmt <= account.BalanceAmount)
             {
                 account.BalanceAmount -= data.CashFreezeAmt;
                 account.FreezeAmount += data.CashFreezeAmt;
                 ChangeType = 61;
             }
-            else if (Kind == 2)
+            else if (Kind == 1 && data.CashFreezeAmt > account.BalanceAmount)
+            {
+                return "冻结金额大于余额";
+            }
+            else if (Kind == 2 && data.CashFreezeAmt <= account.FreezeAmount)
             {
                 account.BalanceAmount += data.CashFreezeAmt;
                 account.FreezeAmount -= data.CashFreezeAmt;
                 ChangeType = 62;
             }
-            else if (Kind == 3)
+            else if (Kind == 2 && data.CashFreezeAmt > account.FreezeAmount)
+            {
+                return "解冻金额大于冻结金额";
+            }
+            else if (Kind == 3 && data.CashFreezeAmt <= account.BalanceAmount)
             {
                 account.TotalAmount -= data.CashFreezeAmt;
                 account.BalanceAmount -= data.CashFreezeAmt;
                 ChangeType = 63;
             }
+            else if (Kind == 3 && data.CashFreezeAmt > account.BalanceAmount)
+            {
+                return "扣减金额大于余额";
+            }
             else if (Kind == 4)
             {
                 account.TotalAmount += data.CashFreezeAmt;
@@ -426,7 +464,7 @@ namespace MySystem.Areas.Admin.Controllers
         }
 
         #endregion
-        
+
         #region 详情
 
         public IActionResult Detail(string right, int Id = 0)
@@ -451,7 +489,7 @@ namespace MySystem.Areas.Admin.Controllers
         }
 
         #endregion
-        
+
         #region 三/四要素验证
 
         public IActionResult ThreeElement(string right)
@@ -468,7 +506,7 @@ namespace MySystem.Areas.Admin.Controllers
         [HttpPost]
         public string ThreeElement(string Name, string CertId, string CardNo, string Mobile)
         {
-            
+
             return "success";
         }
 
@@ -498,6 +536,75 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 注销
+        // 1、未实名创客;
+        // 2、已实名创客,无开通商户;
+        // 3、近7天未在商城下单过商品;
+        // 4、名下无未绑定机具、机具券,无未申请的循环机;
+        public string Cancel(string UserId)
+        {
+            Users user = db.Users.FirstOrDefault(m => m.Id == Convert.ToInt32(UserId));
+            if (user != null)
+            {
+                if (user.AuthFlag == 1)
+                {
+                    bool check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.BindingState == 1);
+                    if (check)
+                    {
+                        // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:已实名创客,无开通商户。如有疑问,请联系客服" });
+                        return "注销失败,未满足条件:已实名创客,无开通商户。如有疑问,请联系客服";
+                    }
+                    DateTime checkDate = DateTime.Now.AddDays(-7);
+                    check = db.Orders.Any(m => m.CreateDate >= checkDate && m.Status > 0 && m.UserId == user.Id);
+                    if (check)
+                    {
+                        // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:近7天未在商城下单过商品。如有疑问,请联系客服" });
+                        return "注销失败,未满足条件:近7天未在商城下单过商品。如有疑问,请联系客服";
+                    }
+                    check = db.PosMachinesTwo.Any(m => m.BuyUserId == user.Id && m.IsPurchase == 0);
+                    if (check)
+                    {
+                        // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服" });
+                        return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
+                    }
+                    check = db.PosCoupons.Any(m => m.UserId == user.Id && m.IsUse == 0);
+                    if (check)
+                    {
+                        // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服" });
+                        return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
+                    }
+                    UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
+                    if (forMobile != null)
+                    {
+                        db.Remove(forMobile);
+                    }
+                    user.Status = -1;
+                    user.Mobile += "d";
+                    user.CertId += "d";
+                }
+                else
+                {
+                    UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
+                    if (forMobile != null)
+                    {
+                        db.Remove(forMobile);
+                    }
+                    user.Status = -1;
+                    user.Mobile += "d";
+                    user.CertId += "d";
+                }
+                function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
+                // TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
+                // TODO: 清除token,token登录返回
+                db.SaveChanges();
+
+            }
+            return "success";
+        }
+        #endregion
+
+
         #region 开启
 
         /// <summary>
@@ -544,6 +651,101 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 一键企业创客
+
+        /// <summary>
+        /// 一键企业创客
+        /// </summary>
+        /// <returns></returns>
+        public string OpenEnterpriseMaker(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "Users", "OpenEnterpriseMaker");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("BusinessFlag", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭企业创客
+
+        /// <summary>
+        /// 关闭企业创客
+        /// </summary>
+        /// <returns></returns>
+        public string CloseEnterpriseMaker(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "Users", "CloseEnterpriseMaker");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("BusinessFlag", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+
+        #region 一键大盟主
+
+        /// <summary>
+        /// 一键大盟主
+        /// </summary>
+        /// <returns></returns>
+        public string SetBigLeader(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "Users", "SetBigLeader");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("LeaderLevel", 2);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 一键小盟主
+
+        /// <summary>
+        /// 一键小盟主
+        /// </summary>
+        /// <returns></returns>
+        public string SetSmallLeader(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "Users", "SetSmallLeader");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("LeaderLevel", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+
         #region 风控
 
         public IActionResult Risk(string right, int Id = 0)
@@ -641,7 +843,7 @@ namespace MySystem.Areas.Admin.Controllers
                     string SettleAmount = dr[2].ToString();
                     UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
                     if (UserCode != null)
-                    { 
+                    {
                         Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
                         if (User != null)
                         {
@@ -660,7 +862,7 @@ namespace MySystem.Areas.Admin.Controllers
                     string CashFreezeAmt = dr[2].ToString();
                     UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
                     if (UserCode != null)
-                    { 
+                    {
                         Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
                         if (User != null)
                         {
@@ -680,7 +882,7 @@ namespace MySystem.Areas.Admin.Controllers
                     string RiskNote = dr[3].ToString();
                     UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
                     if (UserCode != null)
-                    { 
+                    {
                         Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
                         if (User != null)
                         {
@@ -691,6 +893,101 @@ namespace MySystem.Areas.Admin.Controllers
                 }
                 db.SaveChanges();
             }
+            else if (Kind == 4)
+            {
+                string error = "";
+                for (int i = 1; i < list.Count; i++)
+                {
+                    JsonData dr = list[i];
+                    string MakerCode = dr[0].ToString();
+                    string OperationAmt = dr[2].ToString();//操作金额
+                    string OperationType = dr[3].ToString();//操作类型
+
+                    UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+                    if (UserCode != null)
+                    {
+                        Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
+                        UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == User.Id);
+                        if (account == null)
+                        {
+                            account = db.UserAccount.Add(new UserAccount()
+                            {
+                                Id = User.Id,
+                                UserId = User.Id,
+                            }).Entity;
+                            db.SaveChanges();
+                        }
+                        if (User != null)
+                        {
+
+                            decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                            decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                            decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                            int ChangeType = 0;
+                            if (OperationType == "1" && Convert.ToDecimal(OperationAmt) <= account.BalanceAmount)
+                            {
+                                account.BalanceAmount -= Convert.ToDecimal(OperationAmt);
+                                account.FreezeAmount += Convert.ToDecimal(OperationAmt);
+                                ChangeType = 61;
+                            }
+                            else if (OperationType == "1" && Convert.ToDecimal(OperationAmt) > account.BalanceAmount)
+                            {
+                                error += "以下操作失败" + User.MakerCode + ',' + User.RealName + "冻结金额大于余额" + '|' + '\n';
+                            }
+                            else if (OperationType == "2" && Convert.ToDecimal(OperationAmt) <= account.FreezeAmount)
+                            {
+                                account.BalanceAmount += Convert.ToDecimal(OperationAmt);
+                                account.FreezeAmount -= Convert.ToDecimal(OperationAmt);
+                                ChangeType = 62;
+                            }
+                            else if (OperationType == "2" && Convert.ToDecimal(OperationAmt) > account.FreezeAmount)
+                            {
+                                error += "以下操作失败" + User.MakerCode + ',' + User.RealName + "解冻金额大于冻结金额" + '|' + '\n';
+                            }
+                            else if (OperationType == "3" && Convert.ToDecimal(OperationAmt) <= account.BalanceAmount)
+                            {
+                                account.TotalAmount -= Convert.ToDecimal(OperationAmt);
+                                account.BalanceAmount -= Convert.ToDecimal(OperationAmt);
+                                ChangeType = 63;
+                            }
+                            else if (OperationType == "3" && Convert.ToDecimal(OperationAmt) > account.BalanceAmount)
+                            {
+                                error += "以下操作失败" + User.MakerCode + ',' + User.RealName + "扣减金额大于余额" + '|' + '\n';
+                            }
+                            else if (OperationType == "4")
+                            {
+                                account.TotalAmount += Convert.ToDecimal(OperationAmt);
+                                account.BalanceAmount += Convert.ToDecimal(OperationAmt);
+                                ChangeType = 64;
+                            }
+                            decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                            decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                            decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                            UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                            {
+                                CreateDate = DateTime.Now,
+                                UpdateDate = DateTime.Now,
+                                UserId = User.Id, //创客
+                                ChangeType = ChangeType, //变动类型
+                                ChangeAmount = Convert.ToDecimal(OperationAmt), //变更金额
+                                BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                Remark = dr[4].ToString(),
+                            }).Entity;
+                            db.SaveChanges();
+                            AddSysLog(User.Id.ToString(), "Users", "ChangeCashFreezeAmts");
+                            db.SaveChanges();
+
+                        }
+                    }
+                }
+                db.SaveChanges();
+                return "warning" + error;
+            }
             AddSysLog("0", "Users", "Import");
             return "success";
         }
@@ -726,22 +1023,22 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
             }
             //实名状态
-            if(!string.IsNullOrEmpty(AuthFlagSelect))
+            if (!string.IsNullOrEmpty(AuthFlagSelect))
             {
                 condition += " and AuthFlag=" + AuthFlagSelect;
             }
             //顶级创客
-            if(TopUserId > 0)
+            if (TopUserId > 0)
             {
                 condition += " and ParentNav like '," + TopUserId + ",%'";
             }
             //风控标识
-            if(!string.IsNullOrEmpty(RiskFlagSelect))
+            if (!string.IsNullOrEmpty(RiskFlagSelect))
             {
                 condition += " and RiskFlag=" + RiskFlagSelect;
             }
             //商户创客类型
-            if(!string.IsNullOrEmpty(MerchantTypeSelect))
+            if (!string.IsNullOrEmpty(MerchantTypeSelect))
             {
                 condition += " and MerchantType=" + MerchantTypeSelect;
             }
@@ -755,7 +1052,7 @@ namespace MySystem.Areas.Admin.Controllers
                 }
             }
             if (ParentId > 0)
-            { 
+            {
                 condition += " and ParentUserId=" + ParentId;
             }
 
@@ -773,7 +1070,7 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["ParentRealName"] = puser.RealName;
                 string ParentNav = dic["ParentNav"].ToString();
                 if (!string.IsNullOrEmpty(ParentNav))
-                { 
+                {
                     string[] list = ParentNav.Trim(',').Replace(",,", ",").Split(',');
                     if (list.Length > 1)
                     {
@@ -816,6 +1113,121 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 直属创客导出Excel
+
+        /// <summary>
+        /// 直属创客导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportZSExcel(Users data, string MakerCode, string ParentMakerCode)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            string condition = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and ParentUserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //直属创客编号
+            if (!string.IsNullOrEmpty(ParentMakerCode))
+            {
+                condition += " and ParentUserId in (select UserId from UserForMakerCode where MakerCode='" + ParentMakerCode + "')";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, "Id desc", "True", 1, 20000, condition, "Id,MakerCode,RealName,UserLevel", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int Id = int.Parse(dic["Id"].ToString());
+                Users userZS = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
+                dic["MakerCode"] = userZS.MakerCode;
+                dic["RealName"] = userZS.RealName;
+                dic["UserLevel"] = RelationClass.GetUserLevelSetInfo(int.Parse(dic["UserLevel"].ToString()));
+            }
+            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>();
+
+            ReturnFields.Add("Id", "Id");
+            ReturnFields.Add("MakerCode", "创客编号");
+            ReturnFields.Add("RealName", "创客姓名");
+            ReturnFields.Add("UserLevel", "创客等级");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "Users", "ExportZSExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
+        #region 上级创客导出Excel
+
+        /// <summary>
+        /// 上级创客导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportSJExcel(Users data, string MakerCode, string ParentMakerCode)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            string condition = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                var query = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+                Users self = db.Users.FirstOrDefault(m => m.Id == query.UserId);
+                if (self != null)
+                {
+                    string ParentNav = function.CheckNull(self.ParentNav);
+                    condition += " and Id in (" + ParentNav.Trim(',').Replace(",,", ",") + ")";
+                }
+            }
+            //直属创客编号
+            if (!string.IsNullOrEmpty(ParentMakerCode))
+            {
+                var query = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == ParentMakerCode);
+                Users self = db.Users.FirstOrDefault(m => m.Id == query.UserId);
+                if (self != null)
+                {
+                    string ParentNav = function.CheckNull(self.ParentNav);
+                    condition += " and Id in (" + ParentNav.Trim(',').Replace(",,", ",") + ")";
+                }
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, "Id desc", "True", 1, 20000, condition, "Id,MakerCode,RealName,UserLevel", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int Id = int.Parse(dic["Id"].ToString());
+                Users userSJ = db.Users.FirstOrDefault(m => m.Id == Id) ?? new Users();
+                dic["MakerCode"] = userSJ.MakerCode;
+                dic["RealName"] = userSJ.RealName;
+                dic["UserLevel"] = RelationClass.GetUserLevelSetInfo(int.Parse(dic["UserLevel"].ToString()));
+            }
+            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>();
+
+            ReturnFields.Add("Id", "Id");
+            ReturnFields.Add("MakerCode", "创客编号");
+            ReturnFields.Add("RealName", "创客姓名");
+            ReturnFields.Add("UserLevel", "创客等级");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "Users", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
         #region 同步数据
 
         /// <summary>
@@ -827,20 +1239,7 @@ namespace MySystem.Areas.Admin.Controllers
             var Brands = db.KqProducts.Where(m => m.Status == 1).ToList();
             foreach (var Brand in Brands)
             {
-                string IdBrand = Id + "_" + Brand.Id;
-                UserMachineData machineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                if (machineData == null)
-                {
-                    machineData = db.UserMachineData.Add(new UserMachineData()
-                    {
-                        IdBrand = IdBrand
-                    }).Entity;
-                    db.SaveChanges();
-                }
-                machineData.BindCount = db.PosMachinesTwo.Count(m => m.BuyUserId == Id && m.BrandId == Brand.Id && m.BindingState == 1);
-                machineData.UnBindCount = db.PosMachinesTwo.Count(m => m.BuyUserId == Id && m.BrandId == Brand.Id && m.BindingState == 0);
-                machineData.TotalMachineCount = machineData.BindCount + machineData.UnBindCount;
-                db.SaveChanges();
+                PublicFunction.SycnMachineCount(Id, Brand.Id);
                 // RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, machineData);
                 // RedisDbconn.Instance.SetExpire("UserMachineData:" + IdBrand, function.get_Random(1800, 5400));
             }
@@ -867,7 +1266,7 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
         #region 同步交易额
-        
+
         [HttpPost]
         public string SycnTradeAmountDo(DateTime sdate, DateTime edate, int UserId, int BrandId)
         {
@@ -876,7 +1275,7 @@ namespace MySystem.Areas.Admin.Controllers
                 return "时间间隔不能超过1个月";
             }
             if (edate >= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"))
-            { 
+            {
                 return "结束时间只能是今天之前";
             }
             string check = RedisDbconn.Instance.Get<string>("ResetUserTradeQueue:" + UserId + ":" + BrandId);
@@ -939,7 +1338,7 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
             }
             //顶级创客
-            if(TopUserId > 0)
+            if (TopUserId > 0)
             {
                 condition += " and ParentNav like '," + TopUserId + ",%'";
             }
@@ -954,7 +1353,7 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["ParentRealName"] = puser.RealName;
                 string ParentNav = dic["ParentNav"].ToString();
                 if (!string.IsNullOrEmpty(ParentNav))
-                { 
+                {
                     int TopId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
                     Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
                     dic["TopMakerCode"] = tuser.MakerCode;
@@ -992,22 +1391,22 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and Id in (select UserId from UserForRealName where RealName='" + ParentRealName + "')";
             }
             //实名状态
-            if(!string.IsNullOrEmpty(AuthFlagSelect))
+            if (!string.IsNullOrEmpty(AuthFlagSelect))
             {
                 condition += " and AuthFlag=" + AuthFlagSelect;
             }
             //顶级创客
-            if(TopUserId > 0)
+            if (TopUserId > 0)
             {
                 condition += " and ParentNav like '," + TopUserId + ",%'";
             }
             //风控标识
-            if(!string.IsNullOrEmpty(RiskFlagSelect))
+            if (!string.IsNullOrEmpty(RiskFlagSelect))
             {
                 condition += " and RiskFlag=" + RiskFlagSelect;
             }
             //商户创客类型
-            if(!string.IsNullOrEmpty(MerchantTypeSelect))
+            if (!string.IsNullOrEmpty(MerchantTypeSelect))
             {
                 condition += " and MerchantType=" + MerchantTypeSelect;
             }
@@ -1026,7 +1425,7 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["ParentRealName"] = puser.RealName;
                 string ParentNav = dic["ParentNav"].ToString();
                 if (!string.IsNullOrEmpty(ParentNav))
-                { 
+                {
                     int TopId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
                     Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
                     dic["TopMakerCode"] = tuser.MakerCode;
@@ -1065,5 +1464,355 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+
+        #region 根据条件查询直属创客交易额列表
+
+        /// <summary>
+        /// 直属创客交易额列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Children(Users data, string right, int ParentId = 0, string MakerCode = "")
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.ParentId = ParentId.ToString();
+            ViewBag.MakerCode = MakerCode;
+
+            List<Users> TopUsers = db.Users.Where(m => m.ParentUserId == 0).ToList();
+            ViewBag.TopUsers = TopUsers;
+            List<UserLevelSet> Levels = db.UserLevelSet.OrderBy(m => m.Id).ToList();
+            ViewBag.Levels = Levels;
+            List<KqProducts> Brands = db.KqProducts.OrderBy(m => m.Id).ToList();
+            ViewBag.Brands = Brands;
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询直属创客交易额列表
+
+        /// <summary>
+        /// 直属创客交易额列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ChildrenData(Users data, int BrandSelect, string MakerCode, string CreateDateData, int ParentId = 0, int page = 1, int limit = 30)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("MakerCode", "1"); //创客编号
+
+            int BrandId = BrandSelect;
+            string start = "";
+            string end = "";
+
+            string condition = " and Status>-1";
+            string con = " and Status>-1";
+            // string cons = " and Status>=-1";
+            string sort = "Id desc";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and Id in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            if (ParentId > 0)
+            {
+                condition += " and ParentUserId=" + ParentId + " or Id=" + ParentId;
+            }
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                start = datelist[0].Replace("-", "");
+                end = datelist[1].Replace("-", "");
+                con += " and TradeDate>='" + start + "' and TradeDate<='" + end + "'";
+            }
+            if (!string.IsNullOrEmpty(BrandSelect.ToString()) && BrandId > 0)
+            {
+                con += " and BrandId='" + BrandId + "'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, sort, "True", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UId = int.Parse(dic["Id"].ToString());
+                var Info = GetMonthTradeForBrand(UId, start, end, BrandId);
+
+                dic["TotalAmtfc"] = Convert.ToDecimal(Info["TotalAmtfc"].ToString()) + Convert.ToDecimal(Info["YAmtfc"].ToString());
+                dic["DAmtfc"] = Convert.ToDecimal(Info["DAmtfc"].ToString());
+                dic["JAmtfc"] = Convert.ToDecimal(Info["JAmtfc"].ToString());
+                dic["JfAmtfc"] = Convert.ToDecimal(Info["JfAmtfc"].ToString());
+                dic["JCountfc"] = Convert.ToInt32(Info["JCountfc"].ToString());
+                dic["YAmtfc"] = Convert.ToDecimal(Info["YAmtfc"].ToString());
+
+                dic["TotalAmtwd"] = Convert.ToDecimal(Info["TotalAmtwd"].ToString()) + Convert.ToDecimal(Info["YAmtwd"].ToString());
+                dic["DAmtwd"] = Convert.ToDecimal(Info["DAmtwd"].ToString());
+                dic["JAmtwd"] = Convert.ToDecimal(Info["JAmtwd"].ToString());
+                dic["JfAmtwd"] = Convert.ToDecimal(Info["JfAmtwd"].ToString());
+                dic["JCountwd"] = Convert.ToInt32(Info["JCountwd"].ToString());
+                dic["YAmtwd"] = Convert.ToDecimal(Info["YAmtwd"].ToString());
+
+                dic["BCount"] = Info["BCount"].ToString();
+                dic["ACount"] = Info["ACount"].ToString();
+
+            }
+
+            //扶持期
+            decimal TotalAmtfc = 0;
+            decimal DAmtfc = 0;
+            decimal JAmtfc = 0;
+            decimal JfAmtfc = 0;
+            int JCountfc = 0;
+            decimal YAmtfc = 0;
+
+            //稳定期
+            decimal TotalAmtwd = 0;
+            decimal DAmtwd = 0;
+            decimal JAmtwd = 0;
+            decimal JfAmtwd = 0;
+            int JCountwd = 0;
+            decimal YAmtwd = 0;
+
+            // int BCount = 0;
+            // int ACount = 0;
+
+            WebCMSEntities db = new WebCMSEntities();
+            Dictionary<string, object> other = new Dictionary<string, object>();
+            DataTable dt = OtherMySqlConn.dtable("select Sum(HelpDirectTradeAmt + HelpDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                TotalAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                DAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitTradeAmt),Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                JAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                JfAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                JCountfc = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                YAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectTradeAmt + NotHelpDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                TotalAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                DAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitTradeAmt),Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                JAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                JfAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='self' and UserId= '" + ParentId + "'" + con);
+            if (dt.Rows.Count > 0)
+            {
+                YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            // dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=0 AND UserId= '" + ParentId + "'" + cons);
+            // if (dt.Rows.Count > 0)
+            // {
+            //     BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            // }
+            // dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=1 AND UserId= '" + ParentId + "'" + cons);
+            // if (dt.Rows.Count > 0)
+            // {
+            //     ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            // }
+
+            other.Add("TotalAmtfc", TotalAmtfc);
+            other.Add("DAmtfc", DAmtfc);
+            other.Add("JAmtfc", JAmtfc);
+            other.Add("JfAmtfc", JfAmtfc);
+            other.Add("JCountfc", JCountfc);
+            other.Add("YAmtfc", YAmtfc);
+
+            other.Add("TotalAmtwd", TotalAmtwd);
+            other.Add("DAmtwd", DAmtwd);
+            other.Add("JAmtwd", JAmtwd);
+            other.Add("JfAmtwd", JfAmtwd);
+            other.Add("JCountwd", JCountwd);
+            other.Add("YAmtwd", YAmtwd);
+
+            // other.Add("BCount", BCount);
+            // other.Add("ACount", ACount);
+            db.Dispose();
+            obj.Add("other", other);
+
+            return Json(obj);
+        }
+
+        public Dictionary<string, object> GetMonthTradeForBrand(int UserId, string sTradeDate, string eTradeDate, int BrandId)
+        {
+            string condition = " and Status>-1";
+            string cons = " and Status>=-1";
+
+            //产品类型
+            if (!string.IsNullOrEmpty(BrandId.ToString()) && BrandId > 0)
+            {
+                condition += " and BrandId =" + BrandId;
+                cons += " and BrandId =" + BrandId;
+            }
+            //创客Id
+            if (!string.IsNullOrEmpty(UserId.ToString()))
+            {
+                condition += " and UserId =" + UserId;
+            }
+            //开始时间
+            if (!string.IsNullOrEmpty(sTradeDate))
+            {
+                condition += " and TradeDate >=" + Convert.ToInt32(sTradeDate);
+                cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') >=" + Convert.ToInt32(sTradeDate);
+            }
+            //结束时间
+            if (!string.IsNullOrEmpty(eTradeDate))
+            {
+                condition += " and TradeDate <=" + Convert.ToInt32(eTradeDate);
+                cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') <=" + Convert.ToInt32(eTradeDate);
+            }
+
+            //扶持期
+            decimal TotalAmtfc = 0;
+            decimal DAmtfc = 0;
+            decimal JAmtfc = 0;
+            decimal JfAmtfc = 0;
+            int JCountfc = 0;
+            decimal YAmtfc = 0;
+
+            //稳定期
+            decimal TotalAmtwd = 0;
+            decimal DAmtwd = 0;
+            decimal JAmtwd = 0;
+            decimal JfAmtwd = 0;
+            int JCountwd = 0;
+            decimal YAmtwd = 0;
+
+            int BCount = 0;
+            int ACount = 0;
+
+            WebCMSEntities db = new WebCMSEntities();
+            Dictionary<string, object> obj = new Dictionary<string, object>();
+            DataTable dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt + HelpNonDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                TotalAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                DAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectDebitTradeAmt),Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                JAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                JfAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                JCountfc = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                YAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt + NotHelpNonDirectDebitTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                TotalAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                DAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectDebitTradeAmt),Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                JAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                JfAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='team'" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND UserId= '" + UserId + "'" + cons);
+            if (dt.Rows.Count > 0)
+            {
+                BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE ActivationState=1 AND UserId= '" + UserId + "'" + cons);
+            if (dt.Rows.Count > 0)
+            {
+                ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+
+
+            obj.Add("TotalAmtfc", TotalAmtfc);
+            obj.Add("DAmtfc", DAmtfc);
+            obj.Add("JAmtfc", JAmtfc);
+            obj.Add("JfAmtfc", JfAmtfc);
+            obj.Add("JCountfc", JCountfc);
+            obj.Add("YAmtfc", YAmtfc);
+
+            obj.Add("TotalAmtwd", TotalAmtwd);
+            obj.Add("DAmtwd", DAmtwd);
+            obj.Add("JAmtwd", JAmtwd);
+            obj.Add("JfAmtwd", JfAmtwd);
+            obj.Add("JCountwd", JCountwd);
+            obj.Add("YAmtwd", YAmtwd);
+
+            obj.Add("BCount", BCount);
+            obj.Add("ACount", ACount);
+            db.Dispose();
+            return obj;
+        }
+
+        #endregion
     }
 }

+ 6 - 6
Areas/Admin/Views/BsServer/Advertisment/Add.cshtml

@@ -66,7 +66,7 @@
                     <div class="layui-form-item layui-form-text">
                         <label class="layui-form-label">内容</label>
                         <div class="layui-input-block">
-<textarea class="layui-textarea" id="Contents" name="Contents" placeholder="请输入内容" style="width:100%;height:500px;"></textarea>
+                            <textarea class="layui-textarea" id="Contents" name="Contents" placeholder="请输入内容" style="width:100%;height:500px;"></textarea>
                         </div>
                     </div>
                     <div class="layui-form-item">
@@ -109,7 +109,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -206,10 +206,10 @@
 
 
             //上传文件
-            WebUploadJs('PicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("AdvertismentPicPath"))),  function (filename) {
-$('#PicPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
-$('#PicPath').val(filename);
-});
+            WebUploadJs('PicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("AdvertismentPicPath"))),  function (filename) {
+                $('#PicPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
+                $('#PicPath').val(filename);
+            });
 
 
             //穿梭框

+ 2 - 2
Areas/Admin/Views/BsServer/Advertisment/Edit.cshtml

@@ -117,7 +117,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -213,7 +213,7 @@
 
 
             //上传文件
-            WebUploadJs('PicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("AdvertismentPicPath"))),  function (filename) {
+            WebUploadJs('PicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("AdvertismentPicPath"))),  function (filename) {
                 $('#PicPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
                 $('#PicPath').val(filename);
             });

+ 2 - 2
Areas/Admin/Views/BsServer/Col/Add.cshtml

@@ -106,7 +106,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -202,7 +202,7 @@
 
 
             //上传文件
-            WebUploadJs('ColPicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("ColColPicPath"))),  function (filename) {
+            WebUploadJs('ColPicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("ColColPicPath"))),  function (filename) {
 $('#ColPicPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
 $('#ColPicPath').val(filename);
 });

+ 2 - 2
Areas/Admin/Views/BsServer/Col/Edit.cshtml

@@ -114,7 +114,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -211,7 +211,7 @@
 
 
             //上传文件
-            WebUploadJs('ColPicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("ColColPicPath"))),  function (filename) {
+            WebUploadJs('ColPicPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("ColColPicPath"))),  function (filename) {
                 $('#ColPicPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
                 $('#ColPicPath').val(filename);
             });

+ 1 - 1
Areas/Admin/Views/BsServer/MsgBlackList/Add.cshtml

@@ -84,7 +84,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgBlackList/Edit.cshtml

@@ -89,7 +89,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 2 - 2
Areas/Admin/Views/BsServer/MsgPersonal/Add.cshtml

@@ -120,7 +120,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -284,7 +284,7 @@
             
 
             //上传文件
-            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPersonalBgPic"))), function (filename) {
+            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPersonalBgPic"))), function (filename) {
 $('#BgPicImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
 $('#BgPic').val(filename);
 });

+ 3 - 3
Areas/Admin/Views/BsServer/MsgPersonal/Edit.cshtml

@@ -1,4 +1,4 @@
-@using MySystem.BsModels;
+@using MySystem.Models;
 @{MsgPersonal editData = ViewBag.data as MsgPersonal;}
 @{
     string RightInfo = ViewBag.RightInfo as string;
@@ -139,7 +139,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -288,7 +288,7 @@
             
 
             //上传文件
-            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPersonalBgPic"))), function (filename) {
+            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPersonalBgPic"))), function (filename) {
 $('#BgPicImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
 $('#BgPic').val(filename);
 });

+ 2 - 2
Areas/Admin/Views/BsServer/MsgPlacard/Add.cshtml

@@ -146,7 +146,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -340,7 +340,7 @@
 
 
             //上传文件
-            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPlacardBgPic"))), function (filename) {
+            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPlacardBgPic"))), function (filename) {
             $('#BgPicImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
             $('#BgPic').val(filename);
             });

+ 2 - 2
Areas/Admin/Views/BsServer/MsgPlacard/Detail.cshtml

@@ -1,4 +1,4 @@
-@using MySystem.BsModels;
+@using MySystem.Models;
 @{MsgPlacard editData = ViewBag.data as MsgPlacard;}
 @{
     string RightInfo = ViewBag.RightInfo as string;
@@ -50,7 +50,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 3 - 3
Areas/Admin/Views/BsServer/MsgPlacard/Edit.cshtml

@@ -1,4 +1,4 @@
-@using MySystem.BsModels;
+@using MySystem.Models;
 @{MsgPlacard editData = ViewBag.data as MsgPlacard;}
 @{
     string RightInfo = ViewBag.RightInfo as string;
@@ -166,7 +166,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
@@ -379,7 +379,7 @@
 
 
             //上传文件
-            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPlacardBgPic"))), function (filename) {
+            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgPlacardBgPic"))), function (filename) {
             $('#BgPicImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
             $('#BgPic').val(filename);
             });

+ 1 - 1
Areas/Admin/Views/BsServer/MsgPlacardRead/Add.cshtml

@@ -58,7 +58,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgPlacardRead/Edit.cshtml

@@ -61,7 +61,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgPush/Add.cshtml

@@ -103,7 +103,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgPush/Edit.cshtml

@@ -108,7 +108,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgSms/Add.cshtml

@@ -40,7 +40,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgSms/Edit.cshtml

@@ -43,7 +43,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgSmsSet/Add.cshtml

@@ -81,7 +81,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

+ 1 - 1
Areas/Admin/Views/BsServer/MsgSmsSet/Edit.cshtml

@@ -85,7 +85,7 @@
     </div>
 
     <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>

Некоторые файлы не были показаны из-за большого количества измененных файлов