Quellcode durchsuchen

整理
修改数据库配置

lcl vor 2 Jahren
Ursprung
Commit
e6e406701d
72 geänderte Dateien mit 9 neuen und 17632 gelöschten Zeilen
  1. BIN
      Areas/Api/Controllers/.DS_Store
  2. BIN
      Areas/Api/Controllers/v1/.DS_Store
  3. BIN
      Areas/Api/Controllers/v1/Activity/.DS_Store
  4. 0 148
      Areas/Api/Controllers/v1/Activity/ActivityProgressBarController.cs
  5. 0 75
      Areas/Api/Controllers/v1/Activity/ActivityRecommendKingController.cs
  6. 0 311
      Areas/Api/Controllers/v1/Activity/ActivityRedPackageJoinsController.cs
  7. 0 110
      Areas/Api/Controllers/v1/Activity/ActivityRedPackageTop10Controller.cs
  8. 0 94
      Areas/Api/Controllers/v1/Activity/RecommendTradeSummaryController.cs
  9. 0 104
      Areas/Api/Controllers/v1/MainServer/APPSetInfoController.cs
  10. 0 78
      Areas/Api/Controllers/v1/MainServer/AppVersionController.cs
  11. 0 174
      Areas/Api/Controllers/v1/MainServer/HkController.cs
  12. 0 157
      Areas/Api/Controllers/v1/MainServer/JkController.cs
  13. 0 155
      Areas/Api/Controllers/v1/MainServer/KdbController.cs
  14. 0 142
      Areas/Api/Controllers/v1/MainServer/LdController.cs
  15. 0 149
      Areas/Api/Controllers/v1/MainServer/LisController.cs
  16. 0 184
      Areas/Api/Controllers/v1/MainServer/LsController.cs
  17. 0 186
      Areas/Api/Controllers/v1/MainServer/PageUpdateInfoController.cs
  18. 0 135
      Areas/Api/Controllers/v1/MainServer/PosMachinesFeeChangeRecordController.cs
  19. 0 144
      Areas/Api/Controllers/v1/MainServer/SftController.cs
  20. 0 220
      Areas/Api/Controllers/v1/MainServer/StoreHouseController.cs
  21. 0 936
      Areas/Api/Controllers/v1/MainServer/StoreStockChangeController.cs
  22. 0 81
      Areas/Api/Controllers/v1/MainServer/SysRechargeRecordController.cs
  23. 0 390
      Areas/Api/Controllers/v1/MainServer/SystemSetController.cs
  24. 0 591
      Areas/Api/Controllers/v1/MainServer/UserTradeDaySummaryController.cs
  25. 0 1
      Areas/Api/Controllers/v1/MainServer/UsersController.cs
  26. 0 364
      Areas/Api/Controllers/v1/Pos/ActiveRewardController.cs
  27. 0 80
      Areas/Api/Controllers/v1/Pos/AppVideoController.cs
  28. 0 82
      Areas/Api/Controllers/v1/Pos/AppVideoListController.cs
  29. 0 533
      Areas/Api/Controllers/v1/Pos/ApplyMachineController.cs
  30. 0 240
      Areas/Api/Controllers/v1/Pos/DepositQueryController.cs
  31. 0 149
      Areas/Api/Controllers/v1/Pos/FluxProfitSummaryController.cs
  32. 0 183
      Areas/Api/Controllers/v1/Pos/KqProductsController.cs
  33. 0 1039
      Areas/Api/Controllers/v1/Pos/LargeDataScreenController.cs
  34. 0 156
      Areas/Api/Controllers/v1/Pos/LeaderReserveRecordController.cs
  35. 0 851
      Areas/Api/Controllers/v1/Pos/MachineApplyController.cs
  36. 0 358
      Areas/Api/Controllers/v1/Pos/MachineChangeController.cs
  37. 0 124
      Areas/Api/Controllers/v1/Pos/MerchantDepositReturnsController.cs
  38. 0 525
      Areas/Api/Controllers/v1/Pos/MerchantInfoController.cs
  39. 0 123
      Areas/Api/Controllers/v1/Pos/OpenRewardController.cs
  40. 0 392
      Areas/Api/Controllers/v1/Pos/OrdersController.cs
  41. 0 156
      Areas/Api/Controllers/v1/Pos/PosCouponOrdersController.cs
  42. 0 191
      Areas/Api/Controllers/v1/Pos/PosCouponRecordController.cs
  43. 0 137
      Areas/Api/Controllers/v1/Pos/PosCouponsController.cs
  44. 0 502
      Areas/Api/Controllers/v1/Pos/PosMachinesController.cs
  45. 0 110
      Areas/Api/Controllers/v1/Pos/PosMachinesTwoController.cs
  46. 0 875
      Areas/Api/Controllers/v1/Pos/PosMerchantInfoController.cs
  47. 0 705
      Areas/Api/Controllers/v1/Pos/PreSendStockDetailController.cs
  48. 0 140
      Areas/Api/Controllers/v1/Pos/ProfitRewardRecordController.cs
  49. 0 814
      Areas/Api/Controllers/v1/Pos/RecycMachineOrderController.cs
  50. 0 79
      Areas/Api/Controllers/v1/Pos/SetMerchantTypeRecordController.cs
  51. 0 346
      Areas/Api/Controllers/v1/Pos/SmallStoreHouseController.cs
  52. 0 95
      Areas/Api/Controllers/v1/Pos/StoreChangeHistoryController.cs
  53. 0 214
      Areas/Api/Controllers/v1/Pos/StoreHouseAmountPromissController.cs
  54. 0 115
      Areas/Api/Controllers/v1/Pos/StoreHouseAmountRecordController.cs
  55. 0 252
      Areas/Api/Controllers/v1/Pos/StoreMachineApplyController.cs
  56. 0 121
      Areas/Api/Controllers/v1/Pos/StoreSnActivateSummaryController.cs
  57. 0 247
      Areas/Api/Controllers/v1/Pos/TradeDaySummaryController.cs
  58. 0 80
      Areas/Api/Controllers/v1/Pos/UserInviteFriendsController.cs
  59. 0 117
      Areas/Api/Controllers/v1/Pos/UserProfitSubsidySummaryController.cs
  60. 0 154
      Areas/Api/Controllers/v1/Pos/UserStoreChangeController.cs
  61. 0 528
      Areas/Api/Controllers/v1/Pos/UserTradeDaySummaryController.cs
  62. 0 367
      Areas/Api/Controllers/v1/School/SchoolMakerStudyController.cs
  63. 0 130
      Areas/Api/Controllers/v1/School/SchoolMaterialsController.cs
  64. 0 127
      Areas/Api/Controllers/v1/School/SchoolMorningMeetController.cs
  65. 0 112
      Areas/Api/Controllers/v1/School/SchoolMorningMeetLogController.cs
  66. 0 104
      Areas/Api/Controllers/v1/School/SchoolSignInDataController.cs
  67. 0 103
      Areas/Api/Controllers/v1/School/SchoolSignInRecordController.cs
  68. 0 96
      Areas/Api/Controllers/v1/School/SchoolSignInTaskController.cs
  69. 0 80
      Areas/Api/Controllers/v1/School/SchoolSignInTaskRecordController.cs
  70. 0 179
      Areas/Api/Controllers/v2/TradeDaySummaryController.cs
  71. 0 581
      Areas/Api/Controllers/v2/UserTradeDaySummaryController.cs
  72. 9 11
      appsettings.json

BIN
Areas/Api/Controllers/.DS_Store


BIN
Areas/Api/Controllers/v1/.DS_Store


BIN
Areas/Api/Controllers/v1/Activity/.DS_Store


+ 0 - 148
Areas/Api/Controllers/v1/Activity/ActivityProgressBarController.cs

@@ -1,148 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class ActivityProgressBarController : BaseController
-    {
-        public ActivityProgressBarController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 创客-翻倍活动
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public Dictionary<string, object> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var lastmonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
-            var thismonth = DateTime.Now.ToString("yyyyMM");
-            DateTime start = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date;
-            DateTime end = DateTime.Now.AddDays(16 - DateTime.Now.Day).Date;
-            // DateTime end = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1);//本月月底
-
-            int IsBuy = 0;//是否参与(0-否 1-是)
-            Orders od = maindb.Orders.FirstOrDefault(m => m.UserId == UserId && m.TotalPrice == 88 && m.Status > 0 && m.CreateDate >= start && m.CreateDate <= end);
-            if (od != null)
-            {
-                IsBuy = 1;
-                string UserIdString = "," + UserId + ",";
-                List<Users> users = maindb.Users.Where(m => m.ParentNav.Contains(UserIdString) || m.Id == UserId).ToList();
-                List<int> uids = new List<int>();
-                List<int> uids2 = new List<int>();
-                foreach (var user in users)
-                {
-                    uids.Add(user.Id);
-                }
-                var orders = maindb.Orders.Select(m => new { m.Id, m.UserId, m.TotalPrice, m.Status, m.CreateDate }).Where(m => m.TotalPrice == 88 && m.Status > 0 && uids.Contains(m.UserId) && m.CreateDate >= start && m.CreateDate <= end).ToList();
-                foreach (var order in orders)
-                {
-                    uids2.Add(order.UserId);
-                }
-                users = users.Where(m => uids2.Contains(m.Id)).ToList();
-                List<ProgressUserList> list = new List<ProgressUserList>();
-                foreach (Users user in users)
-                {
-                    int IsOk = 0;//是否达标(0-否 1-是)
-                    decimal lastMonthAmt = maindb.TradeDaySummary.Where(m => m.TradeMonth == lastmonth && m.SeoTitle == "team" && m.UserId == user.Id).Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt + m.ProfitNonDirectTradeAmt);
-                    decimal thisMonthAmt = maindb.TradeDaySummary.Where(m => m.TradeMonth == thismonth && m.SeoTitle == "team" && m.UserId == user.Id).Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt + m.ProfitNonDirectTradeAmt);
-                    if (thisMonthAmt >= lastMonthAmt * 2)
-                    {
-                        IsOk = 1;
-                    }
-                    ProgressUserList item = new ProgressUserList()
-                    {
-                        LastMonth = lastMonthAmt,
-                        ThisMonth = thisMonthAmt,
-                        UserId = user.Id,
-                        IsOk = IsOk,
-                        ParentNav = user.ParentNav
-                    };
-                    list.Add(item);
-                }
-                list = list.OrderBy(m => m.ParentNav).ToList();
-                int index = 0;
-                decimal selfTrade = 0; // 自己的本月交易额
-                decimal lastTrade = 0; // 自己的上月交易额
-                decimal totalTrade = 0; // 自己的本月目标交易额
-                string selfNav = ""; // 自己的ParentNav
-                List<string> ParentNavs = new List<string>();
-                if (list.Count > 0)
-                {
-                    foreach (ProgressUserList sub in list)
-                    {
-                        index += 1;
-                        if (index == 1)
-                        {
-                            selfTrade = sub.ThisMonth;
-                            lastTrade = sub.LastMonth;
-                            totalTrade = lastTrade * 2;
-                            selfNav = sub.ParentNav + "," + sub.UserId + ",";
-                        }
-                        else
-                        {
-                            bool op = true; //是否满足条件
-                            string ParentNav = sub.ParentNav + "," + sub.UserId + ",";
-                            foreach (string subNav in ParentNavs)
-                            {
-                                if (ParentNavs.Contains(ParentNav) && ParentNav != subNav)
-                                {
-                                    op = false;
-                                }
-                            }
-                            if (op)
-                            {
-                                if (sub.IsOk == 1)
-                                {
-                                    selfTrade -= sub.ThisMonth;
-                                    totalTrade -= sub.ThisMonth;
-                                }
-                            }
-                            ParentNavs.Add(ParentNav);
-                        }
-                    }
-                }
-                if (lastTrade * 2 < 2000000 || selfTrade == 0 || totalTrade < 2000000)
-                {
-                    totalTrade = 2000000;
-                }
-                Obj.Add("IsBuy", IsBuy);
-                Obj.Add("SelfTrade", selfTrade);
-                Obj.Add("LastTrade", lastTrade);
-                Obj.Add("TotalTrade", totalTrade);
-                return Obj;
-            }
-            else
-            {
-                Obj.Add("IsBuy", IsBuy);
-                return Obj;
-            }
-
-        }
-        #endregion
-
-    }
-}

+ 0 - 75
Areas/Api/Controllers/v1/Activity/ActivityRecommendKingController.cs

@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class ActivityRecommendKingController : BaseController
-    {
-        public ActivityRecommendKingController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 创客-开机王
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> Obj = ListDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj, Other = Other });
-        }
-
-        public List<Dictionary<string, object>> ListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            int SkipNum = PageSize * (PageNum - 1);
-            var days = (int)DateTime.Now.DayOfWeek - 1;
-            DateTime start = DateTime.Parse(DateTime.Now.AddDays(-days).ToString("yyyy-MM-dd") + " 00:00:00");
-            DateTime end = start.AddDays(6);
-            Other = new Dictionary<string, object>();
-            Other.Add("StratTime", start.ToString("yyyy-MM-dd"));
-            Other.Add("EndTime", end.ToString("yyyy-MM-dd"));
-            string check = RedisDbconn.Instance.Get<string>("ActivityRecommendKing");
-            if(!string.IsNullOrEmpty(check))
-            {
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(check);
-            }
-            var a = Convert.ToInt32(start.ToString("yyyyMMdd"));
-            var b = Convert.ToInt32(end.ToString("yyyyMMdd"));
-            DataTable dt = OtherMySqlConn.dtable("SELECT UserId,sum(ActiveBuddyMerStatus) Sum FROM UserTradeMonthSummary where SeoKeyword >= '" + a + "' and SeoKeyword <= '" + b + "'and SeoTitle='self' GROUP BY UserId ORDER BY Sum DESC LIMIT " + SkipNum + "," + PageSize + "");
-            foreach (DataRow item in dt.Rows)
-            {
-                Dictionary<string, object> obj = new Dictionary<string, object>();
-                var query = maindb.Users.FirstOrDefault(m => m.Id == (int)item["UserId"]);
-                obj.Add("HeadPhoto", DefaultPic(query.HeadPhoto));
-                obj.Add("RealName", PublicFunction.SetSensitiveName(query.RealName));
-                obj.Add("MakerCode", query.MakerCode);
-                obj.Add("OpenCount", int.Parse(item["Sum"].ToString()));
-                Obj.Add(obj);
-            }
-            RedisDbconn.Instance.Set("ActivityRecommendKing", Newtonsoft.Json.JsonConvert.SerializeObject(Obj), 1800);
-            return Obj;
-
-        }
-        #endregion
-
-    }
-}

+ 0 - 311
Areas/Api/Controllers/v1/Activity/ActivityRedPackageJoinsController.cs

@@ -1,311 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class ActivityRedPackageJoinsController : BaseController
-    {
-        public ActivityRedPackageJoinsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-红包活动-参与记录
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<ActivityRedPackageJoins> query = maindb.ActivityRedPackageJoins.Where(m => m.UserId == UserId);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ActivityDate", subdata.ActivityDate); //期数
-                curData.Add("PrizeAmt", subdata.PrizeAmt); //中奖金额
-                curData.Add("Status", subdata.Status);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-红包活动-获取创客当前信息
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 22:00:00");
-            string DateString = DateTime.Now.ToString("yyyyMMdd");
-            string PreDateString = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
-            string PreInfoString = RedisDbconn.Instance.Get<string>("PreInfoString:" + PreDateString);
-            if(string.IsNullOrEmpty(PreInfoString))
-            {
-                bool checkPre = maindb.ActivityRedPackageStock.Any(m => m.ActivityDate == PreDateString);
-                if (checkPre)
-                {
-                    ActivityRedPackageStock preInfo = maindb.ActivityRedPackageStock.Where(m => m.ActivityDate == PreDateString).OrderByDescending(m => m.PrizeAmt).FirstOrDefault();
-                    if (preInfo != null)
-                    {
-                        Users user = maindb.Users.FirstOrDefault(m => m.Id == preInfo.UserId) ?? new Users();
-                        string PreMakerCode = user.MakerCode;
-                        string PreRealName = user.RealName;
-                        decimal PrePrizeAmt = preInfo.PrizeAmt;
-                        RedisDbconn.Instance.Set("PreInfoString:" + PreDateString, PreMakerCode + "|" + PreRealName + "|" + PrePrizeAmt);
-                        RedisDbconn.Instance.SetExpire("PreInfoString:" + PreDateString, 7200);
-                    }
-                }
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Dictionary<string, object> MyTopInfo1 = new Dictionary<string, object>();
-            Dictionary<string, object> MyTopInfo2 = new Dictionary<string, object>();
-            int GetStatus = 0; //0-未达标,1-可领取,2-已领取,3-未开始,4-抢光了
-            int StaStatus = 0;
-            int PreStatus = 0;
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.BuyUserId == UserId && m.ActivationState == 1 && m.ActivationTime >= today);
-            if (pos != null)
-            {
-                StaStatus = 1;
-                RedisDbconn.Instance.Set("CheckStaStatus:" + UserId + ":" + DateString, StaStatus.ToString());
-                RedisDbconn.Instance.SetExpire("CheckStaStatus:" + UserId + ":" + DateString, 7200);
-                if (DateTime.Now >= start)
-                {
-                    bool check = maindb.ActivityRedPackageStock.Any(m => m.ActivityDate == DateString && m.UserId == 0);
-                    if (check)
-                    {
-                        bool query = maindb.ActivityRedPackageStock.Any(m => m.UserId == UserId && m.ActivityDate == DateString);
-                        if (query)
-                        {
-                            GetStatus = 2;
-                        }
-                        else
-                        {
-                            GetStatus = 1;
-                        }
-                    }
-                    else
-                    {
-                        GetStatus = 4;
-                    }
-                }
-                else
-                {
-                    GetStatus = 3;
-                }
-            }
-            else
-            {
-                GetStatus = 0;
-            }
-            bool pre = maindb.ActivityRedPackageJoins.Any(m => m.UserId == UserId && m.ActivityDate == PreDateString);
-            PreStatus = pre ? 1 : 0;
-            Users myInfo = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-            MyTopInfo1.Add("MakerCode", myInfo.MakerCode);
-            MyTopInfo1.Add("RealName", myInfo.RealName);
-            MyTopInfo2.Add("MakerCode", myInfo.MakerCode);
-            MyTopInfo2.Add("RealName", myInfo.RealName);
-            ActivityRedPackageTop10 mytop1 = maindb.ActivityRedPackageTop10.FirstOrDefault(m => m.UserId == UserId && m.Kind == 1) ?? new ActivityRedPackageTop10();
-            MyTopInfo1.Add("Num", mytop1.Sort);
-            MyTopInfo1.Add("Data", mytop1.PrizeAmt);
-            ActivityRedPackageTop10 mytop2 = maindb.ActivityRedPackageTop10.FirstOrDefault(m => m.UserId == UserId && m.Kind == 2) ?? new ActivityRedPackageTop10();
-            MyTopInfo2.Add("Num", mytop2.Sort);
-            MyTopInfo2.Add("Data", mytop2.TimeNum);
-            Obj.Add("GetStatus", GetStatus); //领取状态
-            Obj.Add("StaStatus", StaStatus); //达标状态
-            Obj.Add("PreStatus", PreStatus); //上期参与状态
-            Obj.Add("MyTopInfo1", MyTopInfo1); //我的排行信息
-            Obj.Add("MyTopInfo2", MyTopInfo2);
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-红包活动-领取奖励
-        [Authorize]
-        public JsonResult GetPrize(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = GetPrizeDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson GetPrizeDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 22:00:00");
-            DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            string ActivityDate = DateTime.Now.ToString("yyyyMMdd");
-            string tmpCheck = RedisDbconn.Instance.Get<string>("GetPrizeFlag:" + UserId + ":" + ActivityDate);
-            if(!string.IsNullOrEmpty(tmpCheck))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请无频繁操作,谢谢合作" };
-            }
-            RedisDbconn.Instance.Set("GetPrizeFlag:" + UserId + ":" + ActivityDate, "wait");
-            RedisDbconn.Instance.SetExpire("GetPrizeFlag:" + UserId + ":" + ActivityDate, 120);
-            string PreDate = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
-            bool op = false;
-            if (DateTime.Now >= start)
-            {
-                string pos = RedisDbconn.Instance.Get<string>("CheckStaStatus:" + UserId + ":" + ActivityDate);
-                // bool pos = maindb.PosMachinesTwo.Any(m => m.BuyUserId == UserId && m.ActivationState == 1 && m.ActivationTime >= today);
-                if (pos == "1")
-                {
-                    bool check = maindb.ActivityRedPackageStock.Any(m => m.ActivityDate == ActivityDate && m.UserId == 0);
-                    if (check)
-                    {
-                        check = maindb.ActivityRedPackageStock.Any(m => m.UserId == UserId && m.ActivityDate == ActivityDate);
-                        if (!check)
-                        {
-                            op = true;
-                        }
-                    }
-                }
-            }
-            bool IsNull = maindb.ActivityRedPackageStock.Any(m => m.ActivityDate == ActivityDate && m.UserId ==0);//判断是否存在数据
-            if (!IsNull)
-            {
-                return new AppResultJson() { Status = "2", Info = "已抢光" };
-            }
-            if (!op)
-            {
-                return new AppResultJson() { Status = "-1", Info = "领取失败" };
-            }
-            
-            Dictionary<string, object> Obj = new Dictionary<string, object>();            
-            List<ActivityRedPackageStock> list = maindb.ActivityRedPackageStock.Where(m => m.ActivityDate == ActivityDate && m.UserId == 0).ToList();
-            ActivityRedPackageStock edit = new ActivityRedPackageStock();
-            if(list.Count == 200 - 17 || list.Count == 200 - 27 || list.Count == 200 - 37 || list.Count == 200 - 47 || list.Count == 200 - 57 || list.Count == 200 - 67)
-            {
-                edit = list.FirstOrDefault(m => m.PrizeAmt == 88.88M && m.UserId == 0);
-            }
-            if(edit == null)
-            {
-                edit = new ActivityRedPackageStock();
-            }
-            if(edit.Id == 0)
-            {
-                edit = list[function.get_Random(0,list.Count-1)];
-            }
-            edit.UserId = UserId;
-            edit.UpdateDate = DateTime.Now;
-            ActivityRedPackageJoins query = maindb.ActivityRedPackageJoins.Add(new ActivityRedPackageJoins()
-            {
-                CreateDate = DateTime.Now, //创建时间
-                Status = 1,
-                UserId = UserId, //创客
-                ActivityDate = ActivityDate, //期数
-                PrizeAmt = edit.PrizeAmt,
-            }).Entity;
-            maindb.SaveChanges();
-            
-            RedisDbconn.Instance.AddList("RedPrizeQueue", query.Id.ToString());
-            Obj.Add("PrizeAmt", query.PrizeAmt); //中奖金额
-
-            string PreMakerCode = "";
-            string PreRealName = "";
-            decimal PrePrizeAmt = 0;
-            string PreInfoString = RedisDbconn.Instance.Get<string>("PreInfoString:" + PreDate);
-            if(string.IsNullOrEmpty(PreInfoString))
-            {
-                bool checkPre = maindb.ActivityRedPackageStock.Any(m => m.ActivityDate == PreDate);
-                if (checkPre)
-                {
-                    ActivityRedPackageStock preInfo = maindb.ActivityRedPackageStock.Where(m => m.ActivityDate == PreDate).OrderByDescending(m => m.PrizeAmt).FirstOrDefault();
-                    if (preInfo != null)
-                    {
-                        Users user = maindb.Users.FirstOrDefault(m => m.Id == preInfo.UserId) ?? new Users();
-                        PreMakerCode = user.MakerCode;
-                        PreRealName = user.RealName;
-                        PrePrizeAmt = preInfo.PrizeAmt;
-                        RedisDbconn.Instance.Set("PreInfoString:" + PreDate, PreMakerCode + "|" + PreRealName + "|" + PrePrizeAmt);
-                        RedisDbconn.Instance.SetExpire("PreInfoString:" + PreDate, 7200);
-                    }
-                }
-            }
-            else
-            {
-                string[] datalist = PreInfoString.Split('|');
-                PreMakerCode = datalist[0];
-                PreRealName = datalist[1];
-                PrePrizeAmt = decimal.Parse(datalist[2]);
-            }
-            Dictionary<string, object> PreInfo = new Dictionary<string, object>();
-            PreInfo.Add("MakerCode", PreMakerCode);
-            PreInfo.Add("RealName", PreRealName);
-            PreInfo.Add("PrizeAmt", PrePrizeAmt);
-            Obj.Add("PreInfo", PreInfo);
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 110
Areas/Api/Controllers/v1/Activity/ActivityRedPackageTop10Controller.cs

@@ -1,110 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class ActivityRedPackageTop10Controller : BaseController
-    {
-        public ActivityRedPackageTop10Controller(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-红包活动-排行榜
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString())); //类别
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<ActivityRedPackageTop10> query = maindb.ActivityRedPackageTop10.Where(m => m.Kind == Kind);
-            if(Kind == 1)
-            {
-                query = query.OrderByDescending(m => m.PrizeAmt).ThenBy(m => m.Sort);
-            }
-            else if(Kind == 2)
-            {
-                query = query.OrderByDescending(m => m.TimeNum).ThenBy(m => m.Sort);
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("UserId", RelationClass.GetUsersInfo(subdata.UserId)); //创客
-                Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == subdata.UserId) ?? new Users();
-                UserInfo.Add("RealName", UsersData.RealName); //真实姓名
-                UserInfo.Add("MakerCode", UsersData.MakerCode); //创客编号
-                curData.Add("UserInfo", UserInfo);
-                curData.Add("Num", subdata.Sort); //排行名次
-                if(Kind == 1)
-                {
-                    curData.Add("Data", subdata.PrizeAmt); //金额/次数
-                }
-                else if(Kind == 2)
-                {
-                    curData.Add("Data", subdata.TimeNum); //金额/次数
-                }
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 94
Areas/Api/Controllers/v1/Activity/RecommendTradeSummaryController.cs

@@ -1,94 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class RecommendTradeSummaryController : BaseController
-    {
-        public RecommendTradeSummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-活动-推荐王-创客交易数据
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var recommendDirectUser = maindb.RecommendDirectUser.Where(m => m.UserId == UserId && m.TradeMonth == TradeMonth).ToList();
-            List<int> DirectUser = new List<int>();
-            foreach (var item in recommendDirectUser)
-            {
-                Dictionary<string, object> userInfo = new Dictionary<string, object>();
-                Users users = maindb.Users.FirstOrDefault(m => m.Id == item.DirectUserId)?? new Users();
-                userInfo.Add("HeadPhoto", DefaultPic(users.HeadPhoto));
-                userInfo.Add("Name", PublicFunction.SetSensitiveName(users.RealName));
-                userInfo.Add("MakerCode", users.MakerCode);
-
-                int posCount = maindb.RecommendTradeSummary.Where(m => m.UserId == item.DirectUserId && m.TradeMonth == TradeMonth).Count();
-                var posAmountList = maindb.RecommendTradeSummary.Where(m => m.UserId == item.DirectUserId && m.TradeMonth == TradeMonth).OrderByDescending(m => m.TradeAmount).Take(2).ToList();
-                decimal posAmount = posAmountList.Count > 0 ? posAmountList[0].TradeAmount : 0;
-                decimal posAmount2 = posAmountList.Count > 1 ? posAmountList[1].TradeAmount : 0;
-
-                userInfo.Add("PosCount", posCount);
-                userInfo.Add("PosAmount", posAmount);
-                userInfo.Add("PosAmount2", posAmount2);
-                dataList.Add(userInfo);
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-
-            return dataList;
-        }
-        #endregion
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 104
Areas/Api/Controllers/v1/MainServer/APPSetInfoController.cs

@@ -1,104 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using System.Text.RegularExpressions;
-
-namespace MySystem.Areas.Api.Controllers
-{
-    [Area("Api")]
-    [Route("Api/[controller]/[action]")]
-    public class APPSetInfoController : BaseController
-    {
-        public APPSetInfoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 系统-APP入口数据
-        public JsonResult List(string value)
-        {
-            value = HttpUtility.UrlDecode(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-
-            List<AppBottomNavs> navs = new List<AppBottomNavs>();
-            if (UserId == 1)
-            { 
-                navs = RedisDbconn.Instance.GetList<AppBottomNavs>("AppBottomNavsForStore", 1, 5).OrderByDescending(m => m.Sort).ThenBy(m => m.Id).ToList();
-            }
-            else
-            { 
-                navs = RedisDbconn.Instance.GetList<AppBottomNavs>("AppBottomNavs", 1, 5).OrderByDescending(m => m.Sort).ThenBy(m => m.Id).ToList();
-            }
-            foreach (AppBottomNavs nav in navs)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TextInfo", nav.Title); //文本
-                curData.Add("Icon", nav.NormalIcon.Substring(nav.NormalIcon.IndexOf("/static"))); //图标
-                curData.Add("Icon1", nav.SelectIcon.Substring(nav.SelectIcon.IndexOf("/static"))); //图标1
-                curData.Add("TextColor", nav.NormalTextColor); //文字颜色
-                curData.Add("TextColorSelect", nav.SelectTextColor); //文字选中颜色
-                curData.Add("Url", nav.PageName); //链接地址
-                curData.Add("NoUrlMessage", nav.NoPageHint); //提示信息
-                curData.Add("BgColor", nav.BgColor);
-                dataList.Add(curData);
-            }
-
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = navs.Count });
-        }
-        #endregion
-
-
-
-        private int versionToNumber(string version)
-        {
-            string[] versionlist = version.Split('.');
-            string left = versionlist[0];
-            string mid = versionlist[1];
-            if (mid.Length == 1) mid = "00" + mid;
-            if (mid.Length == 2) mid = "0" + mid;
-            string right = versionlist[2];
-            if (right.Length == 1) right = "00" + right;
-            if (right.Length == 2) right = "0" + right;
-            string result = left + mid + right;
-            return int.Parse(result);
-        }
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 78
Areas/Api/Controllers/v1/MainServer/AppVersionController.cs

@@ -1,78 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class AppVersionController : BaseController
-    {
-        public AppVersionController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商户-检查更新
-        // [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string VersionNum = data["VersionNum"].ToString(); //版本号
-            string ClientType = data["ClientType"].ToString(); //终端类型
-            string Role = data["Role"].ToString(); //角色,1-商户,2-创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            AppVersion query = RedisDbconn.Instance.Get<AppVersion>("AppVersion:Last:" + Role + ":" + ClientType) ?? new AppVersion();
-            if (VersionNum == query.VersionNum)
-            { 
-                return Json(new AppResultJson() { Status = "-1", Info = "已是最新版本", Data = Obj });
-            }
-            Obj.Add("CancelText", query.CancelText);
-            Obj.Add("ConfirmText", query.ConfirmText);
-            Obj.Add("Info", query.Info);
-            Obj.Add("Title", query.Title);
-            Obj.Add("VersionNum", query.VersionNum); //版本号
-            Obj.Add("Status", query.Status); //状态
-            Obj.Add("DownloadUrl", query.DownloadUrl);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 174
Areas/Api/Controllers/v1/MainServer/HkController.cs

@@ -1,174 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class HkController : BaseController
-    {
-        public HkController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 海科-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            Dictionary<string, object> row = new Dictionary<string, object>();
-            row.Add("Id", "100");
-            row.Add("Name", "押99");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "200");
-            row.Add("Name", "押199");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "300");
-            row.Add("Name", "押299");
-            dataList.Add(row);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 海科-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string check = RedisDbconn.Instance.Get<string>("SetHkDepositWait:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "操作频繁,请稍后再试" });
-            }
-            RedisDbconn.Instance.Set("SetHkDepositWait:" + UserId, SnIds);
-            RedisDbconn.Instance.SetExpire("SetHkDepositWait:" + UserId, 120);
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.UserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                var posMer = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                string OldId = "", NewId = "";
-                if (DepositId == "100")
-                {
-                    NewId = pos.BrandId == 8 ? "202207011718129" : "202207011718197";
-                }
-                else if (DepositId == "200")
-                {
-                    NewId = pos.BrandId == 8 ? "747200504467566592" : "747199934126108672";
-                }
-                else if (DepositId == "300")
-                {
-                    NewId = pos.BrandId == 8 ? "747193472108732416" : "747193820156276736";
-                }
-                string content = PublicImportDataService.Instance.QueryActiveForConfigHK(pos.PosSn, pos.BrandId);
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["code"].ToString() == "0")
-                {
-                    OldId = jsonObj["data"]["posMarket"]["id"].ToString();
-                }
-                jsonObj = JsonMapper.ToObject(content);
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + OldId + ":" + NewId, "海科-设置押金-返回报文");
-                content = PublicImportDataService.Instance.SetDepositForHK(pos.PosSn, OldId, NewId, pos.BrandId);
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "海科-设置押金-返回报文");
-                if (content == "fail")
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "设置失败" });
-                }
-                jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["code"].ToString() != "0")
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = jsonObj["msg"].ToString() });
-                }
-                decimal amount = decimal.Parse(DepositId);
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    if (RelationClass.GetKqProductBrandInfo(pos.BrandId) == "立刷云电签")
-                    {
-                        BeforeDeposit = 249;
-                    }
-                    else
-                    {
-                        BeforeDeposit = 299;
-                    }
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                if (pos.BrandId == 8 || pos.BrandId == 9)
-                {
-                    amount -= 1;
-                }
-                pos.PrizeParams = amount.ToString("f0");
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 157
Areas/Api/Controllers/v1/MainServer/JkController.cs

@@ -1,157 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class JkController : BaseController
-    {
-        public JkController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 金控-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();            
-            Dictionary<string, object> row = new Dictionary<string, object>();
-            row.Add("Id", "0");
-            row.Add("Name", "押0");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "99");
-            row.Add("Name", "押99");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "199");
-            row.Add("Name", "押199");
-            dataList.Add(row);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 金控-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string check = RedisDbconn.Instance.Get<string>("SetDepositWait:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            { 
-                return Json(new AppResultJson() { Status = "-1", Info = "操作频繁,请稍后再试" });
-            }
-            RedisDbconn.Instance.Set("SetDepositWait:" + UserId, SnIds);
-            RedisDbconn.Instance.SetExpire("SetDepositWait:" + UserId, 120);
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.UserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + DepositId, "金控-设置押金-返回报文");
-                string content = function.GetWebRequest("http://sp.kexiaoshuang.com/api/test/SetDeposit?sn=" + pos.PosSn + "&num=" + DepositId); //PublicImportDataService.Instance.SetDeposit(pos.PosSn, decimal.Parse(DepositId));
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "金控-设置押金-返回报文");
-                if (content == "fail")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "设置失败" });
-                }
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["code"].ToString() != "000000")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = jsonObj["message"].ToString() });
-                }
-                content = jsonObj["data"].ToString();
-                content = PublicImportDataService.Instance.Decrypt(content);
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "金控-设置押金-返回报文");
-                JsonData contentObj = JsonMapper.ToObject(content);
-                if (contentObj["respCode"].ToString() != "00")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = contentObj["respMsg"].ToString() });
-                }
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    if (RelationClass.GetKqProductBrandInfo(pos.BrandId) == "立刷云电签")
-                    {
-                        BeforeDeposit = 249;
-                    }
-                    else
-                    {
-                        BeforeDeposit = 299;
-                    }
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                decimal amount = decimal.Parse(DepositId);
-                pos.PrizeParams = amount.ToString("f0");
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 155
Areas/Api/Controllers/v1/MainServer/KdbController.cs

@@ -1,155 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class KdbController : BaseController
-    {
-        public KdbController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 开店宝-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            // JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo();
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo()
-        {
-            // JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            string content = RedisDbconn.Instance.Get<string>("KdbDepositList");
-            if (string.IsNullOrEmpty(content))
-            {
-                content = PublicImportDataService.Instance.GetPolicyList();
-                JsonData tops = JsonMapper.ToObject(content);
-                if (tops.Count > 0)
-                {
-                    content = PublicImportDataService.Instance.GetDepositList(tops[0]["id"].ToString());
-                }
-                RedisDbconn.Instance.Set("KdbDepositList", content);
-                RedisDbconn.Instance.SetExpire("KdbDepositList", function.get_Random(1800, 5400));
-            }
-            JsonData list = JsonMapper.ToObject(content);
-            for (int i = 0; i < list.Count; i++)
-            {
-                JsonData item = list[i];
-                Dictionary<string, object> row = new Dictionary<string, object>();
-                row.Add("Id", item["depositId"].ToString());
-                string depositName = item["depositName"].ToString();
-                if (depositName.Contains("返"))
-                {
-                    depositName = depositName.Split(new string[] { "返" }, StringSplitOptions.None)[0];
-                }
-                if(depositName != "押0")
-                {
-                    row.Add("Name", depositName);
-                    dataList.Add(row);
-                }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 开店宝-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.UserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + DepositId, "开店宝-设置押金-返回报文");
-                string content = PublicImportDataService.Instance.ModifyDeposit(pos.PosSn, DepositId);
-                if (content == "fail")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "设置失败" });
-                }
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "开店宝-设置押金-返回报文");
-
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    if (RelationClass.GetKqProductBrandInfo(pos.BrandId) == "立刷云电签")
-                    {
-                        BeforeDeposit = 249;
-                    }
-                    else
-                    {
-                        BeforeDeposit = 299;
-                    }
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                decimal amount = decimal.Parse(PublicImportDataService.Instance.GetDepositAmount(DepositId));
-                pos.PrizeParams = amount.ToString("f0");
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 142
Areas/Api/Controllers/v1/MainServer/LdController.cs

@@ -1,142 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class LdController : BaseController
-    {
-        public LdController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 联动-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();            
-            Dictionary<string, object> row = new Dictionary<string, object>();
-            row.Add("Id", "0");
-            row.Add("Name", "押0");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "99");
-            row.Add("Name", "押99");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "199");
-            row.Add("Name", "押199");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "299");
-            row.Add("Name", "押299");
-            dataList.Add(row);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 联动-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string check = RedisDbconn.Instance.Get<string>("SetDepositWait:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            { 
-                return Json(new AppResultJson() { Status = "-1", Info = "操作频繁,请稍后再试" });
-            }
-            RedisDbconn.Instance.Set("SetDepositWait:" + UserId, SnIds);
-            RedisDbconn.Instance.SetExpire("SetDepositWait:" + UserId, 120);
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.BuyUserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + DepositId, "联动-设置押金-返回报文");
-                string content = PublicImportDataService.Instance.LDServiceFee(pos.PosSn, int.Parse(DepositId), pos.BrandId);
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "联动-设置押金-返回报文");
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["code"].ToString() != "000000")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = jsonObj["msg"].ToString() });
-                }
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    BeforeDeposit = 299;
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                decimal amount = decimal.Parse(DepositId);
-                pos.PrizeParams = amount.ToString("f0");
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 149
Areas/Api/Controllers/v1/MainServer/LisController.cs

@@ -1,149 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class LisController : BaseController
-    {
-        public LisController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 立刷-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();            
-            Dictionary<string, object> row = new Dictionary<string, object>();
-            row.Add("Id", "0");
-            row.Add("Name", "押0");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "99");
-            row.Add("Name", "押99");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "199");
-            row.Add("Name", "押199");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "249");
-            row.Add("Name", "押249");
-            dataList.Add(row);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 立刷-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string check = RedisDbconn.Instance.Get<string>("SetLisDepositWait:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            { 
-                return Json(new AppResultJson() { Status = "-1", Info = "操作频繁,请稍后再试" });
-            }
-            RedisDbconn.Instance.Set("SetLisDepositWait:" + UserId, SnIds);
-            RedisDbconn.Instance.SetExpire("SetLisDepositWait:" + UserId, 120);
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.UserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + DepositId, "立刷-设置押金-返回报文");
-                string content = PublicImportDataService.Instance.SetLiSDeposit(pos.PosSn, int.Parse(DepositId));
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "立刷-设置押金-返回报文");
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["ret_code"].ToString() != "00")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = jsonObj["ret_msg"].ToString() });
-                }
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "立刷-设置押金-返回报文");
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    if (RelationClass.GetKqProductBrandInfo(pos.BrandId) == "立刷云电签")
-                    {
-                        BeforeDeposit = 249;
-                    }
-                    else
-                    {
-                        BeforeDeposit = 299;
-                    }
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                pos.PrizeParams = DepositId;
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 184
Areas/Api/Controllers/v1/MainServer/LsController.cs

@@ -1,184 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class LsController : BaseController
-    {
-        public LsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 乐刷-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();            
-            Dictionary<string, object> row = new Dictionary<string, object>();
-            row.Add("Id", "100");
-            row.Add("Name", "押99");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "200");
-            row.Add("Name", "押199");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "300");
-            row.Add("Name", "押299");
-            dataList.Add(row);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 乐刷-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string check = RedisDbconn.Instance.Get<string>("SetLsDepositWait:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            { 
-                return Json(new AppResultJson() { Status = "-1", Info = "操作频繁,请稍后再试" });
-            }
-            RedisDbconn.Instance.Set("SetLsDepositWait:" + UserId, SnIds);
-            RedisDbconn.Instance.SetExpire("SetLsDepositWait:" + UserId, 120);
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.UserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                string OldId = "", NewId = "";
-                // string content = PublicImportDataService.Instance.QueryActiveForBrand(int.Parse(DepositId), pos.BrandId);
-                // JsonData jsonObj = JsonMapper.ToObject(content);
-                // if (jsonObj["code"].ToString() == "0")
-                // {
-                if (DepositId == "100")
-                {
-                    NewId = "704067039039856640";
-                }
-                else if (DepositId == "200")
-                {
-                    NewId = "709820183485095936";
-                }
-                else if (DepositId == "300")
-                {
-                    NewId = "709820390742437888";
-                }
-                // }
-                string content = PublicImportDataService.Instance.QueryActiveForConfig(pos.PosSn, pos.BrandId);
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["code"].ToString() == "0")
-                {
-                    OldId = jsonObj["data"]["posMarket"]["id"].ToString();
-                }
-                jsonObj = JsonMapper.ToObject(content);
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + OldId + ":" + NewId, "乐刷-设置押金-返回报文");
-                content = PublicImportDataService.Instance.SetDepositForLS(pos.PosSn, OldId, NewId, pos.BrandId);
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "乐刷-设置押金-返回报文");
-                if (content == "fail")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "设置失败" });
-                }
-                jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["code"].ToString() != "0")
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = jsonObj["msg"].ToString() });
-                }
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "乐刷-设置押金-返回报文");
-                // JsonData contentObj = JsonMapper.ToObject(content);
-                // if (contentObj["respCode"].ToString() != "00")
-                // { 
-                //     return Json(new AppResultJson() { Status = "-1", Info = contentObj["respMsg"].ToString() });
-                // }
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    if (RelationClass.GetKqProductBrandInfo(pos.BrandId) == "立刷云电签")
-                    {
-                        BeforeDeposit = 249;
-                    }
-                    else
-                    {
-                        BeforeDeposit = 299;
-                    }
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                decimal amount = decimal.Parse(DepositId);
-                if (pos.BrandId == 4 || pos.BrandId == 5)
-                {
-                    amount -= 1;
-                }
-                pos.PrizeParams = amount.ToString("f0");
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 186
Areas/Api/Controllers/v1/MainServer/PageUpdateInfoController.cs

@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
-
-namespace MySystem.Areas.Api.Controllers
-{
-    [Area("Api")]
-    [Route("Api/[controller]/[action]")]
-    public class PageUpdateInfoController : BaseController
-    {
-        public PageUpdateInfoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 页面数据检查
-        public JsonResult Check(string value)
-        {
-            value = HttpUtility.UrlDecode(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string version = data["version"].ToString();
-            string CheckSignResult = CheckSign(value, new string[] { "Url" });
-            if (CheckSignResult != "1")
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = CheckSignResult });
-            }
-            else
-            {
-                return CheckDo(value);
-            }
-        }
-        public JsonResult CheckDo(string value, string ismakefile = "1")
-        {
-            value = HttpUtility.UrlDecode(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string pagename = data["Url"].ToString();
-            string apptype = data["apptype"].ToString();
-            string version = data["version"].ToString();
-            // string filename = pagename + ".html";
-            Dictionary<string, string> Obj = new Dictionary<string, string>();
-            PageUpdateInfo query = RedisDbconn.Instance.Get<PageUpdateInfo>("PageUpdateInfo:" + pagename);
-            if (query != null)
-            {
-                SystemSet set = RedisDbconn.Instance.Get<SystemSet>("SystemSet") ?? new SystemSet();
-                Obj.Add("ModuleVersion", query.ModuleVersion.ToString()); //模板更新版本
-                Obj.Add("DataVersion", "1"); //数据更新版本
-                if (apptype == "android")
-                {
-                    Obj.Add("ModulePath", "/template/app/default/");
-                    if (ismakefile == "1")
-                    {
-                        string PagePath = function.ReadInstance("/WebRootPath.txt") + "/template/app/default/" + query.ModulePath;
-                        string pageContent = function.ReadInstanceByFull(PagePath);
-                        Obj.Add("ModuleContent", pageContent); //模板内容
-                    }
-                }
-                else if (apptype == "ios")
-                {
-                    Obj.Add("ModulePath", "/template/app/default/");
-                    if (ismakefile == "1")
-                    {
-                        string PagePath = function.ReadInstance("/WebRootPath.txt") + "/template/app/default/" + query.ModulePath;
-                        string pageContent = function.ReadInstanceByFull(PagePath);
-                        Obj.Add("ModuleContent", pageContent); //模板内容
-                    }
-                }
-                else
-                {
-                    string PagePath = function.ReadInstance("/WebRootPath.txt") + "/template/app/default/" + query.ModulePath;
-                    string pageContent = function.ReadInstanceByFull(PagePath);
-                    pageContent = pageContent.Replace("'/", "'/skin/app/default/");
-                    pageContent = pageContent.Replace("\"/", "\"/skin/app/default/");
-                    pageContent = pageContent.Replace("\"./", "\"/skin/app/default/");
-                    pageContent = pageContent.Replace("'./", "'/skin/app/default/");
-                    pageContent = pageContent.Replace("(./", "(/skin/app/default/");
-                    Obj.Add("ModuleContent", pageContent); //模板内容
-                }
-                Obj.Add("ModuleFileName", query.ModulePath);
-                Obj.Add("DataContent", "{}");
-                string DataId = function.MD5_16(query.ModulePath);
-                Obj.Add("DataId", DataId); //模板数据Id
-
-                if (apptype != "web")
-                {
-                    Obj.Add("BgColor", "#" + query.BgColor);
-                    Obj.Add("TextColor", "#" + query.TextColor);
-                    Obj.Add("StatusBarStyle", query.StatusBarStyle);
-                    Obj.Add("ShowTitle", query.ShowTitle == 1 ? "1" : "0");
-                    Obj.Add("Title", query.Title);
-                    Obj.Add("LeftBtn1", function.CheckNull(query.LeftBtn1));
-                    Obj.Add("LeftBtn2", function.CheckNull(query.LeftBtn2));
-                    Obj.Add("RightBtn1", function.CheckNull(query.RightBtn1));
-                    Obj.Add("RightBtn2", function.CheckNull(query.RightBtn2));
-                    if (ismakefile == "1")
-                    {
-                        Obj.Add("LeftAction1", query.LeftAction1 == null ? "" : query.LeftAction1);
-                        Obj.Add("LeftAction2", query.LeftAction2 == null ? "" : query.LeftAction2);
-                        Obj.Add("RightAction1", query.RightAction1 == null ? "" : query.RightAction1);
-                        Obj.Add("RightAction2", query.RightAction2 == null ? "" : query.RightAction2);
-                    }
-                    else
-                    { 
-                        Obj.Add("LeftAction1", query.LeftAction1 == null ? "" : query.LeftAction1.Replace("\\", "\\\\").Replace("\"", "\\\""));
-                        Obj.Add("LeftAction2", query.LeftAction2 == null ? "" : query.LeftAction2.Replace("\\", "\\\\").Replace("\"", "\\\""));
-                        Obj.Add("RightAction1", query.RightAction1 == null ? "" : query.RightAction1.Replace("\\", "\\\\").Replace("\"", "\\\""));
-                        Obj.Add("RightAction2", query.RightAction2 == null ? "" : query.RightAction2.Replace("\\", "\\\\").Replace("\"", "\\\""));
-                    }
-                    Obj.Add("IsScrollBar", query.IsScrollBar == 1 ? "1" : "0");
-                    Obj.Add("IsSkid", query.IsSkid == 1 ? "1" : "0");  //是否侧滑返回
-                    Obj.Add("MustUpdate", query.MustUpdate == 1 ? "1" : "0");  //是否强制更新
-                    Obj.Add("WebTitle", query.QueryCount.ToString());
-                }
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        #endregion
-
-        #region 页面层级结构数据
-
-        public JsonResult GetPageTree()
-        {
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            List<PageUpdateInfo> newpages = RedisDbconn.Instance.GetList<PageUpdateInfo>("PageUpdateInfo", 1, 1000);
-            foreach (PageUpdateInfo page in newpages)
-            {
-                if (dic.ContainsKey("page" + page.ModulePath.Replace(".html", "")))
-                {
-                    dic.Add("page" + page.ModulePath.Replace(".html", ""), page.GotoPages);
-                }
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dic });
-        }
-
-        #endregion
-
-
-        private int versionToNumber(string version)
-        {
-            string[] versionlist = version.Split('.');
-            string left = versionlist[0];
-            string mid = versionlist[1];
-            if (mid.Length == 1) mid = "00" + mid;
-            if (mid.Length == 2) mid = "0" + mid;
-            string right = versionlist[2];
-            if (right.Length == 1) right = "00" + right;
-            if (right.Length == 2) right = "0" + right;
-            string result = left + mid + right;
-            return int.Parse(result);
-        }
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-    }
-}

+ 0 - 135
Areas/Api/Controllers/v1/MainServer/PosMachinesFeeChangeRecordController.cs

@@ -1,135 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class PosMachinesFeeChangeRecordController : BaseController
-    {
-        public PosMachinesFeeChangeRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 降扣-申请调低机具费率
-        [Authorize]
-        public JsonResult ApplyPost(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ApplyPostDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ApplyPostDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PosId = int.Parse(function.CheckInt(data["PosId"].ToString())); //机具Id
-            decimal ChangeFee = decimal.Parse(function.CheckNum(data["ChangeFee"].ToString())); //调整费率
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var user = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-            var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == PosId) ?? new PosMachinesTwo();
-            var mer = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
-            string Name = mer.MerchantName;
-            if (mer.BrandId == 2)
-            {
-                if (Name.Contains("-"))
-                {
-                    Name = Name.Split('-')[1];
-                }
-                else if (Name.Contains("_"))
-                {
-                    Name = Name.Split('_')[1];
-                }
-            }
-            var brand = maindb.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
-            RedisDbconn.Instance.GetLock("CheckApplyPostId:" + PosId);
-            var poschannge = maindb.PosMachinesFeeChangeRecord.FirstOrDefault(m => m.PosId == PosId && m.UserId == UserId && m.Status != -1);
-            if (poschannge != null)
-            {
-                RedisDbconn.Instance.ReleaseLock("CheckApplyPostId:" + PosId);
-                return new AppResultJson() { Status = "-1", Info = "已经申请过了,请勿重复申请!", Data = Obj };
-            }
-            else
-            {
-                PosMachinesFeeChangeRecord query = new PosMachinesFeeChangeRecord();
-                query = maindb.PosMachinesFeeChangeRecord.Add(new PosMachinesFeeChangeRecord()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    Sort = pos.BrandId, //品牌Id
-                    UserId = UserId, //创客
-                    PosId = PosId, //机具Id
-                    PosSn = pos.PosSn,
-                    MerNo = mer.MerchantNo,
-                    MerchantId = mer.Id,
-                    PosUserId = pos.BuyUserId, //机具所属人
-                    ChangeFee = ChangeFee, //调整费率
-                }).Entity;
-                maindb.SaveChanges();
-                // PosId:机具Id
-                // Kind:1或2,1为费率0.63,2为费率0.6
-                // OpMan:操作人,app传创客编号,后台传SysUserName
-                string info = "{\"RecordId\":\"" + query.Id + "\",\"PosId\":\"" + pos.Id + "\",\"Fee\": \"" + 0.6 + "\",\"Kind\": \"2\",\"OpMan\": \"" + user.MakerCode + "\"}";
-                RedisDbconn.Instance.AddList("SetDepositQueue", info);
-                string snhtml = "<div style='margin-bottom: .48rem;'>";
-                snhtml += "<div style='margin-bottom: .48rem;'><div class='f16'>商户姓名:" + Name + "</div>";
-                snhtml += "<div class='f16'>机具品牌:" + brand.Name + "</div>";
-                snhtml += "<div class='f16'>SN:" + pos.PosSn + "</div>";
-                snhtml += "<div class='f16'>当前费率:0.63%</div>";
-                snhtml += "<div class='f16'>变更费率:0.6%</div>";
-                snhtml += "<div class='f16'>变更时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</div></div>";
-                snhtml += "</div>";
-                RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                {
-                    UserId = UserId, //创客
-                    Title = "商户费率变更通知", //标题
-                    Content = "<div class='f16' style='margin-bottom: .72rem'>您的商户刷卡交易费率正在审核中!</div>" + snhtml, //内容
-                    Summary = "您的商户刷卡交易费率正在审核中!",
-                    CreateDate = DateTime.Now,
-
-                }));
-            }
-
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 144
Areas/Api/Controllers/v1/MainServer/SftController.cs

@@ -1,144 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SftController : BaseController
-    {
-        public SftController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 盛付通-获取押金列表
-        [Authorize]
-        public JsonResult GetDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = GetDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> GetDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            Dictionary<string, object> row = new Dictionary<string, object>();
-            row.Add("Id", "2021POS99");
-            row.Add("Name", "押99");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "2021POS199");
-            row.Add("Name", "押199");
-            dataList.Add(row);
-            row = new Dictionary<string, object>();
-            row.Add("Id", "2021POS299");
-            row.Add("Name", "押299");
-            dataList.Add(row);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 盛付通-设置押金
-        [Authorize]
-        public JsonResult SetDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string SnIds = data["SnIds"].ToString(); //机具Id列表
-            string check = RedisDbconn.Instance.Get<string>("SetSftDepositWait:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "操作频繁,请稍后再试" });
-            }
-            RedisDbconn.Instance.Set("SetSftDepositWait:" + UserId, SnIds);
-            RedisDbconn.Instance.SetExpire("SetSftDepositWait:" + UserId, 120);
-            string DepositId = data["DepositId"].ToString(); //押金Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int SnIdNum = int.Parse(SnId);
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum && m.UserId == UserId && m.BindingState == 0 && (string.IsNullOrEmpty(m.SeoKeyword) || m.SeoKeyword == "0"));
-                if (pos == null)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "已设置押金,请勿重复设置" });
-                }
-                function.WriteLog(DateTime.Now.ToString() + ":请求参数," + pos.PosSn + ":" + DepositId, "盛付通-设置押金-返回报文");
-                string content = PublicImportDataService.Instance.SetDepositForSft(pos.PosSn, DepositId);
-                function.WriteLog(DateTime.Now.ToString() + "\n" + content, "盛付通-设置押金-返回报文");
-                JsonData jsonObj = JsonMapper.ToObject(content);
-                if (jsonObj["respCode"].ToString() != "00")
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = jsonObj["errorMsg"].ToString() });
-                }
-                var BeforeDeposit = 0;
-                if (string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    if (RelationClass.GetKqProductBrandInfo(pos.BrandId) == "立刷云电签")
-                    {
-                        BeforeDeposit = 249;
-                    }
-                    else
-                    {
-                        BeforeDeposit = 299;
-                    }
-                }
-                else
-                {
-                    BeforeDeposit = int.Parse(pos.PrizeParams);
-                }
-                pos.PrizeParams = DepositId.Replace("2021POS", "");
-                maindb.SaveChanges();
-
-                //设置押金添加记录
-                PublicFunction.MerchantDepositSet(pos.BrandId, UserId, SnIdNum, pos.PosSn, BeforeDeposit, decimal.Parse(pos.PrizeParams), content);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 220
Areas/Api/Controllers/v1/MainServer/StoreHouseController.cs

@@ -1,220 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class StoreHouseController : BaseController
-    {
-        public StoreHouseController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-商城-确认支付-发货仓库
-        [Authorize]
-        public JsonResult SendStores(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = SendStoresDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> SendStoresDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            string BrandId = data["BrandId"].ToString(); //品牌Id
-            string searchContent = data["searchContent"].ToString();
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            Users user = UsersDbconn.Instance.Get(UserId) ?? new Users();
-            List<int> uids = new List<int>();
-            uids.Add(1);
-            uids.Add(UserId);
-            if (!string.IsNullOrEmpty(user.ParentNav))
-            {
-                string ParentNav = function.CheckNull(user.ParentNav).Trim(',').Replace(",,", ",");
-                string[] ParentNavList = ParentNav.Split(',');
-                // foreach (string uid in ParentNavList)
-                // {
-                //     uids.Add(int.Parse(uid));
-                // }
-                int TopUserId = 0;
-                if (ParentNavList.Length > 1)
-                {
-                    TopUserId = int.Parse(ParentNavList[1]);
-                }
-                else
-                {
-                    TopUserId = int.Parse(ParentNavList[0]);
-                }
-                string UidString = "," + TopUserId + ",";
-                var subusers = maindb.Users.Select(m => new { m.Id, m.ParentNav }).Where(m => m.ParentNav.Contains(UidString)).ToList();
-                foreach (var subuser in subusers)
-                { 
-                    uids.Add(subuser.Id);
-                }
-                uids.Add(TopUserId);
-            }
-            // string UidString = "," + UserId + ",";
-            // var subusers = maindb.Users.Select(m => new { m.Id, m.ParentNav }).Where(m => m.ParentNav.Contains(UidString)).ToList();
-            // foreach (var subuser in subusers)
-            // { 
-            //     uids.Add(subuser.Id);
-            // }
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<StoreHouse> query = maindb.StoreHouse.Where(m => m.Status == 1);
-            if (UserId == 1)
-            { 
-                query = query.Where(m => m.LaveNum > 0 && m.BrandId == BrandId);
-            }
-            else
-            {
-                query = query.Where(m => uids.Contains(m.UserId) && m.LaveNum > 0 && m.BrandId == BrandId);
-            }
-            // IQueryable<StoreHouse> query = maindb.StoreHouse.Where(m => m.LaveNum > 0 && m.BrandId == BrandId);
-            if (!string.IsNullOrEmpty(searchContent))
-            {
-                query = query.Where(m => m.StoreName.Contains(searchContent));
-            }
-            query = query.OrderBy(m => m.UserId);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (StoreHouse subdata in query.ToList())
-            {
-                // StoreHouse subdata = StoreHouseDbconn.Instance.Get(id) ?? new StoreHouse();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("StoreName", subdata.StoreName); //仓库名称
-                curData.Add("Address", subdata.Address); //仓库地址
-                curData.Add("LaveNum", subdata.LaveNum); //剩余库存数
-                curData.Add("Areas", function.CheckNull(subdata.Areas).Replace(",", "")); //所属地区
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-商城-确认支付-发货仓库详情
-        [Authorize]
-        public JsonResult SendStoreDetail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = SendStoreDetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> SendStoreDetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string UserId = data["UserId"].ToString(); //创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            StoreHouse query = new StoreHouse();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            query = StoreHouseDbconn.Instance.Get(Id) ?? new StoreHouse();
-            Obj.Add("StoreName", query.StoreName); //仓库名称
-            Obj.Add("Address", query.Address); //仓库地址
-            Obj.Add("LaveNum", query.LaveNum); //剩余库存数
-            Obj.Add("Areas", function.CheckNull(query.Areas).Replace(",", "")); //所属地区
-            Users user = UsersDbconn.Instance.Get(query.ManageUserId) ?? new Users();
-            Obj.Add("ManageName", user.RealName); //仓库联系人名称
-            if(query.ManageUserId == 1)
-            {
-                Obj.Add("ManageMobile", "19141324516"); //仓库联系人手机号
-            }
-            else
-            {
-                Obj.Add("ManageMobile", user.Mobile); //仓库联系人手机号
-            }
-            Obj.Add("Id", query.Id); //Id
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 首页-仓库管理-主界面产品
-        [Authorize]
-        public JsonResult IndexList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = IndexListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> IndexListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //仓库归属人
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<StoreHouse> query = maindb.StoreHouse.Where(m => m.UserId == UserId && m.Sort == 0 && m.Status > 0).ToList(); //StoreHouseDbconn.Instance.GetList(UserId, PageNum, PageSize);
-            foreach (StoreHouse subdata in query)
-            {
-                // StoreHouse subdata = StoreHouseDbconn.Instance.Get(id) ?? new StoreHouse();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ProductName", subdata.ProductName); //产品名称
-                int PreCount = maindb.PreSendStockDetail.Count(m => m.FromStoreId == subdata.Id && m.ApplyFlag == 0 && m.Status >= 0 && m.Status <= 1);
-                curData.Add("LaveNum", subdata.LaveNum); //剩余库存数
-                curData.Add("PreCount", PreCount); //预发机数
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("BrandId", subdata.BrandId);
-                curData.Add("Icon", ""); //产品图标
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 936
Areas/Api/Controllers/v1/MainServer/StoreStockChangeController.cs

@@ -1,936 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class StoreStockChangeController : BaseController
-    {
-        public StoreStockChangeController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 首页-仓库管理-整箱划拨
-        [Authorize]
-        public JsonResult TransferWhole(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = TransferWholeDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson TransferWholeDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString()));
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人
-            string SnNo = data["SnNo"].ToString(); //首台SN编号
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            if (string.IsNullOrEmpty(SnNo))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请选择机具" };
-            }
-            StoreHouse store = maindb.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-
-            string[] SnIdList = SnNo.Split(',');
-            string SnNos = ""; //划拨的机具号(多个)
-
-            Orders order = maindb.Orders.FirstOrDefault(m => m.Id == OrderId);
-            if (order != null)
-            {
-                if (order.Status == 2)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "该订单已处理,请勿重复操作" };
-                }
-                int ApplyType = 0; // 申请类型,1-机具SN,2-200兑换码,3-300券
-                List<string> SourceSnNos = new List<string>();
-                if (order.Sort > 0)
-                {
-                    MachineApply Apply = maindb.MachineApply.FirstOrDefault(m => m.Id == order.Sort);
-                    if (Apply != null)
-                    {
-                        Apply.Status = 1;
-                        Apply.QueryCount = order.Id;
-                        ApplyType = Apply.Sort;
-                        if (!string.IsNullOrEmpty(Apply.SwapSnExpand))
-                        {
-                            string[] SwapSnExpands = Apply.SwapSnExpand.Split('\n');
-                            foreach (string sub in SwapSnExpands)
-                            {
-                                if (!string.IsNullOrEmpty(sub))
-                                {
-                                    SourceSnNos.Add(sub.Split(':')[0]);
-                                }
-                            }
-                        }
-                    }
-                }
-                Dictionary<int, string> couponIds = new Dictionary<int, string>();
-                int SnIndex = 0;
-                foreach (string SnId in SnIdList)
-                {
-                    string ChangeNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    int SnIdNum = int.Parse(SnId);
-                    int LeaderUserId = 0;
-                    // int OpId = 0;
-                    DateTime RecycEndDate = DateTime.Now.AddDays(360);
-                    if (SourceSnNos.Count > SnIndex)
-                    {
-                        string SourceSnNo = SourceSnNos[SnIndex];
-                        if (ApplyType <= 1)
-                        {
-                            MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == SourceSnNo) ?? new MachineForSnNo();
-                            PosMachinesTwo spos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
-                            RecycEndDate = spos.RecycEndDate == null ? RecycEndDate = DateTime.Now.AddDays(360) : spos.RecycEndDate.Value;
-                            LeaderUserId = spos.LeaderUserId;
-                            // OpId = spos.OpId;
-                        }
-                        else if (ApplyType > 1)
-                        {
-                            PosCoupons coupon = maindb.PosCoupons.FirstOrDefault(m => m.ExchangeCode == SourceSnNo) ?? new PosCoupons();
-                            LeaderUserId = coupon.LeaderUserId;
-                            if (coupon.OpId > 0)
-                            {
-                                if (couponIds.ContainsKey(coupon.OpId))
-                                {
-                                    string[] datas = couponIds[coupon.OpId].Split(',');
-                                    int Num = int.Parse(datas[2]) + 1;
-                                    couponIds[coupon.OpId] = datas[0] + "," + datas[1] + "," + Num;
-                                }
-                                else
-                                {
-                                    couponIds.Add(coupon.OpId, coupon.Id + "," + coupon.QueryCount + ",1");
-                                }
-                                // OpId = coupon.OpId;
-                            }
-                        }
-                    }
-                    PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum) ?? new PosMachinesTwo();
-                    //扣减分仓所关联的运营中心总机具数
-                    if (pos.OpId > 0)
-                    {
-                        var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == pos.OpId) ?? new OpModels.SysAdmin();
-                        if (sysAdmin.Id > 0)
-                        {
-                            sysAdmin.TotalMachineCount -= 1;
-                            opdb.SaveChanges();
-                        }
-                    }
-                    SnNos += pos.PosSn + ",";
-                    Users toUser = UsersDbconn.Instance.Get(ToUserId) ?? new Users();
-                    StoreStockChange query = maindb.StoreStockChange.Add(new StoreStockChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        StoreId = StoreId, //仓库
-                        BrandId = pos.BrandId, //产品类型
-                        ProductName = RelationClass.GetKqProductBrandInfo(pos.BrandId), //产品名称
-                        ChangeNo = ChangeNo, //变更单号
-                        TransType = 10, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceType = pos.DeviceType, //设备类型
-                        FromUserId = store.UserId, //出货人
-                        FromDate = DateTime.Now, //出库时间
-                        ToUserId = ToUserId, //收货人
-                        ToStoreId = StoreId, //退货收货仓库
-                        OpId = pos.OpId
-                    }).Entity;
-                    UserStoreChange userstore = maindb.UserStoreChange.Add(new UserStoreChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = store.UserId, //创客
-                        BrandId = pos.BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        TransType = 0, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 0, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceType = pos.DeviceKind, //设备类型
-                        DeviceModel = pos.DeviceType, //设备型号
-                        ToUserId = ToUserId, //收货创客
-                        ToDate = DateTime.Now, //入库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        SnStatus = 1, //SN状态
-                        BindStatus = (int)pos.BindingState, //绑定状态
-                        BindMerchantId = pos.BindMerchantId, //绑定商户
-                        ActiveStatus = (int)pos.ActivationState, //激活状态
-                        ActRewardUserId = pos.BuyUserId, //激活奖励创客
-                        BrandType = pos.DeviceType, //品牌类型
-                    }).Entity;
-                    StoreChangeHistory history = maindb.StoreChangeHistory.Add(new StoreChangeHistory()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = store.UserId, //创客
-                        BrandId = pos.BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        TransType = 2, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceModel = pos.DeviceKind, //设备型号
-                        DeviceType = pos.DeviceType, //设备类型
-                        ToUserId = ToUserId, //收货创客
-                        FromUserId = store.UserId, //出货创客
-                        FromDate = DateTime.Now, //出库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        StoreId = store.Id, //仓库
-                        OpId = pos.OpId
-                    }).Entity;
-                    maindb.SaveChanges();
-                    PublicFunction.StatUserMachineData(ToUserId, pos.BrandId, 1);
-
-                    store.LaveNum -= 1;
-                    store.OutNum += 1;
-
-                    pos.OrderId = OrderId;
-                    pos.BuyUserId = ToUserId;
-                    pos.UserId = ToUserId;
-                    pos.TransferTime = DateTime.Now;
-                    pos.RecycEndDate = RecycEndDate; // 循环结束时间
-                    pos.PosSnType = order.QueryCount; //机具类型,0-兑换机,1-循环机
-                    pos.LeaderUserId = LeaderUserId;
-                    // pos.OpId = OpId;
-                    maindb.SaveChanges();
-                    SnIndex += 1;
-                }
-                order.Status = 2;
-                order.SendStatus = 1;
-                order.SendDate = DateTime.Now;
-                order.SnNos = SnNos.TrimEnd(',');
-                maindb.SaveChanges();
-
-                //扣减分仓所关联的运营和中心总机具数
-                if (store.OpId > 0)
-                {
-                    var count = SnIdList.Count();
-                    var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == store.OpId) ?? new OpModels.SysAdmin();
-                    if (sysAdmin.Id > 0)
-                    {
-                        sysAdmin.TotalMachineCount -= count;
-                        opdb.SaveChanges();
-                    }
-                }
-
-                string SendData = "{\"Kind\":\"4\",\"Data\":{\"StoreId\":\"" + StoreId + "\",\"SnIds\":\"" + SnNo + "\"}}";
-                //只给对应分仓增加可用额度
-                RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-
-                // if(ApplyType > 1)
-                // {
-                //     // 兑换成机具将向运营中心返还对应机具额度
-                //     foreach(int OpId in couponIds.Keys)
-                //     {
-                //         string[] datalist = couponIds[OpId].Split(',');
-                //         decimal OperateAmount = 200 + int.Parse(datalist[2]);
-                //         if(datalist[1] == "2") OperateAmount = 300 + int.Parse(datalist[2]);
-                //         string OperateData = "{\"UserId\":\"" + OpId + "\",\"DataId\":\"" + datalist[0] + "\",\"Kind\":\"1\",\"Amount\":\"" + OperateAmount + "\"}";
-                //         RedisDbconn.Instance.AddList("OperateAmountQueue", OperateData);
-                //     }
-                // }
-            }
-            maindb.Dispose();
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-        #region 首页-仓库管理-逐台划拨
-        [Authorize]
-        public JsonResult TransferOne(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = TransferOneDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson TransferOneDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString()));
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人
-            string SnIds = data["SnIds"].ToString(); //SN的Id集合
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            if (string.IsNullOrEmpty(SnIds))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请选择机具" };
-            }
-            StoreHouse store = maindb.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-
-            string[] SnIdList = SnIds.Split(',');
-            string SnNos = ""; //划拨的机具号(多个)
-            Orders order = maindb.Orders.FirstOrDefault(m => m.Id == OrderId);
-            if (order != null)
-            {
-                if (order.Status == 2)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "该订单已处理,请勿重复操作" };
-                }
-                int ApplyType = 0; // 申请类型,1-机具SN,2-200兑换码,3-300券
-                List<string> SourceSnNos = new List<string>();
-                if (order.Sort > 0)
-                {
-                    MachineApply Apply = maindb.MachineApply.FirstOrDefault(m => m.Id == order.Sort);
-                    if (Apply != null)
-                    {
-                        Apply.Status = 1;
-                        Apply.QueryCount = order.Id;
-                        ApplyType = Apply.Sort;
-                        if (!string.IsNullOrEmpty(Apply.SwapSnExpand))
-                        {
-                            string[] SwapSnExpands = Apply.SwapSnExpand.Split('\n');
-                            foreach (string sub in SwapSnExpands)
-                            {
-                                if (!string.IsNullOrEmpty(sub))
-                                {
-                                    SourceSnNos.Add(sub.Split(':')[0]);
-                                }
-                            }
-                        }
-                    }
-                }
-                Dictionary<int, string> couponIds = new Dictionary<int, string>();
-                int SnIndex = 0;
-                foreach (string SnId in SnIdList)
-                {
-                    string ChangeNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    int SnIdNum = int.Parse(SnId);
-                    DateTime RecycEndDate = DateTime.Now.AddDays(360);
-                    int LeaderUserId = 0;
-                    // int OpId = 0;
-                    if (SourceSnNos.Count > SnIndex)
-                    {
-                        string SourceSnNo = SourceSnNos[SnIndex];
-                        if (ApplyType <= 1)
-                        {
-                            MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == SourceSnNo) ?? new MachineForSnNo();
-                            PosMachinesTwo spos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
-                            RecycEndDate = spos.RecycEndDate == null ? RecycEndDate = DateTime.Now.AddDays(360) : spos.RecycEndDate.Value;
-                            LeaderUserId = spos.LeaderUserId;
-                            // OpId = spos.OpId;
-                        }
-                        else if (ApplyType > 1)
-                        {
-                            PosCoupons coupon = maindb.PosCoupons.FirstOrDefault(m => m.ExchangeCode == SourceSnNo) ?? new PosCoupons();
-                            LeaderUserId = coupon.LeaderUserId;
-                            if (coupon.OpId > 0)
-                            {
-                                if (couponIds.ContainsKey(coupon.OpId))
-                                {
-                                    string[] datas = couponIds[coupon.OpId].Split(',');
-                                    int Num = int.Parse(datas[2]) + 1;
-                                    couponIds[coupon.OpId] = datas[0] + "," + datas[1] + "," + Num;
-                                }
-                                else
-                                {
-                                    couponIds.Add(coupon.OpId, coupon.Id + "," + coupon.QueryCount + ",1");
-                                }
-                            }
-                        }
-                    }
-                    PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum) ?? new PosMachinesTwo();
-
-                    //扣减分仓所关联的运营中心总机具数
-                    if (pos.OpId > 0)
-                    {
-                        var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == pos.OpId) ?? new OpModels.SysAdmin();
-                        if (sysAdmin.Id > 0)
-                        {
-                            sysAdmin.TotalMachineCount -= 1;
-                            opdb.SaveChanges();
-                        }
-                    }
-
-                    if (StoreId == 0)
-                    {
-                        StoreId = pos.StoreId;
-                    }
-                    SnNos += pos.PosSn + ",";
-                    Users toUser = UsersDbconn.Instance.Get(ToUserId) ?? new Users();
-                    StoreStockChange query = maindb.StoreStockChange.Add(new StoreStockChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        StoreId = StoreId, //仓库
-                        BrandId = pos.BrandId, //产品类型
-                        ProductName = RelationClass.GetKqProductBrandInfo(pos.BrandId), //产品名称
-                        ChangeNo = ChangeNo, //变更单号
-                        TransType = 11, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceType = pos.DeviceType, //设备类型
-                        FromUserId = store.UserId, //出货人
-                        FromDate = DateTime.Now, //出库时间
-                        ToUserId = ToUserId, //收货人
-                        ToStoreId = StoreId, //退货收货仓库
-                        OpId = pos.OpId
-                    }).Entity;
-                    UserStoreChange userstore = maindb.UserStoreChange.Add(new UserStoreChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = store.UserId, //创客
-                        BrandId = pos.BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        TransType = 0, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 0, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceType = pos.DeviceKind, //设备类型
-                        DeviceModel = pos.DeviceType, //设备型号
-                        ToUserId = ToUserId, //收货创客
-                        ToDate = DateTime.Now, //入库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        SnStatus = 1, //SN状态
-                        BindStatus = (int)pos.BindingState, //绑定状态
-                        BindMerchantId = pos.BindMerchantId, //绑定商户
-                        ActiveStatus = (int)pos.ActivationState, //激活状态
-                        ActRewardUserId = pos.BuyUserId, //激活奖励创客
-                        BrandType = pos.DeviceType, //品牌类型
-                    }).Entity;
-                    StoreChangeHistory history = maindb.StoreChangeHistory.Add(new StoreChangeHistory()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = store.UserId, //创客
-                        BrandId = pos.BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        TransType = 2, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceModel = pos.DeviceKind, //设备型号
-                        DeviceType = pos.DeviceType, //设备类型
-                        ToUserId = ToUserId, //收货创客
-                        FromUserId = store.UserId, //出货创客
-                        FromDate = DateTime.Now, //出库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        StoreId = store.Id, //仓库
-                        OpId = pos.OpId
-                    }).Entity;
-                    maindb.SaveChanges();
-                    PublicFunction.StatUserMachineData(ToUserId, pos.BrandId, 1);
-                    store.LaveNum -= 1;
-                    store.OutNum += 1;
-
-                    pos.OrderId = OrderId;
-                    pos.BuyUserId = ToUserId;
-                    pos.UserId = ToUserId;
-                    pos.TransferTime = DateTime.Now;
-                    pos.RecycEndDate = RecycEndDate; // 循环结束时间
-                    pos.PosSnType = order.QueryCount;
-                    pos.LeaderUserId = LeaderUserId;
-
-                    //机子无标记就赋运营中心的值
-                    // if ((pos.OpId == 0 && ApplyType > 1) || ApplyType <= 1)
-                    // {
-                    //     pos.OpId = OpId;
-                    // }
-
-                    maindb.SaveChanges();
-                    SnIndex += 1;
-
-                }
-                order.Status = 2;
-                order.SendStatus = 1;
-                order.SendDate = DateTime.Now;
-                order.SnNos = SnNos.TrimEnd(',');
-                maindb.SaveChanges();
-
-                string SendData = "{\"Kind\":\"4\",\"Data\":{\"StoreId\":\"" + StoreId + "\",\"SnIds\":\"" + SnIds + "\"}}";
-                RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-
-                // if(ApplyType > 1)
-                // {
-                //     // 兑换成机具将向运营中心返还对应机具额度
-                //     foreach(int OpId in couponIds.Keys)
-                //     {
-                //         string[] datalist = couponIds[OpId].Split(',');
-                //         decimal OperateAmount = 200 + int.Parse(datalist[2]);
-                //         if(datalist[1] == "2") OperateAmount = 300 + int.Parse(datalist[2]);
-                //         string OperateData = "{\"UserId\":\"" + OpId + "\",\"DataId\":\"" + datalist[0] + "\",\"Kind\":\"1\",\"Amount\":\"" + OperateAmount + "\"}";
-                //         RedisDbconn.Instance.AddList("OperateAmountQueue", OperateData);
-                //     }
-                // }
-            }
-            maindb.Dispose();
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-        #region 首页-仓库管理-售后单-划拨
-        [Authorize]
-        public JsonResult TransferForChange(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = TransferForChangeDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson TransferForChangeDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString()));
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            string SnIds = data["SnIds"].ToString(); //SN的Id集合
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            if (string.IsNullOrEmpty(SnIds))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请选择机具" };
-            }
-            int CheckCount = maindb.MachineChange.Count(m => m.OutStoreId == StoreId && m.AuditResult == 0);
-            if (CheckCount >= 10)
-            {
-                return new AppResultJson() { Status = "-1", Info = "待审核订单超过10单,请等待管理员审核" };
-            }
-            StoreHouse store = maindb.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-            string[] SnIdList = SnIds.Split(',');
-            string SnNos = ""; //划拨的机具号(多个)
-            Orders order = maindb.Orders.FirstOrDefault(m => m.Id == OrderId);
-            if (order != null)
-            {
-                if (order.Status == 2)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "该订单已处理,请勿重复操作" };
-                }
-                int ToUserId = order.UserId;
-                int ChangeId = 0;
-                List<string> SourceSnNos = new List<string>();
-                if (order.Sort > 0)
-                {
-                    MachineChange Apply = maindb.MachineChange.FirstOrDefault(m => m.Id == order.Sort);
-                    if (Apply != null)
-                    {
-                        Apply.Status = 1;
-                        if (!string.IsNullOrEmpty(Apply.ChangeSnExpand))
-                        {
-                            string[] ChangeSnExpand = Apply.ChangeSnExpand.Split('\n');
-                            foreach (string sub in ChangeSnExpand)
-                            {
-                                if (!string.IsNullOrEmpty(sub))
-                                {
-                                    SourceSnNos.Add(sub.Split(':')[0]);
-                                }
-                            }
-                        }
-                        ChangeId = Apply.Id;
-                    }
-                }
-                int SnIndex = 0;
-                List<string> contents = new List<string>();
-                foreach (string SnId in SnIdList)
-                {
-                    string ChangeNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    int SnIdNum = int.Parse(SnId);
-                    DateTime RecycEndDate = DateTime.Now.AddDays(360);
-                    string SourceSnNo = "";
-                    if (SourceSnNos.Count > SnIndex)
-                    {
-                        SourceSnNo = SourceSnNos[SnIndex];
-                        MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == SourceSnNo) ?? new MachineForSnNo();
-                        PosMachinesTwo spos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
-                        RecycEndDate = spos.RecycEndDate == null ? RecycEndDate = DateTime.Now.AddDays(360) : spos.RecycEndDate.Value;
-                    }
-                    PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnIdNum) ?? new PosMachinesTwo();
-
-                    //扣减分仓所关联的运营中心总机具数
-                    if (pos.OpId > 0)
-                    {
-                        var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == pos.OpId) ?? new OpModels.SysAdmin();
-                        if (sysAdmin.Id > 0)
-                        {
-                            sysAdmin.TotalMachineCount -= 1;
-                            opdb.SaveChanges();
-                        }
-                    }
-
-                    PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
-                    SnNos += pos.PosSn + ",";
-                    Users toUser = UsersDbconn.Instance.Get(ToUserId) ?? new Users();
-                    StoreStockChange query = maindb.StoreStockChange.Add(new StoreStockChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        StoreId = StoreId, //仓库
-                        BrandId = pos.BrandId, //产品类型
-                        ProductName = RelationClass.GetKqProductBrandInfo(pos.BrandId), //产品名称
-                        ChangeNo = ChangeNo, //变更单号
-                        TransType = 11, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceType = pos.DeviceType, //设备类型
-                        FromUserId = store.UserId, //出货人
-                        FromDate = DateTime.Now, //出库时间
-                        ToUserId = ToUserId, //收货人
-                        ToStoreId = StoreId, //退货收货仓库
-                    }).Entity;
-                    UserStoreChange userstore = maindb.UserStoreChange.Add(new UserStoreChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = store.UserId, //创客
-                        BrandId = pos.BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        TransType = 0, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 0, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceType = pos.DeviceKind, //设备类型
-                        DeviceModel = pos.DeviceType, //设备型号
-                        ToUserId = ToUserId, //收货创客
-                        ToDate = DateTime.Now, //入库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        SnStatus = 1, //SN状态
-                        BindStatus = (int)pos.BindingState, //绑定状态
-                        BindMerchantId = pos.BindMerchantId, //绑定商户
-                        ActiveStatus = (int)pos.ActivationState, //激活状态
-                        ActRewardUserId = pos.BuyUserId, //激活奖励创客
-                        BrandType = pos.DeviceType, //品牌类型
-                    }).Entity;
-                    StoreChangeHistory history = maindb.StoreChangeHistory.Add(new StoreChangeHistory()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = store.UserId, //创客
-                        BrandId = pos.BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        TransType = 2, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceModel = pos.DeviceKind, //设备型号
-                        DeviceType = pos.DeviceType, //设备类型
-                        ToUserId = ToUserId, //收货创客
-                        FromUserId = store.UserId, //出货创客
-                        FromDate = DateTime.Now, //出库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        StoreId = store.Id, //仓库
-                    }).Entity;
-                    maindb.SaveChanges();
-                    PublicFunction.StatUserMachineData(ToUserId, pos.BrandId, 1);
-                    store.LaveNum -= 1;
-                    store.OutNum += 1;
-
-                    pos.OrderId = OrderId;
-                    pos.BuyUserId = ToUserId;
-                    pos.UserId = ToUserId;
-                    pos.TransferTime = DateTime.Now;
-                    pos.RecycEndDate = RecycEndDate; // 循环结束时间
-                    pos.PosSnType = order.QueryCount;
-                    maindb.SaveChanges();
-                    SnIndex += 1;
-
-                    string content = "{"; //执行机具数据同步
-                    content += "\"OldSn\":\"" + SourceSnNo + "\",";
-                    content += "\"NewSn\":\"" + pos.PosSn + "\",";
-                    content += "\"MerNo\":\"" + merchant.KqMerNo + "\",";
-                    content += "\"ChangeId\":\"" + ChangeId + "\"";
-                    content += "}";
-                    contents.Add(content);
-                }
-                order.Status = 2;
-                order.SendStatus = 1;
-                order.SendDate = DateTime.Now;
-                order.SnNos = SnNos.TrimEnd(',');
-                maindb.SaveChanges();
-
-                foreach (string content in contents)
-                {
-                    RedisDbconn.Instance.AddList("ChangePosTimerQueue", content);
-                }
-
-                string SendData = "{\"Kind\":\"4\",\"Data\":{\"StoreId\":\"" + StoreId + "\",\"SnIds\":\"" + SnIds + "\"}}";
-                RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-            }
-            maindb.Dispose();
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-        #region 首页-仓库管理-售后单-划拨验证
-        [Authorize]
-        public JsonResult TransferForCheck(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = TransferForCheckDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson TransferForCheckDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int CheckCount = maindb.MachineChange.Count(m => m.OutStoreId == StoreId && m.AuditResult == 0);
-            if (CheckCount >= 10)
-            {
-                return new AppResultJson() { Status = "-1", Info = "待审核订单超过10单,请等待管理员审核" };
-            }
-            return new AppResultJson() { Status = "1", Info = "" };
-        }
-        #endregion
-
-        #region 首页-仓库管理-售后单-驳回
-        [Authorize]
-        public JsonResult RefuseForChange(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = RefuseForChangeDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson RefuseForChangeDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString()));
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            Orders order = maindb.Orders.FirstOrDefault(m => m.Id == OrderId && m.StoreId == StoreId);
-            if (order != null)
-            {
-                order.Status = -1;
-                MachineChange change = maindb.MachineChange.FirstOrDefault(m => m.Id == order.Sort);
-                if (change != null)
-                {
-                    change.AuditResult = 2;
-                }
-                maindb.SaveChanges();
-                maindb.Dispose();
-                return new AppResultJson() { Status = "1", Info = "" };
-            }
-            maindb.Dispose();
-            return new AppResultJson() { Status = "-1", Info = "" };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-划拨记录-拨入
-        [Authorize]
-        public JsonResult In(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = InDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> InDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SearchKey = data["SearchKey"].ToString();
-            int ToStoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //退货收货仓库
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<StoreStockChange> query = maindb.StoreStockChange.Where(m => m.ToStoreId == ToStoreId);
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                query = query.Where(m => m.SnNo == SearchKey);
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            query = query.OrderByDescending(m => m.Id);
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("StoreId", subdata.StoreId); //仓库
-                Dictionary<string, object> StoreInfo = new Dictionary<string, object>();
-                StoreHouse StoreHouseData = maindb.StoreHouse.FirstOrDefault(m => m.Id == subdata.StoreId) ?? new StoreHouse();
-                StoreInfo.Add("StoreName", StoreHouseData.StoreName); //仓库名称
-                curData.Add("StoreInfo", StoreInfo);
-
-                curData.Add("SnNo", subdata.SnNo); //SN编号
-                curData.Add("FromUserId", subdata.FromUserId); //出货人
-                Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == subdata.FromUserId) ?? new Users();
-                UserInfo.Add("RealName", UsersData.RealName); //真实姓名
-                UserInfo.Add("MakerCode", UsersData.MakerCode); //创客编号
-                UserInfo.Add("Mobile", UsersData.Mobile); //手机号
-                curData.Add("UserInfo", UserInfo);
-
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 创客-首页-仓库管理-划拨记录-拨出
-        [Authorize]
-        public JsonResult Out(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = OutDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> OutDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SearchKey = data["SearchKey"].ToString();
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<StoreStockChange> query = maindb.StoreStockChange.Where(m => m.StoreId == StoreId && m.ToUserId > 0);
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                query = query.Where(m => m.SnNo == SearchKey);
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            query = query.OrderByDescending(m => m.Id);
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ChangeNo", subdata.ChangeNo); //变更单号
-                curData.Add("SnNo", subdata.SnNo); //SN编号
-                curData.Add("ToUserId", subdata.ToUserId); //收货人
-                Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == subdata.ToUserId) ?? new Users();
-                UserInfo.Add("RealName", UsersData.RealName); //真实姓名
-                UserInfo.Add("MakerCode", UsersData.MakerCode); //创客编号
-                UserInfo.Add("Mobile", UsersData.Mobile); //手机号
-                curData.Add("UserInfo", UserInfo);
-
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 创客-首页-仓库管理-出货记录-按天
-        [Authorize]
-        public JsonResult ForDate(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ForDateDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ForDateDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            // int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string Month = data["Month"].ToString(); //月份
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DataTable dt = OtherMySqlConn.dtable("SELECT DATE_FORMAT(CreateDate,'%Y%m%d') date,COUNT(0) count FROM StoreStockChange WHERE StoreId = '" + StoreId + "' AND TransType in (2,10,11) AND DATE_FORMAT(CreateDate,'%Y%m') = '" + Month + "' GROUP BY DATE_FORMAT(CreateDate,'%Y%m%d') ORDER BY DATE_FORMAT(CreateDate,'%Y%m%d') DESC");
-            foreach (DataRow item in dt.Rows)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Date", item["date"]); //时间
-                curData.Add("ActTotal", Convert.ToInt32(function.CheckInt(item["count"].ToString()))); //总激活
-
-                List<Dictionary<string, object>> snList = new List<Dictionary<string, object>>();
-                DataTable dts = OtherMySqlConn.dtable("SELECT DATE_FORMAT(CreateDate,'%Y%m%d') date,SnNo FROM StoreStockChange WHERE StoreId = '" + StoreId + "' AND TransType in (2,10,11) AND DATE_FORMAT(CreateDate,'%Y%m%d') = '" + item["date"] + "'");
-                foreach (DataRow items in dts.Rows)
-                {
-                    Dictionary<string, object> sn = new Dictionary<string, object>();
-                    sn.Add("Date", items["date"]); //时间
-                    sn.Add("Sn", items["SnNo"]); //Sn
-                    snList.Add(sn);
-                }
-                curData.Add("SnList", snList);
-                dataList.Add(curData);
-
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-出货记录-按月
-        [Authorize]
-        public JsonResult ForMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ForMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ForMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            // int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DataTable dt = OtherMySqlConn.dtable("SELECT DATE_FORMAT(CreateDate,'%Y%m') date,COUNT(0) count FROM StoreStockChange WHERE StoreId = '" + StoreId + "' AND TransType in (2,10,11) GROUP BY DATE_FORMAT(CreateDate,'%Y%m') ORDER BY DATE_FORMAT(CreateDate,'%Y%m') DESC");
-            foreach (DataRow item in dt.Rows)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Date", item["date"]); //时间
-                curData.Add("ActTotal", Convert.ToInt32(function.CheckInt(item["count"].ToString()))); //总激活
-                dataList.Add(curData);
-
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-
-            return dataList;
-        }
-        #endregion
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 81
Areas/Api/Controllers/v1/MainServer/SysRechargeRecordController.cs

@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SysRechargeRecordController : BaseController
-    {
-        public SysRechargeRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-快联盟头条
-        [Authorize]
-        public JsonResult HeadLine(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = HeadLineDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> HeadLineDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = 0; //int.Parse(function.CheckInt(data["UserId"].ToString()));
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<SysRechargeRecord> query = RedisDbconn.Instance.GetList<SysRechargeRecord>("HeadLine", PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Amount", subdata.Amount); //奖励金额
-                Users user = UsersDbconn.Instance.Get(subdata.UserId) ?? new Users();
-                curData.Add("RealName", user.RealName); //创客姓名
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 390
Areas/Api/Controllers/v1/MainServer/SystemSetController.cs

@@ -1,390 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using System.Web;
-using MySystem.Models;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using Microsoft.IdentityModel.Tokens;
-using System.Text;
-using System.Security.Claims;
-using System.IdentityModel.Tokens.Jwt;
-
-namespace MySystem.Areas.Api.Controllers
-{
-    [Area("Api")]
-    [Route("Api/[controller]/[action]")]
-    public class SystemSetController : BaseController
-    {
-        public SystemSetController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-        #region APP启动初始数据
-        public JsonResult Detail(string value)
-        {
-            value = HttpUtility.UrlDecode(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string apptype = data["apptype"].ToString();
-            string version = data["version"].ToString();
-            string CheckSignResult = CheckSign(value, new string[] { });
-            if (CheckSignResult != "1")
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = CheckSignResult });
-            }
-            else
-            {
-                return DetailDo(value);
-            }
-        }
-        public JsonResult DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string apptype = data["apptype"].ToString();
-            string version = data["version"].ToString();
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> PageSDK = new List<Dictionary<string, object>>();
-            Models.SystemSet set = RedisDbconn.Instance.Get<Models.SystemSet>("SystemSet");
-            List<FileUpdateInfo> files = RedisDbconn.Instance.GetList<FileUpdateInfo>("FileUpdateInfo", 1, 1000).OrderBy(m => m.Path).OrderBy(m => m.FileName).ToList();
-            foreach (FileUpdateInfo subfile in files)
-            {
-                string Tag = function.MD5_16(subfile.Id.ToString());
-                string Url = subfile.Path;
-                string FileName = subfile.FileName;
-                int ver = subfile.Version;
-                Dictionary<string, object> row = new Dictionary<string, object>();
-                row.Add("Url", Url);
-                row.Add("DownloadUrl", "/skin/app/default/" + Url);
-                row.Add("FileName", FileName);
-                row.Add("Version", ver);
-                row.Add("Tag", Tag);
-                PageSDK.Add(row);
-            }
-            List<Dictionary<string, string>> AfterStartPhotos = new List<Dictionary<string, string>>();
-            string StartAdPhoto = "static/images/startadphoto.png";
-            if (!string.IsNullOrEmpty(set.StartAdPhoto))
-            {
-                StartAdPhoto = set.StartAdPhoto;
-                StartAdPhoto = StartAdPhoto.Substring(StartAdPhoto.IndexOf("static"));
-            }
-            string StartAdUrl = "";
-            Dictionary<string, string> after = new Dictionary<string, string>();
-            after.Add("Url", "");
-            after.Add("Photo", "static/images/afterstartphoto1.png");
-            AfterStartPhotos.Add(after);
-            after = new Dictionary<string, string>();
-            after.Add("Url", "");
-            after.Add("Photo", "static/images/afterstartphoto2.png");
-            AfterStartPhotos.Add(after);
-            after = new Dictionary<string, string>();
-            after.Add("Url", "");
-            after.Add("Photo", "static/images/afterstartphoto3.png");
-            AfterStartPhotos.Add(after);
-            Obj.Add("PageSDK", PageSDK); //页面所需资源引用
-            List<Dictionary<string, string>> HtmlVersion = new List<Dictionary<string, string>>();
-            List<PageUpdateInfo> pages = RedisDbconn.Instance.GetList<PageUpdateInfo>("PageUpdateInfo", 1, 1000).ToList();
-            foreach (PageUpdateInfo page in pages)
-            {
-                Dictionary<string, string> item = new Dictionary<string, string>();
-                string DataId = function.MD5_16(page.ModulePath);
-                item.Add("Id", page.Id.ToString());
-                item.Add("DataId", DataId);
-                item.Add("ModuleVersion", page.ModuleVersion.ToString());
-                item.Add("FileName", page.ModulePath);
-                HtmlVersion.Add(item);
-            }
-            Obj.Add("HtmlVersion", HtmlVersion);
-            Obj.Add("IsPageSDKZip", "0");
-            Obj.Add("PageSDKZip", "/Areas/Admin/Assets/TemplateFile/Areas.zip");
-            Obj.Add("StartAdPhoto", string.IsNullOrEmpty(set.StartAdPhoto) ? "" : StartAdPhoto);
-            Obj.Add("StartAdUrl", StartAdUrl);
-            Obj.Add("AfterStartPhotos", AfterStartPhotos);
-            Obj.Add("IsLeftSide", "0");  //是否侧滑
-            Obj.Add("LeftSideUrl", "http://www.baidu.com/");  //侧滑页面地址
-
-            if (apptype == "ios")
-            {
-                Obj.Add("AppClose", "0");
-                int check = RedisDbconn.Instance.GetList<AppVersion>("AppVersion", 1, 1000).Count(m => m.TerminalKind == "ios");
-                if (check > 0)
-                {
-                    AppVersion ver = RedisDbconn.Instance.GetList<AppVersion>("AppVersion", 1, 1000).Where(m => m.TerminalKind == "ios").OrderByDescending(m => m.Id).FirstOrDefault();
-                    if (ver.Status == 1 && versionToNumber(version) < versionToNumber(ver.VersionNum))
-                    {
-                        Obj.Add("AppStatus", "1");
-                        Obj.Add("AppTitle", ver.Title);
-                        Obj.Add("AppInfo", ver.Info);
-                        Obj.Add("AppBtn1", ver.ConfirmText);
-                        Obj.Add("AppBtn2", ver.CancelText);
-                        Obj.Add("AppBtn1Url", ver.DownloadUrl);
-                    }
-                    else
-                    {
-                        Obj.Add("AppStatus", "0");
-                    }
-                }
-                else
-                {
-                    Obj.Add("AppStatus", "0");
-                }
-            }
-            else
-            {
-                int check = RedisDbconn.Instance.GetList<AppVersion>("AppVersion", 1, 1000).Count(m => m.TerminalKind == "android");
-                if (check > 0)
-                {
-                    AppVersion ver = RedisDbconn.Instance.GetList<AppVersion>("AppVersion", 1, 1000).Where(m => m.TerminalKind == "android").OrderByDescending(m => m.Id).FirstOrDefault();
-                    if (ver.Status == 1 && versionToNumber(version) < versionToNumber(ver.VersionNum))
-                    {
-                        Obj.Add("AppStatus", "1");
-                        Obj.Add("AppTitle", ver.Title);
-                        Obj.Add("AppInfo", ver.Info);
-                        Obj.Add("AppBtn1", ver.ConfirmText);
-                        Obj.Add("AppBtn2", ver.CancelText);
-                        Obj.Add("AppBtn1Url", ver.DownloadUrl);
-                    }
-                    else
-                    {
-                        Obj.Add("AppStatus", "0");
-                    }
-                }
-                else
-                {
-                    Obj.Add("AppStatus", "0");
-                }
-            }
-            Obj.Add("ConnectErrUrl", ""); //网络错误页面
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        #endregion
-
-
-        #region 附加方法
-        
-        List<string> SystemFilesV2;
-        private void GetSystemFilesV2()
-        {
-            SystemFilesV2 = new List<string>();
-            string dataFilePath = function.getPath("/wwwroot/skin/app/default/");
-            System.IO.FileSystemInfo info = new System.IO.DirectoryInfo(dataFilePath);
-            scanV2(info);
-        }
-        private void scanV2(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)
-                {
-                    string filename = file.FullName.Replace("\\", "/");
-                    SystemFilesV2.Add(filename.Substring(filename.LastIndexOf("/")));
-                }
-                else scanV2(files[i]);
-            }
-        }
-
-
-        private int versionToNumber(string version)
-        {
-            string[] versionlist = version.Split('.');
-            string left = versionlist[0];
-            string mid = versionlist[1];
-            if (mid.Length == 1) mid = "00" + mid;
-            if (mid.Length == 2) mid = "0" + mid;
-            string right = versionlist[2];
-            if (right.Length == 1) right = "00" + right;
-            if (right.Length == 2) right = "0" + right;
-            string result = left + mid + right;
-            return int.Parse(result);
-        }
-
-        #endregion
-
-
-        #region 生成APP配置文件
-        public string makeAppInitData(string version, string apptype)
-        {
-            Models.SystemSet set = RedisDbconn.Instance.Get<Models.SystemSet>("SystemSet") ?? new Models.SystemSet();
-            string url = Host + "Api/APPSetInfo/List?value={\"Kind\":\"1\",\"PageSize\":\"10\",\"PageNum\":\"1\",\"version\":\"" + version + "\",\"apptype\":\"" + apptype + "\"}";
-            string AppInfoList = function.GetWebRequest(url);
-            string SystemSet = function.GetWebRequest(Host + "Api/SystemSet/DetailDo?value={\"version\":\"" + version + "\",\"apptype\":\"" + apptype + "\"}");
-            string GotoPages = "{";
-            string PageInfoList = "{";
-            string LibFile = "{";
-            List<PageUpdateInfo> newpages = RedisDbconn.Instance.GetList<PageUpdateInfo>("PageUpdateInfo", 1, 1000).OrderBy(m => m.Id).ToList();
-            foreach (PageUpdateInfo page in newpages)
-            {
-                string FileName = page.ModulePath.Split('.')[0];
-                PageInfoList += "\"page" + FileName + "\":" + function.GetWebRequest(Host + "Api/PageUpdateInfo/CheckDo?value={\"Url\":\"" + FileName + "\",\"version\":\"" + version + "\",\"apptype\":\"" + apptype + "\"}&ismakefile=0") + ",";
-                GotoPages += "\"page" + FileName + "\":\"" + function.CheckNull(page.GotoPages).Trim(',') + "\",";
-
-                string PagePath = function.ReadInstance("/WebRootPath.txt") + "/template/app/default/" + page.ModulePath;
-                string pageContent = function.ReadInstanceByFull(PagePath);
-                pageContent = dbconn.Encrypt3DES(pageContent, "*ga34|^7");
-                LibFile += "\"page" + FileName + "\":\"" + pageContent + "\",";
-            }
-            PageInfoList = PageInfoList.TrimEnd(',');
-            PageInfoList += "}";
-            GotoPages = GotoPages.TrimEnd(',');
-            GotoPages += "}";
-            LibFile = LibFile.TrimEnd(',');
-            LibFile += "}";
-            return AppInfoList + "#cut#" + SystemSet + "#cut#" + PageInfoList + "#cut#" + GotoPages + "#cut#" + dbconn.Encrypt3DES(LibFile, "*ga34|^7");
-        }
-        #endregion
-
-
-        #region 验证获取jwt的token
-
-        public JsonResult AppCheck(string value)
-        { 
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string CheckSignResult = CheckSign(value, new string[] { "uuid", "salt" });
-            if (CheckSignResult != "1")
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = CheckSignResult });
-            }
-            else
-            {
-                string uuid = data["uuid"].ToString();
-                string salt = data["salt"].ToString();
-                string u = function.MD5_16(uuid + salt);
-                Dictionary<string, object> Obj = new Dictionary<string, object>();
-                //生成jwt令牌
-                Obj.Add("Token", AppToken(u));
-                return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-            }
-        }
-
-        public JsonResult AppCheckTest(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string uuid = data["uuid"].ToString();
-            string salt = data["salt"].ToString();
-            string u = function.MD5_16(uuid + salt);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            //生成jwt令牌
-            Obj.Add("Token", AppToken(u));
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public string AppToken(string u)
-        {
-            u = "old_" + u;
-            string test = function.get_Random(10);
-            var securityKey = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes(JwtSecret)), SecurityAlgorithms.HmacSha256);
-            var claims = new Claim[] {
-                new Claim(JwtRegisteredClaimNames.Iss,JwtIss),
-                new Claim(JwtRegisteredClaimNames.Aud,test),
-                new Claim("Guid", Guid.NewGuid().ToString("D")),
-                new Claim(ClaimTypes.Role, "system"),
-                new Claim(ClaimTypes.Role, "admin"),
-            };
-            SecurityToken securityToken = new JwtSecurityToken(
-                signingCredentials: securityKey,
-                expires: DateTime.Now.AddDays(10),//过期时间
-                claims: claims,
-                audience: test,
-                issuer: u
-            );
-            RedisDbconn.Instance.Set("utoken:" + u, test);
-            RedisDbconn.Instance.SetExpire("utoken:" + u, 3600 * 24 * 10);
-            //生成jwt令牌
-            return new JwtSecurityTokenHandler().WriteToken(securityToken);
-        }
-
-        public string AppTokenV2(int UserId, string DeviceId, string DeviceType)
-        {
-            string Token = RedisDbconn.Instance.Get<string>("apptoken:" + DeviceId + ":" + DeviceType + ":" + UserId);
-            if(!string.IsNullOrEmpty(Token))
-            {
-                return Token;
-            }
-            string issuer = "new_" + UserId + "_" + DeviceId + "_" + DeviceType;
-            string test = function.get_Random(10);
-            var securityKey = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes(JwtSecret)), SecurityAlgorithms.HmacSha256);
-            var claims = new Claim[] {
-                new Claim(JwtRegisteredClaimNames.Iss,JwtIss),
-                new Claim(JwtRegisteredClaimNames.Aud,test),
-                new Claim("Guid", Guid.NewGuid().ToString("D")),
-                new Claim(ClaimTypes.Role, "system"),
-                new Claim(ClaimTypes.Role, "admin"),
-            };
-            SecurityToken securityToken = new JwtSecurityToken(
-                signingCredentials: securityKey,
-                expires: DateTime.Now.AddDays(10),//过期时间
-                claims: claims,
-                audience: test,
-                issuer: issuer
-            );
-            RedisDbconn.Instance.Set("utoken:" + issuer, test);
-            RedisDbconn.Instance.SetExpire("utoken:" + issuer, 3600 * 24 * 10);
-            //生成jwt令牌
-            Token = new JwtSecurityTokenHandler().WriteToken(securityToken);
-            RedisDbconn.Instance.Set("apptoken:" + DeviceId + ":" + DeviceType + ":" + UserId, Token);
-            RedisDbconn.Instance.SetExpire("apptoken:" + DeviceId + ":" + DeviceType + ":" + UserId, 3600 * 24 * 10 - 60);
-            return Token;
-        }
-
-        #endregion
-
-
-
-
-
-
-
-        #region 获取OSS参数
-        public JsonResult OssParam(string value)
-        {
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("AccessId", "LTAI5t7ivibdYZTro4SRVZ9M");
-            Obj.Add("AccessKey", "nfr1bmbJbMhLuaj10iBORkuFfIAX7M");
-            return Json(new AppResultJson() { Status = "-1", Info = "", Data = Obj });
-        }
-
-        #endregion
-
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 591
Areas/Api/Controllers/v1/MainServer/UserTradeDaySummaryController.cs

@@ -1,591 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class UserTradeDaySummaryController : BaseController
-    {
-        public UserTradeDaySummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-        #region 首页-本月团队业绩
-        [Authorize]
-        public JsonResult ThisMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ThisMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ThisMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string Month = DateTime.Now.ToString("yyyyMM");
-            if (DateTime.Now.Day == 1)
-            {
-                Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
-            }
-            decimal HelpAmount = 0;
-            decimal final = 0;
-
-            DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + ")) AND TradeMonth=" + Month + "");
-            // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + ")) or SeoDescription like '%," + UserId + ",%' or QueryCount=" + UserId + ") AND TradeMonth=" + Month + "");
-            if (dt.Rows.Count > 0)
-            {
-                HelpAmount = decimal.Parse(function.CheckNum(dt.Rows[0]["TradeAmount"].ToString()));
-                var a = UserTradeDaySummaryDbconn.Instance.GetMonthTrade(UserId, Month, "team");
-                final = a + HelpAmount;
-                Obj.Add("HelpAmount", HelpAmount); //助利宝交易额
-            }
-            Obj.Add("DirectTradeAmt", final); //团队交易总额
-            Obj.Add("DirectDebitCapNum", UserDataDbconn.Instance.GetTeamPosActCount(UserId, Month)); //直营激活商户数
-            Obj.Add("AddCount", UsersDbconn.Instance.GetTeamNewUserCount(UserId, Month)); //新增创客数
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩
-        [Authorize]
-        public JsonResult PersonalPerformance(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = PersonalPerformanceDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> PersonalPerformanceDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            decimal HelpAmount = 0;
-            // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId=" + UserId + ") or QueryCount=" + UserId + ") AND TradeMonth=" + TradeMonth + "");
-            DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId=" + UserId + ")) AND TradeMonth=" + TradeMonth + "");
-            foreach (DataRow item in dt.Rows)
-            {
-                HelpAmount = decimal.Parse(function.CheckNum(item["TradeAmount"].ToString()));
-                Obj.Add("HelpAmount", HelpAmount); //助利宝交易额
-            }
-            Obj.Add("TotalAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(UserId, TradeMonth) + HelpAmount); //总交易
-            Obj.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TotalAmount:Active:" + UserId + ":" + TradeMonth)); //总活动交易
-            Obj.Add("TotalUnActiveAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 0, 0)); //非活动交易
-            Obj.Add("TotalUser", UsersDbconn.Instance.GetNewUserCount(UserId)); //累计总创客
-            Obj.Add("TotalActMerchant", RedisDbconn.Instance.Get<int>("ActMerchantCount:" + UserId + ":" + TradeMonth)); //累计激活商户
-            Obj.Add("TotalWeChatOrder", RedisDbconn.Instance.Get<int>("TotalOrder:WeChat:" + UserId + ":" + TradeMonth)); //微信订单数
-            Obj.Add("TotalAlipayOrder", RedisDbconn.Instance.Get<int>("TotalOrder:Alipay:" + UserId + ":" + TradeMonth)); //支付宝订单数
-
-            Obj.Add("TotalPosAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 0, 1)); //POS机刷卡交易额
-            Obj.Add("TotalCloudPayAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 1)); //云闪付小额交易额
-            Obj.Add("AddUser", UsersDbconn.Instance.GetNewUserCount(UserId, TradeMonth)); //新增创客
-            Obj.Add("TotalPosMerchant", UserDataDbconn.Instance.GetPosActCount(UserId)); //累计激活POS机商户
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩-服务费明细
-        [Authorize]
-        public JsonResult PersonalServiceProfit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalServiceProfitDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalServiceProfitDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeDate = data["TradeDate"].ToString(); //交易日
-            string PayMode = data["PayMode"].ToString(); //支付方式
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserTradeDaySummary> query = RedisDbconn.Instance.GetList<UserTradeDaySummary>("UserTradeDaySummary", PageNum, PageSize);
-            if (!string.IsNullOrEmpty(data["UserId"].ToString()))
-            {
-                query = query.Where(m => m.UserId == UserId).ToList();
-            }
-            if (!string.IsNullOrEmpty(data["TradeDate"].ToString()))
-            {
-                query = query.Where(m => m.TradeDate == TradeDate).ToList();
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("PayMode", ""); //支付方式
-                curData.Add("ServiceProfit", ""); //服务费分润
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩-每月明细
-        [Authorize]
-        public JsonResult PersonalPerformanceForDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalPerformanceForDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalPerformanceForDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddMonths(1).AddDays(-1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                // if (date.ToString("yyyyMMdd") != start.ToString("yyyyMMdd"))
-                // {
-                string Date = date.ToString("yyyyMMdd");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                decimal HelpAmount = 0;
-                // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId=" + UserId + ") or QueryCount=" + UserId + ") AND TradeDate=" + Date + "");
-                DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId=" + UserId + ")) AND TradeDate=" + Date + "");
-                foreach (DataRow item in dt.Rows)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(item["TradeAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeDate", date.ToString("yyyy-MM-dd")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetDateTrade(UserId, Date) + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TotalAmount:Active:" + UserId + ":" + Date)); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryDbconnV2.Instance.GetDateTradeForCloud(UserId, Date, 0, 0)); //码牌非活动交易
-                curData.Add("TotalPosAmount", UserTradeDaySummaryDbconnV2.Instance.GetDateTradeForCloud(UserId, Date, 0, 1)); //刷卡总交易
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryDbconn.Instance.GetDateTradeForCloud(UserId, Date, 1)); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryDbconn.Instance.GetDateTradeForBrand(UserId, Date, sub.Id);
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-                // }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩-近半年
-        [Authorize]
-        public JsonResult PersonalPerformanceHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalPerformanceHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalPerformanceHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                var month = Month.ToString("yyyyMM");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                decimal HelpAmount = 0;
-                // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId=" + UserId + ") or QueryCount=" + UserId + ") AND TradeMonth=" + month + "");
-                DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId=" + UserId + ")) AND TradeMonth=" + month + "");
-                foreach (DataRow item in dt.Rows)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(item["TradeAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(UserId, Month.ToString("yyyyMM")) + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TotalAmount:Active:" + UserId + ":" + Month.ToString("yyyyMM"))); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 0, 0)); //码牌非活动交易
-                curData.Add("TotalPosAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 0, 1)); //刷卡总交易
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 1)); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryDbconn.Instance.GetMonthTradeForBrand(UserId, Month.ToString("yyyyMM"), sub.Id);
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩
-        [Authorize]
-        public JsonResult TeamPerformance(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = TeamPerformanceDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> TeamPerformanceDo(string value)
-        {
-            // TODO:每月1号显示上月数据,2号显示本月数据
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            decimal HelpAmount = 0;
-            // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + ")) or SeoDescription like '%," + UserId + ",%' or QueryCount=" + UserId + ") AND TradeMonth=" + TradeMonth + "");
-            DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + "))) AND TradeMonth=" + TradeMonth + "");
-            foreach (DataRow item in dt.Rows)
-            {
-                HelpAmount = decimal.Parse(function.CheckNum(item["TradeAmount"].ToString()));
-                Obj.Add("HelpAmount", HelpAmount); //助利宝交易额
-            }
-            Obj.Add("TotalAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(UserId, TradeMonth, "team") + HelpAmount); //总交易
-            Obj.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TeamTotalAmount:Active:" + UserId + ":" + TradeMonth)); //总活动交易
-            Obj.Add("TotalUnActiveAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 0, 0, "team")); //非活动交易
-            Obj.Add("TotalUser", UsersDbconn.Instance.GetTeamNewUserCount(UserId)); //累计总创客
-            Obj.Add("TotalActMerchant", RedisDbconn.Instance.Get<int>("TeamActMerchantCount:" + UserId + ":" + TradeMonth)); //累计激活商户
-            Obj.Add("TotalWeChatOrder", RedisDbconn.Instance.Get<int>("TeamTotalOrder:WeChat:" + UserId + ":" + TradeMonth)); //微信订单数
-            Obj.Add("TotalAlipayOrder", RedisDbconn.Instance.Get<int>("TeamTotalOrder:Alipay:" + UserId + ":" + TradeMonth)); //支付宝订单数
-
-            Obj.Add("TotalPosAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 0, 1, "team")); //POS机刷卡交易额
-            Obj.Add("TotalCloudPayAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 1, "team")); //云闪付小额交易额
-            Obj.Add("AddUser", UsersDbconn.Instance.GetTeamNewUserCount(UserId, TradeMonth)); //新增创客
-            Obj.Add("TotalPosMerchant", UserDataDbconn.Instance.GetTeamPosActCount(UserId)); //累计激活POS机商户
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩-服务费明细
-        [Authorize]
-        public JsonResult TeamServiceProfit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamServiceProfitDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamServiceProfitDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeDate = data["TradeDate"].ToString(); //交易日
-            string PayMode = data["PayMode"].ToString(); //支付方式
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserTradeDaySummary> query = RedisDbconn.Instance.GetList<UserTradeDaySummary>("UserTradeDaySummary", PageNum, PageSize);
-            if (!string.IsNullOrEmpty(data["UserId"].ToString()))
-            {
-                query = query.Where(m => m.UserId == UserId).ToList();
-            }
-            if (!string.IsNullOrEmpty(data["TradeDate"].ToString()))
-            {
-                query = query.Where(m => m.TradeDate == TradeDate).ToList();
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("PayMode", ""); //支付方式
-                curData.Add("ServiceProfit", ""); //服务费分润
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩-每月明细
-        [Authorize]
-        public JsonResult TeamPerformanceForDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceForDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceForDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddMonths(1).AddDays(-1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                // if (date.ToString("yyyyMMdd") != start.ToString("yyyyMMdd"))
-                // {
-                string Date = date.ToString("yyyyMMdd");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-
-                decimal HelpAmount = 0;
-                // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + ")) or SeoDescription like '%," + UserId + ",%' or QueryCount=" + UserId + ") AND TradeDate=" + Date + "");
-                DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + "))) AND TradeDate=" + Date + "");
-                foreach (DataRow item in dt.Rows)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(item["TradeAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeDate", date.ToString("yyyy-MM-dd")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetDateTrade(UserId, Date, "team") + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TeamTotalAmount:Active:" + UserId + ":" + Date)); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryDbconnV2.Instance.GetDateTradeForCloud(UserId, Date, 0, 0, "team")); //码牌非活动交易
-                curData.Add("TotalPosAmount", UserTradeDaySummaryDbconnV2.Instance.GetDateTradeForCloud(UserId, Date, 0, 1, "team")); //刷卡总交易
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryDbconn.Instance.GetDateTradeForCloud(UserId, Date, 1, "team")); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryDbconn.Instance.GetDateTradeForBrand(UserId, Date, sub.Id, "team");
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-                // }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩-近半年
-        [Authorize]
-        public JsonResult TeamPerformanceHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                var month = Month.ToString("yyyyMM");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                decimal HelpAmount = 0;
-
-                // DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + ")) or SeoDescription like '%," + UserId + ",%' or QueryCount=" + UserId + ") AND TradeMonth=" + month + "");
-                DataTable dt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + UserId + ",%' OR Id=" + UserId + "))) AND TradeMonth=" + month + "");
-                foreach (DataRow item in dt.Rows)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(item["TradeAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(UserId, Month.ToString("yyyyMM"), "team") + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TeamTotalAmount:Active:" + UserId + ":" + Month.ToString("yyyyMM"))); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 0, 0, "team")); //码牌非活动交易
-                curData.Add("TotalPosAmount", UserTradeDaySummaryDbconnV2.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 0, 1, "team")); //刷卡总交易
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 1, "team")); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryDbconn.Instance.GetMonthTradeForBrand(UserId, Month.ToString("yyyyMM"), sub.Id, "team");
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //名称
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-我的商户-商户详情-交易统计
-        [Authorize]
-        public JsonResult MerchantTradeList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = MerchantTradeListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> MerchantTradeListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<string> query = RedisDbconn.Instance.GetList<string>("MerchantTradeList:" + MerchantId + ":" + TradeMonth, PageNum, PageSize);
-            foreach (string DateString in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeDate", DateString); //交易日
-                curData.Add("TradeAmt", RedisDbconn.Instance.Get<decimal>("MerchantTradeAmount:" + MerchantId + ":" + DateString)); //交易额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-我的商户-商户详情-交易统计-近半年
-        [Authorize]
-        public JsonResult MerchantTradeListForHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = MerchantTradeListForHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> MerchantTradeListForHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserTradeDaySummary> query = RedisDbconn.Instance.GetList<UserTradeDaySummary>("UserTradeDaySummary", PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", subdata.TradeMonth); //交易月
-                curData.Add("TradeAmt", ""); //交易额
-                curData.Add("TradeCount", ""); //交易数
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 0 - 1
Areas/Api/Controllers/v1/MainServer/UsersController.cs

@@ -440,7 +440,6 @@ namespace MySystem.Areas.Api.Controllers.v1
                     Kind = 1,
                 };
             }
-            Obj.Add("Token", new SystemSetController(_accessor, _logger, _setting).AppTokenV2(user.Id, DeviceId, DeviceType));
             user.DeviceId = DeviceId;
             user.DeviceType = DeviceType;
             maindb.SaveChanges();

+ 0 - 364
Areas/Api/Controllers/v1/Pos/ActiveRewardController.cs

@@ -1,364 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class ActiveRewardController : BaseController
-    {
-        public ActiveRewardController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-首页-我的业绩-个人业绩-激活商户-每月明细
-        [Authorize]
-        public JsonResult ActMerchantForMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ActMerchantForMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ActMerchantForMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddHours(1).AddDays(-1).AddMonths(1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                string Month = date.ToString("yyyyMM");
-                string Date = date.ToString("yyyyMMdd");
-                // if (Date != DateTime.Now.ToString("yyyyMMdd"))
-                // {
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    DataTable dt = OtherMySqlConn.dtable("select sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'self' and UserId = " + UserId + " and TradeMonth = " + Month + " and SeoKeyword = " + Date + "");
-                    foreach (DataRow item in dt.Rows)
-                    {
-                        var ActTotal = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                        curData.Add("Date", date.ToString("yyyy-MM-dd")); //时间
-                        curData.Add("ActTotal", ActTotal); //总激活
-                    }
-                    //产品列表
-                    List<Dictionary<string, object>> TypeList = new List<Dictionary<string, object>>();
-                    DataTable dts = OtherMySqlConn.dtable("select BrandId, sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'self' and UserId = " + UserId + " and TradeMonth = " + Month + " and SeoKeyword = " + Date + " GROUP BY BrandId");
-                    foreach (DataRow item in dts.Rows)
-                    {
-                        Dictionary<string, object> TypeCount = new Dictionary<string, object>();
-                        var Id = Convert.ToInt32(item["BrandId"]);
-                        var query = maindb.KqProducts.FirstOrDefault(m => m.Id == Id);
-                        var Count = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                        if (Count > 0)
-                        {
-                            TypeCount.Add("Brand", query.Name); //产品名称
-                            TypeCount.Add("Count", Count); //激活数
-                            TypeList.Add(TypeCount);
-                        }
-                    }
-                    curData.Add("TypeList", TypeList);
-                    dataList.Add(curData);
-                // }
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 创客-首页-我的业绩-个人业绩-激活商户-近半年
-        [Authorize]
-        public JsonResult ActMerchantForHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ActMerchantForHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ActMerchantForHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                var TradeMonth = Month.ToString("yyyyMM");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                DataTable dt = OtherMySqlConn.dtable("select sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'self' and UserId = " + UserId + " and TradeMonth = " + TradeMonth + "");
-                foreach (DataRow item in dt.Rows)
-                {
-                    var ActTotal = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                    curData.Add("ActTotal", ActTotal); //总激活
-                }
-                //产品列表
-                List<Dictionary<string, object>> TypeList = new List<Dictionary<string, object>>();
-                DataTable dts = OtherMySqlConn.dtable("select BrandId, sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'self' and UserId = " + UserId + " and TradeMonth = " + TradeMonth + " GROUP BY BrandId");
-                foreach (DataRow item in dts.Rows)
-                {
-                    Dictionary<string, object> TypeCount = new Dictionary<string, object>();
-                    var Id = Convert.ToInt32(item["BrandId"]);
-                    var query = maindb.KqProducts.FirstOrDefault(m => m.Id == Id);
-                    var Count = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                    if (Count > 0)
-                    {
-                        TypeCount.Add("Brand", query.Name); //产品名称
-                        TypeCount.Add("Count", Count); //激活数
-                        TypeList.Add(TypeCount);
-                    }
-                }
-                curData.Add("TypeList", TypeList);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-我的业绩-团队业绩-激活商户-每月明细
-        [Authorize]
-        public JsonResult TeamActMerchantForMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamActMerchantForMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamActMerchantForMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddHours(1).AddDays(-1).AddMonths(1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                string Month = date.ToString("yyyyMM");
-                string Date = date.ToString("yyyyMMdd");
-                // if (Date != DateTime.Now.ToString("yyyyMMdd"))
-                // {
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    DataTable dt = OtherMySqlConn.dtable("select sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'team' and UserId = " + UserId + " and TradeMonth = " + Month + " and SeoKeyword = " + Date + "");
-                    foreach (DataRow item in dt.Rows)
-                    {
-                        var ActTotal = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                        curData.Add("Date", date.ToString("yyyy-MM-dd")); //时间
-                        curData.Add("ActTotal", ActTotal); //总激活
-                    }
-                    //产品列表
-                    List<Dictionary<string, object>> TypeList = new List<Dictionary<string, object>>();
-                    DataTable dts = OtherMySqlConn.dtable("select BrandId, sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'team' and UserId = " + UserId + " and TradeMonth = " + Month + " and SeoKeyword = " + Date + " GROUP BY BrandId");
-                    foreach (DataRow item in dts.Rows)
-                    {
-                        Dictionary<string, object> TypeCount = new Dictionary<string, object>();
-                        var Id = Convert.ToInt32(item["BrandId"]);
-                        var query = maindb.KqProducts.FirstOrDefault(m => m.Id == Id);
-                        var Count = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                        if (Count > 0)
-                        {
-                            TypeCount.Add("Brand", query.Name); //产品名称
-                            TypeCount.Add("Count", Count); //激活数
-                            TypeList.Add(TypeCount);
-                        }
-                    }
-                    curData.Add("TypeList", TypeList);
-                    dataList.Add(curData);
-                // }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-我的业绩-团队业绩-激活商户-近半年
-        [Authorize]
-        public JsonResult TeamActMerchantForHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamActMerchantForHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamActMerchantForHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                var TradeMonth = Month.ToString("yyyyMM");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                DataTable dt = OtherMySqlConn.dtable("select sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'team' and UserId = " + UserId + " and TradeMonth = " + TradeMonth + "");
-                foreach (DataRow item in dt.Rows)
-                {
-                    var ActTotal = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                    curData.Add("ActTotal", ActTotal); //总激活
-                }
-                //产品列表
-                List<Dictionary<string, object>> TypeList = new List<Dictionary<string, object>>();
-                DataTable dts = OtherMySqlConn.dtable("select BrandId, sum(ActiveBuddyMerStatus) sum from UserTradeMonthSummary where SeoTitle = 'team' and UserId = " + UserId + " and TradeMonth = " + TradeMonth + " GROUP BY BrandId");
-                foreach (DataRow item in dts.Rows)
-                {
-                    Dictionary<string, object> TypeCount = new Dictionary<string, object>();
-                    var Id = Convert.ToInt32(item["BrandId"]);
-                    var query = maindb.KqProducts.FirstOrDefault(m => m.Id == Id);
-                    var Count = Convert.ToInt32(function.CheckInt(item["sum"].ToString()));
-                    if (Count > 0)
-                    {
-                        TypeCount.Add("Brand", query.Name); //产品名称
-                        TypeCount.Add("Count", Count); //激活数
-                        TypeList.Add(TypeCount);
-                    }
-                }
-                curData.Add("TypeList", TypeList);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 首页-客小爽产品-收益查看-激活奖励
-        [Authorize]
-        public JsonResult StatList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StatListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StatListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
-            string Date = Kind == 1 ? "Day" : "Month";
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<string> query = RedisDbconn.Instance.GetList<string>("ActiveReward" + Date + ":" + UserId + ":" + ProductType, PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("RewardAmount", RedisDbconn.Instance.Get<decimal>("ActiveRewardAmt:" + UserId + ":" + ProductType + ":" + subdata)); //奖励金额
-                if (Kind == 1)
-                {
-                    curData.Add("ActDate", subdata.Substring(0, 4) + "年" + subdata.Substring(4, 2) + "月" + subdata.Substring(6, 2) + "日"); //激活时间
-                }
-                else
-                {
-                    curData.Add("ActDate", subdata.Substring(0, 4) + "年" + subdata.Substring(4, 2) + "月"); //激活时间
-                }
-                curData.Add("ActDateValue", subdata); //激活时间值
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 首页-客小爽产品-收益查看-激活奖励-详情
-        [Authorize]
-        public JsonResult StatDetail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StatDetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StatDetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            string ActDate = data["ActDate"].ToString(); //激活时间
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<int> query = RedisDbconn.Instance.GetList<int>("ActiveRewardDetail:" + UserId + ":" + ProductType + ":" + ActDate, PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                PosMerchantInfo merchant = PosMerchantInfoDbconn.Instance.Get(subdata) ?? new PosMerchantInfo();
-                curData.Add("MerchantName", merchant.MerchantName); //商户名称
-                curData.Add("RewardAmount", RedisDbconn.Instance.Get<decimal>("ActiveRewardAmt:mer:" + merchant.Id + ":" + ProductType + ":" + ActDate)); //奖励金额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 80
Areas/Api/Controllers/v1/Pos/AppVideoController.cs

@@ -1,80 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class AppVideoController : BaseController
-    {
-        public AppVideoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-操作视频分类
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<AppVideo> query = RedisDbconn.Instance.GetList<AppVideo>("AppVideo", PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Name", subdata.Name); //名称
-                curData.Add("BannerPic", DefaultPic(subdata.BannerPic)); //Banner图片
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 82
Areas/Api/Controllers/v1/Pos/AppVideoListController.cs

@@ -1,82 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class AppVideoListController : BaseController
-    {
-        public AppVideoListController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-操作视频列表
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int VideoId = int.Parse(function.CheckInt(data["VideoId"].ToString())); //视频分类Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<AppVideoList> query = RedisDbconn.Instance.GetList<AppVideoList>("AppVideoList:" + VideoId, PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Title", subdata.Title); //标题
-                curData.Add("VideoUrl", subdata.VideoUrl); //视频地址
-                curData.Add("BgPic", DefaultPic(subdata.BgPic)); //背景图
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 533
Areas/Api/Controllers/v1/Pos/ApplyMachineController.cs

@@ -1,533 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using System.Text;
-
-/// <summary>
-/// 分仓向总仓申请机具接口
-/// </summary>
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("/Api/v1/[controller]/[action]")]
-    public class ApplyMachineController : BaseController
-    {
-        public ApplyMachineController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-        // #region 创客-首页-仓库管理-仓库列表
-        // /// <summary>
-        // /// 创客仓库列表
-        // /// </summary>
-        // /// <param name="value"></param>
-        // /// <returns></returns>
-        // [Authorize]
-        // public JsonResult StoreHouseList(string value)
-        // {
-        //     value = DesDecrypt(value);
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> dataList = StoreHouseListDo(value);
-        //     return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        // }
-        // public List<Dictionary<string, object>> StoreHouseListDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-        //     int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-        //     List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-        //     List<int> query = ApplyMachineDbconn.Instance.GetList(UserId, PageNum, PageSize);
-
-        //     foreach (int StoreId in query)
-        //     {
-        //         StoreHouse subdata = ApplyMachineDbconn.Instance.Get(StoreId) ?? new StoreHouse();
-        //         Dictionary<string, object> curData = new Dictionary<string, object>();
-        //         curData.Add("Id", subdata.Id); //Id
-        //         curData.Add("Name", subdata.ProductName); //产品仓库名称
-        //         curData.Add("LaveNum", subdata.LaveNum); //剩余数量
-        //         dataList.Add(curData);
-        //     }
-        //     return dataList;
-        // }
-        // #endregion
-
-
-        #region 创客-首页-仓库管理-机具申请-返回可申请机具数量
-        [Authorize]
-        public JsonResult StoreApply(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = StoreApplyDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson StoreApplyDo(string value)
-        {
-            // value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));           //创客Id
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString()));         //仓库Id
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString()));         //产品类型
-
-            DateTime LastTime = DateTime.Parse(DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd 00:00:00"));
-            DateTime ThisTime = DateTime.Parse(DateTime.Now.AddDays(1 - DateTime.Now.Day).AddDays(-1).ToString("yyyy-MM-dd 23:59:59"));
-
-            //剩余库存量
-            var storeHousesLaveNum = maindb.StoreHouse.FirstOrDefault(m => m.UserId == UserId && m.Id == StoreId).LaveNum;
-
-            //上月出货总量
-            int applyDeviceNum = 0;
-            bool check = maindb.MachineApply.Any(m => m.UserId == UserId && m.StoreId == StoreId && m.ApplyTime >= LastTime && m.ApplyTime <= ThisTime);
-            if (check)
-            {
-                applyDeviceNum = maindb.MachineApply.Where(m => m.UserId == UserId && m.StoreId == StoreId && m.ApplyTime >= LastTime && m.ApplyTime <= ThisTime).Sum(m => m.ApplyDeviceNum);
-            }
-
-            //上月出货量两倍
-            int LastApplyTwo = applyDeviceNum * 2;
-
-            //最低库存数 固定
-            int minInventory = 0;
-
-            //电签
-            if (BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6)
-            {
-                minInventory = 60;
-            }
-            //大Pos
-            else if (BrandId == 3 || BrandId == 5)
-            {
-                minInventory = 25;
-            }
-
-            // //金控电签
-            // if (BrandId == 1)
-            // {
-            //     minInventory = 60;
-            // }
-            // //开店宝电签
-            // else if (BrandId == 2)
-            // {
-            //     minInventory = 60;
-            // }
-            // //金控大POS
-            // else if (BrandId == 3)
-            // {
-            //     minInventory = 25;
-            // }
-            // //乐刷电签
-            // else if (BrandId == 4)
-            // {
-            //     minInventory = 60;
-            // }
-
-            //申请数量上限(上月出库量的2倍或最低库存量)
-            int findInventory = 0;
-            if (LastApplyTwo > minInventory)
-            {
-                findInventory = (LastApplyTwo - storeHousesLaveNum) < 0 ? 0 : (LastApplyTwo - storeHousesLaveNum);
-            }
-            else
-            {
-                findInventory = minInventory - storeHousesLaveNum < 0 ? 0 : minInventory - storeHousesLaveNum;
-            }
-
-            //箱数
-            int boxes = 0;
-
-            //电签
-            if (BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6)
-            {
-                boxes = findInventory / 50;
-            }
-            //大Pos
-            else if (BrandId == 3 || BrandId == 5)
-            {
-                boxes = findInventory / 10;
-            }
-
-            // //电签
-            // if (BrandId == 1 || BrandId == 1 || BrandId == 1 || BrandId == 1)
-            // {
-            //     boxes = findInventory / 50;
-            // }
-            // //开店宝电签
-            // else if (BrandId == 2)
-            // {
-            //     boxes = findInventory / 50;
-            // }
-            // //金控大POS
-            // else if (BrandId == 3)
-            // {
-            //     boxes = findInventory / 10;
-            // }
-            // //乐刷电签
-            // else if (BrandId == 4)
-            // {
-            //     boxes = findInventory / 50;
-            // }
-            // //乐刷大POS
-            // else if (BrandId == 5)
-            // {
-            //     boxes = findInventory / 10;
-            // }
-            // //立刷电签
-            // else if (BrandId == 6)
-            // {
-            //     boxes = findInventory / 50;
-            // }
-
-            //每箱台数
-            int boxNum = 0;
-            if (BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6)
-            {
-                boxNum = 50;
-            }
-            else if (BrandId == 3 || BrandId == 5)
-            {
-                boxNum = 10;
-            }
-
-            Machines machines = new Machines();
-            machines.findInventory = findInventory;
-            machines.boxes = boxes;
-            machines.boxeNum = boxNum;
-
-            return new AppResultJson() { Status = "1", Info = "", Data = machines };
-        }
-        #endregion
-
-
-        // #region 创客-首页-仓库管理-机具申请--确认申请
-        // [Authorize]
-        // public JsonResult ConfirmApply(string value)
-        // {
-        //     value = DesDecrypt(value);
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     AppResultJson result = ConfirmApplyDo(value);
-        //     return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        // }
-        // public AppResultJson ConfirmApplyDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));           //创客Id
-        //     int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString()));         //仓库Id
-        //     int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString()));         //产品类型
-        //     int ApplyNum = int.Parse(function.CheckInt(data["ApplyNum"].ToString()));       //申请箱数
-
-        //     DateTime LastTime = DateTime.Parse(DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).ToString("yyyy-MM-dd 00:00:00"));
-        //     DateTime ThisTime = DateTime.Parse(DateTime.Now.AddDays(1 - DateTime.Now.Day).AddDays(-1).ToString("yyyy-MM-dd 23:59:59"));
-
-        //     //剩余库存量
-        //     var storeHousesLaveNum = maindb.StoreHouse.FirstOrDefault(m => m.UserId == UserId && m.Id == StoreId).LaveNum;
-
-        //     //上月出货总量
-        //     int applyDeviceNum = 0;
-        //     bool check = maindb.MachineApply.Any(m => m.UserId == UserId && m.StoreId == StoreId && m.ApplyTime >= LastTime && m.ApplyTime <= ThisTime);
-        //     if (check)
-        //     {
-        //         applyDeviceNum = maindb.MachineApply.Where(m => m.UserId == UserId && m.StoreId == StoreId && m.ApplyTime >= LastTime && m.ApplyTime <= ThisTime).Sum(m => m.ApplyDeviceNum);
-        //     }
-
-        //     //上月出货量两倍
-        //     int LastApplyTwo = applyDeviceNum * 2;
-
-        //     //最低库存数
-        //     int minInventory = 0;
-
-        //     //电签
-        //     if (BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6)
-        //     {
-        //         minInventory = 60;
-        //     }
-        //     //大Pos
-        //     else if (BrandId == 3 || BrandId == 5)
-        //     {
-        //         minInventory = 25;
-        //     }
-
-        //     //申请数量上限(上月出库量的2倍或最低库存量)
-        //     int findInventory = 0;
-        //     if (LastApplyTwo > minInventory)
-        //     {
-        //         findInventory = (LastApplyTwo - storeHousesLaveNum) < 0 ? 0 : (LastApplyTwo - storeHousesLaveNum);
-        //     }
-        //     else
-        //     {
-        //         findInventory = minInventory - storeHousesLaveNum < 0 ? 0 : minInventory - storeHousesLaveNum;
-        //     }
-
-        //     //每箱台数
-        //     int boxNum = 0;
-        //     if (BrandId == 1 || BrandId == 2 || BrandId == 4 || BrandId == 6)
-        //     {
-        //         boxNum = 50;
-        //     }
-        //     else if (BrandId == 3 || BrandId == 5)
-        //     {
-        //         boxNum = 10;
-        //     }
-
-        //     bool checks = maindb.StoreMachineApply.Any(m => m.UserId == UserId && m.StoreId == StoreId && m.BrandId == BrandId && m.Status == 0);
-        //     if (checks)
-        //     {
-        //         return new AppResultJson() { Status = "-1", Info = "您有相同机具类型的申请正在进行中,请等待完成后再次申请" };
-        //     }
-        //     if (!checks)
-        //     {
-        //         if (findInventory < boxNum)
-        //         {
-        //             return new AppResultJson() { Status = "-1", Info = "可申请机具数量低于机具整箱数量,不可申请" };
-        //         }
-        //         if (storeHousesLaveNum <= applyDeviceNum || storeHousesLaveNum <= minInventory)
-        //         {
-        //             Users users = maindb.Users.Find(UserId);
-
-        //             StoreHouse storehouse = maindb.StoreHouse.Find(StoreId);
-
-        //             Orders orders = new Orders();
-        //             orders.Status = 0;
-        //             orders.CreateDate = DateTime.Now;
-        //             orders.StoreId = StoreId;
-        //             orders.Areas = storehouse.Areas;
-        //             orders.Address = storehouse.Address;
-        //             orders.Mobile = users.Mobile;
-        //             orders.StoreContactMobile = storehouse.ManageMobile;
-        //             orders.RealName = users.RealName;
-        //             orders.UserId = storehouse.UserId;
-        //             maindb.Orders.Add(orders);
-        //             maindb.SaveChanges();
-
-        //             StoreMachineApply storeMachineApply = new StoreMachineApply();
-        //             storeMachineApply.Version = 0;
-        //             storeMachineApply.CreateDate = DateTime.Now;
-        //             storeMachineApply.ApplyTime = DateTime.Now;
-        //             storeMachineApply.ApplyNo = "AS" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-        //             storeMachineApply.BrandId = BrandId;
-        //             storeMachineApply.ApplyNum = ApplyNum;
-        //             storeMachineApply.BoxNum = boxNum;
-        //             storeMachineApply.LastApply = applyDeviceNum;
-        //             storeMachineApply.MaxApply = findInventory;
-        //             storeMachineApply.ActualApply = ApplyNum * boxNum;
-        //             storeMachineApply.UserId = UserId;
-        //             storeMachineApply.StoreId = StoreId;
-        //             maindb.StoreMachineApply.Add(storeMachineApply);
-        //             maindb.SaveChanges();
-
-        //             storeMachineApply.OrderId = orders.Id;
-        //             orders.Sort = storeMachineApply.Id;
-        //             maindb.SaveChanges();
-        //         }
-        //     }
-        //     return new AppResultJson() { Status = "1", Info = "申请成功", Data = "" };
-
-        // }
-        // #endregion
-
-
-
-
-        // #region 创客-首页-仓库管理-机具申请-申请记录列表
-        // /// <summary>
-        // /// 机具申请记录列表
-        // /// </summary>
-        // /// <param name="value"></param>
-        // /// <returns></returns>
-        // [Authorize]
-        // public JsonResult StoreApplyRecordList(string value)
-        // {
-        //     value = DesDecrypt(value);
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> dataList = StoreApplyRecordListDo(value);
-        //     return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        // }
-        // public List<Dictionary<string, object>> StoreApplyRecordListDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString()));//产品类型
-        //     int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString()));//仓库Id
-        //     int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-        //     int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-
-        //     List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-        //     List<int> query = ApplyMachineDbconn.Instance.GetApplyList(UserId, StoreId, PageNum, PageSize);
-
-        //     foreach (int Id in query)
-        //     {
-        //         StoreMachineApply subdata = ApplyMachineDbconn.Instance.GetApply(Id) ?? new StoreMachineApply();
-        //         Dictionary<string, object> curData = new Dictionary<string, object>();
-        //         curData.Add("Id", subdata.Id); //Id
-        //         curData.Add("ApplyTime", Convert.ToDateTime(subdata.ApplyTime).ToString("yyyy-MM-dd HH:mm:ss")); //申请时间
-        //         curData.Add("BrandId", subdata.BrandId); //机具类型
-        //         curData.Add("ApplyNum", subdata.ApplyNum); //申请箱数
-        //         curData.Add("Status", subdata.Status); //申请状态
-        //         dataList.Add(curData);
-        //     }
-        //     return dataList;
-        // }
-        // #endregion
-
-
-        // #region 创客-首页-仓库管理-机具申请-申请记录详情
-        // /// <summary>
-        // /// 机具申请列表详情
-        // /// </summary>
-        // /// <param name="value"></param>
-        // /// <returns></returns>
-        // [Authorize]
-        // public JsonResult StoreApplyDetail(string value)
-        // {
-        //     value = DesDecrypt(value);
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> dataList = StoreApplyDetailDo(value);
-        //     return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        // }
-        // public List<Dictionary<string, object>> StoreApplyDetailDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString()));//仓库Id
-        //     int StoreApplyId = int.Parse(function.CheckInt(data["StoreApplyId"].ToString()));//申请记录Id
-
-        //     List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-        //     List<int> query = ApplyMachineDbconn.Instance.GetApplyDetailList(UserId, StoreId, StoreApplyId);
-
-        //     foreach (int Id in query)
-        //     {
-        //         StoreMachineApply subdata = ApplyMachineDbconn.Instance.GetApply(Id) ?? new StoreMachineApply();
-        //         var temp = subdata.SwapSnExpand;
-        //         temp = temp.Substring(1);
-        //         temp = temp.Substring(0, temp.Length - 1);
-        //         var SwapSnExpand = temp.Split(",,");
-        //         Orders orders = OrdersDbconn.Instance.Get(subdata.OrderId.Value) ?? new Orders();
-        //         Dictionary<string, object> curData = new Dictionary<string, object>();
-        //         curData.Add("Id", subdata.Id); //Id
-        //         curData.Add("ApplyTime", Convert.ToDateTime(subdata.ApplyTime).ToString("yyyy-MM-dd HH:mm:ss")); //申请时间
-        //         curData.Add("BrandId", subdata.BrandId); //快递单号
-        //         curData.Add("ApplyNum", subdata.ApplyNum); //申请箱数
-        //         curData.Add("SendNum", subdata.SendNum); //发货箱数
-        //         curData.Add("BoxNum", subdata.BoxNum); //每箱台数
-        //         curData.Add("ErpMode", orders.ErpMode); //配送方式
-        //         curData.Add("OrderNo", orders.OrderNo); //快递单号
-        //         curData.Add("SwapSnExpand", SwapSnExpand); //机具SN号
-        //         dataList.Add(curData);
-        //     }
-        //     return dataList;
-        // }
-        // #endregion
-
-
-        #region 创客-首页-仓库管理-订单列表-库存
-        [Authorize]
-        public JsonResult StoreStockList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StoreStockListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StoreStockListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.StoreId == StoreId && m.UserId == 0 && m.BuyUserId == 0 && m.PreUserId == 0 && m.Status > -1);//库存和预发机分离
-            int skipNum = PageSize * (PageNum - 1);
-            query = query.Skip(skipNum).Take(PageSize);
-            foreach (var item in query.ToList())
-            {
-                PosMachinesTwo subdata = PosMachinesTwoDbconn.Instance.Get(item.Id) ?? new PosMachinesTwo();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("PosSn", subdata.PosSn);
-                curData.Add("CreateDate", subdata.CreateDate);
-                curData.Add("PreUserId", subdata.PreUserId);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 创客-首页-仓库管理-订单列表-预发机
-        [Authorize]
-        public JsonResult PreStoreStockList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PreStoreStockListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PreStoreStockListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PreSendStockDetail> query = maindb.PreSendStockDetail.Where(m => m.FromStoreId == StoreId && m.Status >= 0 && m.Status <= 1 && m.ApplyFlag == 0);
-            int skipNum = PageSize * (PageNum - 1);
-            query = query.Skip(skipNum).Take(PageSize);
-            foreach (var item in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("PosSn", item.SnNo);
-                curData.Add("CreateDate", item.CreateDate);
-                curData.Add("isGrant", item.AuthFlag); //占用小分仓额度标记
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-
-        #region  私有类-获取最多申请台数、箱数、每箱台数
-        public class Machines
-        {
-            //最多申请台数
-            public int findInventory { get; set; }
-            //最多申请箱数
-            public int boxes { get; set; }
-            //每箱台数
-            public int boxeNum { get; set; }
-
-        }
-        #endregion
-    }
-}

+ 0 - 240
Areas/Api/Controllers/v1/Pos/DepositQueryController.cs

@@ -1,240 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using System.Text;
-
-/// <summary>
-/// 商户验证相关接口
-/// </summary>
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("/Api/v1/[controller]/[action]")]
-    public class DepositQueryController : BaseController
-    {
-        public DepositQueryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-        #region 获取商户机具押金列表
-        [Authorize]
-        public JsonResult CheckMerchants(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = CheckMerchantsDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson CheckMerchantsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SN = data["SN"].ToString(); //机具SN
-            string MerchantName = data["MerchantName"].ToString(); //商户名称
-            string MerchantCertId = data["MerchantCertId"].ToString(); //商户身份证号
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MobileCode = data["MobileCode"].ToString(); //短信验证码
-            if (string.IsNullOrEmpty(MerchantMobile))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写手机号" };
-            }
-            if (MerchantMobile.Length > 11)
-            {
-                return new AppResultJson() { Status = "-1", Info = "手机号最多11个字符" };
-            }
-            if (function.CheckMobile(MerchantMobile) == "")
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写正确的手机号" };
-            }
-            MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + MerchantMobile);
-            if (mobilecheck == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            if (mobilecheck.CheckCode != MobileCode)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-
-            //通过机具SN查询并更新商户数据
-            List<PosMachinesTwo> posMachinesTwos = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.PosSn == SN).ToList();
-            if (posMachinesTwos.Count > 0)
-            {
-                maindb.PosMerchantInfo.Add(new PosMerchantInfo()
-                {
-                    MerIdcardNo = MerchantCertId,
-                    MerRealName = MerchantName,
-                    MerchantMobile = MerchantMobile
-                });
-                maindb.SaveChanges();
-            }
-
-            List<PosMerchantInfo> merchants = maindb.PosMerchantInfo.Where(m => m.MerIdcardNo == MerchantCertId).ToList();
-            if (merchants.Count == 0)
-            {
-                merchants = maindb.PosMerchantInfo.Where(m => m.MerRealName.Contains(MerchantName)).ToList();
-            }
-            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
-            foreach (PosMerchantInfo sub in merchants)
-            {
-                Dictionary<string, object> item = new Dictionary<string, object>();
-                item.Add("Id", sub.Id);
-                item.Add("MerchantName", sub.MerchantName);
-                item.Add("MerchantCode", sub.KqMerNo);
-                item.Add("ProductName", RelationClass.GetKqProductBrandInfo(sub.BrandId));
-                list.Add(item);
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = list };
-        }
-        #endregion
-
-        #region 通用-通过商户编号查询商户信息-2
-        [Authorize]
-        public JsonResult QueryMerchantInfo2(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson Obj = QueryMerchantInfo2Do(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public AppResultJson QueryMerchantInfo2Do(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SN = data["SN"].ToString(); //机具SN
-            string MerchantNo = data["MerchantNo"].ToString(); //商户编号
-            string MerchantName = data["MerchantName"].ToString(); //商户名称
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerchantCertId = data["MerchantCertId"].ToString(); //商户身份证号
-            string MobileCode = data["MobileCode"].ToString(); //短信验证码
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> datalist = new List<Dictionary<string, object>>();
-            if (string.IsNullOrEmpty(MerchantMobile))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写手机号" };
-            }
-            if (MerchantMobile.Length > 11)
-            {
-                return new AppResultJson() { Status = "-1", Info = "手机号最多11个字符" };
-            }
-            if (function.CheckMobile(MerchantMobile) == "")
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写正确的手机号" };
-            }
-            MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + MerchantMobile);
-            if (mobilecheck == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            if (mobilecheck.CheckCode != MobileCode)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            RedisDbconn.Instance.Clear("MobileCodeCheck:" + MerchantMobile);
-            string CheckMobile = MerchantMobile.Substring(0, 3) + "****" + MerchantMobile.Substring(7);
-
-            //通过机具SN查询并更新商户数据
-            List<PosMachinesTwo> posMachinesTwos = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.PosSn == SN).ToList();
-            if (posMachinesTwos.Count > 0)
-            {
-                maindb.PosMerchantInfo.Add(new PosMerchantInfo()
-                {
-                    MerIdcardNo = MerchantCertId,
-                    MerRealName = MerchantName,
-                    MerchantMobile = MerchantMobile
-                });
-                maindb.SaveChanges();
-            }
-
-            PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerchantNo);
-            if (merchant == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "", Data = Obj };
-            }
-            bool CheckCertId = maindb.PosMerchantOtherInfo.Any(m => m.CertId == MerchantCertId);
-            if (function.CheckNull(merchant.MerchantMobile).Contains("****") && !CheckCertId)
-            {
-                merchant.MerRealName = MerchantName;
-                merchant.MerchantMobile = MerchantMobile;
-                merchant.MerIdcardNo = MerchantCertId;
-                PosMerchantOtherInfo other = maindb.PosMerchantOtherInfo.FirstOrDefault(m => m.CertId == MerchantCertId);
-                if (other == null)
-                {
-                    maindb.PosMerchantOtherInfo.Add(new PosMerchantOtherInfo()
-                    {
-                        CertId = MerchantCertId,
-                        MerchantId = merchant.Id,
-                        RealName = MerchantName,
-                        MerNo = MerchantNo,
-                        BrandId = merchant.BrandId,
-                    });
-                }
-                else
-                {
-                    other.MerchantId = merchant.Id;
-                    other.RealName = MerchantName;
-                    other.MerNo = MerchantNo;
-                    other.BrandId = merchant.BrandId;
-                }
-                maindb.SaveChanges();
-            }
-            bool checkPos = maindb.PosMachinesTwo.Any(m => m.Status > -1 && m.BindMerchantId == merchant.Id);
-            PosMachinesTwo pos = new PosMachinesTwo();
-            if (checkPos)
-            {
-                pos = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BindMerchantId == merchant.Id).OrderByDescending(m => m.SeoKeyword).FirstOrDefault() ?? new PosMachinesTwo();
-            }
-            Obj.Add("MerRealName", merchant.MerRealName); //商户真实名称
-            Obj.Add("MerchantMobile", merchant.MerchantMobile); //商户手机号
-            Obj.Add("SN", pos.PosSn); //机具SN号
-            Obj.Add("type", RelationClass.GetKqProductBrandInfo(merchant.BrandId)); //品牌名称
-            if (pos.ActivationState == 1)
-            {
-                Obj.Add("createTime", pos.ActivationTime == null ? "" : pos.ActivationTime.Value.ToString("yyyy-MM-dd")); //创建时间
-            }
-            else
-            {
-                Obj.Add("createTime", "未激活");
-            }
-            Obj.Add("totalTurnover", pos.CreditTrade.ToString("f2")); //累计交易额
-            Obj.Add("mounthTurnover", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(merchant.Id, DateTime.Now.ToString("yyyyMM"))); //本月交易额
-            decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-            if (pos.BrandId != 2 && pos.BrandId != 7)
-            {
-                deposit = deposit / 100;
-            }
-            Obj.Add("deposit", deposit.ToString("f2")); //押金金额
-            Obj.Add("policy", "押99返100,押199返200,押299返300"); //返押政策
-            bool status = maindb.ActiveReward.Any(m => m.KqSnNo == pos.PosSn);
-            Obj.Add("status", status ? "未返" : "已返"); //返押金状态
-            if (status)
-            {
-                Obj.Add("reason", ""); //返回失败原因
-            }
-            else
-            {
-                string reason = "";
-                if (string.IsNullOrEmpty(pos.SeoKeyword))
-                {
-                    reason = "处理中";
-                }
-                else if (pos.CreditTrade < 1000)
-                {
-                    reason = "贷记卡交易未满1000";
-                }
-                Obj.Add("reason", reason);
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-    }
-}

+ 0 - 149
Areas/Api/Controllers/v1/Pos/FluxProfitSummaryController.cs

@@ -1,149 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class FluxProfitSummaryController : BaseController
-    {
-        public FluxProfitSummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-收益查看-流量卡分佣
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["ProductType"].ToString()));//产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<FluxProfitSummary> query = maindb.FluxProfitSummary.Where(m => m.UserId == UserId && m.BrandId == BrandId).OrderByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                string TradeMonth = subdata.TradeMonth;
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2)); //交易月
-                curData.Add("TradeMonthValue", TradeMonth);
-                curData.Add("FluxProfitAmt", subdata.FluxProfitAmt); //流量分润总金额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-收益查看-流量卡分佣详细
-        [Authorize]
-        public JsonResult ByDate(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ByDateDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ByDateDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString())); //产品类型
-            string TradeMonth = data["TradeMonth"].ToString();
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<FluxProfitDetail> query = maindb.FluxProfitDetail.Where(m => m.UserId == UserId && m.TradeMonth == TradeMonth && m.BrandId == ProductType);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                string TradeDate = subdata.TradeDate;
-                curData.Add("TradeDate", TradeDate.Substring(0, 4) + "-" + TradeDate.Substring(4, 2) + "-" + TradeDate.Substring(6, 2)); //交易日
-                curData.Add("FluxProfitAmt", subdata.FluxProfitAmt); //流量分润总金额
-                PosMerchantInfo merchant = PosMerchantInfoDbconn.Instance.Get(subdata.MerchantId) ?? new PosMerchantInfo();
-                string MerchantName = merchant.MerchantName;
-                if (ProductType == 2)
-                {
-                    if (MerchantName.Contains("-"))
-                    {
-                        MerchantName = MerchantName.Split('-')[1];
-                    }
-                    else if (MerchantName.Contains("_"))
-                    {
-                        MerchantName = MerchantName.Split('_')[1];
-                    }
-                }
-                curData.Add("RealName", MerchantName); //姓名
-                curData.Add("Mobile", merchant.MerchantMobile); //手机号
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 183
Areas/Api/Controllers/v1/Pos/KqProductsController.cs

@@ -1,183 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class KqProductsController : BaseController
-    {
-        public KqProductsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 通用-产品列表
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<KqProducts> query = KqProductsDbconn.Instance.GetList();
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                int Price = 0;
-                if (subdata.Name.Contains("电签"))
-                {
-                    Price = 200;
-                }
-                if (subdata.Name.Contains("POS"))
-                {
-                    Price = 300;
-                }
-                curData.Add("Name", subdata.Name); //名称
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("Price", Price); //价格
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-主界面产品数据
-        [Authorize]
-        public JsonResult MainStatData(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = MainStatDataDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> MainStatDataDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string UserId = data["UserId"].ToString(); //创客Id
-            
-            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
-            List<KqProducts> querys = KqProductsDbconn.Instance.GetList();
-            foreach (KqProducts query in querys)
-            {
-                Dictionary<string, object> Obj = new Dictionary<string, object>();
-                Obj.Add("Id", query.Id);
-                Obj.Add("Name", query.Name); //名称
-
-                UserMachineData MachineData = UserMachineDataDbconn.Instance.Get(UserId + "_" + query.Id) ?? new UserMachineData();
-                Dictionary<string, object> Machine = new Dictionary<string, object>();
-                Machine.Add("TotalMachineCount", MachineData.TotalMachineCount);  //总机具数
-                Machine.Add("UnBindCount", MachineData.UnBindCount); //未绑定机具数
-                Machine.Add("BindCount", MachineData.BindCount); //已绑定机具数
-                Obj.Add("Machine", Machine); //机具管理数据
-
-                Dictionary<string, object> Profit = new Dictionary<string, object>();
-                Profit.Add("TradeProfit", MachineData.TradeProfit); //交易分润
-                Profit.Add("ActProfit", MachineData.ActProfit); //激活奖励
-                Profit.Add("OpenProfit", MachineData.OpenProfit); //开机奖励
-                Profit.Add("DividendsProfit", MachineData.DividendsProfit); //分红奖励
-                Profit.Add("OtherProfit", MachineData.OtherProfit); //分润补贴
-                Profit.Add("FluxProfit", MachineData.FluxProfit); //流量卡分佣
-                Obj.Add("Profit", Profit); //收益查看数据
-
-                List<Dictionary<string, object>> Advertisment = new List<Dictionary<string, object>>();
-                string ColId = "";
-                if (query.Id == 1)
-                { 
-                    ColId = "003002";
-                }
-                else if (query.Id == 2)
-                { 
-                    ColId = "003004";
-                }
-                else if (query.Id == 3)
-                { 
-                    ColId = "003003";
-                }
-                else if (query.Id == 4)
-                { 
-                    ColId = "003005";
-                }
-                else if (query.Id == 5)
-                { 
-                    ColId = "003006";
-                }
-                else if (query.Id == 6)
-                { 
-                    ColId = "003007";
-                }
-                else if (query.Id == 7)
-                { 
-                    ColId = "003009";
-                }
-                else if (query.Id == 8 || query.Id == 9)
-                { 
-                    ColId = "003008";
-                }
-                else if (query.Id == 10 || query.Id == 11)
-                { 
-                    ColId = "003010";
-                }
-                List<Models.Advertisment> ads = AdvertismentDbconn.Instance.GetList(ColId);
-                foreach (Models.Advertisment ad in ads)
-                {
-                    Dictionary<string, object> item = new Dictionary<string, object>();
-                    item.Add("Url", ad.Url); //跳转地址
-                    item.Add("BannerPic", DefaultPic(ad.PicPath)); //广告图片
-                    item.Add("Id", ad.Id); //Id
-                    Advertisment.Add(item);
-                }
-                Obj.Add("Advertisment", Advertisment);
-                list.Add(Obj);
-            }
-            return list;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 1039
Areas/Api/Controllers/v1/Pos/LargeDataScreenController.cs

@@ -1,1039 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using System.Text;
-using Microsoft.IdentityModel.Tokens;
-using System.Security.Claims;
-using System.IdentityModel.Tokens.Jwt;
-
-//数据大屏相关接口
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("/Api/v1/[controller]/[action]")]
-    public class LargeDataScreenController : BaseController
-    {
-        public LargeDataScreenController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-
-        }
-
-
-        #region 数据大屏-今日新增商户和创客
-        [Authorize]
-        public JsonResult AllMakerData(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<MakerShopAdds> Obj = AllMakerDataDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<MakerShopAdds> AllMakerDataDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<MakerShopAdds> Obj = LargeDataScreenDbconn.Instance.GetMakerShopAddsList();
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> AllMakerDataDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     DataTable dt = OtherMySqlConn.dtable("select (select count(0) count from PosMerchantInfo where TO_DAYS(CreateDate)=TO_DAYS(NOW())) shcount, (select count(0) count from Users where TO_DAYS(CreateDate)=TO_DAYS(NOW())) ckcount from PosMerchantInfo,Users limit 1");
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var shcount = item["shcount"];//今日新增商户
-        //         var ckcount = item["ckcount"];//今日新增创客
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("shcount", shcount);
-        //         ob.Add("ckcount", ckcount);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-        // }
-
-        #endregion
-
-
-        #region 数据大屏-全国创客开机列表
-        /// <summary>
-        /// 全国创客开机列表
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MakerListCount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<MakerOpenMachines> list = MakerListCountDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = list });
-        }
-
-        public List<MakerOpenMachines> MakerListCountDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<MakerOpenMachines> Obj = LargeDataScreenDbconn.Instance.GetMakerOpenMachinesList("MakerOpenMachinesList: "+PageNum,PageNum,PageSize);
-            return Obj;
-        }
-
-        // public JsonResult MakerListCount(string value)
-        // {
-        //     value = DesDecrypt(value);
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> list = MakerListCountDo(value);
-        //     return Json(new AppResultJson() { Status = "1", Info = "", Data = list });
-        // }
-
-        // public List<Dictionary<string, object>> MakerListCountDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-        //     int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     DataTable dt = OtherMySqlConn.dtable("select b.ActivationTime ActivationTime,k.NAME productName,a.RealName realname,c.count count from Users a left join PosMachinesTwo b on a.Id=b.userId LEFT JOIN KqProducts k ON k.Id=b.BrandId left join (select a.Id,count(a.Id) as count from Users a left join PosMachinesTwo b on a.Id=b.UserId LEFT JOIN KqProducts k ON k.Id=b.BrandId where BindingState=1 group by a.Id)c on a.Id=c.Id where BindingState=1 AND MONTH(ActivationTime)=MONTH(now()) and YEAR(ActivationTime)=YEAR(now())order by a.Id");
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var ActivationTime = Convert.ToDateTime(item["ActivationTime"]).ToString("yyyy-MM-dd HH:mm:ss");//激活时间
-        //         var productName = item["productName"];//机具类型
-        //         var realname = SetSensitiveName(item["realname"].ToString());//创客姓名
-        //         int count = Convert.ToInt32(item["count"]);//创客本月开机
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("ActivationTime", ActivationTime);
-        //         ob.Add("productName", productName);
-        //         ob.Add("realname", realname);
-        //         ob.Add("count", count);
-        //         Obj.Add(ob);
-        //     }
-
-        //     list.Clear();
-        //     list = Obj.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-        //     OtherMySqlConn.connstr = "";
-        //     return list;
-        // }
-
-
-        #endregion
-
-
-        #region 数据大屏-全国展业数据
-        /// <summary>
-        /// 全国展业数据
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult ExhibitionData(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Exhibitions> Obj = ExhibitionDataDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<Exhibitions> ExhibitionDataDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Exhibitions> Obj = LargeDataScreenDbconn.Instance.GetExhibitionList();
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> ExhibitionDataDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     //本年交易额
-        //     // DataTable dt = OtherMySqlConn.dtable("select(select count(0) count from StoreHouse where YEAR(CreateDate)=YEAR(now())) count,(select sum(b.WithdrawAmount) WithdrawAmount from Users a left join UserAccount b on a.id=b.userid) WithdrawAmount,(select sum(TradeAmount) from TradeRecord where YEAR(CreateDate) = YEAR(NOW())) yearsum, (select count(*) from PosMachinesTwo where ActivationState=1 and YEAR(ActivationTime) = YEAR(NOW())) yearcount,(select sum(TradeAmount) from TradeRecord where quarter(CreateDate)=quarter(now())) quartersum, (select count(*) from PosMachinesTwo where ActivationState=1 and quarter(ActivationTime)=quarter(now())) quartercount,(select sum(TradeAmount) from TradeRecord where YEAR(CreateDate) = YEAR(NOW()) and MONTH(CreateDate)=MONTH(now())) monthsum, (select count(*) from PosMachinesTwo where ActivationState=1 and YEAR(ActivationTime) = YEAR(NOW()) and MONTH(ActivationTime)=MONTH(now())) monthcount,(select sum(TradeAmount) from TradeRecord where TO_DAYS(CreateDate)=TO_DAYS(NOW())) nowsum, (select count(*) from PosMachinesTwo where ActivationState=1 and TO_DAYS(ActivationTime)=TO_DAYS(NOW())) nowcount from TradeRecord,PosMachinesTwo limit 1");
-        //     DataTable dt = OtherMySqlConn.dtable("select(select count(0) count from StoreHouse where YEAR(CreateDate)=YEAR(now())) count,(select sum(NonDirectTradeAmt) WithdrawAmount from UserTradeDaySummary where UserId=1 and SeoTitle='team') WithdrawAmount,(select sum(NonDirectTradeAmt) WithdrawAmount from UserTradeDaySummary where UserId=1 and SeoTitle='team' and left(TradeMonth,4) = YEAR(NOW())) yearsum,(select sum(NonDirectDebitCapNum) from UserTradeDaySummary where UserId=1 and SeoTitle='team' and left(TradeMonth,4) = YEAR(NOW())) yearcount,(select sum(NonDirectTradeAmt) from UserTradeDaySummary where UserId=1 and SeoTitle='team' and quarter(TradeDate)=quarter(now())) quartersum, (select sum(NonDirectDebitCapNum) from UserTradeDaySummary where UserId=1 and SeoTitle='team' and quarter(TradeDate)=quarter(now())) quartercount,(select sum(NonDirectTradeAmt) WithdrawAmount from UserTradeDaySummary where UserId=1 and SeoTitle='team' and RIGHT(TradeMonth,2) = MONTH(NOW())) monthsum,(select sum(NonDirectDebitCapNum) WithdrawAmount from UserTradeDaySummary where UserId=1 and SeoTitle='team' and RIGHT(TradeMonth,2) = MONTH(NOW())) monthcount,(select sum(NonDirectTradeAmt) from UserTradeDaySummary where UserId=1 and SeoTitle='team' and TO_DAYS(TradeDate)=TO_DAYS(NOW())) nowsum, (select sum(NonDirectDebitCapNum) from UserTradeDaySummary where UserId=1 and SeoTitle='team' and TO_DAYS(TradeDate)=TO_DAYS(NOW())) nowcount from UserTradeDaySummary limit 1");
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var WithdrawAmount = item["WithdrawAmount"];//累计收益
-        //         var count = Convert.ToInt32(item["count"]);//分仓数
-        //         var yearsum = item["yearsum"];//本年交易额(元)
-        //         if (String.IsNullOrEmpty(item["yearsum"].ToString()))
-        //         {
-        //             yearsum = 0;
-        //         }
-        //         var yearcount = Convert.ToInt32(item["yearcount"]);//本年激活机具
-        //         var quartersum = item["quartersum"];//本季度交易额(元)
-        //         if (String.IsNullOrEmpty(item["quartersum"].ToString()))
-        //         {
-        //             quartersum = 0;
-        //         }
-        //         var quartercount = Convert.ToInt32(item["quartercount"]);//本季度激活机具
-        //         var monthsum = item["monthsum"];//本月交易额(元)
-        //         if (String.IsNullOrEmpty(item["monthsum"].ToString()))
-        //         {
-        //             monthsum = 0;
-        //         }
-        //         var monthcount = Convert.ToInt32(item["monthcount"]);//本月激活机具
-        //         var nowsum = item["nowsum"];//今日交易额(元)
-        //         if (String.IsNullOrEmpty(item["nowsum"].ToString()))
-        //         {
-        //             nowsum = 0;
-        //         }
-        //         var nowcount = item["nowcount"];//今日激活机具
-        //         if (String.IsNullOrEmpty(item["nowcount"].ToString()))
-        //         {
-        //             nowcount = 0;
-        //         }
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("WithdrawAmount", WithdrawAmount);
-        //         ob.Add("count", count);
-        //         ob.Add("yearsum", yearsum);
-        //         ob.Add("yearcount", yearcount);
-        //         ob.Add("quartersum", quartersum);
-        //         ob.Add("quartercount", quartercount);
-        //         ob.Add("monthsum", monthsum);
-        //         ob.Add("monthcount", monthcount);
-        //         ob.Add("nowsum", nowsum);
-        //         ob.Add("nowcount", nowcount);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-
-        // }
-        #endregion
-
-
-        #region 数据大屏-本月创客排名-开机榜
-        /// <summary>
-        /// 本月创客排名--开机榜
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MakerSort(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<OpenMachines> Obj = MakerSortDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<OpenMachines> MakerSortDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            List<OpenMachines> Obj = LargeDataScreenDbconn.Instance.GetOpenMachinesList(UserId);
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> MakerSortDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     // DataTable dt = OtherMySqlConn.dtable("select a.UserId UserId,b.RealName RealName,a.sum Sum from(select UserId, sum(NonDirectDebitCapNum) sum from UserTradeDaySummary where TradeMonth = date_format(CURDATE(), '%Y%m') and UserId in (select Id from Users where ParentNav like '%," + UserId + ",%')GROUP BY UserId ORDER BY sum desc limit 10)a left join Users b on a.UserId = b.Id");//本月数据统计
-        //     DataTable dt = OtherMySqlConn.dtable("select a.UserId UserId,b.RealName RealName,a.sum Sum from(select UserId, sum(NonDirectDebitCapNum) sum from UserTradeDaySummary where SeoTitle='team' and UserId in (select Id from Users where ParentNav like '%," + UserId + ",%')GROUP BY UserId ORDER BY sum desc limit 10)a left join Users b on a.UserId = b.Id");//累计数据统计
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var RealName = SetSensitiveName(item["RealName"].ToString());
-        //         var OpenCount = decimal.Parse(item["Sum"].ToString());
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("realName", RealName);
-        //         ob.Add("openCount", OpenCount);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-        // }
-
-        #endregion
-
-        #region H5-开机榜
-        /// <summary>
-        /// 本月创客排名--开机榜
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MakerSorts(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = MakerSortsDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<Dictionary<string, object>> MakerSortsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select a.UserId UserId,b.RealName RealName,a.sum Sum from(select UserId, sum(NonDirectDebitCapNum) sum from UserTradeDaySummary where TradeMonth = '202205' and UserId in (select Id from Users where ParentNav like '%," + UserId + ",%')GROUP BY UserId ORDER BY sum desc limit 10)a left join Users b on a.UserId = b.Id");
-            foreach (DataRow item in dt.Rows)
-            {
-                var RealName = SetSensitiveName(item["RealName"].ToString());
-                var OpenCount = decimal.Parse(item["Sum"].ToString());
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("realName", RealName);
-                ob.Add("openCount", OpenCount);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-本月创客排名-流水榜
-        /// <summary>
-        /// 本月创客排名--流水榜
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MakerFlowingWaterSort(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<FlowingWater> Obj = MakerFlowingWaterSortDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<FlowingWater> MakerFlowingWaterSortDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            List<FlowingWater> Obj = LargeDataScreenDbconn.Instance.GetFlowingWaterList(UserId);
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> MakerFlowingWaterSortDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     // DataTable dt = OtherMySqlConn.dtable("select a.UserId UserId,b.RealName RealName,a.sum Sum from(select UserId, sum(NonDirectDebitTradeAmt + NonDirectTradeAmt) sum from UserTradeDaySummary where TradeMonth = date_format(CURDATE(), '%Y%m') and UserId in (select Id from Users where ParentNav like '%," + UserId + ",%')GROUP BY UserId ORDER BY sum desc limit 10)a left join Users b on a.UserId = b.Id");//本月数据统计
-        //     DataTable dt = OtherMySqlConn.dtable("select a.UserId UserId,b.RealName RealName,a.sum Sum from(select UserId, sum(NonDirectDebitTradeAmt + NonDirectTradeAmt) sum from UserTradeDaySummary where SeoTitle='team' and UserId in (select Id from Users where ParentNav like '%," + UserId + ",%')GROUP BY UserId ORDER BY sum desc limit 10)a left join Users b on a.UserId = b.Id");//累计数据统计
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var RealName = SetSensitiveName(item["RealName"].ToString());
-        //         var Sum = decimal.Parse(item["Sum"].ToString());
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("UserId", UserId);
-        //         ob.Add("RealName", RealName);
-        //         ob.Add("Sum", Sum);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-        // }
-        #endregion
-
-        #region H5-流水榜
-        /// <summary>
-        /// 本月创客排名--流水榜
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MakerFlowingWatersSort(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = MakerFlowingWaterSortsDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> MakerFlowingWaterSortsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select a.UserId UserId,b.RealName RealName,a.sum Sum from(select UserId, sum(NonDirectDebitTradeAmt + NonDirectTradeAmt) sum from UserTradeDaySummary where TradeMonth = '202205' and UserId in (select Id from Users where ParentNav like '%," + UserId + ",%')GROUP BY UserId ORDER BY sum desc limit 10)a left join Users b on a.UserId = b.Id");
-            foreach (DataRow item in dt.Rows)
-            {
-                var RealName = SetSensitiveName(item["RealName"].ToString());
-                var Sum = decimal.Parse(item["Sum"].ToString());
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("UserId", UserId);
-                ob.Add("RealName", RealName);
-                ob.Add("Sum", Sum);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-本月创客排名-收益榜
-        /// <summary>
-        /// 本月创客排名--收益榜
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MakerIncomeSort(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<InCome> Obj = MakerIncomeSortDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<InCome> MakerIncomeSortDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<InCome> Obj = LargeDataScreenDbconn.Instance.GetIncomeList();
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> MakerIncomeSortDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     if (Obj.Count > 0)
-        //     {
-        //         return Obj;
-        //     }
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     // DataTable dt = OtherMySqlConn.dtable("select c.RealName RealName,b.Sum Sum from(select a.UserId, sum(a.ChangeAmount) Sum from(select * from UserAccountRecord where ChangeType = 1 or ChangeType = 12 or ChangeType = 50 or ChangeType = 60 or ChangeType = 111 or ChangeType = 112)a where YEAR(a.CreateDate) = YEAR(NOW()) and MONTH(a.CreateDate) = MONTH(now()) and a.UserId != 0 GROUP BY a.UserId ORDER BY Sum desc limit 10)b left join Users c on b.UserId = c.Id");//本月数据统计
-        //     DataTable dt = OtherMySqlConn.dtable("select c.RealName RealName,b.Sum Sum from(select a.UserId, sum(a.ChangeAmount) Sum from(select * from UserAccountRecord where ChangeType = 1 or ChangeType = 12 or ChangeType = 50 or ChangeType = 60 or ChangeType = 111 or ChangeType = 112)a where a.UserId != 0 GROUP BY a.UserId ORDER BY Sum desc limit 10)b left join Users c on b.UserId = c.Id");//累计数据统计
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var RealName = SetSensitiveName(item["RealName"].ToString());
-        //         var Sum = decimal.Parse(item["Sum"].ToString());
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("RealName", RealName);
-        //         ob.Add("Sum", Sum);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-        // }
-
-        #endregion
-
-
-        #region 数据大屏-交易额统计-本年每月
-        /// <summary>
-        /// 交易额统计--本年每月
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult TradeYearMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = TradeYearMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> TradeYearMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select year(a.CreateDate) year,month(a.CreateDate) month,count(*) count,sum(a.TradeAmount) sumamount from TradeRecord a where YEAR(a.CreateDate) = YEAR(NOW())group by year(a.CreateDate), month(a.CreateDate)order by month(a.CreateDate)");
-            foreach (DataRow item in dt.Rows)
-            {
-                var year = item["year"];
-                var month = item["month"];
-                var count = item["count"];
-                double sumamount = Convert.ToDouble(item["sumamount"]) / 10000;
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("year", year);
-                ob.Add("month", month);
-                ob.Add("count", count);
-                ob.Add("sumamount", sumamount);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-redis通过userId近一年每月交易额
-        /// <summary>
-        /// redis通过userId近一年每月交易额
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult TeamPerformanceYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 12; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(UserId, Month.ToString("yyyyMM"), "team")); //总交易额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 数据大屏-交易额统计-本年本月本天
-        [Authorize]
-        public JsonResult TradeMonthDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = TradeMonthDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> TradeMonthDayDo(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select month(a.CreateDate) month,sum(a.TradeAmount) sumamount from TradeRecord a where YEAR(a.CreateDate) = YEAR(NOW()) AND MONTH(a.CreateDate)=MONTH(now())group by year(a.CreateDate), month(a.CreateDate),day(a.CreateDate)order by day(a.CreateDate)");
-            foreach (DataRow item in dt.Rows)
-            {
-                var month = item["month"];
-                double sumamount = Convert.ToDouble(item["sumamount"]) / 10000;
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("month", month);
-                ob.Add("sumamount", sumamount);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        // #region 交易额统计--近两周
-        // /// <summary>
-        // /// 交易额统计--近两周
-        // /// </summary>
-        // /// <param name="value"></param>
-        // /// <returns></returns>
-        // [Authorize]
-        // public JsonResult TradeTwoWeeks(string value)
-        // {
-        //     value = DesDecrypt(value);
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> Obj = TradeTwoWeeksDo(value);
-        //     return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        // }
-        // public List<Dictionary<string, object>> TradeTwoWeeksDo(string value)
-        // {
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     DataTable dt = dbconn.dtable("select day(a.CreateDate) day,sum(a.TradeAmount) sumamount from traderecord a where a.CreateDate between DATE_SUB(CURDATE(), INTERVAL 13 DAY) and date(NOW())group by year(a.CreateDate), month(a.CreateDate),day(a.CreateDate)order by day(a.CreateDate)");
-        //     foreach(DataRow item in dt.Rows){
-        //         var day = item["day"];
-        //         double sumamount = Convert.ToDouble(item["sumamount"])/10000;
-        //         Dictionary<string,object> ob=new Dictionary<string, object>();
-        //         ob.Add("day",day);
-        //         ob.Add("sumamount",sumamount);
-        //         Obj.Add(ob);
-        //     }
-        //     return Obj;
-        // }
-        // #endregion
-
-
-        #region 数据大屏-redis通过userId当前近两周交易额
-        [Authorize]
-        public JsonResult TradeTwoWeeks(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TradeTwoWeeksDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TradeTwoWeeksDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            for (int i = 0; i <= 14; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                if (date.ToString("yyyyMMdd") != start.ToString("yyyyMMdd"))
-                {
-                    string Date = date.ToString("yyyyMMdd");
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    curData.Add("TradeDate", date.ToString("dd")); //交易日期
-                    curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetDateTrade(UserId, Date, "team")); //总交易额
-                    dataList.Add(curData);
-                }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 数据大屏-交易额统计-近一天
-        /// <summary>
-        /// 交易额统计--近一天
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult TradeOneDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = TradeOneDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> TradeOneDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select hour(a.CreateDate) hour,sum(a.TradeAmount) sumamount from TradeRecord a where a.CreateDate between date_sub(now( ), interval '24:00:00' day_second) and NOW()group by year(a.CreateDate), month(a.CreateDate),day(a.CreateDate),hour(a.CreateDate)order by hour(a.CreateDate)");
-            foreach (DataRow item in dt.Rows)
-            {
-                string hour = item["hour"].ToString();
-                double sumamount = Convert.ToDouble(item["sumamount"]) / 10000;
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("hour", hour);
-                ob.Add("sumamount", sumamount);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-redis通过userId当前近一天交易额
-        [Authorize]
-        public JsonResult TradeOneDays(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TradeOneDaysDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TradeOneDaysDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
-            for (int i = 0; i <= 24; i++)
-            {
-                DateTime date = start.AddHours(-i);
-                if (date.ToString("yyyy-MM-dd hh:mm:ss") != start.ToString("yyyy-MM-dd hh:mm:ss"))
-                {
-                    string Date = date.ToString("yyyy-MM-dd hh:mm:ss");
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    curData.Add("TradeDate", date.ToString("yyyy-MM-dd hh:mm:ss")); //交易时间
-                    curData.Add("TradeAmount", UserTradeDaySummaryDbconn.Instance.GetDateTrade(UserId, Date, "team")); //总交易额
-                    dataList.Add(curData);
-                }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 数据大屏-交易额统计-本年本月本天
-        [Authorize]
-        public JsonResult TradeDayHour(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = TradeDayHourDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> TradeDayHourDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select year(a.CreateDate) year,month(a.CreateDate) month,day(a.CreateDate) day,hour(a.CreateDate) hour,count(*) count,sum(a.TradeAmount) sumamount from TradeRecord a where YEAR(a.CreateDate) = YEAR(NOW()) AND MONTH(a.CreateDate) = MONTH(now()) AND Day(a.CreateDate) = Day(now())group by year(a.CreateDate), month(a.CreateDate),day(a.CreateDate),hour(a.CreateDate)order by hour(a.CreateDate)");
-            foreach (DataRow item in dt.Rows)
-            {
-                string year = item["year"].ToString();
-                string month = item["month"].ToString();
-                string day = item["day"].ToString();
-                string hour = item["hour"].ToString();
-                string count = item["count"].ToString();
-                double sumamount = Convert.ToDouble(item["sumamount"]) / 10000;
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("year", year);
-                ob.Add("month", month);
-                ob.Add("day", day);
-                ob.Add("hour", hour);
-                ob.Add("count", count);
-                ob.Add("sumamount", sumamount);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-交易额统计-本年本月本天此时
-        [Authorize]
-        public JsonResult TradeHourMinute(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = TradeHourMinuteDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> TradeHourMinuteDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select year(a.CreateDate) year,month(a.CreateDate) month,day(a.CreateDate) day,hour(a.CreateDate) hour,minute(a.CreateDate) minute,count(*) count,sum(a.TradeAmount) sumamount from TradeRecord a where YEAR(a.CreateDate) = YEAR(NOW()) AND MONTH(a.CreateDate) = MONTH(now()) AND Day(a.CreateDate) = Day(now()) AND HOUR(a.CreateDate) = HOUR(now())group by year(a.CreateDate), month(a.CreateDate),day(a.CreateDate),hour(a.CreateDate),minute(a.CreateDate)order by minute(a.CreateDate)");
-            foreach (DataRow item in dt.Rows)
-            {
-                string year = item["year"].ToString();
-                string month = item["month"].ToString();
-                string day = item["day"].ToString();
-                string hour = item["hour"].ToString();
-                string minute = item["minute"].ToString();
-                string count = item["count"].ToString();
-                double sumamount = Convert.ToDouble(item["sumamount"]) / 10000;
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("year", year);
-                ob.Add("month", month);
-                ob.Add("day", day);
-                ob.Add("hour", hour);
-                ob.Add("minute", minute);
-                ob.Add("count", count);
-                ob.Add("sumamount", sumamount);
-                Obj.Add(ob);
-            }
-            OtherMySqlConn.connstr = "";
-            return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-月度交易额环比
-        /// <summary>
-        /// 月度交易额环比
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MonthTradePercentage(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> Obj = MonthTradePercentageDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public List<Dictionary<string, object>> MonthTradePercentageDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<Users> query = maindb.Users.Where(m => m.Id == UserId && m.AuthFlag == 1);
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ThisMonthTrade", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(subdata.Id, DateTime.Now.ToString("yyyyMM"), "team")); //本月交易额
-                curData.Add("LastMonthTrade", UserTradeDaySummaryDbconn.Instance.GetMonthTrade(subdata.Id, DateTime.Now.AddMonths(-1).ToString("yyyyMM"), "team")); //上月交易额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 数据大屏-月度新增创客环比
-        /// <summary>
-        /// 月度新增创客环比
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult MonthMakerAddPercentages(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = MonthMakerAddPercentagesDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> MonthMakerAddPercentagesDo(string value)
-        {
-            //  int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            // List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            // OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            // DataTable dt = OtherMySqlConn.dtable("select(select Count(0) lastmonthcount from Users a where a.ParentNav like '%," + UserId + ",%' AND YEAR(a.AuthDate) = YEAR(NOW()) and MONTH(a.AuthDate)=MONTH(now() - INTERVAL 1 MONTH))as LastMonthCount, (select Count(0) thismonthcount from Users a where a.ParentNav like '%," + UserId + ",%' AND YEAR(a.AuthDate) = YEAR(NOW()) and MONTH(a.AuthDate)=MONTH(now())) as ThisMonthCount from Users limit 1");
-            // foreach (DataRow item in dt.Rows)
-            // {
-            //     var ThisMonthCount = int.Parse(item["ThisMonthCount"].ToString());
-            //     var LastMonthCount = int.Parse(item["LastMonthCount"].ToString());
-            //     Dictionary<string,object> ob = new Dictionary<string, object>();
-            //     ob.Add("ThisMonthCount",ThisMonthCount);
-            //     ob.Add("LastMonthCount",LastMonthCount);
-            //     dataList.Add(ob);
-            // }
-
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<Users> query = maindb.Users.Where(m => m.Id == UserId && m.AuthFlag == 1);
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ThisMonthCount", LargeDataScreenDbconn.Instance.GetTeamMakerCountThisMonth(UserId)); //本月新增创客
-                curData.Add("LastMonthCount", LargeDataScreenDbconn.Instance.GetTeamMakerCountLastMonth(UserId)); //上月新增创客
-                dataList.Add(curData);
-            }
-            return dataList;
-            // List<Dictionary<string, object>> Obj = RedisDbconn.Instance.GetList<Dictionary<string, object>>("AddMakerList");
-            // if (Obj.Count > 0)
-            // {
-            //     return Obj;
-            // }
-            // OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            // DataTable dt = OtherMySqlConn.dtable("select(select Count(0) lastmonthcount from Users a where a.ParentNav like '%," + UserId + ",%' AND YEAR(a.AuthDate) = YEAR(NOW()) and MONTH(a.AuthDate)=MONTH(now() - INTERVAL 1 MONTH))as LastMonthCount, (select Count(0) thismonthcount from Users a where a.ParentNav like '%," + UserId + ",%' AND YEAR(a.AuthDate) = YEAR(NOW()) and MONTH(a.AuthDate)=MONTH(now())) as ThisMonthCount from Users limit 1");
-            // foreach (DataRow item in dt.Rows)
-            // {
-            //     var ThisMonthCount = int.Parse(item["ThisMonthCount"].ToString());
-            //     var LastMonthCount = int.Parse(item["LastMonthCount"].ToString());
-            //     Dictionary<string,object> ob = new Dictionary<string, object>();
-            //     ob.Add("ThisMonthCount",ThisMonthCount);
-            //     ob.Add("LastMonthCount",LastMonthCount);
-            //     Obj.Add(ob);
-            // }
-            // foreach (var sub in Obj)
-            // {
-            //     RedisDbconn.Instance.AddList("AddMakerList", sub);
-            // }
-            // return Obj;
-        }
-        #endregion
-
-
-        #region 数据大屏-机型统计-机型占比统计
-        /// <summary>
-        /// 机型统计--机型占比统计
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult ModelTypeCount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<ModelType> Obj = ModelTypeCountDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<ModelType> ModelTypeCountDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            List<ModelType> Obj = LargeDataScreenDbconn.Instance.GetModelTypeList(UserId);
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> ModelTypeCountDo(string value)
-        // {
-        //     // JsonData data = JsonMapper.ToObject(value);
-        //     // int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     // List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     // OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     // DataTable dt = OtherMySqlConn.dtable("select b.Name name,a.count count from(select BrandId,count(0) count from PosMachinesTwo where UserId in(select Id from Users where ParentNav like '%," + UserId + ",%' or Id=" + UserId + ")GROUP BY BrandId)a left join KqProducts b on a.BrandId=b.Id");
-        //     // foreach (DataRow item in dt.Rows)
-        //     // {
-        //     //     var name = item["name"].ToString();
-        //     //     var count = decimal.Parse(item["count"].ToString());
-        //     //     Dictionary<string, object> ob = new Dictionary<string, object>();
-        //     //     ob.Add("name", name);
-        //     //     ob.Add("count", count);
-        //     //     Obj.Add(ob);
-        //     // }
-        //     // return Obj;
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     DataTable dt = OtherMySqlConn.dtable("select b.Name name,a.count count from(select BrandId,count(0) count from PosMachinesTwo where UserId in(select Id from Users where ParentNav like '%," + UserId + ",%' or Id=" + UserId + ")GROUP BY BrandId)a left join KqProducts b on a.BrandId=b.Id");
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var name = item["name"].ToString();
-        //         var count = decimal.Parse(item["count"].ToString());
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("name", name);
-        //         ob.Add("count", count);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-        // }
-        #endregion
-
-
-        #region 数据大屏-机型统计-交易额统计
-        /// <summary>
-        /// 机型统计--交易额统计
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult ModelTypeTradeCount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<ModelTypeTrade> Obj = ModelTypeTradeCountDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-
-        public List<ModelTypeTrade> ModelTypeTradeCountDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            List<ModelTypeTrade> Obj = LargeDataScreenDbconn.Instance.GetModelTypeTradeList(UserId);
-            return Obj;
-        }
-
-        // public List<Dictionary<string, object>> ModelTypeTradeCountDo(string value)
-        // {
-        //     // JsonData data = JsonMapper.ToObject(value);
-        //     // int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     // List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     // OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     // DataTable dt = OtherMySqlConn.dtable("select b.Name name,a.sum sum from(select BrandId,sum(TradeAmount) sum from TradeRecord where UserId in (select Id from Users where ParentNav like '%," + UserId + ",%' or Id=" + UserId + ")GROUP BY BrandId)a left join KqProducts b on a.BrandId=b.Id");
-        //     // foreach (DataRow item in dt.Rows)
-        //     // {
-        //     //     var name = item["name"].ToString();
-        //     //     var sum = decimal.Parse(item["sum"].ToString());
-        //     //     Dictionary<string, object> ob = new Dictionary<string, object>();
-        //     //     ob.Add("name", name);
-        //     //     ob.Add("sum", sum);
-        //     //     Obj.Add(ob);
-        //     // }
-        //     // return Obj;
-
-        //     JsonData data = JsonMapper.ToObject(value);
-        //     int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-        //     List<Dictionary<string, object>> Obj = new List<Dictionary<string, object>>();
-        //     OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        //     DataTable dt = OtherMySqlConn.dtable("select b.Name name,a.sum sum from(select BrandId,sum(TradeAmount) sum from TradeRecord where UserId in (select Id from Users where ParentNav like '%," + UserId + ",%' or Id=" + UserId + ")GROUP BY BrandId)a left join KqProducts b on a.BrandId=b.Id");
-        //     foreach (DataRow item in dt.Rows)
-        //     {
-        //         var name = item["name"].ToString();
-        //         var sum = decimal.Parse(item["sum"].ToString());
-        //         Dictionary<string, object> ob = new Dictionary<string, object>();
-        //         ob.Add("name", name);
-        //         ob.Add("sum", sum);
-        //         Obj.Add(ob);
-        //     }
-        //     OtherMySqlConn.connstr = "";
-        //     return Obj;
-        // }
-        #endregion
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-
-        #region 数据大屏-五一活动创客期望
-        /// <summary>
-        /// 五一活动创客期望
-        /// </summary>
-        /// <param name="value"></param>
-        /// <returns></returns>
-        [Authorize]
-        public JsonResult UsersWish(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = UsersWishDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson UsersWishDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            var ExpectAmount = function.CheckString(data["ExpectAmount"].ToString()); //期望
-            var TargetAmount = function.CheckString(data["TargetAmount"].ToString());//目标
-            string text = string.Format("UserId:{0},ExpectAmount:{1},TargetAmount:{2};", UserId, ExpectAmount, TargetAmount);
-            function.WriteLog(text, "UsersWishs");
-
-            return new AppResultJson() { Status = "1", Info = "", Data = text };
-        }
-        #endregion
-
-        #region 姓名脱敏
-        /// <summary>
-        /// 姓名敏感处理
-        /// </summary>
-        /// <param name="fullName">姓名</param>
-        /// <returns>脱敏后的姓名</returns>
-        public static string SetSensitiveName(string fullName)
-        {
-            if (string.IsNullOrEmpty(fullName)) return string.Empty;
-            string familyName = fullName.Substring(0, 1);
-            string end = fullName.Substring(fullName.Length - 1, 1);
-            string name = string.Empty;
-            //长度为2
-            if (fullName.Length <= 2) name = familyName + "*";
-            //长度⼤于2
-            else if (fullName.Length >= 3)
-            {
-                name = familyName.PadRight(fullName.Length - 1, '*') + end;
-            }
-            return name;
-        }
-        #endregion
-
-
-    }
-}

+ 0 - 156
Areas/Api/Controllers/v1/Pos/LeaderReserveRecordController.cs

@@ -1,156 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class LeaderReserveRecordController : BaseController
-    {
-        public LeaderReserveRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-我的-盟主中心-储备金变动记录
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //变动月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<LeaderReserveRecord> query = maindb.LeaderReserveRecord.Where(m => m.UserId == UserId);
-            if (!string.IsNullOrEmpty(data["TradeMonth"].ToString()))
-            {
-                query = query.Where(m => m.TradeMonth == TradeMonth);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("ChangeType", subdata.ChangeType); //变动类型
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("ChangeAmt", subdata.ChangeAmt); //变动金额
-                curData.Add("AfterAmt", subdata.AfterAmt); //变动后余额
-                curData.Add("Remark", subdata.Remark); //备注
-                if (subdata.Remark == "购机奖励")
-                {
-                    var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-                    curData.Add("LeaderBalanceAmount", userAccount.LeaderBalanceAmount); //剩余可提现余额
-
-                }
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 创客-我的-盟主中心-兑换机具券
-        [Authorize]
-        public JsonResult ExchangePosCoupons(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ExchangePosCouponsDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ExchangePosCouponsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            JsonData ApplyList = data["ApplyList"];//申请数据
-            var a = ApplyList.ToJson().Length;
-            int NeedPay = int.Parse(function.CheckInt(data["NeedPay"].ToString())); //所需金额
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            UserAccount userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-            if (userAccount.LeaderReserve >= NeedPay)
-            {
-                var query = maindb.LeaderReserveRecord.Add(new LeaderReserveRecord()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    QueryCount = 1,
-                    SeoTitle = ApplyList.ToJson(),//申请机具券json数据
-                    SeoKeyword = "MZ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8),//申请单号
-                    UserId = UserId, //创客
-                    Remark = "兑换机具券",
-                    BeforeAmt = userAccount.LeaderReserve,
-                    AfterAmt = userAccount.LeaderReserve - NeedPay,
-                    ChangeAmt = NeedPay,
-                    TradeDate = DateTime.Now.ToString("yyyyMMdd"),
-                    TradeMonth = DateTime.Now.ToString("yyyyMM"),
-                }).Entity;
-                maindb.SaveChanges();
-                userAccount.LeaderReserve -= NeedPay;
-                Obj.Add("LeaderReserve", userAccount.LeaderReserve);
-                maindb.SaveChanges();
-                RedisDbconn.Instance.AddList("LeaderApplyCouponsQueue", query.Id.ToString());
-            }
-            else
-            {
-                return new AppResultJson() { Status = "-1", Info = "额度不足" };
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 851
Areas/Api/Controllers/v1/Pos/MachineApplyController.cs

@@ -1,851 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class MachineApplyController : BaseController
-    {
-        public MachineApplyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-机具管理-机具申请-申请记录
-        [Authorize]
-        public JsonResult ApplyRecords(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ApplyRecordsDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ApplyRecordsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<MachineApply> query = maindb.MachineApply.Where(m => m.UserId == UserId).OrderByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            // List<int> query = MachineApplyDbconn.Instance.GetList(UserId, PageNum, PageSize);
-            foreach (MachineApply subdata in query)
-            {
-                // MachineApply subdata = MachineApplyDbconn.Instance.Get(Convert.ToInt32(ApplyId)) ?? new MachineApply();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ApplyNo", subdata.ApplyNo); //申请单号
-                curData.Add("Areas", function.CheckNull(subdata.Areas).Replace(",", "")); //收货所在地区
-                curData.Add("Address", string.IsNullOrEmpty(subdata.Address) ? "上门自提" : subdata.Address); //收货详细地址
-                curData.Add("ApplyDeviceNum", subdata.ApplyDeviceNum); //申请机具数量
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("Status", RelationClass.GetMachineApplyStatusInfo(subdata.Status)); //Status
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-机具申请-申请记录详情
-        [Authorize]
-        public JsonResult ApplyDetail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ApplyDetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ApplyDetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            MachineApply query = MachineApplyDbconn.Instance.Get(Id) ?? new MachineApply();
-            StoreHouse store = StoreHouseDbconn.Instance.Get(query.StoreId) ?? new StoreHouse();
-            Obj.Add("ApplyNo", query.ApplyNo); //申请单号
-            Obj.Add("ProductName", query.ProductName); //产品名称
-            Obj.Add("Areas", function.CheckNull(query.Areas).Replace(",", "")); //收货所在地区
-            Obj.Add("Address", string.IsNullOrEmpty(query.Address) ? "上门自提" : query.Address); //收货详细地址
-            Obj.Add("RealName", query.RealName); //收件人姓名
-            Obj.Add("Mobile", query.Mobile); //收件人手机号
-            Obj.Add("ApplyDeviceNum", query.ApplyDeviceNum); //申请机具数量
-            Obj.Add("DeliveryType", query.DeliveryType); //提货类型
-            if (store.UserId == 1)
-            {
-                Obj.Add("StoreManagerMobile", "19141324516"); //仓库联系人手机号
-            }
-            else
-            {
-                Obj.Add("StoreManagerMobile", query.StoreManagerMobile); //仓库联系人手机号
-            }
-            Obj.Add("StoreName", store.StoreName); //提货仓库
-            Obj.Add("Status", RelationClass.GetMachineApplyStatusInfo(query.Status)); //状态
-            Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //创建时间
-            return Obj;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-机具申请-申请记录详情-V2
-        [Authorize]
-        public JsonResult ApplyDetail2(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ApplyDetail2Do(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ApplyDetail2Do(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            MachineApply query = MachineApplyDbconn.Instance.Get(Id) ?? new MachineApply();
-            StoreHouse store = StoreHouseDbconn.Instance.Get(query.StoreId) ?? new StoreHouse();
-            Obj.Add("ApplyNo", query.ApplyNo); //申请单号
-            Obj.Add("ProductName", query.ProductName); //产品名称
-            Obj.Add("Areas", function.CheckNull(query.Areas).Replace(",", "")); //收货所在地区
-            Obj.Add("Address", string.IsNullOrEmpty(query.Address) ? "上门自提" : query.Address); //收货详细地址
-            Obj.Add("RealName", query.RealName); //收件人姓名
-            Obj.Add("Mobile", query.Mobile); //收件人手机号
-            Obj.Add("ApplyDeviceNum", query.ApplyDeviceNum); //申请机具数量
-            Obj.Add("DeliveryType", query.DeliveryType); //提货类型
-            if (store.UserId == 1)
-            {
-                Obj.Add("StoreManagerMobile", "19141324516"); //仓库联系人手机号
-            }
-            else
-            {
-                Obj.Add("StoreManagerMobile", query.StoreManagerMobile); //仓库联系人手机号
-            }
-            Obj.Add("StoreName", store.StoreName); //提货仓库
-            Obj.Add("Status", RelationClass.GetMachineApplyStatusInfo(query.Status)); //状态
-            Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //创建时间
-            string SwapSnExpand = query.SwapSnExpand;
-            int Kind = 0;
-            if (SwapSnExpand.StartsWith("02") || SwapSnExpand.StartsWith("03")) Kind = 2;
-            else Kind = 1;
-            List<string> list = new List<string>();
-            if (!string.IsNullOrEmpty(SwapSnExpand))
-            {
-                list = SwapSnExpand.Split('\n').ToList();
-            }
-            Obj.Add("Kind", Kind); //申请类别:1-机具,2-兑换券
-            Obj.Add("SnList", list); //机具SN/兑换码列表
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-机具管理-机具申请-确认申请
-        [Authorize]
-        public JsonResult ConfirmApply(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ConfirmApplyDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ConfirmApplyDo(string value)
-        {
-            function.WriteLog(DateTime.Now.ToString() + "\r\n" + value, "首页-客小爽产品-机具管理-机具申请-确认申请");
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string SendSn = data["SendSn"].ToString(); //发货SN
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int DeliveryType = int.Parse(function.CheckInt(data["DeliveryType"].ToString())); //提货类型
-            string Remark = data["Remark"].ToString(); //订单备注
-            int AddressId = int.Parse(function.CheckInt(data["AddressId"].ToString()));  //收货地址Id
-            if (StoreId == 0)
-            {
-                return new AppResultJson() { Status = "-1", Info = "请选择仓库" };
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            if (!string.IsNullOrEmpty(SendSn))
-            {
-                string SwapSnExpand = "";
-                string[] SnIds = SendSn.Split(',');
-                int OpId = 0;
-                foreach (string SnId in SnIds)
-                {
-                    int SnIdNum = int.Parse(SnId);
-                    PosMachinesTwo machine = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == SnIdNum);
-                    if (machine != null)
-                    {
-                        machine.IsPurchase = 1;
-                        maindb.SaveChanges();
-                        SwapSnExpand += machine.PosSn + ":" + RelationClass.GetPosSnTypeInfo(machine.PosSnType) + "\n";
-                        OpId = machine.OpId;
-                    }
-                }
-                if (string.IsNullOrEmpty(SwapSnExpand))
-                {
-                    return new AppResultJson() { Status = "-1", Info = "请选择机具" };
-                }
-                string ApplyNo = "BA" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                int BrandId = int.Parse(function.CheckInt(ProductType));
-                KqProducts protype = KqProductsDbconn.Instance.GetList().FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
-                Users user = UsersDbconn.Instance.Get(UserId) ?? new Users();
-                UserAddress address = UserAddressDbconn.Instance.Get(AddressId) ?? new UserAddress();
-                StoreHouse store = StoreHouseDbconn.Instance.Get(StoreId) ?? new StoreHouse();
-                Users manager = UsersDbconn.Instance.Get(store.ManageUserId) ?? new Users();
-                string OrderNo = "BM" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                bool check = maindb.MachineApply.Any(m => m.SwapSnExpand == SwapSnExpand);
-                if (check)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "申请已提交,请勿重复申请" };
-                }
-                RedisDbconn.Instance.GetLock("MachineApply:" + UserId);
-                MachineApply query = maindb.MachineApply.Add(new MachineApply()
-                {
-                    // Id = MachineApplyId,
-                    CreateDate = DateTime.Now,
-                    ApplyNo = ApplyNo, //申请单号
-                    UserId = UserId, //创客
-                    BrandId = BrandId, //品牌
-                    ProductName = protype.Name, //产品名称
-                    Areas = address.Areas, //收货所在地区
-                    Address = address.Address, //收货详细地址
-                    RealName = address.RealName, //收件人姓名
-                    Mobile = address.Mobile, //收件人手机号
-                    ApplyDeviceName = protype.Name, //申请机具名称
-                    ApplyDeviceNum = SnIds.Length, //申请机具数量
-                    ApplyTime = DateTime.Now, //申请时间
-                    DeliveryType = DeliveryType, //提货类型
-                    SwapSnExpand = SwapSnExpand, //兑换机器SN来源
-                    StoreId = store.Id,
-                    StoreUserId = store.UserId,
-                    StoreAreas = store.Areas,
-                    StoreAddress = store.Address,
-                    StoreManager = manager.RealName,
-                    StoreManagerMobile = store.ManageMobile,
-                    TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                    OperateId = OpId,
-                }).Entity;
-                maindb.SaveChanges();
-                function.WriteLog("applyid:" + query.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
-                RedisDbconn.Instance.ReleaseLock("MachineApply:" + UserId);
-                Products product = ProductsDbconn.Instance.Get(protype.QueryCount) ?? new Products();
-                Orders order = maindb.Orders.Add(new Orders()
-                {
-                    OrderNo = OrderNo,
-                    RealName = address.RealName,
-                    Mobile = address.Mobile,
-                    Areas = address.Areas,
-                    Address = address.Address,
-                    StoreContact = manager.RealName,
-                    StoreContactMobile = store.ManageMobile,
-                    StoreUserId = store.UserId,
-                    StoreType = store.StoreType,
-                    CreateDate = DateTime.Now, //创建时间
-                    UserId = UserId, //创客
-                    StoreId = StoreId, //仓库
-                    TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                    DeliveryType = DeliveryType, //提货类型
-                    BuyCount = SnIds.Length,
-                    TotalPrice = 0, //订单总额
-                    Remark = Remark, //订单备注
-                    Status = 1,
-                    PayStatus = 1,
-                    PayDate = DateTime.Now,
-                    QueryCount = 1, //申请循环机标记
-                    Sort = query.Id,
-                    OpId = OpId,
-                }).Entity;
-                maindb.SaveChanges();
-                function.WriteLog("orderid:" + order.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
-                MachineApply edit = maindb.MachineApply.FirstOrDefault(m => m.Id == query.Id);
-                if (edit != null)
-                {
-                    edit.QueryCount = order.Id;
-                    maindb.SaveChanges();
-                }
-                OrderProduct pro = maindb.OrderProduct.Add(new OrderProduct()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    OrderId = order.Id,
-                    ProductId = product.Id,
-                    ProductCount = SnIds.Length,
-                    ProductName = product.ProductName,
-                    ProductPhoto = product.ListPicPath,
-                    ProductPrice = 0,
-                    TotalPrice = 0,
-                    ProductCode = product.ProductCode,
-                    UserId = UserId,
-                    StoreId = StoreId,
-                }).Entity;
-                OrderForNo orderFor = maindb.OrderForNo.Add(new OrderForNo()
-                {
-                    OrderNo = OrderNo,
-                    OrderIds = order.Id.ToString(),
-                }).Entity;
-                maindb.SaveChanges();
-                function.WriteLog("2", "首页-客小爽产品-机具管理-机具申请-确认申请");
-                function.WriteLog("ok\r\n\r\n", "首页-客小爽产品-机具管理-机具申请-确认申请");
-                return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-            }
-            return new AppResultJson() { Status = "-1", Info = "请选择机具", Data = Obj };
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-机具申请-确认申请-V2
-        [Authorize]
-        public JsonResult ConfirmApply2(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ConfirmApply2Do(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ConfirmApply2Do(string value)
-        {
-            function.WriteLog("\r\n\r\n" + DateTime.Now.ToString(), "机具申请-确认申请-V2");
-            function.WriteLog(value, "机具申请-确认申请-V2");
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString())); //申请类型,1-机具SN,2-200兑换码,3-300券
-            string SendSn = data["SendSn"].ToString(); //发货SN            
-            string key = function.MD5_16(UserId + SendSn);
-            string checkOp = RedisDbconn.Instance.Get<string>("ConfirmApply2:" + key);
-            if (!string.IsNullOrEmpty(checkOp))
-            {
-                return new AppResultJson() { Status = "-1", Info = "机具已申请,请勿重复提交" };
-            }
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int IsPre = 0;
-            if (value.Contains("\"IsPre\""))
-            {
-                IsPre = int.Parse(function.CheckInt(data["IsPre"].ToString()));
-            }
-            string SnIdString = "";
-            if (IsPre == 1)
-            {
-                string SnIds = data["SnIds"].ToString(); //发货SN
-                if (string.IsNullOrEmpty(SnIds))
-                {
-                    return new AppResultJson() { Status = "-1", Info = "请选择预发机具" };
-                }
-                string[] SnIdList = SnIds.Split(',');
-                foreach (string SnId in SnIdList)
-                {
-                    var amount = 0;
-                    int Id = int.Parse(SnId);
-                    PreSendStockDetail pre = maindb.PreSendStockDetail.FirstOrDefault(m => m.Id == Id && m.ToUserId == UserId);
-                    if (pre != null)
-                    {
-                        pre.ApplyFlag = 1;
-                        pre.ApplyDate = DateTime.Now;
-                        maindb.SaveChanges();
-                        SnIdString += pre.SnId + ",";
-                        //超时预发机押金申请循环后退还
-                        var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == pre.BrandId);
-                        if (brandInfo.Name.Contains("电签"))
-                        {
-                            amount = 200;
-                        }
-                        if (brandInfo.Name.Contains("大POS"))
-                        {
-                            amount = 300;
-                        }
-                        var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-                        var fuserAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == pre.FromUserId) ?? new UserAccount();
-                        if (pre.CreateDate <= DateTime.Now.AddDays(-30))
-                        {
-                            if (pre.AuthFlag == 1)
-                            {
-                                if (userAccount.Id > 0 && userAccount.SmallStoreDeposit >= amount)
-                                {
-                                    userAccount.SmallStoreDeposit -= amount;//扣减小分仓押金
-                                    var add = maindb.UserAccountRecord.Add(new UserAccountRecord()
-                                    {
-                                        CreateDate = DateTime.Now,
-                                        Remark = "小分仓押金解冻",
-                                        ChangeType = 66,
-                                        BeforeBalanceAmount = userAccount.SmallStoreDeposit + amount, //变更前小分仓押金
-                                        AfterBalanceAmount = userAccount.SmallStoreDeposit, //变更后小分仓押金
-                                        ChangeAmount = amount,//变动金额
-                                        UserId = userAccount.Id,
-                                    }).Entity;
-                                    maindb.SaveChanges();
-                                }
-                            }
-                        }
-                        else
-                        {
-                            if (pre.AuthFlag == 1)
-                            {
-                                if (userAccount.Id > 0)
-                                {
-                                    userAccount.ValidPreAmount += amount;//增加小分仓可用额度
-                                    maindb.SaveChanges();
-                                }
-                            }
-                        }
-                    }
-                }
-                SmallStoreHouse house = maindb.SmallStoreHouse.FirstOrDefault(m => m.UserId == UserId);
-                if (house != null)
-                {
-                    house.TotalNum -= SnIdList.Length;
-                    house.LaveNum += SnIdList.Length;
-                    maindb.SaveChanges();
-                    string text = string.Format("首页-客小爽产品-机具管理-机具申请-确认申请-V2,UserId: '" + UserId + "',LaveNum:'" + house.LaveNum + "',TotalNum:'" + house.TotalNum + "',ChangeCount:'" + SnIdList.Length + "',Time'" + DateTime.Now + "'");
-                    function.WriteLog(text, "smallstorehouse");//小分仓记录日志
-                }
-            }
-            function.WriteLog("SnIdString:" + SnIdString, "机具申请-确认申请-V2");
-            int DeliveryType = int.Parse(function.CheckInt(data["DeliveryType"].ToString())); //提货类型
-            string Remark = data["Remark"].ToString(); //订单备注
-            int AddressId = int.Parse(function.CheckInt(data["AddressId"].ToString()));  //收货地址Id
-            if (StoreId == 0 && IsPre != 1)
-            {
-                return new AppResultJson() { Status = "-1", Info = "请选择仓库" };
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int MachineCount = 0;
-            if (Kind == 1)
-            {
-                if (!string.IsNullOrEmpty(SendSn))
-                {
-                    int OpId = 0;
-                    string SwapSnExpand = "";
-                    string[] SnIds = SendSn.Split(',');
-                    foreach (string SnId in SnIds)
-                    {
-                        int SnIdNum = int.Parse(SnId);
-                        PosMachinesTwo machine = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == SnIdNum);
-                        if (machine != null)
-                        {
-                            bool check = maindb.MachineApply.Any(m => m.SwapSnExpand.Contains(machine.PosSn));
-                            if (check)
-                            {
-                                if (IsPre == 1)
-                                {
-                                    BackPre(data, UserId);
-                                }
-                                return new AppResultJson() { Status = "-1", Info = "机具" + machine.PosSn + "已申请,请勿重复申请" };
-                            }
-                        }
-                    }
-                    foreach (string SnId in SnIds)
-                    {
-                        int SnIdNum = int.Parse(SnId);
-                        PosMachinesTwo machine = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == SnIdNum);
-                        if (machine != null)
-                        {
-                            if (!SwapSnExpand.Contains(machine.PosSn))
-                            {
-                                machine.IsPurchase = 1;
-                                maindb.SaveChanges();
-                                SwapSnExpand += machine.PosSn + ":" + RelationClass.GetPosSnTypeInfo(machine.PosSnType) + "\n";
-                                MachineCount += 1;
-                                OpId = machine.OpId;
-                            }
-                        }
-                    }
-                    if (string.IsNullOrEmpty(SwapSnExpand))
-                    {
-                        if (IsPre == 1)
-                        {
-                            BackPre(data, UserId);
-                        }
-                        return new AppResultJson() { Status = "-1", Info = "请选择机具" };
-                    }
-                    function.WriteLog("Kind:" + Kind, "机具申请-确认申请-V2");
-                    string ApplyNo = "BA" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    int BrandId = int.Parse(function.CheckInt(ProductType));
-                    KqProducts protype = KqProductsDbconn.Instance.GetList().FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
-                    Users user = UsersDbconn.Instance.Get(UserId) ?? new Users();
-                    UserAddress address = UserAddressDbconn.Instance.Get(AddressId) ?? new UserAddress();
-                    StoreHouse store = StoreHouseDbconn.Instance.Get(StoreId) ?? new StoreHouse();
-                    Users manager = UsersDbconn.Instance.Get(store.ManageUserId) ?? new Users();
-                    string OrderNo = "BM" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    RedisDbconn.Instance.GetLock("MachineApply:" + UserId);
-                    MachineApply query = maindb.MachineApply.Add(new MachineApply()
-                    {
-                        // Id = MachineApplyId,
-                        CreateDate = DateTime.Now,
-                        ApplyNo = ApplyNo, //申请单号
-                        UserId = UserId, //创客
-                        BrandId = BrandId, //品牌
-                        ProductName = protype.Name, //产品名称
-                        Areas = address.Areas, //收货所在地区
-                        Address = address.Address, //收货详细地址
-                        RealName = address.RealName, //收件人姓名
-                        Mobile = address.Mobile, //收件人手机号
-                        ApplyDeviceName = protype.Name, //申请机具名称
-                        ApplyDeviceNum = MachineCount, //申请机具数量
-                        ApplyTime = DateTime.Now, //申请时间
-                        DeliveryType = DeliveryType, //提货类型
-                        SwapSnExpand = SwapSnExpand, //兑换机器SN来源
-                        OrderExpand = SendSn,
-                        StoreId = store.Id,
-                        StoreUserId = store.UserId,
-                        StoreAreas = store.Areas,
-                        StoreAddress = store.Address,
-                        StoreManager = manager.RealName,
-                        StoreManagerMobile = store.ManageMobile,
-                        TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                        OperateId = OpId,
-                    }).Entity;
-                    maindb.SaveChanges();
-                    function.WriteLog("in", "机具申请-确认申请-V2");
-                    function.WriteLog("applyid:" + query.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
-                    RedisDbconn.Instance.ReleaseLock("MachineApply:" + UserId);
-                    Products product = ProductsDbconn.Instance.Get(protype.QueryCount) ?? new Products();
-                    Orders order = maindb.Orders.Add(new Orders()
-                    {
-                        OrderNo = OrderNo,
-                        RealName = address.RealName,
-                        Mobile = address.Mobile,
-                        Areas = address.Areas,
-                        Address = address.Address,
-                        StoreContact = manager.RealName,
-                        StoreContactMobile = store.ManageMobile,
-                        StoreUserId = store.UserId,
-                        StoreType = store.StoreType,
-                        CreateDate = DateTime.Now, //创建时间
-                        UserId = UserId, //创客
-                        StoreId = StoreId, //仓库
-                        TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                        DeliveryType = DeliveryType, //提货类型
-                        BuyCount = MachineCount,
-                        TotalPrice = 0, //订单总额
-                        Remark = Remark, //订单备注
-                        Status = 1,
-                        PayStatus = 1,
-                        PayDate = DateTime.Now,
-                        QueryCount = 1, //申请循环机标记
-                        Sort = query.Id,
-                        OpId = OpId,
-                    }).Entity;
-                    maindb.SaveChanges();
-                    function.WriteLog("in2", "机具申请-确认申请-V2");
-                    function.WriteLog("orderid:" + order.Id, "首页-客小爽产品-机具管理-机具申请-确认申请");
-                    MachineApply edit = maindb.MachineApply.FirstOrDefault(m => m.Id == query.Id);
-                    if (edit != null)
-                    {
-                        edit.QueryCount = order.Id;
-                        maindb.SaveChanges();
-                    }
-                    OrderProduct pro = maindb.OrderProduct.Add(new OrderProduct()
-                    {
-                        CreateDate = DateTime.Now, //创建时间
-                        OrderId = order.Id,
-                        ProductId = product.Id,
-                        ProductCount = MachineCount,
-                        ProductName = product.ProductName,
-                        ProductPhoto = product.ListPicPath,
-                        ProductPrice = 0,
-                        TotalPrice = 0,
-                        ProductCode = product.ProductCode,
-                        UserId = UserId,
-                        StoreId = StoreId,
-                    }).Entity;
-                    OrderForNo orderFor = maindb.OrderForNo.Add(new OrderForNo()
-                    {
-                        OrderNo = OrderNo,
-                        OrderIds = order.Id.ToString(),
-                    }).Entity;
-                    maindb.SaveChanges();
-                    function.WriteLog("2", "首页-客小爽产品-机具管理-机具申请-确认申请");
-                    function.WriteLog("ok\r\n\r\n", "首页-客小爽产品-机具管理-机具申请-确认申请");
-                    if (IsPre == 1)
-                    {
-                        string reqdata = "{";
-                        reqdata += "\"OrderId\":\"" + order.Id + "\",";
-                        reqdata += "\"StoreId\":\"" + StoreId + "\",";
-                        reqdata += "\"ToUserId\":\"" + UserId + "\",";
-                        reqdata += "\"SnIds\":\"" + SnIdString.TrimEnd(',') + "\"";
-                        reqdata += "}";
-                        new StoreStockChangeController(_accessor, _logger, _setting).TransferOneDo(reqdata);
-                    }
-                    RedisDbconn.Instance.Set("ConfirmApply2:" + key, "1", 3600 * 24);
-                    return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-                }
-                return new AppResultJson() { Status = "-1", Info = "请选择机具", Data = Obj };
-            }
-            else
-            {
-                if (!string.IsNullOrEmpty(SendSn))
-                {
-                    int OpId = 0;
-                    string SwapSnExpand = "";
-                    string[] SnIds = SendSn.Split(',');
-                    foreach (string SnId in SnIds)
-                    {
-                        int SnIdNum = int.Parse(SnId);
-                        PosCoupons coupon = maindb.PosCoupons.FirstOrDefault(m => m.Id == SnIdNum);
-                        if (coupon != null)
-                        {
-                            if (!SwapSnExpand.Contains(coupon.ExchangeCode))
-                            {
-                                coupon.IsLock = 1;
-                                coupon.IsUse = 1;
-                                coupon.UseDate = DateTime.Now;
-                                SwapSnExpand += coupon.ExchangeCode + "\n";
-                                MachineCount += 1;
-                                OpId = coupon.OpId;
-                            }
-                        }
-                    }
-                    if (string.IsNullOrEmpty(SwapSnExpand))
-                    {
-                        if (IsPre == 1)
-                        {
-                            BackPre(data, UserId);
-                        }
-                        return new AppResultJson() { Status = "-1", Info = "请选择兑换码" };
-                    }
-                    function.WriteLog("Kind:" + Kind, "机具申请-确认申请-V2");
-                    string ApplyNo = "BA" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    int BrandId = int.Parse(function.CheckInt(ProductType));
-                    KqProducts protype = KqProductsDbconn.Instance.GetList().FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
-                    Users user = UsersDbconn.Instance.Get(UserId) ?? new Users();
-                    UserAddress address = UserAddressDbconn.Instance.Get(AddressId) ?? new UserAddress();
-                    StoreHouse store = StoreHouseDbconn.Instance.Get(StoreId) ?? new StoreHouse();
-                    Users manager = UsersDbconn.Instance.Get(store.ManageUserId) ?? new Users();
-                    string OrderNo = "C" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    bool check = maindb.MachineApply.Any(m => m.SwapSnExpand == SwapSnExpand);
-                    if (check)
-                    {
-                        if (IsPre == 1)
-                        {
-                            BackPre(data, UserId);
-                        }
-                        return new AppResultJson() { Status = "-1", Info = "申请已提交,请勿重复申请" };
-                    }
-                    RedisDbconn.Instance.GetLock("MachineApply:" + UserId);
-                    MachineApply query = maindb.MachineApply.Add(new MachineApply()
-                    {
-                        // Id = MachineApplyId,
-                        CreateDate = DateTime.Now,
-                        ApplyNo = ApplyNo, //申请单号
-                        UserId = UserId, //创客
-                        BrandId = BrandId, //品牌
-                        ProductName = protype.Name, //产品名称
-                        Areas = address.Areas, //收货所在地区
-                        Address = address.Address, //收货详细地址
-                        RealName = address.RealName, //收件人姓名
-                        Mobile = address.Mobile, //收件人手机号
-                        ApplyDeviceName = protype.Name, //申请机具名称
-                        ApplyDeviceNum = MachineCount, //申请机具数量
-                        ApplyTime = DateTime.Now, //申请时间
-                        DeliveryType = DeliveryType, //提货类型
-                        SwapSnExpand = SwapSnExpand, //兑换机器SN来源
-                        OrderExpand = SendSn,
-                        StoreId = store.Id,
-                        StoreUserId = store.UserId,
-                        StoreAreas = store.Areas,
-                        StoreAddress = store.Address,
-                        StoreManager = manager.RealName,
-                        StoreManagerMobile = store.ManageMobile,
-                        TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                        Sort = Kind, // 申请类型,1-机具SN,2-200兑换码,3-300券
-                        OperateId = OpId,
-                    }).Entity;
-                    maindb.SaveChanges();
-                    RedisDbconn.Instance.ReleaseLock("MachineApply:" + UserId);
-                    function.WriteLog("in", "机具申请-确认申请-V2");
-                    Products product = ProductsDbconn.Instance.Get(protype.Sort) ?? new Products();
-                    Orders order = maindb.Orders.Add(new Orders()
-                    {
-                        OrderNo = OrderNo,
-                        RealName = address.RealName,
-                        Mobile = address.Mobile,
-                        Areas = address.Areas,
-                        Address = address.Address,
-                        StoreContact = manager.RealName,
-                        StoreContactMobile = store.ManageMobile,
-                        StoreUserId = store.UserId,
-                        StoreType = store.StoreType,
-                        CreateDate = DateTime.Now, //创建时间
-                        UserId = UserId, //创客
-                        StoreId = StoreId, //仓库
-                        TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                        DeliveryType = DeliveryType, //提货类型
-                        BuyCount = MachineCount,
-                        TotalPrice = 0, //订单总额
-                        Remark = Remark, //订单备注
-                        Status = 1,
-                        PayStatus = 1,
-                        PayDate = DateTime.Now,
-                        // QueryCount = 1, //申请循环机标记
-                        Sort = query.Id,
-                        OpId = OpId,
-                    }).Entity;
-                    maindb.SaveChanges();
-                    function.WriteLog("in2", "机具申请-确认申请-V2");
-                    MachineApply edit = maindb.MachineApply.FirstOrDefault(m => m.Id == query.Id);
-                    if (edit != null)
-                    {
-                        edit.QueryCount = order.Id;
-                        maindb.SaveChanges();
-                    }
-                    OrderProduct pro = maindb.OrderProduct.Add(new OrderProduct()
-                    {
-                        CreateDate = DateTime.Now, //创建时间
-                        OrderId = order.Id,
-                        ProductId = product.Id,
-                        ProductCount = MachineCount,
-                        ProductName = product.ProductName,
-                        ProductPhoto = product.ListPicPath,
-                        ProductPrice = 0,
-                        TotalPrice = 0,
-                        ProductCode = product.ProductCode,
-                        UserId = UserId,
-                        StoreId = StoreId,
-                    }).Entity;
-                    OrderForNo orderFor = maindb.OrderForNo.Add(new OrderForNo()
-                    {
-                        OrderNo = OrderNo,
-                        OrderIds = order.Id.ToString(),
-                    }).Entity;
-                    maindb.SaveChanges();
-                    if (IsPre == 1)
-                    {
-                        string reqdata = "{";
-                        reqdata += "\"OrderId\":\"" + order.Id + "\",";
-                        reqdata += "\"StoreId\":\"" + StoreId + "\",";
-                        reqdata += "\"ToUserId\":\"" + UserId + "\",";
-                        reqdata += "\"SnIds\":\"" + SnIdString.TrimEnd(',') + "\"";
-                        reqdata += "}";
-                        new StoreStockChangeController(_accessor, _logger, _setting).TransferOneDo(reqdata);
-                    }
-                    RedisDbconn.Instance.Set("ConfirmApply2:" + key, "1", 3600 * 24);
-                    return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-                }
-                return new AppResultJson() { Status = "-1", Info = "请选择兑换码", Data = Obj };
-            }
-        }
-        private void BackPre(JsonData data, int UserId)
-        {
-            string SnIds = data["SnIds"].ToString(); //发货SN
-            if (string.IsNullOrEmpty(SnIds))
-            {
-                return;
-            }
-            string[] SnIdList = SnIds.Split(',');
-            foreach (string SnId in SnIdList)
-            {
-                int Id = int.Parse(SnId);
-                PreSendStockDetail pre = maindb.PreSendStockDetail.FirstOrDefault(m => m.Id == Id && m.ToUserId == UserId);
-                if (pre != null)
-                {
-                    pre.ApplyFlag = 0;
-                    pre.ApplyDate = null;
-                    maindb.SaveChanges();
-                }
-            }
-            SmallStoreHouse house = maindb.SmallStoreHouse.FirstOrDefault(m => m.UserId == UserId);
-            if (house != null)
-            {
-                house.TotalNum += SnIdList.Length;
-                house.LaveNum -= SnIdList.Length;
-                maindb.SaveChanges();
-                string text = string.Format("首页-客小爽产品-机具管理-机具申请-确认申请-V2-退回,UserId: '" + UserId + "',LaveNum:'" + house.LaveNum + "',TotalNum:'" + house.TotalNum + "',ChangeCount:'" + SnIdList.Length + "',Time'" + DateTime.Now + "'");
-                function.WriteLog(text, "smallstorehouse");//小分仓记录日志
-            }
-        }
-        #endregion
-
-
-        #region 超时预发机押金申请循环后退还
-        private string ReturnSmallStoreDeposit(int UserId, string[] SnIdList)
-        {
-            foreach (string SnId in SnIdList)
-            {
-                var amount = 0;
-                int Id = int.Parse(SnId);
-                PreSendStockDetail pre = maindb.PreSendStockDetail.FirstOrDefault(m => m.Id == Id && m.ToUserId == UserId);
-                if (pre != null)
-                {
-                    if (pre.CreateDate <= DateTime.Now.AddDays(-30))
-                    {
-                        //超时预发机押金申请循环后退还
-                        var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == pre.BrandId);
-                        if (brandInfo.Name.Contains("电签"))
-                        {
-                            amount = 200;
-                        }
-                        if (brandInfo.Name.Contains("大POS"))
-                        {
-                            amount = 300;
-                        }
-                        var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-                        if (userAccount.Id > 0 && userAccount.SmallStoreDeposit >= amount)
-                        {
-                            userAccount.SmallStoreDeposit -= amount;//扣减小分仓押金
-                            var add = maindb.UserAccountRecord.Add(new UserAccountRecord()
-                            {
-                                CreateDate = DateTime.Now,
-                                Remark = "小分仓押金退还",
-                                ChangeType = 66,
-                                BeforeBalanceAmount = userAccount.SmallStoreDeposit + amount, //变更前小分仓押金
-                                AfterBalanceAmount = userAccount.SmallStoreDeposit, //变更后小分仓押金
-                                ChangeAmount = amount,//变动金额
-                                UserId = userAccount.Id,
-
-                            }).Entity;
-                            maindb.SaveChanges();
-                        }
-                    }
-                }
-            }
-            return "success";
-        }
-
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 358
Areas/Api/Controllers/v1/Pos/MachineChangeController.cs

@@ -1,358 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class MachineChangeController : BaseController
-    {
-        public MachineChangeController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-仓库管理-售后单列表
-        [Authorize]
-        public JsonResult OrderList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = OrderListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> OrderListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int OutStoreId = int.Parse(function.CheckInt(data["OutStoreId"].ToString())); //出库仓库
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<MachineChange> query = maindb.MachineChange.Where(m => m.OutStoreId == OutStoreId);
-            query = query.OrderByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("UserId", subdata.UserId); //创客
-                curData.Add("BackProductType", RelationClass.GetKqProductBrandInfo(subdata.BackProductType)); //退回产品类型
-                curData.Add("ChangeTime", subdata.ChangeTime == null ? "" : subdata.ChangeTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //转换时间
-                curData.Add("AuditResult", subdata.AuditResult); //审核结果
-                curData.Add("ChangeSnExpand", subdata.ChangeSnExpand); //转换机器SN来源
-                curData.Add("Id", subdata.Id); //Id
-                Orders order = maindb.Orders.FirstOrDefault(m => m.Id == subdata.QueryCount) ?? new Orders();
-                curData.Add("ReceiveName", order.RealName); //收货人
-                curData.Add("Address", order.Address); //收货地址
-                curData.Add("Mobile", order.Mobile); //联系电话
-                curData.Add("DeliveryType", order.DeliveryType); //提货方式
-                curData.Add("Reason", subdata.SeoKeyword); //换新原因
-                curData.Add("OrderStatus", order.Status);
-                curData.Add("NewSnNo", order.SnNos); //新机具SN
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-售后换新-换新记录
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<MachineChange> query = maindb.MachineChange.Where(m => m.UserId == UserId);
-            query = query.OrderByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("AuditResult", subdata.AuditResult); //审核结果
-                curData.Add("ChangeSnExpand", subdata.ChangeSnExpand); //转换机器SN来源
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("Reason", subdata.SeoKeyword); //换机原因
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-售后换新-换新记录-详情
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MachineChange query = maindb.MachineChange.FirstOrDefault(m => m.Id == Id && m.UserId == UserId) ?? new MachineChange();
-            StoreHouse store = maindb.StoreHouse.FirstOrDefault(m => m.Id == query.OutStoreId) ?? new StoreHouse();
-            Obj.Add("BackProductType", RelationClass.GetKqProductBrandInfo(query.BackProductType)); //退回产品类型
-            Obj.Add("ChangeDeviceNum", query.ChangeDeviceNum); //转换机具数量
-            Obj.Add("ChangeTime", query.ChangeTime == null ? "" : query.ChangeTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //转换时间
-            Obj.Add("AuditResult", query.AuditResult); //审核结果, 0:待审核,1:通过,2:驳回
-            Obj.Add("ChangeSnExpand", query.ChangeSnExpand); //转换机器SN来源
-            Obj.Add("OutStoreId", store.StoreName); //出库仓库
-            Obj.Add("OutStoreManager", query.OutStoreManager); //出库仓库联系人
-            Obj.Add("ChangeDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //申请时间
-            Obj.Add("Reason", query.SeoKeyword); //换机原因
-            Orders order = maindb.Orders.FirstOrDefault(m => m.Id == query.QueryCount) ?? new Orders();
-            Obj.Add("DeliveryType", order.DeliveryType); //提货方式
-            Obj.Add("Note", query.Remark); //备注
-            Obj.Add("OrderId", order.Id); //订单Id
-            Obj.Add("ReceiveName", order.RealName); //收货人
-            Obj.Add("Address", order.Areas + order.Address); //收货地址
-            Obj.Add("Mobile", order.Mobile); //联系电话
-            Obj.Add("NewSnNo", order.SnNos); //新机具SN
-            Obj.Add("OrderStatus", order.Status); //订单状态, 2:已发货(成功),1:待发货,-1:已驳回
-            List<string> PosPhoto = new List<string>();
-            if (!string.IsNullOrEmpty(query.SeoDescription))
-            {
-                string[] Photos = query.SeoDescription.Split(',');
-                foreach (string Photo in Photos)
-                {
-                    PosPhoto.Add(SourceHost + Photo);
-                }
-            }
-            Obj.Add("PosPhoto", PosPhoto); //机具照片(数组)
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-售后换新-提交
-        [Authorize]
-        public JsonResult Add(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson AddDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["BackProductType"].ToString())); //退回产品类型
-            string ChangeSnExpand = data["ChangeSnExpand"].ToString(); //转换机器SN来源
-            string Remark = data["Remark"].ToString(); //订单备注
-            int OutStoreId = int.Parse(function.CheckInt(data["OutStoreId"].ToString())); //出库仓库
-            string PosPhoto = data["PosPhoto"].ToString(); //机具照片
-            int AddressId = int.Parse(function.CheckInt(data["AddressId"].ToString())); //收货地址
-            int DeliveryType = int.Parse(function.CheckInt(data["DeliveryType"].ToString()));//提货方式
-            string Reason = data["Reason"].ToString(); //换机原因
-            string Note = data["Note"].ToString(); //备注
-            if (OutStoreId == 0)
-            { 
-                return new AppResultJson() { Status = "-1", Info = "请选择出库仓库" };
-            }
-            if (string.IsNullOrEmpty(ChangeSnExpand))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写机具SN号" };
-            }
-            MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == ChangeSnExpand);
-            if (forSnNo == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "机具SN号不正确" };
-            }
-            string ChangeNo = "BC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-            KqProducts protype = KqProductsDbconn.Instance.GetList().FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
-            Users user = UsersDbconn.Instance.Get(UserId) ?? new Users();
-            UserAddress address = UserAddressDbconn.Instance.Get(AddressId) ?? new UserAddress();
-            StoreHouse store = StoreHouseDbconn.Instance.Get(OutStoreId) ?? new StoreHouse();
-            if (store.BrandId != BrandId.ToString())
-            { 
-                return new AppResultJson() { Status = "-1", Info = "你选择的品牌和仓库不一致" };
-            }
-            Users storeuser = UsersDbconn.Instance.Get(store.UserId) ?? new Users();
-            Users manager = UsersDbconn.Instance.Get(store.ManageUserId) ?? new Users();
-            string OrderNo = "BM" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-            bool check = maindb.MachineChange.Any(m => m.ChangeSnExpand == ChangeSnExpand && m.AuditResult < 2);
-            if (check)
-            {
-                return new AppResultJson() { Status = "-1", Info = "申请已提交,请勿重复申请" };
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            RedisDbconn.Instance.GetLock("MachineChange:" + UserId);
-            MachineChange query = maindb.MachineChange.Add(new MachineChange()
-            {
-                CreateDate = DateTime.Now,
-                UpdateDate = DateTime.Now,
-                SeoKeyword = Reason,
-                SeoDescription = PosPhoto,
-                ChangeNo = ChangeNo, //转换单号
-                UserId = UserId, //创客
-                BackProductType = BrandId, //退回产品类型
-                BackProductName = protype.Name, //退回产品名称
-                ChangeDeviceNum = 1, //转换机具数量
-                ChangeTime = DateTime.Now, //转换时间
-                ChangeSnExpand = ChangeSnExpand, //转换机器SN来源
-                BackStoreId = OutStoreId, //退回仓库
-                BackStoreName = store.StoreName, //退回仓库名称
-                Remark = Note, //订单备注
-                BackStoreUserId = store.UserId, //退回仓库归属人
-                OutProductType = BrandId, //出库产品类型
-                OutProductName = protype.Name, //出库产品名称
-                OutStoreId = OutStoreId, //出库仓库
-                OutStoreName = store.StoreName, //出库仓库名称
-                OutStoreAreas = store.Areas, //出库仓库所在地区
-                OutStoreAddress	 = store.Address, //出库仓库地址
-                OutStoreManager = storeuser.RealName, //出库仓库联系人
-                OutStoreManagerMobile = store.ManageMobile, //出库仓库联系人手机号
-            }).Entity;
-            maindb.SaveChanges();
-            RedisDbconn.Instance.ReleaseLock("MachineChange:" + UserId);
-            Orders order = maindb.Orders.Add(new Orders()
-            {
-                OrderNo = OrderNo,
-                RealName = address.RealName,
-                Mobile = address.Mobile,
-                Areas = address.Areas,
-                Address = address.Address,
-                StoreContact = manager.RealName,
-                StoreContactMobile = store.ManageMobile,
-                StoreUserId = store.UserId,
-                StoreType = store.StoreType,
-                CreateDate = DateTime.Now, //创建时间
-                UserId = UserId, //创客
-                StoreId = OutStoreId, //仓库
-                TopUserId = PublicFunction.GetTopUserId(user.ParentNav), //顶级创客
-                DeliveryType = DeliveryType, //提货类型
-                BuyCount = 1,
-                TotalPrice = 0, //订单总额
-                Remark = Remark, //订单备注
-                Status = 1,
-                PayStatus = 1,
-                PayDate = DateTime.Now,
-                QueryCount = 2, //申请换新机标记
-                Sort = query.Id,
-            }).Entity;
-            maindb.SaveChanges();
-            MachineChange edit = maindb.MachineChange.FirstOrDefault(m => m.Id == query.Id);
-            if (edit != null)
-            {
-                edit.QueryCount = order.Id;
-                maindb.SaveChanges();
-            }
-            OrderForNo orderFor = maindb.OrderForNo.Add(new OrderForNo()
-            {
-                OrderNo = OrderNo,
-                OrderIds = order.Id.ToString(),
-            }).Entity;
-            maindb.SaveChanges();
-            Obj.Add("Id", query.Id); //Id
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-售后换新-查询
-        [Authorize]
-        public JsonResult Check(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = CheckDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson CheckDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //品牌
-            string PosSn = data["PosSn"].ToString(); //转换机器SN来源
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.PosSn == PosSn && m.UserId == UserId);
-            if (pos == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "SN不存在" };
-            }
-            if (pos.BrandId != BrandId)
-            { 
-                return new AppResultJson() { Status = "-1", Info = "选择的品牌和SN号不一致" };
-            }
-            bool check = maindb.MachineChange.Any(m => m.ChangeSnExpand == PosSn && m.AuditResult < 2);
-            if (check)
-            {
-                return new AppResultJson() { Status = "-1", Info = "此SN已提交,请勿重复申请" };
-            }
-            return new AppResultJson() { Status = "1", Info = "" };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 124
Areas/Api/Controllers/v1/Pos/MerchantDepositReturnsController.cs

@@ -1,124 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class MerchantDepositReturnsController : BaseController
-    {
-        public MerchantDepositReturnsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-押金查询-退押金-确认返还
-        [Authorize]
-        public JsonResult Add(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson AddDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
-            int IsFirst = int.Parse(function.CheckInt(data["IsFirst"].ToString())); //是否首台 1 是 0 否
-            string AlipayAccountNo = data["AlipayAccountNo"].ToString(); //支付宝账号
-            string MobileCode = data["MobileCode"].ToString(); //短信验证码
-            string Mobile = data["Mobile"].ToString(); //手机号
-            MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + Mobile);
-            if (mobilecheck == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            if (mobilecheck.CheckCode != MobileCode)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            RedisDbconn.Instance.Clear("MobileCodeCheck:" + Mobile);
-            string checks = RedisDbconn.Instance.Get<string>("MerchantDepositReturns:" + MerchantId);
-            if (checks == "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "已申请退押" };
-            }
-            RedisDbconn.Instance.Set("MerchantDepositReturns:" + MerchantId, "1");
-            RedisDbconn.Instance.SetExpire("MerchantDepositReturns:" + MerchantId, 10);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == MerchantId && m.StandardMonths >= 10 && m.StandardStatus == 101) ?? new PosMerchantInfo();
-            if (merchant.Id == 0)
-            {
-                return new AppResultJson() { Status = "-1", Info = "未达标,不能申请退押" };
-            }
-            MachineForMerNo forMerNo = maindb.MachineForMerNo.FirstOrDefault(m => m.MerNo == merchant.KqMerNo) ?? new MachineForMerNo();
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forMerNo.SnId) ?? new PosMachinesTwo();
-            decimal DepositMoney = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-            if (pos.BrandId != 2 && pos.BrandId != 7)
-            {
-                DepositMoney = DepositMoney / 100;
-            }
-            var check = maindb.MerchantDepositReturns.Any(m => m.MerchantId == MerchantId && m.Status != 2);
-            if (check)
-            {
-                return new AppResultJson() { Status = "-1", Info = "已申请退押", Data = Obj };
-            }
-            else
-            {
-                var query = maindb.MerchantDepositReturns.Add(new MerchantDepositReturns()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    QueryCount = IsFirst,
-                    SeoKeyword = "TY" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8),
-                    MerchantId = MerchantId, //商户
-                    AlipayAccountNo = AlipayAccountNo, //支付宝账号
-                    UserId = pos.BuyUserId, //创客
-                    ReturnAmount = DepositMoney,
-                }).Entity;
-                merchant.StandardStatus = 1;
-                maindb.SaveChanges();
-                Obj.Add("Id", query.Id); //Id
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 525
Areas/Api/Controllers/v1/Pos/MerchantInfoController.cs

@@ -1,525 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class MerchantInfoController : BaseController
-    {
-        public MerchantInfoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-我的业绩-个人业绩-激活商户-商户搜索
-        [Authorize]
-        public JsonResult ActMerchantSearch(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ActMerchantSearchDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ActMerchantSearchDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SearchKey = data["SearchKey"].ToString(); //搜索关键词
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<MerchantItem> query = RedisDbconn.Instance.GetList<MerchantItem>("MerchantList:" + UserId, 1, 1000000); // TODO:要同步数据到本key
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                query = query.Where(m => m.MerchantName.Contains(SearchKey) || m.MerchantNo.Contains(SearchKey) || m.KqSnNo.Contains(SearchKey) || m.MerchantMobile.Contains(SearchKey)).ToList();
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
-            foreach (var sub in query)
-            {
-                PosMerchantInfo subdata = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == sub.Id) ?? new PosMerchantInfo();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("MerchantName", subdata.MerchantName); //商户姓名
-                curData.Add("ActiveStatus", subdata.ActiveStatus == 1 ? "已激活" : "未激活"); //商户激活状态
-                curData.Add("MerStandardDate", subdata.MerStandardDate == null ? "" : subdata.MerStandardDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //商户激活时间
-                curData.Add("ActType", RelationClass.GetMerchantActTypeInfo(subdata.ActType)); //激活类型
-                curData.Add("BrandId", RelationClass.GetKqProductBrandInfo(subdata.BrandId)); //品牌
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-个人业绩-激活商户-商户明细
-        [Authorize]
-        public JsonResult ActMerchants(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = ActMerchantsDo(value, out Obj);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Obj });
-        }
-        public List<Dictionary<string, object>> ActMerchantsDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString())); //产品类型
-            string IsHelp = data["IsHelp"].ToString(); //是否扶持期
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<MerchantItem> query = RedisDbconn.Instance.GetList<MerchantItem>("MerchantList:" + UserId, 1, 1000000); // TODO:要同步数据到本key
-            DateTime check = DateTime.Now.AddMonths(-3);
-            int Total = query.Count;
-            int HelpCount = query.Count(m => m.RegDate >= check);
-            int NotHelpCount = query.Count(m => m.RegDate < check);
-            if (ProductType > 0)
-            {
-                query = query.Where(m => m.BrandId == ProductType).ToList();
-            }
-            if (!string.IsNullOrEmpty(IsHelp))
-            {
-                if (IsHelp == "1")
-                {
-                    query = query.Where(m => m.RegDate >= check).ToList();
-                }
-                else
-                {
-                    query = query.Where(m => m.RegDate < check).ToList();
-                }
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
-            foreach (MerchantItem merchant in query)
-            {
-                PosMerchantInfo subdata = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == merchant.Id) ?? new PosMerchantInfo();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("MerchantName", subdata.MerchantName); //商户姓名
-                curData.Add("ActiveStatus", subdata.ActiveStatus == 1 ? "已激活" : "未激活"); //商户激活状态
-                curData.Add("MerStandardDate", subdata.MerStandardDate == null ? "" : subdata.MerStandardDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //商户激活时间
-                curData.Add("ActType", RelationClass.GetMerchantActTypeInfo(subdata.ActType)); //激活类型
-                curData.Add("BrandId", RelationClass.GetKqProductBrandInfo(subdata.BrandId)); //品牌
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("Total", Total); //全部商户
-            Obj.Add("HelpCount", HelpCount); //扶持期商户
-            Obj.Add("NotHelpCount", NotHelpCount); //稳定期商户
-            Other = Obj;
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-团队业绩-商户列表
-        [Authorize]
-        public JsonResult TeamPerformanceMerchants(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceMerchantsDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceMerchantsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<MerchantItem> query = RedisDbconn.Instance.GetList<MerchantItem>("MerchantList:" + UserId, 1, 1000000).Where(m => m.ActiveStatus == 1).ToList();
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
-            foreach (MerchantItem Merchant in query)
-            {
-                PosMerchantInfo subdata = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == Merchant.Id) ?? new PosMerchantInfo();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("MerchantName", subdata.MerchantName); //商户姓名
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-我的商户-商户列表
-        [Authorize]
-        public JsonResult MyMerchant(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = MyMerchantDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> MyMerchantDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString())); //产品类型
-            ulong ActiveStatus = ulong.Parse(function.CheckInt(data["ActiveStatus"].ToString())); //商户激活状态
-            decimal MinTrade = decimal.Parse(function.CheckNum(data["MinTrade"].ToString())); //本月交易额最低值
-            decimal MaxTrade = decimal.Parse(function.CheckNum(data["MaxTrade"].ToString())); //本月交易额最高值
-            string ActTime = data["ActTime"].ToString(); //激活时间
-            string Sort = data["Sort"].ToString(); //排序
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<PosMerchantInfo> query = PosMerchantInfoDbconn.Instance.GetList(UserId, 1, 1000000);
-            string today = DateTime.Now.ToString("yyyyMMdd");
-            DateTime date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            int TotalCount = query.Count;
-            int ActCount = query.Count(m => m.MerStandardDate >= date);
-            int ProductCount = query.Count(m => m.BrandId == ProductType);
-            int ProductActCount = query.Count(m => m.ActiveStatus > 0 && m.BrandId == ProductType);
-            int ProductUnActCount = ProductCount - ProductActCount;
-            if (ProductType > 0)
-            {
-                query = query.Where(m => m.BrandId == ProductType).ToList();
-            }
-            if (ActiveStatus > 0)
-            {
-                int ActStatus = 1;
-                if (ActiveStatus == 2) ActStatus = 0;
-                query = query.Where(m => m.ActiveStatus == ActStatus).ToList();
-            }
-            // if (MinTrade > 0)
-            // {
-            //     query = query.Where(m => m.TradeAmount >= MinTrade).ToList();
-            // }
-            // if (MaxTrade > 0)
-            // {
-            //     query = query.Where(m => m.TradeAmount <= MaxTrade).ToList();
-            // }
-            // if (!string.IsNullOrEmpty(ActTime))
-            // {
-            //     query = query.Where(m => m.ActTime == ActTime).ToList();
-            // }
-            // if (Sort == "trade")
-            // {
-            //     query = query.OrderByDescending(m => m.TradeAmount).ToList();
-            // }
-            if (Sort == "regdate")
-            {
-                query = query.OrderByDescending(m => m.CreateDate).ToList();
-            }
-            else
-            {
-                query = query.OrderByDescending(m => m.Status).ThenByDescending(m => m.SeoKeyword).ToList();
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
-            foreach (var item in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                PosMerchantInfo subdata = PosMerchantInfoDbconn.Instance.Get(item.Id) ?? new PosMerchantInfo();
-                var posId = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == item.KqSnNo) ?? new MachineForSnNo();
-                var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == posId.SnId) ?? new PosMachinesTwo();
-                if (pos.UpFeeFlag == 1 && pos.DownFeeFlag == 0)
-                {
-                    curData.Add("IsOk", 1);//未调整
-                }
-                else if (pos.UpFeeFlag == 1 && pos.DownFeeFlag == 1)
-                {
-                    curData.Add("IsOk", 2);//已经调低
-                }
-                else
-                {
-                    curData.Add("IsOk", 0);//初始
-                }
-                string Name = subdata.MerchantName;
-                if (subdata.BrandId == 2)
-                {
-                    if (Name.Contains("-"))
-                    {
-                        Name = Name.Split('-')[1];
-                    }
-                    else if (Name.Contains("_"))
-                    {
-                        Name = Name.Split('_')[1];
-                    }
-                }
-                curData.Add("MerchantName", Name); //商户姓名
-                curData.Add("KqRegTime", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd")); //渠道注册时间
-                curData.Add("Id", item.Id); //Id
-                curData.Add("ThisMonthTrade", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(subdata.Id, DateTime.Now.ToString("yyyyMM"))); //当月交易额 // TODO:记得统计
-                dataList.Add(curData);
-            }
-            Other = new Dictionary<string, object>();
-            Other.Add("TotalCount", TotalCount); //商户数
-            Other.Add("ActCount", ActCount); //商户激活数
-            Other.Add("ProductCount", ProductCount); //当前产品商户总数
-            Other.Add("ProductActCount", ProductActCount); //当前产品已激活数
-            Other.Add("ProductUnActCount", ProductUnActCount); //当前产品未激活数
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-我的商户-商户搜索
-        [Authorize]
-        public JsonResult MerchantSearch(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = MerchantSearchDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> MerchantSearchDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SearchKey = data["SearchKey"].ToString(); //搜索关键词
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString()));
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosMerchantInfo> query = maindb.PosMerchantInfo.Where(m => m.UserId == UserId && m.BrandId == ProductType);
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                query = query.Where(m => (m.MerchantName == SearchKey || m.KqSnNo == SearchKey));
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var item in query.ToList())
-            {
-                PosMerchantInfo subdata = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == item.Id) ?? new PosMerchantInfo();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                string Name = subdata.MerchantName;
-                if (subdata.BrandId == 2)
-                {
-                    if (Name.Contains("-"))
-                    {
-                        Name = Name.Split('-')[1];
-                    }
-                    else if (Name.Contains("_"))
-                    {
-                        Name = Name.Split('_')[1];
-                    }
-                }
-                curData.Add("MerchantName", Name); //商户姓名
-                curData.Add("KqRegTime", subdata.KqRegTime == null ? "" : subdata.KqRegTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //渠道注册时间
-                curData.Add("Id", item.Id); //Id
-                curData.Add("ThisMonthTrade", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(subdata.Id, DateTime.Now.ToString("yyyyMM"))); //当月交易额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-我的商户-商户详情
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            PosMerchantInfo query = PosMerchantInfoDbconn.Instance.Get(Id) ?? new PosMerchantInfo();
-            string Name = query.MerchantName;
-            if (query.BrandId == 2)
-            {
-                if (Name.Contains("-"))
-                {
-                    Name = Name.Split('-')[1];
-                }
-                else if (Name.Contains("_"))
-                {
-                    Name = Name.Split('_')[1];
-                }
-            }
-            MachineForMerNo forMerNo = maindb.MachineForMerNo.FirstOrDefault(m => m.MerNo == query.KqMerNo) ?? new MachineForMerNo();
-            Obj.Add("MerchantName", Name); //商户姓名
-            Obj.Add("MerchantMobile", query.MerchantMobile); //商户手机号
-            Obj.Add("MerRealName", query.MerRealName); //商户真实姓名
-            Obj.Add("MerIdcardNo", query.MerIdcardNo); //商户身份证号
-            Obj.Add("KqMerNo", query.KqMerNo); //商户编号
-            Obj.Add("KqSnNo", query.KqSnNo); //渠道SN号
-            Obj.Add("KqSnId", forMerNo.SnId); //机具Id
-            Obj.Add("MerStatus", query.MerStatus); //商户状态
-            Obj.Add("ActiveStatus", query.ActiveStatus == 1 ? "已激活" : "未激活"); //商户激活状态
-            Obj.Add("MerStandardDate", query.MerStandardDate == null ? "" : query.MerStandardDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //商户激活时间
-            Obj.Add("Remark", query.Remark); //备注
-            Obj.Add("MerUserType", query.MerUserType == 1 ? "商户型创客" : "非商户型创客"); //商户创客类型
-            Obj.Add("ProductType", RelationClass.GetKqProductBrandInfo(query.BrandId)); //来源产品
-            Obj.Add("TradeTotal", PosMerchantTradeSummaryDbconn.Instance.GetTrade(query.Id)); //总交易额
-            Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //创建时间
-
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forMerNo.SnId) ?? new PosMachinesTwo();
-            var poschange = maindb.PosMachinesFeeChangeRecord.FirstOrDefault(m => m.PosId == pos.Id) ?? new PosMachinesFeeChangeRecord();
-            if (pos.UpFeeFlag == 1 && pos.DownFeeFlag == 0 && poschange.Id == 0)
-            {
-                Obj.Add("IsOk", 1);//未调整
-            }
-            else if (pos.UpFeeFlag == 1 && pos.DownFeeFlag == 1 && pos.SeoDescription == "设置成功")
-            {
-                Obj.Add("IsOk", 3);//成功
-            }
-            else if (pos.UpFeeFlag == 1 && pos.DownFeeFlag == 0 && poschange.Id > 0)
-            {
-                Obj.Add("IsOk", 2);//处理中
-            }
-            else if (pos.UpFeeFlag == 1 && pos.DownFeeFlag == 0 && poschange.Status == -1)
-            {
-                Obj.Add("IsOk", -1);//失败
-            }
-            else
-            {
-                Obj.Add("IsOk", 0);//初始
-            }
-            decimal Deposit = 0;
-            if (pos.BrandId == 2)
-            {
-                Deposit = 299;
-                if (!string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    Deposit = decimal.Parse(function.CheckNum(pos.PrizeParams));
-                }
-            }
-            else if (pos.BrandId == 6)
-            {
-                Deposit = 249;
-                if (!string.IsNullOrEmpty(pos.PrizeParams))
-                {
-                    Deposit = decimal.Parse(function.CheckNum(pos.PrizeParams));
-                }
-            }
-            Obj.Add("Deposit", Deposit);
-            if (pos.IsFirst == 1)
-            {
-                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)
-                    {
-                        Obj.Add("ActStatus", "");
-                    }
-                    else
-                    {
-                        if (pos.BindingTime.Value.AddDays(Days) > DateTime.Now)
-                        {
-                            Obj.Add("ActStatus", "扶持期");
-                        }
-                        else if (pos.DownFeeFlag == 1)
-                        {
-                            Obj.Add("ActStatus", "盈利期");
-                        }
-                        else
-                        {
-                            Obj.Add("ActStatus", "稳定期");
-                        }
-                    }
-                }
-                else if (pos.DownFeeFlag == 1)
-                {
-                    Obj.Add("ActStatus", "盈利期");
-                }
-                else
-                {
-                    Obj.Add("ActStatus", "稳定期");
-                }
-            }
-            else if (pos.DownFeeFlag == 1)
-            {
-                Obj.Add("ActStatus", "盈利期");
-            }
-            else
-            {
-                Obj.Add("ActStatus", "稳定期");
-            }
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 123
Areas/Api/Controllers/v1/Pos/OpenRewardController.cs

@@ -1,123 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class OpenRewardController : BaseController
-    {
-        public OpenRewardController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-收益查看-开机奖励
-        [Authorize]
-        public JsonResult StatList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StatListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StatListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            string Date = Kind == 1 ? "Day" : "Month";
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<string> query = RedisDbconn.Instance.GetList<string>("OpenReward" + Date + ":" + UserId + ":" + ProductType, PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("RewardAmount", RedisDbconn.Instance.Get<decimal>("OpenRewardAmt:" + UserId + ":" + ProductType + ":" + subdata)); //奖励金额
-                if (Kind == 1)
-                {
-                    curData.Add("Date", subdata.Substring(0, 4) + "年" + subdata.Substring(4, 2) + "月" + subdata.Substring(6, 2) + "日"); //激活时间
-                }
-                else
-                { 
-                    curData.Add("Date", subdata.Substring(0, 4) + "年" + subdata.Substring(4, 2) + "月"); //激活时间
-                }
-                curData.Add("DateValue", subdata); //激活时间值
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-收益查看-开机奖励-详情
-        [Authorize]
-        public JsonResult StatDetail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StatDetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StatDetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            string PrizeDate = data["PrizeDate"].ToString(); //奖励时间
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<OpenRewardDetail> query = RedisDbconn.Instance.GetList<OpenRewardDetail>("OpenRewardDetail:" + UserId + ":" + ProductType + ":" + PrizeDate, PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("RewardType", subdata.RewardType == 1 ? "开机直接奖励" : "开机间接奖励"); //奖励类型
-                curData.Add("PrizeAmount", subdata.CreditRewardAmount); //奖励金额
-                curData.Add("SnNo", subdata.SnNo); //SN号
-                curData.Add("RealName", subdata.SeoTitle); //机具所属创客
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 392
Areas/Api/Controllers/v1/Pos/OrdersController.cs

@@ -1,392 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.Models;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class OrdersController : BaseController
-    {
-        public OrdersController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-        
-        #region 商城-确认订单
-        [Authorize]
-        public JsonResult ConfirmOrder(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ConfirmOrderDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ConfirmOrderDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int DeliveryType = int.Parse(function.CheckInt(data["DeliveryType"].ToString())); //提货类型
-            string Remark = data["Remark"].ToString(); //订单备注
-            int AddressId = int.Parse(function.CheckInt(data["AddressId"].ToString()));  //收货地址Id
-            JsonData ProductJson = data["ProductJson"]; //商品信息
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string OrderNo = "BM61" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-            UserAddress address = UserAddressDbconn.Instance.Get(AddressId) ?? new UserAddress();
-            StoreHouse store = StoreHouseDbconn.Instance.Get(StoreId) ?? new StoreHouse();
-            Users storeUser = UsersDbconn.Instance.Get(store.ManageUserId) ?? new Users();
-            Users user = UsersDbconn.Instance.Get(UserId) ?? new Users();
-            int TopUserId = PublicFunction.GetTopUserId(user.ParentNav);
-            decimal TotalPrice = 0; //订单总额
-            Orders query = maindb.Orders.Add(new Orders()
-            {
-                OrderNo = OrderNo,
-                RealName = address.RealName,
-                Mobile = address.Mobile,
-                Areas = address.Areas,
-                Address = address.Address,
-                StoreContact = storeUser.RealName,
-                StoreContactMobile = store.ManageMobile,
-                StoreUserId = store.UserId,
-                StoreType = store.StoreType,
-                CreateDate = DateTime.Now, //创建时间
-                UserId = UserId, //创客
-                StoreId = StoreId, //仓库
-                TopUserId = TopUserId, //顶级创客
-                DeliveryType = DeliveryType, //提货类型
-                BuyCount = 0,
-                TotalPrice = TotalPrice, //订单总额
-                Remark = Remark, //订单备注
-            }).Entity;
-            maindb.SaveChanges();
-            for (int i = 0; i < ProductJson.Count; i++)
-            {
-                JsonData item = ProductJson[i];
-                int ProductId = int.Parse(function.CheckInt(item["ProductId"].ToString()));
-                int NormId = int.Parse(function.CheckInt(item["NormId"].ToString()));
-                int BuyCount = int.Parse(function.CheckInt(item["BuyCount"].ToString()));
-                Products product = ProductsDbconn.Instance.Get(ProductId) ?? new Products();
-                ProductNorm norm = ProductNormDbconn.Instance.Get(NormId) ?? new ProductNorm();
-                OrderProduct pro = maindb.OrderProduct.Add(new OrderProduct()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    OrderId = query.Id,
-                    ProductId = ProductId,
-                    ProductCount = BuyCount,
-                    NormId = NormId.ToString(),
-                    NormDetail = norm.ColName,
-                    ProductPrice = norm.Price,
-                    TotalPrice = norm.Price * BuyCount,
-                    ProductCode = product.ProductCode,
-                    UserId = UserId,
-                    StoreId = StoreId,
-                }).Entity;
-                TotalPrice += norm.Price * BuyCount;
-            }
-            query.TotalPrice = TotalPrice;
-            maindb.SaveChanges();
-            Obj.Add("Id", query.Id); //Id
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-机具申请-要兑换的机具
-        [Authorize]
-        public JsonResult ExchangeMachines(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = ExchangeMachinesDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> ExchangeMachinesDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString()));
-            DateTime now = DateTime.Now;
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BrandId == ProductType && m.IsPurchase == 0);
-            int ExpiredCount = query.Count(m => m.RecycEndDate < now);
-            int ActCount = query.Count(m => m.ActivationState == 1);
-            query = query.Where(m => m.RecycEndDate >= now && m.ActivationState == 1);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("SnId", subdata.Id); //机具Id
-                curData.Add("SnNo", subdata.PosSn); //SN号
-                curData.Add("MachineType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
-                int day = 0;
-                if (subdata.RecycEndDate != null)
-                {
-                    TimeSpan ts = subdata.RecycEndDate.Value - DateTime.Now;
-                    day = ts.Days;
-                }
-                curData.Add("RecycDays", day); //循环剩余天数
-                curData.Add("EndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd")); //截止日期
-                List<KqProducts> pros = KqProductsDbconn.Instance.GetList();
-                string BrandIdString = "";
-                foreach (KqProducts pro in pros)
-                {
-                    BrandIdString += pro.Name.Substring(0, 1) + "=" + pro.Id + ",";
-                }
-                curData.Add("ProductType", BrandIdString.TrimEnd(',')); //产品类型 // TODO:数据需要组合,格式:大=1,签=2,超=3
-                dataList.Add(curData);
-            }
-            Other = new Dictionary<string, object>();
-            Other.Add("ActCount", ActCount); //激活数
-            Other.Add("ExpiredCount", ExpiredCount); //过期数
-            Other.Add("MinCount", 1); //最少领取数
-            return dataList;
-        }
-        #endregion
-        
-        #region 首页-客小爽产品-机具管理-机具申请-要兑换的机具-V2
-        [Authorize]
-        public JsonResult ExchangeMachines2(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = ExchangeMachines2Do(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> ExchangeMachines2Do(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString()));
-            DateTime now = DateTime.Now;
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BrandId == ProductType && m.IsPurchase == 0);
-            int ExpiredCount = query.Count(m => m.RecycEndDate < now);
-            int ActCount = query.Count(m => m.ActivationState == 1);
-            query = query.Where(m => m.RecycEndDate >= now && (m.ActivationState == 1 || (!string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0")));
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                int IsLeader = 0;//是否为大盟主机(0-否 1-是)
-                if (subdata.LeaderUserId > 0)
-                {
-                    IsLeader = 1;
-                }
-                else
-                {
-                    IsLeader = 0;
-                }
-                curData.Add("SnId", subdata.Id); //机具Id
-                curData.Add("SnNo", subdata.PosSn); //SN号
-                curData.Add("MachineType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
-                int day = 0;
-                if (subdata.RecycEndDate != null)
-                {
-                    TimeSpan ts = subdata.RecycEndDate.Value - DateTime.Now;
-                    day = ts.Days;
-                }
-                curData.Add("RecycDays", day); //循环剩余天数
-                curData.Add("EndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd")); //截止日期
-                // List<KqProducts> pros = KqProductsDbconn.Instance.GetList();
-                List<int> BrandIds = new List<int>();
-                // foreach (KqProducts pro in pros)
-                // {
-                //     BrandIds.Add(pro.Id);
-                // }
-                if (ProductType == 1 || ProductType == 2 || ProductType == 4 || ProductType == 6 || ProductType == 7 || ProductType == 8 || ProductType == 10)
-                { 
-                    BrandIds.Add(1);
-                    BrandIds.Add(2);
-                    BrandIds.Add(4);
-                    BrandIds.Add(6);
-                    BrandIds.Add(7);
-                    BrandIds.Add(8);
-                    BrandIds.Add(10);
-                }
-                else
-                { 
-                    BrandIds.Add(3);
-                    BrandIds.Add(5);
-                    BrandIds.Add(9);
-                    BrandIds.Add(11);
-                }
-                curData.Add("ProductType", BrandIds); //产品类型 // TODO:数据需要组合,格式:大=1,签=2,超=3
-                curData.Add("IsLeader",IsLeader);
-                dataList.Add(curData);
-            }
-            Other = new Dictionary<string, object>();
-            Other.Add("ActCount", ActCount); //激活数
-            Other.Add("ExpiredCount", ExpiredCount); //过期数
-            Other.Add("MinCount", 1); //最少领取数
-            return dataList;
-        }
-        #endregion
-
-
-
-
-        #region 首页-仓库管理-订单列表
-        [Authorize]
-        public JsonResult StoreOrderList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StoreOrderListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StoreOrderListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string SearchKey = data["SearchKey"].ToString(); //手机号
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int Status = int.Parse(function.CheckInt(data["Status"].ToString())); //订单状态
-            string StartDate = data["StartDate"].ToString(); //下单开始时间
-            string EndDate = data["EndDate"].ToString(); //下单结束时间
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<StoreOrders> query = RedisDbconn.Instance.GetList<StoreOrders>("StoreOrders:" + StoreId, 1, 100000);
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                query = query.Where(m => m.RealName == SearchKey || m.Mobile == SearchKey).ToList();
-            }
-            if (!string.IsNullOrEmpty(StartDate))
-            {
-                DateTime time = DateTime.Parse(StartDate.Substring(0, 4) + "-" + StartDate.Substring(4, 2) + "-" + StartDate.Substring(6, 2) + " 00:00:00");
-                query = query.Where(m => m.CreateDate >= time).ToList();
-            }
-            if (!string.IsNullOrEmpty(EndDate))
-            {
-                DateTime time = DateTime.Parse(EndDate.Substring(0, 4) + "-" + EndDate.Substring(4, 2) + "-" + EndDate.Substring(6, 2) + " 23:59:59");
-                query = query.Where(m => m.CreateDate <= time).ToList();
-            }
-            if (Status > 0)
-            { 
-                if(Status == 2) Status = 0;
-                query = query.Where(m => m.SendStatus == Status).ToList();
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
-            foreach (var item in query)
-            {
-                Orders subdata = OrdersDbconn.Instance.Get(item.Id) ?? new Orders();
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("OrderNo", subdata.OrderNo); //订单号
-                curData.Add("RealName", subdata.RealName); //姓名
-                curData.Add("Mobile", subdata.Mobile); //手机号
-                curData.Add("Areas", subdata.Areas); //所在地区
-                curData.Add("Address", subdata.Address); //详细地址
-                curData.Add("DeliveryType", subdata.DeliveryType); //提货类型
-                curData.Add("BuyCount", subdata.BuyCount); //下单数量
-                curData.Add("SnNos", subdata.SnNos); //SN编号
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                Products pro = ProductsDbconn.Instance.Get(subdata.ProductId) ?? new Products();
-                curData.Add("ProductName", pro.ProductName); //商品名称
-                Users user = UsersDbconn.Instance.Get(subdata.UserId) ?? new Users();
-                curData.Add("OrderRealName", user.RealName); //下单人姓名
-                curData.Add("OrderMakerCode", user.MakerCode); //下单人编号
-                curData.Add("OrderKind", subdata.Sort > 0 ? "机具申请" : "商城购买"); //订单类型
-                curData.Add("SendStatus", item.SendStatus);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-仓库管理-订单详情
-        [Authorize]
-        public JsonResult StoreOrderDetail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = StoreOrderDetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> StoreOrderDetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Orders query = OrdersDbconn.Instance.Get(Id) ?? new Orders();
-            Obj.Add("UserId", RelationClass.GetUsersInfo(query.UserId)); //创客
-            Obj.Add("RealName", query.RealName); //姓名
-            Obj.Add("Mobile", query.Mobile); //手机号
-            Obj.Add("Areas", function.CheckNull(query.Areas).Replace(",", "")); //所在地区
-            Obj.Add("Address", query.Address); //详细地址
-            Obj.Add("DeliveryType", query.DeliveryType); //提货类型
-            Obj.Add("BuyCount", query.BuyCount); //下单数量
-            Obj.Add("SnNos", query.SnNos); //SN编号
-            Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-            Products pro = RedisDbconn.Instance.Get<Products>("Products:" + query.ProductId) ?? new Products();
-            Obj.Add("ProductName", pro.ProductName); //商品名称
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 156
Areas/Api/Controllers/v1/Pos/PosCouponOrdersController.cs

@@ -1,156 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class PosCouponOrdersController : BaseController
-    {
-        public PosCouponOrdersController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-客小爽产品-机具管理-券划拨记录
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));
-            int ChangeKind = int.Parse(function.CheckInt(data["ChangeKind"].ToString())); // 1-拨入,2-拨出
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosCouponOrders> query = maindb.PosCouponOrders.Where(m => m.QueryCount == Kind && m.ChangeKind == ChangeKind && m.FromUserId == UserId).OrderByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Id", subdata.Id);
-                curData.Add("ToUserId", subdata.ToUserId); //目标创客
-                Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == subdata.ToUserId) ?? new Users();
-                string RealName = UsersData.RealName;
-                if (RealName.Length > 2)
-                {
-                    RealName = RealName.Substring(0, 1) + "*" + RealName.Substring(RealName.Length - 1);
-                }
-                else
-                { 
-                    RealName = RealName.Substring(0, 1) + "*";
-                }
-                UserInfo.Add("RealName", RealName); //真实姓名
-                UserInfo.Add("MakerCode", UsersData.MakerCode); //创客编号
-                curData.Add("UserInfo", UserInfo);
-                curData.Add("ChangeCount", subdata.ChangeCount); //变更数量
-                curData.Add("ChangeKind", subdata.ChangeKind); //变更类型
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-客小爽产品-机具管理-券划拨记录-详情
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            PosCouponOrders query = maindb.PosCouponOrders.FirstOrDefault(m => m.Id == Id) ?? new PosCouponOrders();
-            string OrderNo = query.OrderNo;
-            Obj.Add("ToUserId", query.ToUserId); //目标创客
-            Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-            Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == query.ToUserId) ?? new Users();
-            UserInfo.Add("RealName", UsersData.RealName); //真实姓名
-            UserInfo.Add("MakerCode", UsersData.MakerCode); //创客编号
-            UserInfo.Add("Mobile", UsersData.Mobile); //手机号
-            Obj.Add("UserInfo", UserInfo);
-            Obj.Add("ChangeCount", query.ChangeCount); //变更数量
-            Obj.Add("ChangeKind", query.ChangeKind); //变更类型
-            Obj.Add("CreateDate", query.CreateDate); //创建时间
-            List<PosCouponRecord> list = maindb.PosCouponRecord.Where(m => m.OrderNo == OrderNo).ToList();
-            List<string> codes = new List<string>();
-            string CodeType = "";
-            foreach (PosCouponRecord sub in list)
-            {
-                int PosCouponId = sub.PosCouponId;
-                PosCoupons coupon = maindb.PosCoupons.FirstOrDefault(m => m.Id == PosCouponId);
-                if (coupon != null)
-                {
-                    codes.Add(coupon.ExchangeCode);
-                    if (coupon.ExchangeCode.StartsWith("02")) CodeType = "电签兑换券";
-                    if (coupon.ExchangeCode.StartsWith("03")) CodeType = "大机兑换券";
-                }
-            }
-            Obj.Add("Codes", codes); //机具券列表
-            Obj.Add("CodeType", CodeType); //券类型
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 191
Areas/Api/Controllers/v1/Pos/PosCouponRecordController.cs

@@ -1,191 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class PosCouponRecordController : BaseController
-    {
-        public PosCouponRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-客小爽产品-机具管理-划拨券
-        [Authorize]
-        public JsonResult Add(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        int[] ToUserIds = { 1, 76922 };
-        public AppResultJson AddDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //目标创客
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));//券类型
-            string CouponIds = data["CouponIds"].ToString(); //券列表返回的Id集合
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            bool checkUser = maindb.Users.Any(m => m.Id == ToUserId);
-            if (!checkUser)
-            {
-                return new AppResultJson() { Status = "-1", Info = "请输入正确的创客编号", Data = Obj };
-            }
-            Users user = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-            Users touser = maindb.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
-            if (!ToUserIds.Contains(UserId))
-            {
-                if (!function.CheckNull(touser.ParentNav).Contains("," + UserId + ",") || function.CheckNull(user.ParentNav).Contains("," + ToUserId + ","))
-                {
-                    return new AppResultJson() { Status = "-1", Info = "划拨对象不在您的权限范围", Data = Obj };
-                }
-            }
-            if (!string.IsNullOrEmpty(CouponIds))
-            {
-                string ChangeRecordNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                string[] CouponIdList = CouponIds.Split(',');
-                foreach (string CouponId in CouponIdList)
-                {
-                    int CouponIdNum = int.Parse(CouponId);
-                    PosCoupons coupon = maindb.PosCoupons.FirstOrDefault(m => m.Id == CouponIdNum) ?? new PosCoupons();
-                    if (coupon.UserId != UserId)
-                    {
-                        return new AppResultJson() { Status = "-1", Info = "券" + coupon.ExchangeCode + "已划拨,请勿重复划拨", Data = Obj };
-                    }
-                    // if (coupon.UserId > 0)
-                    // {
-                    //     return new AppResultJson() { Status = "-1", Info = "券" + coupon.ExchangeCode + "已划拨,请勿重复划拨", Data = Obj };
-                    // }
-                    if (coupon.QueryCount != Kind)
-                    {
-                        return new AppResultJson() { Status = "-1", Info = "选择的机具券类型不匹配", Data = Obj };
-                    }
-                    PosCouponRecord query = maindb.PosCouponRecord.Add(new PosCouponRecord()
-                    {
-                        QueryCount = Kind,
-                        CreateDate = DateTime.Now,
-                        ChangeKind = 1,
-                        OrderNo = ChangeRecordNo,
-                        ToUserId = ToUserId,
-                        FromUserId = UserId,
-                        PosCouponId = CouponIdNum,
-                    }).Entity;
-                    coupon.UserId = ToUserId;
-                    maindb.SaveChanges();
-                }
-                int CouponCount = CouponIdList.Length;
-                PosCouponForUser forUser = maindb.PosCouponForUser.FirstOrDefault(m => m.Id == UserId);
-                if (forUser == null)
-                {
-                    forUser = maindb.PosCouponForUser.Add(new PosCouponForUser()
-                    {
-                        Id = UserId,
-                    }).Entity;
-                    maindb.SaveChanges();
-                }
-                int BeforeOut = forUser.OutNum;
-                int BeforeTotal = forUser.TotalNum;
-                int BeforeStock = forUser.StockNum;
-                forUser.OutNum += CouponCount;
-                forUser.StockNum -= CouponCount;
-                int AfterOut = forUser.OutNum;
-                int AfterTotal = forUser.TotalNum;
-                int AfterStock = forUser.StockNum;
-                PosCouponOrders stat = maindb.PosCouponOrders.Add(new PosCouponOrders()
-                {
-                    QueryCount = Kind,
-                    CreateDate = DateTime.Now,
-                    ChangeKind = 2,
-                    ChangeCount = CouponCount,
-                    AfterOut = AfterOut,
-                    AfterTotal = AfterTotal,
-                    AfterStock = AfterStock,
-                    BeforeOut = BeforeOut,
-                    BeforeTotal = BeforeTotal,
-                    BeforeStock = BeforeStock,
-                    OrderNo = ChangeRecordNo,
-                    ToUserId = ToUserId,
-                    FromUserId = UserId,
-                }).Entity;
-                maindb.SaveChanges();
-                PosCouponForUser forToUser = maindb.PosCouponForUser.FirstOrDefault(m => m.Id == ToUserId);
-                if (forToUser == null)
-                {
-                    forToUser = maindb.PosCouponForUser.Add(new PosCouponForUser()
-                    {
-                        Id = ToUserId,
-                    }).Entity;
-                    maindb.SaveChanges();
-                }
-                BeforeOut = forToUser.OutNum;
-                BeforeTotal = forToUser.TotalNum;
-                BeforeStock = forToUser.StockNum;
-                forToUser.TotalNum += CouponCount;
-                forToUser.StockNum += CouponCount;
-                AfterOut = forToUser.OutNum;
-                AfterTotal = forToUser.TotalNum;
-                AfterStock = forToUser.StockNum;
-                PosCouponOrders tostat = maindb.PosCouponOrders.Add(new PosCouponOrders()
-                {
-                    QueryCount = Kind,
-                    CreateDate = DateTime.Now,
-                    ChangeKind = 1,
-                    ChangeCount = CouponCount,
-                    AfterOut = AfterOut,
-                    AfterTotal = AfterTotal,
-                    AfterStock = AfterStock,
-                    BeforeOut = BeforeOut,
-                    BeforeTotal = BeforeTotal,
-                    BeforeStock = BeforeStock,
-                    OrderNo = ChangeRecordNo,
-                    ToUserId = UserId,
-                    FromUserId = ToUserId,
-                }).Entity;
-                maindb.SaveChanges();
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 137
Areas/Api/Controllers/v1/Pos/PosCouponsController.cs

@@ -1,137 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class PosCouponsController : BaseController
-    {
-        public PosCouponsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-客小爽产品-机具管理-机具申请-要兑换的券
-        [Authorize]
-        public JsonResult ExchangeCoupons(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = ExchangeCouponsDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> ExchangeCouponsDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString()));//券类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosCoupons> query = maindb.PosCoupons.Where(m => m.UserId == UserId && m.QueryCount == Kind && m.IsUse == 0 && m.IsLock == 0 && m.HelpProfitMerchantId == 0 && m.HelpProfitStatus == 0 && m.HelpProfitFlag == 0);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                int IsLeader = 0;//是否为大盟主机(0-否 1-是)
-                if (subdata.LeaderUserId > 0)
-                {
-                    IsLeader = 1;
-                }
-                else
-                {
-                    IsLeader = 0;
-                }
-                curData.Add("ExchangeCode", subdata.ExchangeCode); //兑换码
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("Kind", subdata.QueryCount); //券类型
-                int day = 0;
-                if (subdata.UpdateDate != null)
-                {
-                    TimeSpan ts = subdata.UpdateDate.Value - DateTime.Now;
-                    day = ts.Days;
-                }
-                curData.Add("RecycDays", day); //循环剩余天数
-                curData.Add("EndDate", subdata.UpdateDate == null ? "" : subdata.UpdateDate.Value.ToString("yyyy-MM-dd")); //截止日期
-                List<int> ProductType = new List<int>();
-                if (subdata.QueryCount == 1)
-                {
-                    ProductType.Add(1);
-                    ProductType.Add(2);
-                    ProductType.Add(4);
-                    ProductType.Add(6);
-                    ProductType.Add(7);
-                    ProductType.Add(8);
-                    ProductType.Add(10);
-                }
-                else if (subdata.QueryCount == 2)
-                {
-                    ProductType.Add(3);
-                    ProductType.Add(5);
-                    ProductType.Add(9);
-                    ProductType.Add(11);
-                }
-                curData.Add("ProductType", ProductType);
-                curData.Add("IsLeader",IsLeader);
-                dataList.Add(curData);
-            }
-            Other = new Dictionary<string, object>();
-            if (PageNum == 1)
-            {
-                Other.Add("NotUseCount", maindb.PosCoupons.Count(m => m.UserId == UserId && m.IsUse == 0 && m.QueryCount == 1 && m.HelpProfitFlag == 0));
-                Other.Add("UsedCount", maindb.PosCoupons.Count(m => m.UserId == UserId && m.IsUse == 1 && m.QueryCount == 1));
-                Other.Add("NotUseCount2", maindb.PosCoupons.Count(m => m.UserId == UserId && m.IsUse == 0 && m.QueryCount == 2 && m.HelpProfitFlag == 0));
-                Other.Add("UsedCount2", maindb.PosCoupons.Count(m => m.UserId == UserId && m.IsUse == 1 && m.QueryCount == 2));
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 502
Areas/Api/Controllers/v1/Pos/PosMachinesController.cs

@@ -1,502 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class PosMachinesController : BaseController
-    {
-        public PosMachinesController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-机具管理-已绑定机具列表
-        [Authorize]
-        public JsonResult MyMachinesForBind(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = MyMachinesForBindDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> MyMachinesForBindDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string SnNo = data["SnNo"].ToString(); //SN号
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                PageSize = 100000;
-            }
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BrandId == BrandId && m.BindingState == 1);
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                query = query.Where(m => m.PosSn == SnNo);
-            }
-            Other = new Dictionary<string, object>();
-            if (PageNum == 1)
-            {
-                Other.Add("count", query.Count());
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                int IsLeader = 0;//是否为大盟主机(0-否 1-是)
-                if (subdata.LeaderUserId > 0)
-                {
-                    IsLeader = 1;
-                }
-                else
-                {
-                    IsLeader = 0;
-                }
-                curData.Add("ActivationState", subdata.ActivationState == 1 ? "已激活" : "未激活"); //激活状态
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
-                curData.Add("Id", subdata.Id); //Id
-                decimal Deposit = 299;
-                if (BrandId == 6)
-                { 
-                    Deposit = 249;
-                }
-                if (!string.IsNullOrEmpty(subdata.PrizeParams))
-                {
-                    Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
-                }
-                curData.Add("Deposit", Deposit);
-                curData.Add("BindedMerchant", subdata.BuyUserId != subdata.UserId ? 1 : 0); //是否已绑定商户型创客
-                curData.Add("IsLeader",IsLeader);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-总机具列表
-        [Authorize]
-        public JsonResult MyMachines(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = MyMachinesDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> MyMachinesDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string SnNo = data["SnNo"].ToString(); //SN号
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                PageSize = 100000;
-            }
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BrandId == BrandId);
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                query = query.Where(m => m.PosSn == SnNo);
-            }
-            Other = new Dictionary<string, object>();
-            if (PageNum == 1)
-            {
-                Other.Add("count", query.Count());
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                int IsLeader = 0;//是否为大盟主机(0-否 1-是)
-                if (subdata.LeaderUserId > 0)
-                {
-                    IsLeader = 1;
-                }
-                else
-                {
-                    IsLeader = 0;
-                }
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("CreateDate", subdata.TransferTime == null ? "" : subdata.TransferTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                StoreHouse store = StoreHouseDbconn.Instance.Get(subdata.StoreId) ?? new StoreHouse();
-                curData.Add("FromStore", store.StoreName); //来自仓库
-                decimal Deposit = 299;
-                if (BrandId == 6)
-                { 
-                    Deposit = 249;
-                }
-                if (!string.IsNullOrEmpty(subdata.PrizeParams))
-                {
-                    Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
-                }
-                curData.Add("Deposit", Deposit);
-                curData.Add("IsLeader",IsLeader);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-未绑定机具列表
-        [Authorize]
-        public JsonResult MyMachinesForUnBind(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = MyMachinesForUnBindDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> MyMachinesForUnBindDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所属创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string SnNo = data["SnNo"].ToString(); //SN号
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                PageSize = 100000;
-            }
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.BrandId == BrandId && m.BindingState == 0);
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                query = query.Where(m => m.PosSn == SnNo && m.PosSnType == 0);
-            }
-            Other = new Dictionary<string, object>();
-            if (PageNum == 1)
-            {
-                Other.Add("count", query.Count());
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                int IsLeader = 0;//是否为大盟主机(0-否 1-是)
-                if (subdata.LeaderUserId > 0)
-                {
-                    IsLeader = 1;
-                }
-                else
-                {
-                    IsLeader = 0;
-                }
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("PosSnType", RelationClass.GetPosSnTypeInfo(subdata.PosSnType)); //机具类型
-                curData.Add("Id", subdata.Id); //Id
-                if (subdata.RecycEndDate != null)
-                {
-                    TimeSpan ts = subdata.RecycEndDate.Value - DateTime.Now;
-                    curData.Add("ActDays", ts.TotalDays.ToString("f0")); //活动剩余天数
-                }
-                else
-                { 
-                    curData.Add("ActDays", 0); //活动剩余天数
-                }
-                curData.Add("CreateDate", subdata.CreateDate.Value.ToString("yyyy-MM-dd")); //机具初始日期
-                curData.Add("EndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd")); //截止日期
-                decimal Deposit = 299;
-                if (BrandId == 6)
-                { 
-                    Deposit = 249;
-                }
-                if (!string.IsNullOrEmpty(subdata.PrizeParams))
-                {
-                    Deposit = decimal.Parse(function.CheckNum(subdata.PrizeParams));
-                }
-                curData.Add("Deposit", Deposit);
-                curData.Add("IsLeader",IsLeader);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-已绑定机具列表-设置商户型创客(立刷)
-        [Authorize]
-        public JsonResult SetMerchantMaker(string value)
-        {
-            //TODO: 要做一下判断机具是否是当前操作人本人
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int SnId = int.Parse(function.CheckInt(data["SnId"].ToString()));
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            Users user = maindb.Users.FirstOrDefault(m => m.Id == UserId);
-            if (user != null)
-            {
-                if (user.MerchantType == 1)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "创客" + user.MakerCode + "已是商户型创客,请勿重复设置" });
-                }
-                if (user.AuthFlag != 1)
-                {
-                    return Json(new AppResultJson() { Status = "-1", Info = "创客" + user.MakerCode + "未实名认证" });
-                }
-                bool checkPos = maindb.PosMachinesTwo.Any(m => m.Status > -1 && m.UserId == user.Id);
-                if (checkPos)
-                { 
-                    return Json(new AppResultJson() { Status = "-1", Info = "创客" + user.MakerCode + "已拥有机具" });
-                }
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == SnId);
-                if (pos != null)
-                {
-                    if (!function.CheckNull(user.ParentNav).Contains("," + pos.BuyUserId + ","))
-                    {
-                        return Json(new AppResultJson() { Status = "-1", Info = "创客" + user.MakerCode + "不在您可操作的系统内" });
-                    }
-                    pos.UserId = user.Id;
-                    user.MerchantType = 1;
-                    string MerNo = "";
-                    PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
-                    if (merchant != null)
-                    {
-                        merchant.UserId = user.Id;
-                        merchant.MerUserType = 1;
-                        MerNo = merchant.MerchantName;
-                    }
-                    pos.SeoTitle = user.Id.ToString(); // 记录商户型创客的Id
-                    maindb.SetMerchantTypeRecord.Add(new SetMerchantTypeRecord()
-                    {
-                        CreateDate = DateTime.Now,
-                        IsRecyc = (ulong)pos.IsPurchase,
-                        CreditAmount = pos.CreditTrade,
-                        PosSnType = pos.PosSnType,
-                        ActDate = pos.ActivationTime,
-                        BindDate = pos.BindingTime,
-                        ActStatus = (ulong)pos.ActivationState,
-                        BindStatus = (ulong)pos.BindingState,
-                        MerNo = MerNo,
-                        PosSn = pos.PosSn,
-                        Note = "设置商户型创客",
-                        ToUserId = user.Id,
-                        FromUserId = pos.BuyUserId,
-                    });
-                    maindb.SaveChanges();
-                }
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "" });
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-已绑定机具列表-设置商户型创客(无创客编号)
-        [Authorize]
-        public JsonResult SetMerchantMakerWithoutUser(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            int SnId = int.Parse(function.CheckInt(data["SnId"].ToString()));
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));
-            string path = function.CreateQRCode2(SourceHost + "/p/user-inviteregist-1?Id=" + UserId + "&SnId=" + SnId, function.MD5_16(SnId.ToString()), "/static/MerQrCode/");
-            path = path.Replace("//", "/");
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = SourceHost + path });
-        }
-        #endregion
-
-        #region 首页-客小爽产品-机具管理-整箱划拨搜索
-        [Authorize]
-        public JsonResult WholeSearchByUser(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = WholeSearchByUserDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> WholeSearchByUserDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //所在仓库
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString()));
-            int BrandSubId = int.Parse(function.CheckInt(data["BrandSubId"].ToString()));
-            string SnNo = data["SnNo"].ToString(); //搜索关键词
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            if (string.IsNullOrEmpty(SnNo))
-            { 
-                return dataList;
-            }
-            List<MachineForSnNo> MachineSnNos = maindb.MachineForSnNo.Where(m => m.SnNo.Contains(SnNo)).ToList();
-            List<int> SnIds = MachineSnNos.Select(m => m.SnId).ToList();
-            List<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => SnIds.Contains(m.Id) && m.Status > -1 && m.BuyUserId == UserId && m.BrandId == BrandId && m.BindingState == 0 && m.ActivationState == 0 && m.PreUserId == 0).OrderBy(m => m.PosSn).ToList();
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("ProductType", RelationClass.GetKqProductBrandInfo(subdata.BrandId)); //产品类型
-                int day = 0;
-                if (subdata.RecycEndDate != null)
-                {
-                    TimeSpan ts = subdata.RecycEndDate.Value - DateTime.Now;
-                    day = ts.Days;
-                }
-                curData.Add("ActDays", day);
-                curData.Add("EndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd"));
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-仓库管理-整箱划拨搜索
-        [Authorize]
-        public JsonResult WholeSearch(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = WholeSearchDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> WholeSearchDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //所在仓库
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString()));
-            string SearchKey = data["SearchKey"].ToString(); //搜索关键词
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            if (string.IsNullOrEmpty(SearchKey))
-            { 
-                return dataList;
-            }
-            List<string> SnNos = new List<string>();
-            int start = int.Parse(SearchKey.Substring(SearchKey.Length - 4));
-            for (int i = start; i < start + 100; i++)
-            {
-                string EndNo = i.ToString();
-                for (int j = 0; j < 4 - i.ToString().Length; j++)
-                {
-                    EndNo = "0" + EndNo;
-                }
-                string SnNo = SearchKey.Substring(0, SearchKey.Length - 4) + EndNo;
-                SnNos.Add(SnNo);
-            }
-            List<MachineForSnNo> MachineSnNos = maindb.MachineForSnNo.Where(m => SnNos.Contains(m.SnNo)).ToList();
-            List<int> SnIds = MachineSnNos.Select(m => m.SnId).ToList();
-            List<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => SnIds.Contains(m.Id) && m.Status > -1 && m.StoreId == StoreId && m.BrandId == BrandId && m.UserId == 0 && m.PosSnType == 0 && m.BindingState == 0 && m.ActivationState == 0 && m.PreUserId == 0).OrderBy(m => m.PosSn).ToList();
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("ProductType", RelationClass.GetKqProductBrandInfo(subdata.BrandId)); //产品类型
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-仓库管理-逐台划拨搜索
-        [Authorize]
-        public JsonResult OneSearch(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = OneSearchDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> OneSearchDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //所在仓库
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString()));
-            string SearchKey = data["SearchKey"].ToString(); //搜索关键词
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.StoreId == StoreId && m.BrandId == BrandId && m.UserId == 0 && m.PreUserId == 0).OrderBy(m => m.PosSn).ToList();
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                query = query.Where(m => m.PosSn.EndsWith(SearchKey)).ToList();
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize).ToList();
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize).ToList();
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("ProductType", RelationClass.GetKqProductBrandInfo(subdata.BrandId)); //产品类型
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 110
Areas/Api/Controllers/v1/Pos/PosMachinesTwoController.cs

@@ -1,110 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class PosMachinesTwoController : BaseController
-    {
-        public PosMachinesTwoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-过期机具回收-回收机具列表
-        [Authorize]
-        public JsonResult RecycPos(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = RecycPosDo(value, out Obj);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Obj });
-        }
-        public List<Dictionary<string, object>> RecycPosDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            int RecycStatus = int.Parse(function.CheckInt(data["RecycStatus"].ToString())); //回收状态(0 待回收 1 已回收 2 拒绝 99 待处理)
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //机具所属人
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var time = DateTime.Parse(DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd 00:00:00"));//过期限制时间
-            IQueryable<PosMachinesTwo> query = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BuyUserId == UserId && m.ScanQrTrade == 999 && m.BindingState == 0 && m.ActivationState == 0 && m.RecycEndDate < time);
-            var RecyclableCount = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.ScanQrTrade == 999 && m.BuyUserId == UserId && m.BrandId == BrandId && m.BindingState == 0 && m.ActivationState == 0 && m.RecycEndDate < time && m.RecycStatus == 0).Count();
-            var PendCount = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.ScanQrTrade == 999 && m.BuyUserId == UserId && m.BrandId == BrandId && m.BindingState == 0 && m.ActivationState == 0 && m.RecycEndDate < time && m.RecycStatus == 99).Count();
-            if (!string.IsNullOrEmpty(data["BrandId"].ToString()))
-            {
-                query = query.Where(m => m.BrandId == BrandId);
-            }
-            if (!string.IsNullOrEmpty(data["RecycStatus"].ToString()))
-            {
-                query = query.Where(m => m.RecycStatus == RecycStatus);
-            }
-            query = query.OrderByDescending(m => m.CreateDate).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("PosSn", subdata.PosSn); //SN编号
-                curData.Add("RecycEndDate", subdata.RecycEndDate == null ? "" : subdata.RecycEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //循环截止时间
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("RecyclableCount", RecyclableCount);//可回收数量
-            Obj.Add("PendCount", PendCount);//待处理数量
-            Other = Obj;
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 875
Areas/Api/Controllers/v1/Pos/PosMerchantInfoController.cs

@@ -1,875 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using System.Text.RegularExpressions;
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class PosMerchantInfoController : BaseController
-    {
-        public PosMerchantInfoController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-我的商户-商户资料完善
-        [Authorize]
-        public JsonResult EditInfo(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = EditInfoDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson EditInfoDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerRealName = data["MerRealName"].ToString(); //商户真实姓名
-            string MerIdcardNo = data["MerIdcardNo"].ToString(); //商户身份证号
-            bool check = maindb.PosMerchantInfo.Any(m => m.MerIdcardNo == MerIdcardNo);
-            if (check)
-            {
-                return new AppResultJson() { Status = "-1", Info = "资料已提交,请勿重复操作" };
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            PosMerchantInfo query = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == Id);
-            if (query != null)
-            {
-                string checkMobile = MerchantMobile.Substring(0, 3) + "****" + MerchantMobile.Substring(7);
-                if (checkMobile != query.MerchantMobile)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "手机号不正确,请核实后重试", Data = Obj };
-                }
-                query.MerchantMobile = MerchantMobile; //商户手机号
-                query.MerRealName = MerRealName; //商户真实姓名
-                query.MerIdcardNo = MerIdcardNo; //商户身份证号
-                query.SeoTitle = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-
-                maindb.PosMerchantOtherInfo.Add(new PosMerchantOtherInfo()
-                {
-                    CertId = MerIdcardNo,
-                    MerchantId = query.Id,
-                    RealName = MerRealName,
-                    MerNo = query.MerchantNo,
-                    BrandId = query.BrandId,
-                });
-                maindb.SaveChanges();
-            }
-            Obj.Add("Id", query.Id); //Id
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-        #region 通用-通过商户编号查询商户信息
-        [Authorize]
-        public JsonResult QueryMerchantInfo(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = QueryMerchantInfoDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> QueryMerchantInfoDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantNo = data["MerchantNo"].ToString(); //商户编号
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerchantNo) ?? new PosMerchantInfo();
-            bool checkPos = maindb.PosMachinesTwo.Any(m => m.Status > -1 && m.BindMerchantId == merchant.Id);
-            PosMachinesTwo pos = new PosMachinesTwo();
-            if (checkPos)
-            {
-                pos = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BindMerchantId == merchant.Id).OrderByDescending(m => m.SeoKeyword).FirstOrDefault() ?? new PosMachinesTwo();
-            }
-            Obj.Add("userName", merchant.MerRealName); //商户名称
-            Obj.Add("tel", merchant.MerchantMobile); //商户手机号
-            // Obj.Add("SN", ""); //机具SN号
-            Obj.Add("type", RelationClass.GetKqProductBrandInfo(merchant.BrandId)); //品牌名称
-            if (pos.ActivationState == 1)
-            {
-                Obj.Add("createTime", pos.ActivationTime == null ? "" : pos.ActivationTime.Value.ToString("yyyy-MM-dd")); //创建时间
-            }
-            else
-            {
-                Obj.Add("createTime", "未激活");
-            }
-            Obj.Add("totalTurnover", pos.CreditTrade.ToString("f2")); //累计交易额
-            Obj.Add("mounthTurnover", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(merchant.Id, DateTime.Now.ToString("yyyyMM"))); //本月交易额
-            decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-            if (pos.BrandId != 2 && pos.BrandId != 7)
-            {
-                deposit = deposit / 100;
-            }
-            Obj.Add("deposit", deposit.ToString("f2")); //押金金额
-            Obj.Add("policy", "押99返100,押199返200,押299返300"); //返押政策
-            bool status = maindb.ActiveReward.Any(m => m.KqSnNo == pos.PosSn);
-            Obj.Add("status", status ? "未返" : "已返"); //返押金状态
-            if (status)
-            {
-                Obj.Add("reason", ""); //返回失败原因
-            }
-            else
-            {
-                string reason = "";
-                if (string.IsNullOrEmpty(pos.SeoKeyword))
-                {
-                    reason = "处理中";
-                }
-                else if (pos.CreditTrade < 1000)
-                {
-                    reason = "贷记卡交易未满1000";
-                }
-                Obj.Add("reason", reason);
-            }
-            return Obj;
-        }
-        #endregion
-
-
-        #region 通用-通过商户编号查询商户信息-2
-        [Authorize]
-        public JsonResult QueryMerchantInfo2(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = QueryMerchantInfo2Do(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> QueryMerchantInfo2Do(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantNo = data["MerchantNo"].ToString(); //商户编号
-            string MerchantName = data["MerchantName"].ToString(); //商户名称
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerchantCertId = data["MerchantCertId"].ToString(); //商户身份证号
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerchantNo);
-            if (merchant == null)
-            {
-                return Obj;
-            }
-            bool CheckCertId = maindb.PosMerchantOtherInfo.Any(m => m.CertId == MerchantCertId);
-            if (function.CheckNull(merchant.MerchantMobile).Contains("****") && !CheckCertId)
-            {
-                merchant.MerRealName = MerchantName;
-                merchant.MerchantMobile = MerchantMobile;
-                merchant.MerIdcardNo = MerchantCertId;
-                PosMerchantOtherInfo other = maindb.PosMerchantOtherInfo.FirstOrDefault(m => m.CertId == MerchantCertId);
-                if (other == null)
-                {
-                    maindb.PosMerchantOtherInfo.Add(new PosMerchantOtherInfo()
-                    {
-                        CertId = MerchantCertId,
-                        MerchantId = merchant.Id,
-                        RealName = MerchantName,
-                        MerNo = MerchantNo,
-                        BrandId = merchant.BrandId,
-                    });
-                }
-                else
-                {
-                    other.MerchantId = merchant.Id;
-                    other.RealName = MerchantName;
-                    other.MerNo = MerchantNo;
-                    other.BrandId = merchant.BrandId;
-                }
-                maindb.SaveChanges();
-            }
-            bool checkPos = maindb.PosMachinesTwo.Any(m => m.Status > -1 && m.BindMerchantId == merchant.Id);
-            PosMachinesTwo pos = new PosMachinesTwo();
-            if (checkPos)
-            {
-                pos = maindb.PosMachinesTwo.Where(m => m.Status > -1 && m.BindMerchantId == merchant.Id).OrderByDescending(m => m.SeoKeyword).FirstOrDefault() ?? new PosMachinesTwo();
-            }
-            Obj.Add("userName", merchant.MerRealName); //商户名称
-            Obj.Add("tel", merchant.MerchantMobile); //商户手机号
-            // Obj.Add("SN", ""); //机具SN号
-            Obj.Add("type", RelationClass.GetKqProductBrandInfo(merchant.BrandId)); //品牌名称
-            if (pos.ActivationState == 1)
-            {
-                Obj.Add("createTime", pos.ActivationTime == null ? "" : pos.ActivationTime.Value.ToString("yyyy-MM-dd")); //创建时间
-            }
-            else
-            {
-                Obj.Add("createTime", "未激活");
-            }
-            Obj.Add("totalTurnover", pos.CreditTrade.ToString("f2")); //累计交易额
-            Obj.Add("mounthTurnover", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(merchant.Id, DateTime.Now.ToString("yyyyMM"))); //本月交易额
-            decimal deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-            if (pos.BrandId != 2 && pos.BrandId != 7)
-            {
-                deposit = deposit / 100;
-            }
-            Obj.Add("deposit", deposit.ToString("f2")); //押金金额
-            Obj.Add("policy", "押99返100,押199返200,押299返300"); //返押政策
-            bool status = maindb.ActiveReward.Any(m => m.KqSnNo == pos.PosSn);
-            Obj.Add("status", status ? "未返" : "已返"); //返押金状态
-            if (status)
-            {
-                Obj.Add("reason", ""); //返回失败原因
-            }
-            else
-            {
-                string reason = "";
-                if (string.IsNullOrEmpty(pos.SeoKeyword))
-                {
-                    reason = "处理中";
-                }
-                else if (pos.CreditTrade < 1000)
-                {
-                    reason = "贷记卡交易未满1000";
-                }
-                Obj.Add("reason", reason);
-            }
-            return Obj;
-        }
-        #endregion
-
-
-        #region 通用-匹配满足商户的列表
-        [Authorize]
-        public JsonResult CheckMerchants(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantName = data["MerchantName"].ToString(); //商户名称
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerchantCertId = data["MerchantCertId"].ToString(); //商户身份证号
-            string MobileCode = data["MobileCode"].ToString(); //短信验证码
-            if (string.IsNullOrEmpty(MerchantMobile))
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "请填写手机号" });
-            }
-            if (MerchantMobile.Length > 11)
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "手机号最多11个字符" });
-            }
-            if (function.CheckMobile(MerchantMobile) == "")
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "请填写正确的手机号" });
-            }
-            MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + MerchantMobile);
-            if (mobilecheck == null)
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "短信验证码不正确" });
-            }
-            if (mobilecheck.CheckCode != MobileCode)
-            {
-                return Json(new AppResultJson() { Status = "-1", Info = "短信验证码不正确" });
-            }
-            RedisDbconn.Instance.Clear("MobileCodeCheck:" + MerchantMobile);
-            string CheckMobile = MerchantMobile.Substring(0, 3) + "****" + MerchantMobile.Substring(7);
-            List<PosMerchantInfo> merchants = maindb.PosMerchantInfo.Where(m => m.MerIdcardNo == MerchantCertId).ToList();
-            if (merchants.Count == 0)
-            {
-                merchants = maindb.PosMerchantInfo.Where(m => m.MerchantMobile == CheckMobile && m.MerchantName.Contains(MerchantName)).ToList();
-            }
-            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
-            foreach (PosMerchantInfo sub in merchants)
-            {
-                Dictionary<string, object> item = new Dictionary<string, object>();
-                item.Add("Id", sub.Id);
-                item.Add("MerchantName", sub.MerchantName);
-                item.Add("MerchantCode", sub.KqMerNo);
-                item.Add("ProductName", RelationClass.GetKqProductBrandInfo(sub.BrandId));
-                list.Add(item);
-            }
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = list });
-        }
-        #endregion
-
-
-        #region 通用-检查商户是否存在
-        [Authorize]
-        public JsonResult CheckMerchantInfo(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerRealName = data["MerRealName"].ToString(); //商户真实姓名
-            string MerIdcardNo = data["MerIdcardNo"].ToString(); //商户身份证号
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            bool Exist = maindb.PosMerchantInfo.Any(m => m.MerIdcardNo == MerIdcardNo);
-            Obj.Add("Exist", Exist ? 1 : 0);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        #endregion
-
-
-        #region 创客-首页-押金查询登录
-        [Authorize]
-        public JsonResult MerchantLogin(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = MerchantLoginDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson MerchantLoginDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MobileCode = data["MobileCode"].ToString(); //短信验证码
-            if (MerchantMobile.Length != 11 || !function.IsInt(MerchantMobile) || MerchantMobile.Substring(0, 1) != "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "手机号不正确" };
-            }
-            MobileCodeCheck mobilecheck = RedisDbconn.Instance.Get<MobileCodeCheck>("MobileCodeCheck:" + MerchantMobile);
-            if (mobilecheck == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            if (mobilecheck.CheckCode != MobileCode)
-            {
-                return new AppResultJson() { Status = "-1", Info = "短信验证码不正确" };
-            }
-            RedisDbconn.Instance.Clear("MobileCodeCheck:" + MerchantMobile);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var AuthFlag = 0;
-            var check = maindb.UserFamilyMember.Any(m => m.Mobile == MerchantMobile);
-            if (check)
-            {
-                var info = maindb.UserFamilyMember.FirstOrDefault(m => m.Mobile == MerchantMobile) ?? new UserFamilyMember();
-                Obj.Add("AuthFlag", info.Status);
-                Obj.Add("MerRealName", info.Name);
-                Obj.Add("MerIdcardNo", info.IdCardNo);
-            }
-            else
-            {
-                var query = maindb.UserFamilyMember.Add(new UserFamilyMember()
-                {
-                    CreateDate = DateTime.Now,
-                    Mobile = MerchantMobile,
-                }).Entity;
-                maindb.SaveChanges();
-                Obj.Add("AuthFlag", AuthFlag);
-            }
-
-            return new AppResultJson() { Status = "1", Info = "登录成功", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-押金查询认证
-        [Authorize]
-        public JsonResult MerchantAuth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = MerchantAuthDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson MerchantAuthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerRealName = data["MerRealName"].ToString(); //商户真实姓名
-            string MerIdcardNo = data["MerIdcardNo"].ToString(); //商户身份证号
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string result = IdCardCheckForThree.Instance.Do(MerchantMobile, MerIdcardNo, MerRealName);
-            JsonData jsonObj = JsonMapper.ToObject(result);
-            if (jsonObj["result_code"].ToString() == "0")
-            {
-                if (jsonObj["state"].ToString() == "1")
-                {
-                    var check = maindb.UserFamilyMember.Any(m => m.IdCardNo == MerIdcardNo);
-                    if (check)
-                    {
-                        return new AppResultJson() { Status = "-1", Info = "该身份证已认证", Data = Obj };
-                    }
-                    else
-                    {
-                        var info = maindb.UserFamilyMember.FirstOrDefault(m => m.Mobile == MerchantMobile) ?? new UserFamilyMember();
-                        info.Status = 1;
-                        info.UpdateDate = DateTime.Now;
-                        info.Name = MerRealName;
-                        info.IdCardNo = MerIdcardNo;
-                        maindb.SaveChanges();
-                        var idCard1 = MerIdcardNo.Substring(0, 6);
-                        var idCard2 = MerIdcardNo.Substring(MerIdcardNo.Length - 4, 4);
-                        var posMerchantInfoList = maindb.PosMerchantInfo.Where(m => m.MerIdcardNo.StartsWith(idCard1) && m.MerIdcardNo.EndsWith(idCard2) && m.MerchantName.Contains(MerRealName)).ToList();
-                        foreach (var item in posMerchantInfoList)
-                        {
-                            var posMer = posMerchantInfoList.FirstOrDefault(m => m.Id == item.Id) ?? new PosMerchantInfo();
-                            posMer.MerchantMobile = MerchantMobile;
-                            posMer.MerRealName = MerRealName;
-                            posMer.MerIdcardNo = MerIdcardNo;
-                            maindb.SaveChanges();
-                        }
-                    }
-                }
-                else
-                {
-                    return new AppResultJson() { Status = "-1", Info = jsonObj["result_message"].ToString(), Data = Obj };
-                }
-            }
-
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-押金查询详情列表
-        [Authorize]
-        public JsonResult MerchantDepositList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<MerchantDepositList> dataList = MerchantDepositListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<MerchantDepositList> MerchantDepositListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerRealName = data["MerRealName"].ToString(); //商户真实姓名
-            string MerIdcardNo = data["MerIdcardNo"].ToString(); //商户身份证号
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<MerchantDepositList> merchantDepositLists = new List<MerchantDepositList>();
-            PosMerchantInfo firstPos = maindb.PosMerchantInfo.FirstOrDefault(m => m.MerIdcardNo == MerIdcardNo && m.MerchantName.Contains(MerRealName) && m.StandardStatus == 1);
-            if (firstPos != null)
-            {
-                merchantDepositLists.Add(PosItem(firstPos));
-            }
-            IQueryable<PosMerchantInfo> query = maindb.PosMerchantInfo.Where(m => m.MerIdcardNo == MerIdcardNo && m.MerchantName.Contains(MerRealName) && m.StandardStatus != 1).OrderBy(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var subdata in query.ToList())
-            {
-                merchantDepositLists.Add(PosItem(subdata));
-            }
-            if (firstPos == null)
-            {
-                merchantDepositLists = merchantDepositLists.OrderBy(m => m.CreateDate).ToList();
-            }
-            return merchantDepositLists;
-        }
-        private MerchantDepositList PosItem(PosMerchantInfo subdata)
-        {
-            MerchantDepositList merchantDepositList = new MerchantDepositList();
-            MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == subdata.KqSnNo) ?? new MachineForSnNo();
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
-            var depositRreturn = maindb.MerchantDepositReturns.FirstOrDefault(m => m.MerchantId == subdata.Id) ?? new MerchantDepositReturns();
-            decimal DepositMoney = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-            if (pos.BrandId != 2 && pos.BrandId != 7)
-            {
-                DepositMoney = DepositMoney / 100;
-            }
-            //人工已退
-            if (subdata.StandardStatus == -2)
-            {
-                merchantDepositList.Status = -2;
-            }
-            else
-            {
-                // 未达标
-                if (subdata.StandardMonths < 10)
-                {
-                    merchantDepositList.Status = 0;
-                }
-                //已达标
-                if (subdata.StandardMonths == 10)
-                {
-                    merchantDepositList.Status = 4;
-                }
-                //达标失败
-                if (subdata.StandardMonths >= 0 && subdata.StandardStatus == -1)
-                {
-                    merchantDepositList.Status = -1;
-                }
-                //已返还
-                if (subdata.StandardStatus == 1)
-                {
-                    merchantDepositList.Status = 1;
-                }
-                //领取达标奖
-                if (subdata.StandardStatus == 101)
-                {
-                    merchantDepositList.Status = 101;
-                }
-            }
-
-            merchantDepositList.MerchantId = subdata.Id;
-            merchantDepositList.MerRealName = subdata.MerRealName;
-            merchantDepositList.KqSnNo = subdata.KqSnNo;
-            merchantDepositList.BrandId = RelationClass.GetKqProductBrandInfo(subdata.BrandId);
-            merchantDepositList.CreateDate = Convert.ToDateTime(pos.BindingTime);
-            merchantDepositList.DepositMoney = DepositMoney;
-            merchantDepositList.Months = subdata.StandardMonths;
-            merchantDepositList.TradeAmtForMonth = PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(subdata.Id, DateTime.Now.ToString("yyyyMM"));
-            return merchantDepositList;
-        }
-        #endregion
-
-
-        #region 创客-首页-押金查询详情添加
-        [Authorize]
-        public JsonResult CheckDeposit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = CheckDepositDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson CheckDepositDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantMobile = data["MerchantMobile"].ToString(); //商户手机号
-            string MerRealName = data["MerRealName"].ToString(); //商户真实姓名
-            string MerIdcardNo = data["MerIdcardNo"].ToString(); //商户身份证号
-            string KqSnNo = data["KqSnNo"].ToString(); //渠道SN号
-            if (string.IsNullOrEmpty(MerchantMobile))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写商户手机号" };
-            }
-            if (MerchantMobile.Length != 11 || !function.IsInt(MerchantMobile) || MerchantMobile.Substring(0, 1) != "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "商户手机号不正确" };
-            }
-            if (string.IsNullOrEmpty(MerRealName))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写商户真实姓名" };
-            }
-            if (string.IsNullOrEmpty(MerIdcardNo))
-            {
-                return new AppResultJson() { Status = "-1", Info = "请填写商户身份证号" };
-            }
-            if (MerIdcardNo.Length != 18 || !function.IsInt(MerIdcardNo.Substring(0, 17)))
-            {
-                return new AppResultJson() { Status = "-1", Info = "商户身份证号不正确" };
-            }
-            MerIdcardNo = MerIdcardNo.ToUpper();
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == KqSnNo);
-            if (forSnNo == null)
-            {
-                return new AppResultJson() { Status = "-1", Info = "机具号不存在" };
-            }
-            //判断机具是否属于该商户
-            var mobile1 = MerchantMobile.Substring(0, 3);
-            var mobile2 = MerchantMobile.Substring(MerchantMobile.Length - 4, 4);
-            var idCard1 = MerIdcardNo.Substring(0, 6);
-            var idCard2 = MerIdcardNo.Substring(MerIdcardNo.Length - 4, 4);
-            var idCard11 = MerIdcardNo.Substring(0, 4);
-            var idCard22 = MerIdcardNo.Substring(MerIdcardNo.Length - 3, 3);
-            var idCard23 = MerIdcardNo.Substring(MerIdcardNo.Length - 2, 2);
-            var checks = maindb.PosMerchantInfo.FirstOrDefault(m => m.KqSnNo == KqSnNo) ?? new PosMerchantInfo();
-            PosMerchantInfo posMerchant = new PosMerchantInfo();
-            if (!string.IsNullOrEmpty(checks.MerIdcardNo))
-            {
-                posMerchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.KqSnNo == KqSnNo && ((m.MerIdcardNo.StartsWith(idCard1) && m.MerIdcardNo.ToUpper().EndsWith(idCard2)) || (m.MerIdcardNo.StartsWith(idCard11) && m.MerIdcardNo.ToUpper().EndsWith(idCard22)) || (m.MerIdcardNo.StartsWith(idCard11) && m.MerIdcardNo.ToUpper().EndsWith(idCard23))) && (m.MerchantName.Contains(MerRealName) || m.MerchantName == MerRealName || m.MerchantName.StartsWith(MerRealName.Substring(0, 1)))) ?? new PosMerchantInfo();
-            }
-            else
-            {
-                posMerchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.KqSnNo == KqSnNo && m.MerchantMobile.StartsWith(mobile1) && m.MerchantMobile.EndsWith(mobile2) && m.MerchantName.Contains(MerRealName)) ?? new PosMerchantInfo();
-            }
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forSnNo.SnId && m.BindMerchantId == posMerchant.Id) ?? new PosMachinesTwo();
-            if (pos.Id == 0)
-            {
-                return new AppResultJson() { Status = "-1", Info = "该机具不在您的名下或不存在" };
-            }
-            if (pos.ActivationState == 0)
-            {
-                return new AppResultJson() { Status = "-1", Info = "机具未激活" };
-            }
-            if ((!function.CheckNull(posMerchant.MerIdcardNo).Contains("*") || !function.CheckNull(posMerchant.MerchantMobile).Contains("*")) && !string.IsNullOrEmpty(posMerchant.MerIdcardNo) && pos.BrandId != 6)
-            {
-                return new AppResultJson() { Status = "-1", Info = "该机具已添加" };
-            }
-            if (!function.CheckNull(posMerchant.MerIdcardNo).Contains("*") && !string.IsNullOrEmpty(posMerchant.MerIdcardNo) && pos.BrandId == 6)
-            {
-                return new AppResultJson() { Status = "-1", Info = "该机具已添加" };
-            }
-            int IsFirst = 1;
-            bool check = maindb.PosMerchantInfo.Any(m => m.MerIdcardNo == MerIdcardNo);
-            if (check)
-            {
-                IsFirst = 0;
-            }
-            PosMerchantInfo query = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
-            if (query != null)
-            {
-                query.UpdateDate = DateTime.Now; //修改时间
-                query.MerchantMobile = MerchantMobile; //商户手机号
-                query.MerRealName = MerRealName; //商户真实姓名
-                query.MerIdcardNo = MerIdcardNo; //商户身份证号
-                query.Sort = IsFirst;
-                maindb.SaveChanges();
-                return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-            }
-            return new AppResultJson() { Status = "-1", Info = "查无此商户", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-押金查询-商户详情
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString()));
-            PosMerchantInfo query = PosMerchantInfoDbconn.Instance.Get(MerchantId) ?? new PosMerchantInfo();
-            MachineForMerNo forMerNo = maindb.MachineForMerNo.FirstOrDefault(m => m.MerNo == query.KqMerNo) ?? new MachineForMerNo();
-            Obj.Add("MerRealName", query.MerRealName); //商户真实姓名
-            Obj.Add("KqSnNo", query.KqSnNo); //渠道SN号
-            Obj.Add("KqSnId", forMerNo.SnId); //机具Id
-            Obj.Add("ProductType", RelationClass.GetKqProductBrandInfo(query.BrandId)); //来源产品
-            Obj.Add("TradeTotal", PosMerchantTradeSummaryDbconn.Instance.GetTrade(query.Id)); //总交易额
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-押金查询-商户详情-交易统计
-        [Authorize]
-        public JsonResult MerchantTradeList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = MerchantTradeListDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> MerchantTradeListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int MerchantId = int.Parse(data["MerchantId"].ToString()); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var query = maindb.PosMerchantTradeSummay.Where(m => m.MerchantId == MerchantId && m.TradeMonth == TradeMonth);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            foreach (var DateString in query.ToList())
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeDate", DateString.TradeDate); //交易日
-                curData.Add("TradeAmt", DateString.TradeAmount); //交易额
-                dataList.Add(curData);
-            }
-            Other = new Dictionary<string, object>();
-            Other.Add("MonthTradeAmt", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(MerchantId, TradeMonth));
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-押金查询-详情
-        [Authorize]
-        public JsonResult DepositMerchantList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = DepositMerchantListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> DepositMerchantListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerIdcardNo = data["MerIdcardNo"].ToString(); //商户身份证号
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<PosMerchantInfo> query = maindb.PosMerchantInfo.Where(m => m.MerIdcardNo == MerIdcardNo).OrderBy(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            int index = 0;
-            foreach (var subdata in query.ToList())
-            {
-                index += 1;
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Id", subdata.Id);
-                curData.Add("MerRealName", subdata.MerRealName); //商户真实姓名
-                curData.Add("KqSnNo", subdata.KqSnNo); //渠道SN号
-                curData.Add("BrandId", RelationClass.GetKqProductBrandInfo(subdata.BrandId)); //品牌
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                MachineForSnNo forSnNo = maindb.MachineForSnNo.FirstOrDefault(m => m.SnNo == subdata.KqSnNo) ?? new MachineForSnNo();
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
-                decimal DepositMoney = decimal.Parse(function.CheckNum(pos.SeoKeyword));
-                if (pos.BrandId != 2 && pos.BrandId != 7)
-                {
-                    DepositMoney = DepositMoney / 100;
-                }
-                curData.Add("DepositMoney", DepositMoney.ToString("f2")); //押金金额
-                int Months = 0;
-                int Status = 0;
-                string MonthString = "";
-                if (pos.BindingState == 1)
-                {
-                    DateTime start = DateTime.Parse(subdata.CreateDate.Value.AddMonths(1).ToString("yyyy-MM") + "-01 00:00:00");
-                    DateTime end = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00");
-                    while (start <= end)
-                    {
-                        decimal checkTrade = PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(subdata.Id, start.ToString("yyyyMM"));
-                        if (checkTrade >= 10000)
-                        {
-                            Months += 1;
-                            start = start.AddMonths(1);
-                            Status = 1;
-                        }
-                        else
-                        {
-                            if (start.ToString("yyyy-MM") != DateTime.Now.ToString("yyyy-MM"))
-                            {
-                                Months = start.Month;
-                                MonthString = start.ToString("yyyy-MM");
-                                start = end.AddSeconds(1);
-                                Status = 5;
-                            }
-                            else
-                            {
-                                start = start.AddMonths(1);
-                            }
-                        }
-                    }
-                }
-                curData.Add("Status", Status); //返押状态
-                if (Status == 5)
-                {
-                    curData.Add("Months", MonthString); //未达标月
-                }
-                else
-                {
-                    curData.Add("Months", Months); //连续达标月数
-                }
-                curData.Add("TradeAmtForMonth", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(subdata.Id, DateTime.Now.ToString("yyyyMM"))); //本月交易额
-                curData.Add("DepositStatus", 0); //返押状态
-                curData.Add("MerType", index == 1 ? 1 : 0); //机具类型
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-押金查询-退押金-确认信息
-        [Authorize]
-        public JsonResult ReturnDepositForConfirm(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ReturnDepositForConfirmDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ReturnDepositForConfirmDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            PosMerchantInfo query = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == Id) ?? new PosMerchantInfo();
-            Obj.Add("MerchantMobile", query.MerchantMobile); //商户手机号
-            Obj.Add("MerRealName", query.MerRealName); //商户真实姓名
-            Obj.Add("MerIdcardNo", query.MerIdcardNo); //商户身份证号
-            return Obj;
-        }
-        #endregion
-
-        #region 通过机具Id查询机具号和商户名称
-        [Authorize]
-        public JsonResult SearchInfo(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = SearchInfoDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> SearchInfoDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int SnId = int.Parse(function.CheckInt(data["SnId"].ToString()));
-            int IsOk = 0;
-            PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnId) ?? new PosMachinesTwo();
-            if (pos.BuyUserId != pos.UserId)
-            {
-                IsOk = 1;
-            }
-            PosMerchantInfo query = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
-            string Name = Regex.Replace(function.CheckNull(query.MerchantName), "[0-9][a-zA-Z]", "");
-            Obj.Add("IsOk", IsOk); //是否商户型创客
-            Obj.Add("PosSn", pos.PosSn); //机具号
-            Obj.Add("MerchantName", Name); //商户名称
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 705
Areas/Api/Controllers/v1/Pos/PreSendStockDetailController.cs

@@ -1,705 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class PreSendStockDetailController : BaseController
-    {
-        public PreSendStockDetailController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-首页-客小爽产品-机具管理-机具申请-预发机列表
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            // var date = DateTime.Now.AddDays(-30);
-            IQueryable<PreSendStockDetail> query = maindb.PreSendStockDetail.Where(m => m.ToUserId == ToUserId && m.Status == 1 && m.ApplyFlag == 0);
-            if (!string.IsNullOrEmpty(data["BrandId"].ToString()))
-            {
-                query = query.Where(m => m.BrandId == BrandId);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                var CreateDate = Convert.ToDateTime(subdata.CreateDate).ToString("yyyy/MM/dd hh:mm:ss");
-                PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == subdata.SnId) ?? new PosMachinesTwo();
-                // var TimeOut = 0;
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                // if (subdata.CreateDate <= date && subdata.AuthFlag == 1)
-                // {
-                //     TimeOut = 1;
-                //     curData.Add("TimeOut", TimeOut); //是否超时
-                // }
-                // else
-                // {
-                //     curData.Add("TimeOut", TimeOut); //是否超时
-                // }
-                curData.Add("SnId", subdata.SnId); //机具Id
-                curData.Add("SnNo", subdata.SnNo); //机具SN编号
-                curData.Add("Id", subdata.Id); //ID
-                curData.Add("FromStoreId", subdata.FromStoreId); //出货仓库Id
-                StoreHouse StoreHouseData = maindb.StoreHouse.FirstOrDefault(m => m.Id == subdata.FromStoreId) ?? new StoreHouse();
-                curData.Add("StoreName", StoreHouseData.StoreName); //出货仓库名称
-                curData.Add("isGrant", subdata.AuthFlag); //占用小分仓额度标记
-                curData.Add("CreateDate", CreateDate); //是否超时
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-小分仓-撤回
-        [Authorize]
-        public JsonResult Cancel(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = CancelDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson CancelDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            PreSendStockDetail query = new PreSendStockDetail();
-            int SnId = int.Parse(function.CheckInt(data["SnId"].ToString()));//记录Id
-            RedisDbconn.Instance.GetLock("CheckCancelPos:" + UserId + ":" + function.MD5_16(SnId.ToString()));
-            query = maindb.PreSendStockDetail.FirstOrDefault(m => m.FromUserId == UserId && m.Id == SnId);
-            var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-            var tuserAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == query.ToUserId) ?? new UserAccount();
-            KqProducts kqProducts = maindb.KqProducts.FirstOrDefault(m => m.Id == query.BrandId);
-            var date = DateTime.Now.AddDays(-30);
-            var amount = 0;
-            if (query != null)
-            {
-                PosMachinesTwo posMachinesTwo = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == query.SnId) ?? new PosMachinesTwo();
-                StoreHouse storeHouse = maindb.StoreHouse.FirstOrDefault(m => m.Id == query.FromStoreId) ?? new StoreHouse();
-                PosMachinesTwo pm = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == query.SnId);
-                var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == posMachinesTwo.BrandId);
-                if (brandInfo.Name.Contains("电签"))
-                {
-                    amount = 200;
-                }
-                if (brandInfo.Name.Contains("大POS"))
-                {
-                    amount = 300;
-                }
-                if (pm != null)
-                {
-                    if (pm.BindingState == 1)
-                    {
-                        return new AppResultJson() { Status = "-1", Info = "机具已绑定,不可撤回!请创客申请机具后补录!" };
-                    }
-                    SmallStoreHouse smallStoreHouse = maindb.SmallStoreHouse.FirstOrDefault(m => m.UserId == query.ToUserId);
-                    posMachinesTwo.PreUserId = 0;
-                    query.UpdateDate = DateTime.Now;
-                    query.Status = -1;
-                    query.CancelFlag = 1;
-                    storeHouse.LaveNum += 1;
-
-                    // //增加分仓所关联运营中心的总机具数
-                    // if (storeHouse.OpId > 0)
-                    // {
-                    //     var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == storeHouse.OpId) ?? new OpModels.SysAdmin();
-                    //     if (sysAdmin.Id > 0)
-                    //     {
-                    //         sysAdmin.TotalMachineCount += 1;
-                    //         opdb.SaveChanges();
-                    //     }
-                    // }
-                    smallStoreHouse.UpdateDate = DateTime.Now;
-                    smallStoreHouse.LaveNum += 1;
-                    smallStoreHouse.TotalNum -= 1;
-                    if (query.CreateDate <= date)
-                    {
-                        //撤回占用小分仓额度的增加接收创客的小分仓可用额度
-                        if (query.AuthFlag == 1 && tuserAccount.SmallStoreDeposit >= amount)
-                        {
-                            userAccount.ValidAmount -= amount;//扣减分仓可用额度
-                            tuserAccount.SmallStoreDeposit -= amount;
-                            tuserAccount.ValidPreAmount += amount;//增加小分仓可用额度
-                            var add = maindb.UserAccountRecord.Add(new UserAccountRecord()
-                            {
-                                CreateDate = DateTime.Now,
-                                Remark = "小分仓押金退还",
-                                ChangeType = 66,
-                                BeforeBalanceAmount = userAccount.SmallStoreDeposit + amount, //变更前小分仓押金
-                                AfterBalanceAmount = userAccount.SmallStoreDeposit, //变更后小分仓押金
-                                ChangeAmount = amount,//变动金额
-                                UserId = tuserAccount.Id,
-                            }).Entity;
-                            maindb.SaveChanges();
-                        }
-                    }
-                    else
-                    {
-                        //撤回占用小分仓额度的增加接收创客的小分仓可用额度
-                        if (query.AuthFlag == 1)
-                        {
-                            tuserAccount.ValidPreAmount += amount;//增加小分仓可用额度
-                            userAccount.ValidAmount -= amount;//扣减分仓可用额度
-                        }
-                    }
-                    string text = string.Format("创客-首页-仓库管理-小分仓-撤回,UserId: '" + UserId + "',ToUserId: '" + smallStoreHouse.UserId + "',LaveNum:'" + smallStoreHouse.LaveNum + "',TotalNum:'" + smallStoreHouse.TotalNum + "',ChangeCount:'" + 1 + "',Time'" + DateTime.Now + "'");
-                    function.WriteLog(text, "smallstorehouse");//小分仓记录日志
-                    if (smallStoreHouse.LaveNum > 10 || smallStoreHouse.TotalNum < 0)
-                    {
-                        RedisDbconn.Instance.ReleaseLock("CheckCancelPos:" + UserId + ":" + function.MD5_16(SnId.ToString()));
-                        return new AppResultJson() { Status = "-1", Info = "*库存已重置,不可撤回!", Data = Obj };
-                    }
-                    maindb.SaveChanges();
-                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                    {
-                        UserId = query.ToUserId, //收货创客
-                        Title = "预发机撤回通知", //标题
-                        Content = "<div class='f16'>您的预发机 SN:<br/>" + query.SnNo + "<br/>已被" + storeHouse.StoreName + " 撤回!</div>", //内容
-                        Summary = "您的预发机: " + kqProducts.Name + "  sn:" + query.SnNo + "已被 " + storeHouse.StoreName + " 撤回!",
-                        CreateDate = DateTime.Now,
-
-                    }));
-
-                    var toUser = maindb.Users.FirstOrDefault(m => m.Id == query.ToUserId);
-                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                    {
-                        UserId = query.FromUserId, //收货创客
-                        Title = "预发机撤回通知", //标题
-                        Content = "<div class='f16'>已撤回创客:" + toUser.MakerCode + " " + toUser.RealName + " 的预发机 SN:<br/>" + query.SnNo + "</div>", //内容
-                        Summary = "已撤回创客:" + toUser.MakerCode + " " + toUser.RealName + " 的预发机 SN:" + query.SnNo + "",
-                        CreateDate = DateTime.Now,
-
-                    }));
-                }
-                RedisDbconn.Instance.ReleaseLock("CheckCancelPos:" + UserId + ":" + function.MD5_16(SnId.ToString()));
-            }
-            return new AppResultJson() { Status = "1", Info = "撤回成功", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-小分仓-确认发货
-        [Authorize]
-        public JsonResult Send(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = SendDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson SendDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //发货人Id
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人Id
-            int FromStoreId = int.Parse(function.CheckInt(data["FromStoreId"].ToString())); //出货仓库Id
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型Id
-            string SnIds = data["SnIds"].ToString(); //机具Id
-
-            // Users user = maindb.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();
-            // if (!user.ParentNav.Contains("," + UserId + ","))
-            // {
-            //     return new AppResultJson() { Status = "-1", Info = "收货创客不在您的操作权限内,请检查收货创客编号是否正确" };
-            // }
-
-            if (ToUserId <= 0)
-            {
-                return new AppResultJson() { Status = "-1", Info = "收货创客不存在,请检查收货创客编号是否正确" };
-            }
-
-            //分割SN
-            string[] strids = SnIds.Split(',');
-            var count = strids.ToList().Count();
-
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<PreSendStockDetail> LPD = new List<PreSendStockDetail>();
-            SmallStoreHouse smallStoreHouse = maindb.SmallStoreHouse.FirstOrDefault(m => m.UserId == ToUserId);
-
-            //判断是否符合预发货规范(总库存数<=10)
-            if (smallStoreHouse.LaveNum > 0 && smallStoreHouse.TotalNum < 10)
-            {
-                if (smallStoreHouse.LaveNum - count < 0 || smallStoreHouse.TotalNum + count > 10)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "*发货失败,发货后该创客预发机超过10台" };
-                }
-
-                //循环添加到数据库
-                foreach (var item in strids)
-                {
-                    PreSendStockDetail preSendStockDetail = maindb.PreSendStockDetail.FirstOrDefault(m => m.FromUserId == UserId && m.Status >= 0 && m.Status <= 1 && m.SnId == Convert.ToInt32(item));
-                    if (preSendStockDetail != null)
-                    {
-                        return new AppResultJson() { Status = "-1", Info = "*发货失败,请勿重复提交" };
-                    }
-                    PreSendStockDetail pd = new PreSendStockDetail();
-                    PosMachinesTwo posMachinesTwo = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == Convert.ToInt32(item));
-                    posMachinesTwo.PreUserId = ToUserId;
-                    pd.CreateDate = DateTime.Now; //创建时间
-                    pd.FromUserId = UserId;//发货人Id
-                    pd.ToUserId = ToUserId; //收货人Id
-                    pd.SourceStoreId = 0; //源仓库Id
-                    pd.BrandId = BrandId; //产品类型Id
-                    pd.SnNo = posMachinesTwo.PosSn; //机具SN
-                    pd.FromStoreId = FromStoreId; //出货仓库Id
-                    pd.ToStoreId = smallStoreHouse.Id; //收货仓库Id
-                    pd.StoreId = smallStoreHouse.Id; //仓库Id
-                    pd.SnId = Convert.ToInt32(item);
-                    LPD.Add(pd);
-                }
-                smallStoreHouse.LaveNum -= count;
-                smallStoreHouse.TotalNum += count;
-                string text = string.Format("创客-首页-仓库管理-小分仓-确认发货,UserId: '" + UserId + "',ToUserId: '" + ToUserId + "',LaveNum:'" + smallStoreHouse.LaveNum + "',TotalNum:'" + smallStoreHouse.TotalNum + "',ChangeCount:'" + count + "',Time'" + DateTime.Now + "'");
-                function.WriteLog(text, "smallstorehouse");//小分仓记录日志
-                StoreHouse storeHouse = maindb.StoreHouse.First(m => m.Id == FromStoreId);
-                storeHouse.UpdateDate = DateTime.Now;
-                storeHouse.LaveNum -= count;
-
-                // //扣减分仓所关联运营中心的总机具数
-                // if (storeHouse.OpId > 0)
-                // {
-                //     var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == storeHouse.OpId) ?? new OpModels.SysAdmin();
-                //     if (sysAdmin.Id > 0)
-                //     {
-                //         sysAdmin.TotalMachineCount -= count;
-                //         opdb.SaveChanges();
-                //     }
-                // }
-                maindb.PreSendStockDetail.AddRange(LPD);
-                function.WriteLog("");//小分仓记录日志
-                maindb.SaveChanges();
-
-            }
-            else
-            {
-                return new AppResultJson() { Status = "-1", Info = "*发货失败,该创客已有10台预发机" };
-            }
-
-            return new AppResultJson() { Status = "1", Info = "发货成功", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-小分仓-预发货确认反馈
-        [Authorize]
-        public JsonResult Confirm(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ConfirmDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ConfirmDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人
-            string Ids = data["Ids"].ToString(); //反馈的记录Id列表
-            int Status = int.Parse(function.CheckInt(data["Status"].ToString())); //状态
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Users toUser = new Users();
-            PreSendStockDetail query = new PreSendStockDetail();
-            //获取小分仓额度
-            var amount = 0;
-            decimal totalAmount = 0;
-            var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == ToUserId) ?? new UserAccount();
-            if (userAccount.Id > 0)
-            {
-                totalAmount = userAccount.ValidPreAmount;//小分仓额度
-            }
-
-            //分割SN
-            string[] strids = Ids.Split(',');
-            var count = strids.ToList().Count();
-            foreach (var item in strids)
-            {
-                bool check = maindb.PreSendStockDetail.Any(m => m.Id == Convert.ToInt32(item) && m.Status == -1);
-                if(check)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "机具已退回仓库,操作失败", Data = Obj };
-                }
-            }
-            //同意
-            if (Status == 1)
-            {
-                string StoreName = "";
-                string Sn = "";
-                foreach (var item in strids)
-                {
-                    query = maindb.PreSendStockDetail.FirstOrDefault(m => m.Id == Convert.ToInt32(item));
-                    var fuserAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == query.FromUserId) ?? new UserAccount();
-                    PosMachinesTwo posMachinesTwo = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == query.SnId);
-                    var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == posMachinesTwo.BrandId);
-                    if (brandInfo.Name.Contains("电签"))
-                    {
-                        amount = 200;
-                    }
-                    if (brandInfo.Name.Contains("大POS"))
-                    {
-                        amount = 300;
-                    }
-                    totalAmount -= amount;
-                    StoreHouse storeHouse = maindb.StoreHouse.FirstOrDefault(m => m.Id == query.FromStoreId) ?? new StoreHouse();
-                    if (query != null)
-                    {
-                        query.UpdateDate = DateTime.Now; //修改时间
-                        query.Status = Status;//状态(-1 撤回,0 初始,1 同意,2 拒绝)
-                        //小分仓额度减掉机子占用的额度 >=0
-                        if (totalAmount >= 0 && userAccount.ValidPreAmount >= amount)
-                        {
-                            query.AuthFlag = 1;//添加小分仓额度标记
-                            fuserAccount.ValidAmount += amount;//增加预发机来源分仓可用额度
-                            userAccount.ValidPreAmount -= amount;//扣减小分仓可用额度
-                        }
-                        maindb.SaveChanges();
-                    }
-                    if (!StoreName.Contains(storeHouse.StoreName))
-                    {
-                        StoreName += storeHouse.StoreName + ',';
-                    }
-                    Sn += query.SnNo + ",<br/>";
-
-                }
-                RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                {
-                    UserId = ToUserId, //创客
-                    Title = "预发货确认通知", //标题
-                    Content = "<div class='f16'>已确认接收来自:<br/>" + StoreName + " 的 " + count + " 台 预发货机具<br/>SN:" + Sn + "<br/>*注:请仔细核对SN后确认,确认接收机具后若出现机具丢失等问题,则需承担相应损失。</div>", //内容
-                    Summary = "已确认接收来自: " + StoreName + " 的 " + count + " 台 预发货机具",
-                    CreateDate = DateTime.Now,
-
-                }));
-
-                List<int> FromUserList = new List<int>();
-
-                DataTable dts = OtherMySqlConn.dtable("SELECT FromUserId FROM PreSendStockDetail WHERE Id IN(" + Ids + ") GROUP BY FromUserId");
-                foreach (DataRow items in dts.Rows)
-                {
-                    int FromUserId = int.Parse(items["FromUserId"].ToString());
-                    FromUserList.Add(FromUserId);
-                }
-                foreach (var sub in FromUserList)
-                {
-                    string FStoreName = "";
-                    string FSn = "";
-                    int sum = 0;
-                    toUser = maindb.Users.FirstOrDefault(m => m.Id == ToUserId);
-                    DataTable dt = OtherMySqlConn.dtable("SELECT FromStoreId,SnId FROM PreSendStockDetail WHERE Id IN(" + Ids + ") AND FromUserId=" + sub + " GROUP BY FromStoreId,SnId");
-                    foreach (DataRow item in dt.Rows)
-                    {
-                        int FromStoreId = int.Parse(item["FromStoreId"].ToString());
-                        int SnId = int.Parse(item["SnId"].ToString());
-                        StoreHouse storeHouse = maindb.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId);
-                        var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnId);
-                        if (!FStoreName.Contains(storeHouse.StoreName))
-                        {
-                            FStoreName += storeHouse.StoreName + ',';
-                        }
-                        FSn += pos.PosSn + ",<br/>";
-                        sum += 1;
-                    }
-                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                    {
-                        UserId = sub, //创客
-                        Title = "预发货确认通知", //标题
-                        Content = "<div class='f16'>创客:" + toUser.MakerCode + " " + toUser.RealName + " 已确认接收来自您的:<br/>" + FStoreName + " 的 " + sum + " 台 预发货机具<br/>SN:" + FSn + "<br/>*注:请仔细核对SN后确认,确认接收机具后若出现机具丢失等问题,则需承担相应损失。</div>", //内容
-                        Summary = "创客:" + toUser.MakerCode + " " + toUser.RealName + " 已确认接收来自您的: " + FStoreName + " 的 " + sum + " 台 预发货机具",
-                        CreateDate = DateTime.Now,
-
-                    }));
-                }
-            }
-            //拒绝
-            else if (Status == 2)
-            {
-                string StoreName = "";
-                string Sn = "";
-                foreach (var item in strids)
-                {
-                    query = maindb.PreSendStockDetail.FirstOrDefault(m => m.Id == Convert.ToInt32(item));
-
-                    StoreHouse storeHouse = maindb.StoreHouse.FirstOrDefault(m => m.Id == query.FromStoreId) ?? new StoreHouse();
-                    storeHouse.LaveNum += 1;
-                    
-                    // //增加分仓所关联运营中心的总机具数
-                    // if (storeHouse.OpId > 0)
-                    // {
-                    //     var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.UserId == storeHouse.OpId) ?? new OpModels.SysAdmin();
-                    //     if (sysAdmin.Id > 0)
-                    //     {
-                    //         sysAdmin.TotalMachineCount += 1;
-                    //         opdb.SaveChanges();
-                    //     }
-                    // }
-                    maindb.SaveChanges();
-
-                    PosMachinesTwo posMachinesTwo = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == query.SnId);
-                    if (query != null)
-                    {
-                        query.UpdateDate = DateTime.Now; //修改时间
-                        query.Status = Status;//状态(-1 撤回,0 初始,1 同意,2 拒绝)
-                        posMachinesTwo.PreUserId = 0;
-                        maindb.SaveChanges();
-                    }
-                    if (!StoreName.Contains(storeHouse.StoreName))
-                    {
-                        StoreName += storeHouse.StoreName + ',';
-                    }
-                    Sn += query.SnNo + ",<br/>";
-                }
-                SmallStoreHouse smallStoreHouse = maindb.SmallStoreHouse.FirstOrDefault(m => m.UserId == ToUserId);
-                smallStoreHouse.LaveNum += count;
-                smallStoreHouse.TotalNum -= count;
-                string text = string.Format("创客-首页-仓库管理-小分仓-预发货确认反馈(拒绝),UserId: '" + query.FromUserId + "',ToUserId: '" + ToUserId + "',LaveNum:'" + smallStoreHouse.LaveNum + "',TotalNum'" + smallStoreHouse.TotalNum + "',ChangeCount:'" + count + "',Time'" + DateTime.Now + "'");
-                function.WriteLog(text, "smallstorehouse");//小分仓记录日志
-                maindb.SaveChanges();
-                RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                {
-                    UserId = ToUserId, //创客
-                    Title = "预发货拒绝通知", //标题
-                    Content = "<div class='f16'>已拒绝接收来自:<br/>" + StoreName + " 的 " + count + " 台 预发货机具<br/>SN:" + Sn + "<br/>*注:请仔细核对SN后确认,确认接收机具后若出现机具丢失等问题,则需承担相应损失。</div>", //内容
-                    Summary = "已拒绝接收来自: " + StoreName + " 的 " + count + " 台 预发货机具",
-                    CreateDate = DateTime.Now,
-                }));
-
-                List<int> FromUserList = new List<int>();
-                DataTable dts = OtherMySqlConn.dtable("SELECT FromUserId FROM PreSendStockDetail WHERE Id IN(" + strids + ") GROUP BY FromUserId");
-                foreach (DataRow items in dts.Rows)
-                {
-                    int FromUserId = int.Parse(items["FromUserId"].ToString());
-                    FromUserList.Add(FromUserId);
-                }
-                foreach (var sub in FromUserList)
-                {
-                    string FStoreName = "";
-                    string FSn = "";
-                    int sum = 0;
-                    toUser = maindb.Users.FirstOrDefault(m => m.Id == ToUserId);
-                    DataTable dt = OtherMySqlConn.dtable("SELECT FromStoreId,SnId FROM PreSendStockDetail WHERE Id IN(" + strids + ") AND FromUserId=" + sub + " GROUP BY FromStoreId,SnId");
-                    foreach (DataRow item in dt.Rows)
-                    {
-                        int FromStoreId = int.Parse(item["FromStoreId"].ToString());
-                        int SnId = int.Parse(item["SnId"].ToString());
-                        StoreHouse storeHouse = maindb.StoreHouse.FirstOrDefault(m => m.Id == FromStoreId);
-                        var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == SnId);
-                        if (!FStoreName.Contains(storeHouse.StoreName))
-                        {
-                            FStoreName += storeHouse.StoreName + ',';
-                        }
-                        FSn += pos.PosSn + ",<br/>";
-                        sum += 1;
-                    }
-                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                    {
-                        UserId = sub, //创客
-                        Title = "预发货拒绝通知", //标题
-                        Content = "<div class='f16'>创客:" + toUser.MakerCode + " " + toUser.RealName + " 已拒绝接收来自您的:<br/>" + FStoreName + " 的 " + sum + " 台 预发货机具<br/>SN:" + FSn + "<br/>*注:请仔细核对SN后确认,确认接收机具后若出现机具丢失等问题,则需承担相应损失。</div>", //内容
-                        Summary = "创客:" + toUser.MakerCode + " " + toUser.RealName + " 已拒绝接收来自您的: " + FStoreName + " 的 " + sum + " 台 预发货机具",
-                        CreateDate = DateTime.Now,
-
-                    }));
-                }
-            }
-
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-小分仓-预发货确认查询
-        [Authorize]
-        public JsonResult WaitConfirms(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> dataList = WaitConfirmsDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public Dictionary<string, object> WaitConfirmsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //收货人Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            Dictionary<string, object> dataList = new Dictionary<string, object>();
-            List<Dictionary<string, object>> storeList = new List<Dictionary<string, object>>();
-            List<Dictionary<string, object>> pssdList = new List<Dictionary<string, object>>();
-            IQueryable<PreSendStockDetail> query = maindb.PreSendStockDetail.Where(m => m.Status == 0 && m.ToUserId == ToUserId);
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-
-            if (mydata.Count() == 0)
-            {
-                return dataList;
-            }
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable dt = OtherMySqlConn.dtable("select b.Id StoreId,b.StoreName StoreName from(select FromStoreId from PreSendStockDetail where ToUserId='" + ToUserId + "' and Status=0 GROUP BY FromStoreId)a left join StoreHouse b on a.FromStoreId = b.Id");
-            foreach (DataRow item in dt.Rows)
-            {
-                var StoreId = item["StoreId"];//仓库Id
-                var StoreName = item["StoreName"];//仓库名称
-                Dictionary<string, object> ob = new Dictionary<string, object>();
-                ob.Add("StoreId", StoreId);
-                ob.Add("StoreName", StoreName);
-                storeList.Add(ob);
-            }
-            dataList.Add("StoreList", storeList);
-            OtherMySqlConn.connstr = "";
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("SnNo", subdata.SnNo); //机具编号
-                curData.Add("SnId", subdata.SnId); //机具Id
-                curData.Add("Id", subdata.Id); //记录Id
-                pssdList.Add(curData);
-
-            }
-            dataList.Add("SnList", pssdList);
-            return dataList;
-        }
-        #endregion
-
-
-        #region 创客-我的-小分仓-机具Sn列表
-        [Authorize]
-        public JsonResult SnList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = SnListDo(value, out Obj);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Obj });
-        }
-        public List<Dictionary<string, object>> SnListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));//出货创客Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-            // var date = DateTime.Now.AddDays(-30);
-            List<KqProducts> brandList = maindb.KqProducts.ToList();
-            foreach (var items in brandList)
-            {
-                List<PreSendStockDetail> mydata = maindb.PreSendStockDetail.Where(m => m.ToUserId == UserId && m.Status == 1 && m.ApplyFlag == 0 && m.BrandId == items.Id).ToList();
-                if (mydata.Count > 0)
-                {
-                    Dictionary<string, object> brandInfo = new Dictionary<string, object>();
-                    KqProducts kqProducts = maindb.KqProducts.FirstOrDefault(m => m.Id == items.Id);
-                    brandInfo.Add("Id", items.Id);//产品类型Id
-                    brandInfo.Add("Name", items.Name);//产品类型名称
-                    List<Dictionary<string, object>> snList = new List<Dictionary<string, object>>();
-                    foreach (var subdata in mydata)
-                    {
-                        // var TimeOut = 0;
-                        var CreateDate = Convert.ToDateTime(subdata.CreateDate).ToString("yyyy/MM/dd hh:mm:ss");
-                        Dictionary<string, object> curData = new Dictionary<string, object>();
-                        // if (subdata.CreateDate <= date && subdata.AuthFlag == 1)
-                        // {
-                        //     TimeOut = 1;
-                        //     curData.Add("TimeOut", TimeOut); //是否超时
-                        // }
-                        // else
-                        // {
-                        //     curData.Add("TimeOut", TimeOut); //是否超时
-                        // }
-                        curData.Add("SnNo", subdata.SnNo); //机具SN
-                        curData.Add("isGrant", subdata.AuthFlag); //占用小分仓额度标记
-                        curData.Add("CreateDate", CreateDate); //是否超时
-                        snList.Add(curData);
-                    }
-                    brandInfo.Add("SnList", snList);
-                    dataList.Add(brandInfo);
-                }
-
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("ThisMonthPreAmount", userAccount.ThisMonthPreAmount);//本月预发额度
-            Obj.Add("ValidPreAmount", userAccount.ValidPreAmount);//可用预发额度
-            Other = Obj;
-
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 140
Areas/Api/Controllers/v1/Pos/ProfitRewardRecordController.cs

@@ -1,140 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class ProfitRewardRecordController : BaseController
-    {
-        public ProfitRewardRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-收益查看-交易分润
-        [Authorize]
-        public JsonResult TradeProfitList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TradeProfitListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TradeProfitListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString()));//产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<ProfitRecord> query = maindb.ProfitRecord.Where(m => m.UserId == UserId && m.BrandId == ProductType).OrderByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            Dictionary<string, string> items = new Dictionary<string, string>();
-            foreach (var subdata in query.ToList())
-            {
-                if(!items.ContainsKey(subdata.SeoTitle))
-                {
-                    string CreateDate = subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
-                    items.Add(subdata.SeoTitle, subdata.ProfitAmount + "|" + CreateDate);
-                }
-                else
-                {
-                    string[] datalist = items[subdata.SeoTitle].Split('|');
-                    decimal ProfitAmount = decimal.Parse(datalist[0]) + subdata.ProfitAmount;
-                    items[subdata.SeoTitle] = ProfitAmount + "|" + datalist[1];
-                }
-            }
-            foreach (string MonthString in items.Keys)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                string[] datalist = items[MonthString].Split('|');
-                curData.Add("TradeProfit", datalist[0]); //交易分润
-                string Month = MonthString.Substring(0, 4) + "-" + MonthString.Substring(4);
-                curData.Add("TradeMonth", Month); //交易月
-                curData.Add("CreateDate", datalist[1]); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-收益查看-分红奖励
-        [Authorize]
-        public JsonResult DividendList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = DividendListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> DividendListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<TradeProfitItem> query = RedisDbconn.Instance.GetList<TradeProfitItem>("TradeProfit:Divi:" + UserId + ":" + ProductType, PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeProfit", subdata.TradeProfit); //交易分润
-                curData.Add("TradeMonth", subdata.TradeMonth); //交易月
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 814
Areas/Api/Controllers/v1/Pos/RecycMachineOrderController.cs

@@ -1,814 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class RecycMachineOrderController : BaseController
-    {
-        public RecycMachineOrderController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-过期机具回收-仓库管理-待回收机具
-        [Authorize]
-        public JsonResult StoreList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = StoreListDo(value, out Obj);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Obj });
-        }
-        public List<Dictionary<string, object>> StoreListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string UserId = data["UserId"].ToString(); //创客Id
-            int Status = int.Parse(function.CheckInt(data["Status"].ToString())); //状态
-            string Keyword = data["Keyword"].ToString(); //搜索关键词
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<RecycMachineOrder> list = maindb.RecycMachineOrder.Where(m => m.SeoTitle == UserId);
-            //待处理
-            if (Status == 0)
-            {
-                list = list.Where(m => m.Sort != m.QueryCount).OrderByDescending(m => m.CreateDate);
-            }
-            else
-            {
-                list = list.Where(m => m.Sort == m.QueryCount).OrderByDescending(m => m.UpdateDate);
-            }
-            if (!string.IsNullOrEmpty(Keyword))
-            {
-                List<int> PosIdList = maindb.RecycMachineOrderPos.Select(m => new { m.SnNo, m.OrderId }).Where(m => m.SnNo.EndsWith(Keyword)).ToList().Select(m => m.OrderId).ToList();
-                UserForMakerCode code = maindb.UserForMakerCode.FirstOrDefault(m => m.MakerCode == Keyword) ?? new UserForMakerCode();
-                list = list.Where(m => (PosIdList.Contains(m.Id) || m.UserId == code.UserId));
-            }
-            foreach (var item in list.ToList())
-            {
-                var order = maindb.RecycMachineOrder.FirstOrDefault(m => m.Id == item.Id && m.Sort == 1) ?? new RecycMachineOrder();
-                var orderp = maindb.RecycMachineOrderPos.FirstOrDefault(m => m.Status == 0 && m.OrderId == order.Id) ?? new RecycMachineOrderPos();
-                var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.BindingState == 1 && m.ActivationState == 1 && m.PosSn == orderp.SnNo) ?? new PosMachinesTwo();
-                if (order.Id == 0 || pos.Id == 0)
-                {
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == item.UserId) ?? new Users();
-                    curData.Add("Id", item.Id); //Id
-                    curData.Add("RealName", UsersData.RealName); //真实姓名
-                    curData.Add("Mobile", UsersData.Mobile); //手机号
-                    curData.Add("MakerCode", UsersData.MakerCode); //创客编号
-                    curData.Add("RecycOrderNo", item.RecycOrderNo); //申请单号
-                    if (item.PostType == 1)
-                    {
-                        curData.Add("PostType", item.PostType); //寄回方式(1 邮寄 2 送货上门)
-                        curData.Add("ErpCode", item.ErpCode); //快递单号
-                    }
-                    if (item.PostType == 2)
-                    {
-                        curData.Add("PostType", item.PostType); //寄回方式(1 邮寄 2 送货上门)
-                    }
-                    curData.Add("CreateDate", item.CreateDate == null ? "" : item.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                    curData.Add("UpdateDate", item.UpdateDate == null ? "" : item.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //确认或驳回时间
-                    curData.Add("BrandId", item.BrandId); //机具品牌
-                    var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == item.BrandId) ?? new KqProducts();
-                    curData.Add("BrandName", brandInfo.Name); //品牌名称
-                    List<Dictionary<string, object>> SnLists = new List<Dictionary<string, object>>();
-                    var orderPos = maindb.RecycMachineOrderPos.Where(m => m.OrderId == item.Id).ToList();
-                    foreach (var items in orderPos)
-                    {
-                        var posMachinesTwo = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.BindingState == 1 && m.ActivationState == 1 && m.PosSn == items.SnNo) ?? new PosMachinesTwo();
-                        Dictionary<string, object> SnList = new Dictionary<string, object>();
-                        if (posMachinesTwo.Id == 0)
-                        {
-                            SnList.Add("Status", items.Status);
-                            SnList.Add("SnNo", items.SnNo);
-                            SnLists.Add(SnList);
-                        }
-                    }
-                    curData.Add("SnList", SnLists);
-                    dataList.Add(curData);
-                }
-
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var PendCount = maindb.RecycMachineOrder.Where(m => m.Sort != m.QueryCount && m.SeoTitle == UserId).Count();//待处理
-            var RecyclableCount = maindb.RecycMachineOrder.Where(m => m.Sort == m.QueryCount && m.SeoTitle == UserId).Count();//已完成
-            Obj.Add("RecyclableCount", RecyclableCount);//已完成
-            Obj.Add("PendCount", PendCount);//待处理数量
-            Other = Obj;
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-过期机具回收-仓库管理-待回收详情
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int RecycStoreId = int.Parse(function.CheckInt(data["RecycStoreId"].ToString())); //退回仓库
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));//申请订单Id
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var query = maindb.RecycMachineOrder.FirstOrDefault(m => m.Id == Id) ?? new RecycMachineOrder();
-            var recycMachineOrderPos = maindb.RecycMachineOrderPos.Where(m => m.OrderId == query.Id).ToList();
-            if (recycMachineOrderPos.Count > 0)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                var count = recycMachineOrderPos.Count();
-                curData.Add("Count", count); //数量
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == query.UserId) ?? new Users();
-                curData.Add("RealName", UsersData.RealName); //真实姓名
-                curData.Add("Mobile", UsersData.Mobile); //手机号
-                curData.Add("MakerCode", UsersData.MakerCode); //创客编号
-                curData.Add("RecycOrderNo", query.RecycOrderNo); //申请单号
-                if (query.PostType == 1)
-                {
-                    curData.Add("PostType", query.PostType); //寄回方式(1 邮寄 2 送货上门)
-                    curData.Add("ErpCode", query.ErpCode); //快递单号
-                }
-                if (query.PostType == 2)
-                {
-                    curData.Add("PostType", query.PostType); //寄回方式(1 邮寄 2 送货上门)
-                }
-                curData.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("UpdateDate", query.UpdateDate == null ? "" : query.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //确认或驳回时间
-                curData.Add("BrandId", query.BrandId); //机具品牌
-                var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == query.BrandId) ?? new KqProducts();
-                curData.Add("BrandName", brandInfo.Name); //品牌名称
-                foreach (var items in recycMachineOrderPos)
-                {
-                    Dictionary<string, object> SnList = new Dictionary<string, object>();
-                    SnList.Add("Status", items.Status);//状态(-1 已撤回 0 待处理 1 已确认 2 驳回)
-                    SnList.Add("SnNo", items.SnNo);
-                    curData.Add("SnList", SnList);
-                }
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion      
-
-
-        #region 创客-过期机具回收-仓库管理-确认收货
-        [Authorize]
-        public JsonResult ConfirmRecyc(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ConfirmRecycDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ConfirmRecycDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int RecycStoreId = int.Parse(function.CheckInt(data["RecycStoreId"].ToString())); //仓库Id
-            int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString())); //记录Id
-            string SnList = data["SnList"].ToString(); //机具Sn
-            string[] Sns = SnList.Split(',');
-            string checks = RedisDbconn.Instance.Get<string>("CheckConfirmRecyc:" + OrderId);
-            if (checks == "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "请勿重复操作" };
-            }
-            RedisDbconn.Instance.Set("CheckConfirmRecyc:" + OrderId, "1");
-            RedisDbconn.Instance.SetExpire("CheckConfirmRecyc:" + OrderId, 10);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var query = maindb.RecycMachineOrder.FirstOrDefault(m => m.Id == OrderId) ?? new RecycMachineOrder();
-            var recycMachineOrderPos = maindb.RecycMachineOrderPos.Where(m => m.OrderId == OrderId && m.Status == 0).ToList();
-            foreach (var item in Sns)
-            {
-                var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.PosSn == item && m.BindingState == 0 && m.ActivationState == 0 && m.RecycStatus == 99) ?? new PosMachinesTwo();
-                var poscount = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.PosSn == item && m.BindingState == 1 && m.ActivationState == 1) ?? new PosMachinesTwo();
-                var orderposcount = recycMachineOrderPos.FirstOrDefault(m => m.QueryCount == 0 && m.SnNo == item) ?? new RecycMachineOrderPos();
-                if (poscount.Id > 0 && orderposcount.Id > 0)
-                {
-                    query.QueryCount += 1;
-                    query.UpdateDate = DateTime.Now;
-                    orderposcount.QueryCount += 1;
-                    orderposcount.UpdateDate = DateTime.Now;
-                    maindb.SaveChanges();
-                    return new AppResultJson() { Status = "-1", Info = "部分机具已激活,请重新刷新操作" };
-                }
-                if (pos.Id == 0)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "机具" + item + "不满足操作条件", Data = Obj };
-                    // return new AppResultJson() { Status = "-1", Info = "部分机具已激活,请重新刷新操作" };
-                }
-                var brandinfo = maindb.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
-                var storeInfo = maindb.StoreHouse.FirstOrDefault(m => m.Id == query.RecycStoreId) ?? new StoreHouse();
-                var storeAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == storeInfo.UserId) ?? new UserAccount();
-                var amount = 0;
-                if (brandinfo.Name.Contains("电签"))
-                {
-                    amount = 200;
-                }
-                if (brandinfo.Name.Contains("大POS"))
-                {
-                    amount = 300;
-                }
-
-                //扣减机具来源创客机具数
-                var fInfo = pos.BuyUserId + "_" + pos.BrandId;
-                var userMachineDatas = maindb.UserMachineData.FirstOrDefault(m => m.IdBrand == fInfo) ?? new UserMachineData();
-                userMachineDatas.TotalMachineCount -= 1;
-                userMachineDatas.UnBindCount -= 1;
-
-                //增加分仓机具数
-                var tInfo = storeInfo.UserId + "_" + pos.BrandId;
-                var userMachineData = maindb.UserMachineData.FirstOrDefault(m => m.IdBrand == tInfo) ?? new UserMachineData();
-                userMachineData.TotalMachineCount += 1;
-                userMachineData.UnBindCount += 1;
-
-                //增加仓库剩余库存数和总数
-                storeInfo.LaveNum += 1;
-                storeInfo.TotalNum += 1;
-
-                storeAccount.ValidAmount -= amount;//扣减分仓可用额度
-
-                var add = maindb.StoreHouseAmountRecord.Add(new StoreHouseAmountRecord()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    BeforeAmount = storeAccount.ValidAmount - amount,
-                    AfterAmount = storeAccount.ValidAmount,
-                    UseAmount = amount,
-                    UserId = storeInfo.UserId,
-                }).Entity;
-                var info = recycMachineOrderPos.FirstOrDefault(m => m.Status == 0 && m.OrderId == OrderId && m.SnNo == item) ?? new RecycMachineOrderPos();
-                if (info.Id == 0)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "机具" + item + "不满足操作条件", Data = Obj };
-                }
-                info.Status = 1;//状态(-1 已撤回 0 待处理 1 已确认 2 驳回)
-                info.UpdateDate = DateTime.Now;
-                info.ResultDate = DateTime.Now;
-
-                //重置为仓库机
-                pos.Status = 1;
-                pos.StoreId = query.RecycStoreId;
-                pos.QueryCount = 0;
-                pos.UpdateDate = null;
-                pos.ActivityList = null;
-                pos.SeoKeyword = null;
-                pos.SeoDescription = null;
-                pos.OrderId = 0;
-                pos.RecycEndDate = null;
-                pos.RecycBackCount = 0;
-                pos.PrizeParams = null;
-                pos.ScanQrTrade = 0;
-                pos.BindMerchantId = 0;
-                pos.CreditTrade = 0;
-                pos.DebitCardTrade = 0;
-                pos.IsVip = 0;
-                pos.UserNav = null;
-                pos.TransferTime = null;
-                pos.IsPurchase = 0;
-                pos.Detail = null;
-                pos.BindingTime = null;
-                pos.BindingState = 0;
-                pos.ActivationTime = null;
-                pos.ActivationState = 0;
-                pos.LeaderUserId = 0;
-                pos.PreUserId = 0;
-                pos.IsFirst = 0;
-                pos.DownFeeMan = null;
-                pos.DownFeeFlag = 0;
-                pos.DownFeeDate = null;
-                pos.UpFeeMan = null;
-                pos.UpFeeFlag = 0;
-                pos.UpFeeDate = null;
-                pos.OpReserve1 = 0;
-                pos.OpReserve2 = 0;
-                pos.OpReserve3 = 0;
-                pos.OpId = 0;
-                pos.RecycStartDate = null;
-                pos.SourcePosSn = null;
-                pos.BuyUserId = 0;
-                pos.UserId = 0;
-                pos.RecycStatus = 0;
-                // maindb.SaveChanges();
-            }
-            query.UpdateDate = DateTime.Now;
-            query.ResultDate = DateTime.Now;
-            query.QueryCount += Sns.Length;//添加订单完成数
-            maindb.SaveChanges();
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-过期机具回收-仓库管理-驳回
-        [Authorize]
-        public JsonResult RefuseRecyc(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = RefuseRecycDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson RefuseRecycDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            // int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int RecycStoreId = int.Parse(function.CheckInt(data["RecycStoreId"].ToString())); //仓库Id
-            int OrderId = int.Parse(function.CheckInt(data["OrderId"].ToString())); //记录Id
-            string SnList = data["SnList"].ToString(); //机具Sn
-            string[] Sns = SnList.Split(',');
-            string checks = RedisDbconn.Instance.Get<string>("CheckRefuseRecyc:" + OrderId);
-            if (checks == "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "请勿重复操作" };
-            }
-            RedisDbconn.Instance.Set("CheckRefuseRecyc:" + OrderId, "1");
-            RedisDbconn.Instance.SetExpire("CheckRefuseRecyc:" + OrderId, 10);
-            var PosInfo = "";
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var query = maindb.RecycMachineOrder.FirstOrDefault(m => m.Id == OrderId) ?? new RecycMachineOrder();
-            var store = maindb.StoreHouse.FirstOrDefault(m => m.Id == query.RecycStoreId) ?? new StoreHouse();
-            var brand = maindb.KqProducts.FirstOrDefault(m => m.Id == query.BrandId) ?? new KqProducts();
-            var recycMachineOrderPos = maindb.RecycMachineOrderPos.Where(m => m.OrderId == OrderId && m.Status == 0).ToList();
-            foreach (var item in Sns)
-            {
-                PosInfo += brand.Name + ":" + item + "," + "<br/>";
-                var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.PosSn == item && m.BindingState == 0 && m.ActivationState == 0 && m.RecycStatus == 99) ?? new PosMachinesTwo();
-                var poscount = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.PosSn == item && m.BindingState == 1 && m.ActivationState == 1) ?? new PosMachinesTwo();
-                var orderposcount = recycMachineOrderPos.FirstOrDefault(m => m.QueryCount == 0 && m.SnNo == item) ?? new RecycMachineOrderPos();
-                if (poscount.Id > 0 && orderposcount.Id > 0)
-                {
-                    query.QueryCount += 1;
-                    query.UpdateDate = DateTime.Now;
-                    orderposcount.QueryCount += 1;
-                    orderposcount.UpdateDate = DateTime.Now;
-                    maindb.SaveChanges();
-                    return new AppResultJson() { Status = "-1", Info = "部分机具已激活,请重新刷新操作" };
-                }
-                var info = recycMachineOrderPos.FirstOrDefault(m => m.Status == 0 && m.OrderId == OrderId && m.SnNo == item) ?? new RecycMachineOrderPos();
-                if (info.Id == 0 || pos.Id == 0)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "不满足驳回条件" };
-                    // return new AppResultJson() { Status = "-1", Info = "部分机具已激活,请重新刷新操作" };
-                }
-                pos.RecycStatus = 0;
-                info.Status = 2;//状态(-1 已撤回 0 待处理 1 已确认 2 驳回)
-                info.UpdateDate = DateTime.Now;
-                info.ResultDate = DateTime.Now;
-                maindb.SaveChanges();
-            }
-            query.UpdateDate = DateTime.Now;
-            query.ResultDate = DateTime.Now;
-            query.QueryCount += Sns.Length;//添加订单完成数
-            maindb.SaveChanges();
-            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-            {
-                UserId = query.UserId, //创客
-                Title = "机具回收驳回通知", //标题
-                Content = "<div class='f16'>" + PosInfo + "</ div > ",//内容
-                Summary = "您提交的过期回收机具已被" + store.StoreNo + "_" + store.StoreName + "驳回,请打开我的-回收机具及时处理!",
-                CreateDate = DateTime.Now,
-            }));
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-过期机具回收-提交回收申请
-        [Authorize]
-        public JsonResult Add(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson AddDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int RecycStoreId = int.Parse(function.CheckInt(data["RecycStoreId"].ToString())); //退回仓库
-            int PostType = int.Parse(function.CheckInt(data["PostType"].ToString())); //寄回方式(1 邮寄 2 送货上门)
-            string ErpName = data["ErpName"].ToString(); //快递名称
-            string ErpCode = data["ErpCode"].ToString(); //快递单号
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //机具品牌
-            string SnList = data["SnList"].ToString(); //机具Sn列表
-            string[] Sns = SnList.Split(',');
-            string checks = RedisDbconn.Instance.Get<string>("CheckRecyMachineAdd:" + UserId);
-            if (checks == "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "请勿重复操作" };
-            }
-            RedisDbconn.Instance.Set("CheckRecyMachineAdd:" + UserId, "1");
-            RedisDbconn.Instance.SetExpire("CheckRecyMachineAdd:" + UserId, 10);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            RecycMachineOrder query = new RecycMachineOrder();
-            RecycMachineOrderPos querys = new RecycMachineOrderPos();
-            var store = maindb.StoreHouse.FirstOrDefault(m => m.Id == RecycStoreId) ?? new StoreHouse();
-            var user = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-            var brand = maindb.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
-            var PosInfo = "";
-            query = maindb.RecycMachineOrder.Add(new RecycMachineOrder()
-            {
-                CreateDate = DateTime.Now, //创建时间
-                Sort = Sns.Length,//订单包含机具数
-                QueryCount = 0,//订单机具完成数
-                UserId = UserId, //创客
-                RecycOrderNo = "JJHS" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8),
-                RecycStoreId = RecycStoreId, //退回仓库
-                SeoTitle = store.UserId.ToString(),//寄回仓库所属创客Id
-                PostType = PostType, //寄回方式
-                ErpName = ErpName, //快递名称
-                ErpCode = ErpCode, //快递单号
-                BrandId = BrandId, //机具品牌
-            }).Entity;
-            maindb.SaveChanges();
-            foreach (var item in Sns)
-            {
-                PosInfo += brand.Name + ":" + item + "," + "<br/>";
-                var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.BrandId == BrandId && m.PosSn == item) ?? new PosMachinesTwo();
-                pos.RecycStatus = 99;//机具回收状态设为待处理
-                querys = maindb.RecycMachineOrderPos.Add(new RecycMachineOrderPos()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    OrderId = query.Id,//订单Id
-                    BrandId = BrandId, //机具品牌
-                    SnNo = item,//机具Sn
-                }).Entity;
-                maindb.SaveChanges();
-            }
-            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-            {
-                UserId = store.UserId, //创客
-                Title = "机具回收通知", //标题
-                Content = "<div class='f16'>" + PosInfo + "</ div > ",//内容
-                Summary = "您收到来自创客" + user.MakerCode + "机具回收订单,请打开仓库管理及时处理!",
-                CreateDate = DateTime.Now,
-            }));
-            return new AppResultJson() { Status = "1", Info = "成功", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-过期机具回收-回收分仓列表
-        [Authorize]
-        public JsonResult StoreInfoList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = StoreInfoListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> StoreInfoListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //机具品牌
-            string KeyWord = data["KeyWord"].ToString(); //搜索关键词
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var strBrandId = BrandId.ToString();
-            IQueryable<StoreHouse> query = maindb.StoreHouse.Where(m => m.Status > 0 && m.Sort == 0 && m.BrandId == strBrandId);
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (!string.IsNullOrEmpty(KeyWord))
-            {
-                query = query.Where(m => m.StoreName.Contains(KeyWord));
-            }
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                var user = maindb.Users.FirstOrDefault(m => m.Id == subdata.UserId) ?? new Users();
-                curData.Add("Id", subdata.Id); //仓库Id
-                curData.Add("BrandId", subdata.BrandId); //仓库品牌
-                curData.Add("Name", subdata.StoreName); //仓库名称
-                curData.Add("Address", subdata.Address); //仓库地址
-                curData.Add("UserName", user.RealName); //仓库所属人
-                curData.Add("userMobile", user.Mobile); //仓库所属人手机号
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-过期机具回收-撤回申请
-        [Authorize]
-        public JsonResult Cancel(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = CancelDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson CancelDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string SnIds = data["SnIds"].ToString(); //机具Id
-            string[] strids = SnIds.Split(',');
-            string checks = RedisDbconn.Instance.Get<string>("CheckRecyMachineCancel:" + UserId);
-            if (checks == "1")
-            {
-                return new AppResultJson() { Status = "-1", Info = "请勿重复操作" };
-            }
-            RedisDbconn.Instance.Set("CheckRecyMachineCancel:" + UserId, "1");
-            RedisDbconn.Instance.SetExpire("CheckRecyMachineCancel:" + UserId, 10);
-            var user = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-            var PosInfo = "";
-            foreach (var item in strids)
-            {
-                var Id = int.Parse(item);
-                var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == Id && m.BindingState == 0 && m.ActivationState == 0 && m.RecycStatus == 99) ?? new PosMachinesTwo();
-                var recy = maindb.RecycMachineOrderPos.FirstOrDefault(m => m.Status == 0 && m.SnNo == pos.PosSn) ?? new RecycMachineOrderPos();
-                if (recy.Id == 0 || pos.Id == 0)
-                {
-                    return new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "不满足撤回条件" };
-                }
-                var brand = maindb.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
-                PosInfo += brand.Name + ":" + pos.PosSn + "," + "<br/>";
-                var recyOrder = maindb.RecycMachineOrder.FirstOrDefault(m => m.Id == recy.OrderId) ?? new RecycMachineOrder();
-                pos.RecycStatus = 0;//变更机具回收状态
-                pos.UpdateDate = DateTime.Now;
-
-                recy.Status = -1;//变更机具回收记录状态
-                recy.UpdateDate = DateTime.Now;
-                recy.CancelDate = DateTime.Now;
-
-                recyOrder.UpdateDate = DateTime.Now;//变更机具回收订单时间
-                recyOrder.CancelDate = DateTime.Now;//变更机具回收订单时间
-                recyOrder.QueryCount += 1;//添加订单机具完成数
-            }
-            maindb.SaveChanges();
-            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-            {
-                UserId = UserId, //创客
-                Title = "机具回收撤回通知", //标题
-                Content = "<div class='f16'>" + PosInfo + "</ div > ",//内容
-                Summary = "您的部分过期回收机具已被您撤回,请查看!",
-                CreateDate = DateTime.Now,
-            }));
-            return new AppResultJson() { Status = "1", Info = "撤回成功", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-过期机具回收-机具寄回记录
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<RecycMachineOrder> query = maindb.RecycMachineOrder.Where(m => m.Status >= -1);//Status(-1 撤回 0 待处理 1 已确认 2 驳回)
-            if (!string.IsNullOrEmpty(data["UserId"].ToString()))
-            {
-                query = query.Where(m => m.UserId == UserId);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.CreateDate).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("RecycStoreId", subdata.RecycStoreId); //退回仓库
-                Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-                StoreHouse StoreHouseData = maindb.StoreHouse.FirstOrDefault(m => m.Id == subdata.RecycStoreId) ?? new StoreHouse();
-                var user = maindb.Users.FirstOrDefault(m => m.Id == StoreHouseData.UserId) ?? new Users();
-                UserInfo.Add("UserName", user.RealName); //仓库所属人
-                UserInfo.Add("UserMobile", user.Mobile); //仓库所属人手机号
-                UserInfo.Add("StoreName", StoreHouseData.StoreName); //仓库名称
-                UserInfo.Add("Address", StoreHouseData.Address); //仓库地址
-                curData.Add("UserInfo", UserInfo);
-
-                curData.Add("RecycOrderNo", subdata.RecycOrderNo); //申请单号
-                if (subdata.PostType == 1)
-                {
-                    curData.Add("PostType", subdata.PostType); //寄回方式(1 邮寄 2 送货上门)
-                    curData.Add("ErpCode", subdata.ErpCode); //快递单号
-                }
-                if (subdata.PostType == 2)
-                {
-                    curData.Add("PostType", subdata.PostType); //寄回方式(1 邮寄 2 送货上门)
-                }
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("UpdateDate", subdata.UpdateDate == null ? "" : subdata.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //最后操作时间
-                curData.Add("BrandId", subdata.BrandId); //机具品牌
-                var brandInfo = maindb.KqProducts.FirstOrDefault(m => m.Id == subdata.BrandId) ?? new KqProducts();
-                curData.Add("BrandName", brandInfo.Name); //品牌名称
-                var recycMachineOrderPos = maindb.RecycMachineOrderPos.Where(m => m.OrderId == subdata.Id).ToList();
-                var count = recycMachineOrderPos.Count();
-                curData.Add("Count", count); //数量
-                List<Dictionary<string, object>> SnLists = new List<Dictionary<string, object>>();
-                foreach (var item in recycMachineOrderPos)
-                {
-                    var posMachinesTwo = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.BindingState == 1 && m.ActivationState == 1 && m.PosSn == item.SnNo) ?? new PosMachinesTwo();
-                    Dictionary<string, object> SnList = new Dictionary<string, object>();
-                    if (posMachinesTwo.Id == 0)
-                    {
-                        SnList.Add("Status", item.Status);
-                        SnList.Add("SnNo", item.SnNo);
-                        SnLists.Add(SnList);
-                    }
-                }
-                curData.Add("SnList", SnLists);
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 创客-过期机具回收-可回收机具数
-        [Authorize]
-        public JsonResult UserPosCount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = UserPosCounDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> UserPosCounDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var time = DateTime.Parse(DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd 00:00:00"));//过期限制时间
-            var Count = maindb.PosMachinesTwo.Where(m => m.Status > -1  && m.ScanQrTrade == 999 && m.BuyUserId == UserId && m.BindingState == 0 && m.ActivationState == 0 && m.RecycEndDate < time && m.RecycStatus == 0).Count();
-            Obj.Add("Count", Count);
-            return Obj;
-        }
-        #endregion
-
-        #region 仓库-过期机具回收-订单数
-        [Authorize]
-        public JsonResult StorePosCount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = StorePosCountDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> StorePosCountDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string UserId = data["UserId"].ToString(); //创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var Count = maindb.RecycMachineOrder.Where(m => m.SeoTitle == UserId && m.Sort != m.QueryCount).Count();
-            Obj.Add("Count", Count);
-            return Obj;
-        }
-        #endregion
-
-
-        #region 创客-过期机具回收-过期机具预扣款
-        [Authorize]
-        public JsonResult ChargeList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = ChargeListDo(value, out Obj);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Obj });
-        }
-        public List<Dictionary<string, object>> ChargeListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var userAccount = maindb.UserAccount.FirstOrDefault(m => m.Id == UserId) ?? new UserAccount();
-            var query = maindb.ToChargeBackRecord.Where(m => m.Status == 0 && m.UserId == UserId).OrderByDescending(m => m.Id).ToList();
-            foreach (var item in query)
-            {
-                Dictionary<string, object> dataInfo = new Dictionary<string, object>();
-                dataInfo.Add("ChargeAmount", item.ChargeAmount);
-                dataInfo.Add("ChargeType", item.ChargeType);
-                dataInfo.Add("CreateDate", item.CreateDate);
-                dataInfo.Add("Remark", item.Remark);
-                dataList.Add(dataInfo);
-            }
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("BalanceAmount", userAccount.BalanceAmount);//余额
-            Obj.Add("ToChargeAmount", userAccount.ToChargeAmount);//预扣款金额
-            Other = Obj;
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-            return dataList;
-        }
-        #endregion
-
-
-        #region 创客-过期机具回收--待回收机具品牌
-        [Authorize]
-        public JsonResult RecycPosBrandList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = RecycPosBrandListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> RecycPosBrandListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var time = DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd 00:00:00");//过期限制时间
-            DataTable dt = OtherMySqlConn.dtable("SELECT BrandId FROM PosMachinesTwo WHERE `Status`>-1 AND ScanQrTrade=999 AND BuyUserId>0 AND BuyUserId=" + UserId + " AND BindingState=0 AND ActivationState=0 AND RecycEndDate <'" + time + "' GROUP BY BrandId");//消息推送创客
-            var brandInfo = maindb.KqProducts.ToList();
-            foreach (DataRow item in dt.Rows)
-            {
-                int BrandId = int.Parse(item["BrandId"].ToString());
-                var brand = brandInfo.FirstOrDefault(m => m.Id == BrandId);
-                Dictionary<string, object> dataInfo = new Dictionary<string, object>();
-                dataInfo.Add("Id", brand.Id);
-                dataInfo.Add("Name", brand.Name);
-                dataList.Add(dataInfo);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 79
Areas/Api/Controllers/v1/Pos/SetMerchantTypeRecordController.cs

@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class SetMerchantTypeRecordController : BaseController
-    {
-        public SetMerchantTypeRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-我的商户-商户详情-转为商户创客生成二维码
-        [Authorize]
-        public JsonResult ChangeToMerUser(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ChangeToMerUserDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ChangeToMerUserDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string UserId = data["UserId"].ToString(); //推荐人
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SetMerchantTypeRecord query = new SetMerchantTypeRecord();
-            query = maindb.SetMerchantTypeRecord.Add(new SetMerchantTypeRecord()
-            {
-                CreateDate = DateTime.Now, //创建时间
-                UpdateDate = DateTime.Now, //修改时间
-            }).Entity;
-            maindb.SaveChanges();
-            Obj.Add("QrCodePath", ""); //二维码
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 346
Areas/Api/Controllers/v1/Pos/SmallStoreHouseController.cs

@@ -1,346 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class SmallStoreHouseController : BaseController
-    {
-        public SmallStoreHouseController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-首页-仓库管理-小分仓-列表
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString()));//出货创客Id
-            string SearchKey = data["SearchKey"].ToString(); //搜索关键词
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-
-            List<KqProducts> brandList = maindb.KqProducts.ToList();
-            DataTable dt = new DataTable();
-            if (!string.IsNullOrEmpty(SearchKey))
-            {
-                var UserForMakerCode = maindb.UserForMakerCode.FirstOrDefault(m => m.MakerCode == SearchKey);
-                if (UserForMakerCode != null)
-                {
-                    var ToUserIds = UserForMakerCode.UserId.ToString();
-                    var ToUserIdss = Convert.ToInt32(ToUserIds);
-                    dt = OtherMySqlConn.dtable("select ToUserId,count(Id) count from PreSendStockDetail where FromUserId='" + UserId + "' and `Status`>=0 and `Status`<=1 and ApplyFlag=0 and ToUserId='" + ToUserIdss + "' group by ToUserId");
-                }
-                else
-                {
-                    var SnNo = SearchKey;
-                    var SnNos = Convert.ToInt32(SnNo);
-                    dt = OtherMySqlConn.dtable("select ToUserId,count(Id) count from PreSendStockDetail where FromUserId='" + UserId + "' and `Status`>=0 and `Status`<=1 and ApplyFlag=0 and SnNo like '%" + SnNos + "%' group by ToUserId");
-                }
-            }
-            else
-            {
-                dt = OtherMySqlConn.dtable("select ToUserId,count(Id) count from PreSendStockDetail where FromUserId='" + UserId + "' and `Status`>=0 and `Status`<=1 and ApplyFlag=0 group by ToUserId");
-            }
-            // foreach (DataRow item in dt.Rows)
-            // {
-            //     int ToUserId = int.Parse(item["ToUserId"].ToString());
-            //     Dictionary<string, object> userInfo = new Dictionary<string, object>();
-            //     Users user = maindb.Users.FirstOrDefault(m => m.Id == ToUserId);
-            //     userInfo.Add("UserId", ToUserId);//创客Id
-            //     userInfo.Add("UserName", user.RealName);//创客姓名
-            //     userInfo.Add("MakerCode", user.MakerCode);//创客编号
-            //     userInfo.Add("Mobile", user.Mobile);//手机号
-            //     // userInfo.Add("HeadPhoto", DefaultPic(user.HeadPhoto));//头像
-            //     userInfo.Add("HeadPhoto", DefaultPic(user.HeadPhoto));//头像
-            //     userInfo.Add("UserLevel", user.UserLevel);//职级
-            //     List<Dictionary<string, object>> brands = new List<Dictionary<string, object>>();
-            //     bool op = false;
-            //     foreach (var items in brandList)
-            //     {
-            //         List<PreSendStockDetail> mydata = maindb.PreSendStockDetail.Where(m => m.FromUserId == UserId && m.ToUserId == ToUserId && m.BrandId == items.Id && m.Status >= 0 && m.Status <= 1 && m.ApplyFlag == 0).ToList();
-            //         if (mydata.Count > 0)
-            //         {
-            //             Dictionary<string, object> brandInfo = new Dictionary<string, object>();
-            //             KqProducts kqProducts = maindb.KqProducts.FirstOrDefault(m => m.Id == items.Id);
-            //             brandInfo.Add("Id", items.Id);//产品类型Id
-            //             brandInfo.Add("Name", items.Name);//产品类型名称
-            //             List<Dictionary<string, object>> snList = new List<Dictionary<string, object>>();
-            //             foreach (var subdata in mydata)
-            //             {
-            //                 Dictionary<string, object> curData = new Dictionary<string, object>();
-            //                 var pos = maindb.PosMachinesTwo.FirstOrDefault( m => m.Id == subdata.SnId) ?? new PosMachinesTwo();
-            //                 curData.Add("Id", subdata.Id);//记录Id
-            //                 curData.Add("SnId", subdata.SnId);//机具Id
-            //                 curData.Add("SnNo", subdata.SnNo); //机具SN
-            //                 curData.Add("Status", subdata.Status); //确认状态(0 待确认,1 已确认)
-            //                 curData.Add("isGrant", subdata.AuthFlag); //占用小分仓额度标记
-            //                 curData.Add("CreateDate", pos.CreateDate == null ? "" : pos.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));//入库时间
-            //                 snList.Add(curData);
-            //             }
-            //             brandInfo.Add("SnList", snList);
-            //             brands.Add(brandInfo);
-            //             op = true;
-            //         }
-            //     }
-
-            //new 优化
-            foreach (DataRow item in dt.Rows)
-            {
-                int ToUserId = int.Parse(item["ToUserId"].ToString());
-                Dictionary<string, object> userInfo = new Dictionary<string, object>();
-                Users user = maindb.Users.FirstOrDefault(m => m.Id == ToUserId);
-                userInfo.Add("UserId", ToUserId);//创客Id
-                userInfo.Add("UserName", user.RealName);//创客姓名
-                userInfo.Add("MakerCode", user.MakerCode);//创客编号
-                userInfo.Add("Mobile", user.Mobile);//手机号
-                userInfo.Add("HeadPhoto", DefaultPic(user.HeadPhoto));//头像
-                userInfo.Add("UserLevel", user.UserLevel);//职级
-                List<Dictionary<string, object>> brands = new List<Dictionary<string, object>>();
-                List<PreSendStockDetail> mydata = maindb.PreSendStockDetail.Where(m => m.FromUserId == UserId && m.ToUserId == ToUserId && m.Status >= 0 && m.Status <= 1 && m.ApplyFlag == 0).ToList();
-                bool op = false;
-                foreach (var items in brandList)
-                {
-                    var mydatas = mydata.Where(m => m.BrandId == items.Id).ToList();
-                    if (mydatas.Count > 0)
-                    {
-                        Dictionary<string, object> brandInfo = new Dictionary<string, object>();
-                        KqProducts kqProducts = maindb.KqProducts.FirstOrDefault(m => m.Id == items.Id);
-                        brandInfo.Add("Id", items.Id);//产品类型Id
-                        brandInfo.Add("Name", items.Name);//产品类型名称
-                        List<Dictionary<string, object>> snList = new List<Dictionary<string, object>>();
-                        foreach (var subdata in mydatas)
-                        {
-                            Dictionary<string, object> curData = new Dictionary<string, object>();
-                            var pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Id == subdata.SnId) ?? new PosMachinesTwo();
-                            curData.Add("Id", subdata.Id);//记录Id
-                            curData.Add("SnId", subdata.SnId);//机具Id
-                            curData.Add("SnNo", subdata.SnNo); //机具SN
-                            curData.Add("Status", subdata.Status); //确认状态(0 待确认,1 已确认)
-                            curData.Add("isGrant", subdata.AuthFlag); //占用小分仓额度标记
-                            curData.Add("CreateDate", pos.CreateDate == null ? "" : pos.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));//入库时间
-                            snList.Add(curData);
-                        }
-                        brandInfo.Add("SnList", snList);
-                        brands.Add(brandInfo);
-                        op = true;
-                    }
-                }
-                if (op)
-                {
-                    userInfo.Add("BrandList", brands);
-                    dataList.Add(userInfo);
-                }
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-
-            return dataList;
-        }
-        #endregion
-
-        #region 创客-首页-仓库管理-小分仓-查询预发机数量
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MakerCode = data["MakerCode"].ToString(); //搜索创客编号
-            int FromUserId = int.Parse(function.CheckInt(data["FromUserId"].ToString())); //出货创客Id
-            int FromStoreId = int.Parse(function.CheckInt(data["FromStoreId"].ToString())); //出货创客仓库Id 
-            var UserIdStr = FromUserId.ToString();
-            Users users = maindb.Users.FirstOrDefault(m => m.MakerCode == MakerCode);
-
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SmallStoreHouse query = maindb.SmallStoreHouse.FirstOrDefault(m => m.UserId == users.Id);
-            if (query == null)
-            {
-                query = maindb.SmallStoreHouse.Add(new SmallStoreHouse()
-                {
-                    CreateDate = DateTime.Now, //创建时间
-                    SeoDescription = UserIdStr,//描述--创建创客Id
-                    // Remark = FromUserId.ToString(),//备注--创建创客Id
-                    Mobile = users.Mobile, //手机号
-                    LaveNum = 10, //剩余库存数
-                    UserId = users.Id, //所属创客Id
-                    StoreName = users.RealName, //仓库名称
-                    StoreNo = users.MakerCode, //仓库编号
-                }).Entity;
-                maindb.SaveChanges();
-            }
-            else if (query != null)
-            {
-                if (!query.SeoDescription.Contains(UserIdStr))
-                {
-                    query.SeoDescription = query.SeoDescription + ',' + UserIdStr;
-                    maindb.SaveChanges();
-                }
-            }
-            Obj.Add("LaveNum", query.LaveNum); //剩余库存数
-            Obj.Add("TotalNum", query.TotalNum); //库存数
-            return Obj;
-        }
-        #endregion
-
-
-
-
-
-
-        #region 创客-首页-仓库管理-出货记录-按天
-        [Authorize]
-        public JsonResult ForDate(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ForDateDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ForDateDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string Month = data["Month"].ToString(); //月份
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<StoreStockChange> query = maindb.StoreStockChange.Where(m => m.Status > 0);
-            if (!string.IsNullOrEmpty(data["StoreId"].ToString()))
-            {
-                query = query.Where(m => m.StoreId == StoreId);
-            }
-            if (!string.IsNullOrEmpty(data["BrandId"].ToString()))
-            {
-                query = query.Where(m => m.BrandId == BrandId);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Date", ""); //日期
-                curData.Add("SnCount", ""); //机具数量
-                curData.Add("SnNos", ""); //机具列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-出货记录-按月
-        [Authorize]
-        public JsonResult ForMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ForMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ForMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<StoreStockChange> query = maindb.StoreStockChange.Where(m => m.Status > 0);
-            if (!string.IsNullOrEmpty(data["StoreId"].ToString()))
-            {
-                query = query.Where(m => m.StoreId == StoreId);
-            }
-            if (!string.IsNullOrEmpty(data["BrandId"].ToString()))
-            {
-                query = query.Where(m => m.BrandId == BrandId);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Month", ""); //月份
-                curData.Add("SendCount", ""); //总发货
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 95
Areas/Api/Controllers/v1/Pos/StoreChangeHistoryController.cs

@@ -1,95 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class StoreChangeHistoryController : BaseController
-    {
-        public StoreChangeHistoryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-机具管理-拨出记录
-        [Authorize]
-        public JsonResult OutRecords(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = OutRecordsDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> OutRecordsDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string SnNo = data["SnNo"].ToString(); //SN编号
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserStoreChange> query = new List<UserStoreChange>();
-            if (!string.IsNullOrEmpty(SnNo))
-            {
-                query = maindb.UserStoreChange.Where(m => m.SnNo == SnNo).ToList();
-            }
-            else
-            {
-                query = UserStoreChangeDbconn.Instance.GetList(UserId, BrandId, PageNum, PageSize);
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("SnNo", subdata.SnNo); //SN编号
-                curData.Add("SnType", RelationClass.GetPosSnTypeInfo(subdata.SnType)); //SN机具类型
-                curData.Add("FromDate", subdata.FromDate == null ? "" : subdata.FromDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //出库时间
-                curData.Add("Id", subdata.Id); //Id
-                Users user = UsersDbconn.Instance.Get(subdata.ToUserId) ?? new Users();
-                curData.Add("MakerCode", user.MakerCode); //收货创客编号
-                curData.Add("MakerName", user.RealName); //收货创客名称
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 214
Areas/Api/Controllers/v1/Pos/StoreHouseAmountPromissController.cs

@@ -1,214 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class StoreHouseAmountPromissController : BaseController
-    {
-        public StoreHouseAmountPromissController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-首页-仓库管理-已担保金额
-        [Authorize]
-        public JsonResult PromissMoney(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = PromissMoneyDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> PromissMoneyDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //用户Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var check = maindb.StoreHouseAmountPromiss.Any(m => m.FromUserId == UserId);
-            decimal amount = 0;
-            if (check)
-            {
-                amount = maindb.StoreHouseAmountPromiss.Where(m => m.Status == 1 && m.FromUserId == UserId).Sum(m => m.PromissAmount);
-            }
-            Obj.Add("PromissAmount", amount); //担保金额
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-担保反馈
-        [Authorize]
-        public JsonResult CallBack(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = CallBackDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson CallBackDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //用户Id
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //记录Id
-            int Status = int.Parse(function.CheckInt(data["Status"].ToString())); //状态
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            var query = maindb.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == Id && m.Status == 0);
-            var userInfo = maindb.Users.FirstOrDefault(m => m.Id == query.ToUserId);
-            if (query != null)
-            {
-                if (Status == 1)//同意
-                {
-                    query.UpdateDate = DateTime.Now; //修改时间
-                    query.Status = 1;
-                    var user = maindb.UserAccount.FirstOrDefault(m => m.Id == query.ToUserId) ?? new UserAccount();
-                    user.ValidAmount += query.PromissAmount;
-                    maindb.SaveChanges();
-                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                    {
-                        UserId = UserId, //接收创客
-                        Title = "仓库担保确认通知", //标题
-                        Content = "<div class='f16'>已经确认为创客 <br/>" + userInfo.RealName + ' ' + userInfo.MakerCode + "进行分仓额度担保<br/>担保金额:" + query.PromissAmount + " </div>", //内容
-                        Summary = "已经确认为创客" + userInfo.RealName + ' ' + userInfo.MakerCode + "进行分仓额度担保,担保金额:" + query.PromissAmount,
-                        CreateDate = DateTime.Now,
-                    }));
-                }
-                if (Status == 2)//拒绝
-                {
-                    query.UpdateDate = DateTime.Now; //修改时间
-                    query.Status = 2;
-                    maindb.SaveChanges();
-                }
-
-            }
-            else
-            {
-                return new AppResultJson() { Status = "-1", Info = "该用户数据不存在", Data = Obj };
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-担保明细
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = ListDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> ListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //用户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<int> toUserIds = new List<int>();
-            DataTable dt = OtherMySqlConn.dtable("SELECT ToUserId FROM StoreHouseAmountPromiss WHERE FromUserId='" + UserId + "' AND `Status`=1 GROUP BY ToUserId ORDER BY ToUserId");
-            foreach (DataRow item in dt.Rows)
-            {
-                toUserIds.Add(int.Parse(item["ToUserId"].ToString()));
-            }
-            foreach (var item in toUserIds)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                var userInfo = maindb.Users.FirstOrDefault(m => m.Id == item);
-                var time = "";
-                DataTable dts = OtherMySqlConn.dtable("SELECT UpDateDate FROM StoreHouseAmountPromiss WHERE FromUserId='" + UserId + "' AND ToUserId='" + item + "' AND `Status`=1 ORDER BY UpDateDate DESC LIMIT 1");
-                foreach (DataRow items in dts.Rows)
-                {
-                    time = Convert.ToDateTime(items["UpDateDate"]).ToString("yyyy-MM-dd HH:mm:ss");
-                }
-                var amount = maindb.StoreHouseAmountPromiss.Where(m => m.FromUserId == UserId && m.ToUserId == item && m.Status == 1).Sum(m => m.PromissAmount);
-                curData.Add("userInfo", userInfo.RealName + ' ' + userInfo.MakerCode);//被担保人信息
-                curData.Add("time", time);//担保时间
-                curData.Add("amount", amount);//担保金额
-                dataList.Add(curData);
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-            Other = new Dictionary<string, object>();
-            var TotalAmount = maindb.StoreHouseAmountPromiss.Where(m => m.FromUserId == UserId && m.Status == 1).Sum(m => m.PromissAmount);
-            Other.Add("TotalAmount", TotalAmount);
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-担保确认提示信息
-        [Authorize]
-        public JsonResult ConfirmInfo(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ConfirmInfoDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ConfirmInfoDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //担保人
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var info = maindb.StoreHouseAmountPromiss.Select(m => new { m.Id, m.ToUserId, m.FromUserId, m.Status }).Where(m => m.FromUserId == UserId && m.Status == 0).ToList();
-            foreach (var item in info)
-            {
-                Dictionary<string, object> Obj = new Dictionary<string, object>();
-                var query = maindb.StoreHouseAmountPromiss.FirstOrDefault(m => m.Id == item.Id);
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == query.ToUserId);
-                Obj.Add("Id", item.Id); //记录Id
-                Obj.Add("RealName", UsersData.RealName); //真实姓名
-                Obj.Add("MakerCode", UsersData.MakerCode); //创客编号
-                Obj.Add("PromissAmount", query.PromissAmount); //担保金额
-                dataList.Add(Obj);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 115
Areas/Api/Controllers/v1/Pos/StoreHouseAmountRecordController.cs

@@ -1,115 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class StoreHouseAmountRecordController : BaseController
-    {
-        public StoreHouseAmountRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-仓库管理-申请机具-调低临时额度
-        [Authorize]
-        public JsonResult DownAmount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = DownAmountDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson DownAmountDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            int Amount = int.Parse(function.CheckInt(data["Amount"].ToString())); //操作金额
-            int ReductQuotaBalance = int.Parse(function.CheckInt(data["ReductQuotaBalance"].ToString())); //操作金额
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string check = RedisDbconn.Instance.Get<string>("DownAmount:" + UserId);
-            if (!string.IsNullOrEmpty(check))
-            {
-                return new AppResultJson() { Status = "-1", Info = "操作频繁,请一分钟后再试", Data = Obj };
-            }
-            RedisDbconn.Instance.Set("DownAmount:" + UserId, "1");
-            RedisDbconn.Instance.SetExpire("DownAmount:" + UserId, 60);
-            var userAccount = maindb.UserAccount.FirstOrDefault(m => m.UserId == UserId);
-            if (Amount > 0)
-            {
-                if (userAccount.ValidAmount >= userAccount.TempAmount && Amount <= userAccount.TempAmount)
-                {
-                    string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + UserId + "\",\"Amount\":\"" + Amount + "\",\"PayMode\":\"1\"}}";
-                    RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-                }
-                else if (userAccount.ValidAmount < userAccount.TempAmount && Amount <= userAccount.ValidAmount)
-                {
-                    string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + UserId + "\",\"Amount\":\"" + Amount + "\",\"PayMode\":\"1\"}}";
-                    RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-                }
-                else
-                {
-                    return new AppResultJson() { Status = "-1", Info = "调低的临时额度大于您的可调低临时额度,请重新选择", Data = Obj };
-                }
-            }
-            if (ReductQuotaBalance > 0)
-            {
-                if (userAccount.ValidAmount >= userAccount.TempAmountForBalance && ReductQuotaBalance <= userAccount.TempAmountForBalance)
-                {
-                    string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + UserId + "\",\"Amount\":\"" + ReductQuotaBalance + "\",\"PayMode\":\"3\"}}";
-                    RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-                }
-                else if (userAccount.ValidAmount < userAccount.TempAmountForBalance && ReductQuotaBalance <= userAccount.ValidAmount)
-                {
-                    string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + UserId + "\",\"Amount\":\"" + ReductQuotaBalance + "\",\"PayMode\":\"3\"}}";
-                    RedisDbconn.Instance.AddList("StoreApplyQueue", SendData);
-                }
-                else
-                {
-                    return new AppResultJson() { Status = "-1", Info = "调低的临时额度大于您的可调低临时额度,请重新选择", Data = Obj };
-                }
-            }
-
-            return new AppResultJson() { Status = "1", Info = "调整成功,金额将返还至您的创客余额", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 252
Areas/Api/Controllers/v1/Pos/StoreMachineApplyController.cs

@@ -1,252 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class StoreMachineApplyController : BaseController
-    {
-        public StoreMachineApplyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 创客-首页-仓库管理-申请机具-申请记录
-        [Authorize]
-        public JsonResult ApplyList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ApplyListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ApplyListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<StoreMachineApply> query = maindb.StoreMachineApply.Where(m => m.Status >= 0 && m.UserId == UserId);
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("ApplyNum", subdata.ApplyNum); //申请台数
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("Status", subdata.Status); //Status(0 待配货 1 已发货 2 已驳回)
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-申请机具-申请记录-详情
-        [Authorize]
-        public JsonResult ApplyDetail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ApplyDetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ApplyDetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            StoreMachineApply query = new StoreMachineApply();
-            query = maindb.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
-            List<KqProducts> brandList = maindb.KqProducts.ToList();
-            List<Dictionary<string, object>> brands = new List<Dictionary<string, object>>();
-            foreach (var items in brandList)
-            {
-                List<StoreStockChange> mydata = maindb.StoreStockChange.Where(m => m.ToUserId == UserId && m.Sort == Id &&  m.BrandId == items.Id && m.Status >= 0).ToList();
-                if (mydata.Count > 0)
-                {
-                    Dictionary<string, object> brandInfo = new Dictionary<string, object>();
-                    KqProducts kqProducts = maindb.KqProducts.FirstOrDefault(m => m.Id == items.Id);
-                    brandInfo.Add("Id", items.Id);//产品类型Id
-                    brandInfo.Add("Name", items.Name);//产品类型名称
-                    List<Dictionary<string, object>> snList = new List<Dictionary<string, object>>();
-                    foreach (var subdata in mydata)
-                    {
-                        Dictionary<string, object> curData = new Dictionary<string, object>();
-                        curData.Add("Id", subdata.Id);//记录Id
-                        curData.Add("SnNo", subdata.SnNo); //机具SN
-                        snList.Add(curData);
-                    }
-                    brandInfo.Add("SnList", snList);
-                    brands.Add(brandInfo);
-                }
-            }
-            // var StoreStockChange = maindb.StoreStockChange.Where(m => m.ToUserId == UserId);
-            Obj.Add("CreateDate", Convert.ToDateTime(query.CreateDate).ToString("yyyy-MM-dd HH:mm:ss")); //创建时间
-            Obj.Add("ApplyNum", query.ApplyNum); //申请台数
-            Obj.Add("SendNum", query.SendNum); //发货台数
-            Obj.Add("UseAmount", query.UseAmount); //使用额度
-            Obj.Add("SendMode", query.SendMode); //发货方式
-            Obj.Add("ErpCode", query.ErpCode); //快递单号
-            Obj.Add("SendSn", brands); //发货SN数据
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-申请机具-确认申请
-        [Authorize]
-        public JsonResult ConfirmApply(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = ConfirmApplyDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson ConfirmApplyDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            JsonData ApplyList = data["ApplyList"];//申请数据
-            int NeedPay = int.Parse(function.CheckInt(data["NeedPay"].ToString())); //所需金额
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            int ApplyNum = 0;
-            for (int i = 0; i < ApplyList.Count; i++)
-            {
-                int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
-                ApplyNum += num;
-            }
-            int CheckUserId = UserId;
-            StoreHouse store = maindb.StoreHouse.FirstOrDefault(m => m.UserId == UserId && m.Status > -1 && m.OpId > 0 && m.Sort == 0) ?? new StoreHouse();
-            StoreMachineApply query = new StoreMachineApply();
-            query = maindb.StoreMachineApply.Add(new StoreMachineApply()
-            {
-                CreateDate = DateTime.Now, //创建时间
-                SendSn = ApplyList.ToJson(),//申请机具json数据
-                ApplyNo = "FC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8),//申请单号
-                ApplyNum = ApplyNum,// 申请机具数量
-                UserId = UserId, //创客
-                QueryCount = store.OpId, //运营中心所属人Id
-            }).Entity;
-            UserAccount userAccount = maindb.UserAccount.FirstOrDefault(m => m.UserId == UserId);
-            // if (userAccount.FixedAmount >= NeedPay)
-            // {
-            //     userAccount.FixedAmount -= NeedPay;
-            // }
-            // if (userAccount.FixedAmount < NeedPay && userAccount.FixedAmount + userAccount.TempAmount >= NeedPay)
-            // {
-            //     userAccount.FixedAmount = 0;
-            //     userAccount.TempAmount -= NeedPay - userAccount.FixedAmount;
-            // }
-            // if (userAccount.FixedAmount < NeedPay || userAccount.FixedAmount + userAccount.TempAmount < NeedPay)
-            // {
-            //     return new AppResultJson() { Status = "-1", Info = "可用额度不足,请充值临时额度" };
-            // }
-
-            if (userAccount.ValidAmount >= NeedPay)
-            {
-                userAccount.ValidAmount -= NeedPay;
-                query.UseAmount = NeedPay;
-            }
-            else
-            {
-                return new AppResultJson() { Status = "-1", Info = "可用额度不足,请充值临时额度" };
-            }
-            maindb.SaveChanges();
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-        #region 创客-首页-仓库管理-申请机具-可选品牌列表
-        [Authorize]
-        public JsonResult ProductList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> ObjList = ProductListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = ObjList });
-        }
-        public List<Dictionary<string, object>> ProductListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            List<Dictionary<string, object>> ObjList = new List<Dictionary<string, object>>();
-            List<StoreHouse> storeHouse = maindb.StoreHouse.Where(m => m.UserId == UserId && m.BrandId != null && m.Status > 0 && m.Sort == 0).ToList();
-            foreach (var item in storeHouse)
-            {
-                Dictionary<string, object> Obj = new Dictionary<string, object>();
-                int Price = 0;
-                KqProducts kqProducts = maindb.KqProducts.FirstOrDefault(m => m.Id == Convert.ToInt32(item.BrandId));
-                if (kqProducts.Name.Contains("大POS"))
-                {
-                    Price = 300;
-                }
-                if (kqProducts.Name.Contains("电签"))
-                {
-                    Price = 200;
-                }
-                Obj.Add("BrandId", kqProducts.Id);
-                Obj.Add("BrandName", kqProducts.Name);
-                Obj.Add("Price", Price);
-                ObjList.Add(Obj);
-
-            }
-            return ObjList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 121
Areas/Api/Controllers/v1/Pos/StoreSnActivateSummaryController.cs

@@ -1,121 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class StoreSnActivateSummaryController : BaseController
-    {
-        public StoreSnActivateSummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-首页-仓库管理-激活记录-按天
-        [Authorize]
-        public JsonResult ForDate(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ForDateDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ForDateDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            // int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //品牌Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DataTable dt = OtherMySqlConn.dtable("SELECT TradeDate,SUM(ActivateNum) sum FROM StoreSnActivateSummary WHERE StoreId = '"+StoreId+"' AND TradeMonth = '"+TradeMonth+"' GROUP BY TradeDate ORDER BY TradeDate DESC");
-            foreach (DataRow item in dt.Rows)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Date", item["TradeDate"]); //时间
-                curData.Add("ActTotal", Convert.ToInt32(function.CheckInt(item["sum"].ToString()))); //总激活
-                dataList.Add(curData);
-                
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-            
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-仓库管理-激活记录-按月
-        [Authorize]
-        public JsonResult ForMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ForMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ForMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int StoreId = int.Parse(function.CheckInt(data["StoreId"].ToString())); //仓库
-            // int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DataTable dt = OtherMySqlConn.dtable("SELECT TradeMonth,SUM(ActivateNum) sum FROM StoreSnActivateSummary WHERE StoreId = '" + StoreId + "' GROUP BY TradeMonth ORDER BY TradeMonth DESC");
-            foreach (DataRow item in dt.Rows)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Date", item["TradeMonth"]); //时间
-                curData.Add("ActTotal", Convert.ToInt32(function.CheckInt(item["sum"].ToString()))); //总激活
-                dataList.Add(curData);
-                
-            }
-            dataList = dataList.Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();//分页的重点
-            
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 247
Areas/Api/Controllers/v1/Pos/TradeDaySummaryController.cs

@@ -1,247 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class TradeDaySummaryController : BaseController
-    {
-        public TradeDaySummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 创客-首页-交易分析-交易明细
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //品牌
-            string TradeMonthOrDate = data["TradeMonthOrDate"].ToString(); //月份或日期
-            string Kind = data["Kind"].ToString(); //类别
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-
-            List<TradeDaySummary> query = new List<TradeDaySummary>();
-            if (TradeMonthOrDate.Length == 6)
-            {
-                bool check = maindb.TradeDaySummary.Any(m => m.SeoTitle == Kind && m.UserId == UserId && m.BrandId == BrandId && m.TradeMonth == TradeMonthOrDate);
-                if (check)
-                {
-                    query = maindb.TradeDaySummary.Where(m => m.SeoTitle == Kind && m.UserId == UserId && m.BrandId == BrandId && m.TradeMonth == TradeMonthOrDate).ToList();
-                }
-            }
-            else if (TradeMonthOrDate.Length == 8)
-            {
-                bool check = maindb.TradeDaySummary.Any(m => m.SeoTitle == Kind && m.UserId == UserId && m.BrandId == BrandId && m.TradeDate == TradeMonthOrDate);
-                if (check)
-                {
-                    query = maindb.TradeDaySummary.Where(m => m.SeoTitle == Kind && m.UserId == UserId && m.BrandId == BrandId && m.TradeDate == TradeMonthOrDate).ToList();
-                }
-            }
-
-            //扶持期
-            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;
-
-            //盈利期
-            decimal TotalAmtyl = 0;
-            decimal DAmtyl = 0;
-            decimal JAmtyl = 0;
-            decimal JfAmtyl = 0;
-            int JCountyl = 0;
-            decimal YAmtyl = 0;
-
-            if (query.Count > 0)
-            {
-                //扶持期
-                if (Kind == "team")
-                {
-                    TotalAmtfc = query.Sum(m => m.HelpNonDirectTradeAmt + m.HelpNonDirectDebitTradeAmt);
-                }
-                else
-                {
-                    TotalAmtfc = query.Sum(m => m.HelpDirectTradeAmt + m.HelpDirectDebitTradeAmt);
-                }
-                //稳定期
-                if (Kind == "team")
-                {
-                    TotalAmtwd = query.Sum(m => m.NotHelpNonDirectTradeAmt + m.NotHelpNonDirectDebitTradeAmt);
-                }
-                else
-                {
-                    TotalAmtwd = query.Sum(m => m.NotHelpDirectTradeAmt + m.NotHelpDirectDebitTradeAmt);
-                }
-                //盈利期
-                if (Kind == "team")
-                {
-                    TotalAmtyl = query.Sum(m => m.ProfitNonDirectTradeAmt + m.ProfitNonDirectDebitTradeAmt);
-                }
-                else
-                {
-                    TotalAmtyl = query.Sum(m => m.ProfitDirectTradeAmt + m.ProfitDirectDebitTradeAmt);
-                }
-            }
-            if (query.Where(m => m.QueryCount == 0).Count() > 0)
-            {
-                //扶持期
-                if (Kind == "team")
-                {
-                    DAmtfc = query.Where(m => m.QueryCount == 0).Sum(m => m.HelpNonDirectTradeAmt);
-                    JAmtfc = query.Where(m => m.QueryCount == 0).Sum(m => m.HelpNonDirectDebitTradeAmt) - query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitCapTradeAmt);
-                    JfAmtfc = query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitCapTradeAmt);
-                    JCountfc = (int)query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitCapNum);
-                }
-                else
-                {
-                    DAmtfc = query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectTradeAmt);
-                    JAmtfc = query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitTradeAmt) - query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitCapTradeAmt);
-                    JfAmtfc = query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitCapTradeAmt);
-                    JCountfc = (int)query.Where(m => m.QueryCount == 0).Sum(m => m.HelpDirectDebitCapNum);
-                }
-                //稳定期
-                if (Kind == "team")
-                {
-                    DAmtwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpNonDirectTradeAmt);
-                    JAmtwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpNonDirectDebitTradeAmt) - query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitCapTradeAmt);
-                    JfAmtwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitCapTradeAmt);
-                    JCountwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitCapNum);
-                }
-                else
-                {
-                    DAmtwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectTradeAmt);
-                    JAmtwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitTradeAmt) - query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitCapTradeAmt);
-                    JfAmtwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitCapTradeAmt);
-                    JCountwd = query.Where(m => m.QueryCount == 0).Sum(m => m.NotHelpDirectDebitCapNum);
-                }
-                //盈利期
-                if (Kind == "team")
-                {
-                    DAmtyl = query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitNonDirectTradeAmt);
-                    JAmtyl = query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitNonDirectDebitTradeAmt) - query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitCapTradeAmt);
-                    JfAmtyl = query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitCapTradeAmt);
-                    JCountyl = (int)query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitCapNum);
-                }
-                else
-                {
-                    DAmtyl = query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectTradeAmt);
-                    JAmtyl = query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitTradeAmt) - query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitCapTradeAmt);
-                    JfAmtyl = query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitCapTradeAmt);
-                    JCountyl = (int)query.Where(m => m.QueryCount == 0).Sum(m => m.ProfitDirectDebitCapNum);
-                }
-            }
-            if (query.Where(m => m.QueryCount == 1).Count() > 0)
-            {
-                //扶持期
-                if (Kind == "team")
-                {
-                    YAmtfc = query.Where(m => m.QueryCount == 1).Sum(m => m.HelpNonDirectTradeAmt);
-                }
-                else
-                {
-                    YAmtfc = query.Where(m => m.QueryCount == 1).Sum(m => m.HelpDirectTradeAmt);
-                }
-                //稳定期
-                if (Kind == "team")
-                {
-                    YAmtwd = query.Where(m => m.QueryCount == 1).Sum(m => m.NotHelpNonDirectTradeAmt);
-                }
-                else
-                {
-                    YAmtwd = query.Where(m => m.QueryCount == 1).Sum(m => m.NotHelpDirectTradeAmt);
-                }
-                //盈利期
-                if (Kind == "team")
-                {
-                    YAmtyl = query.Where(m => m.QueryCount == 1).Sum(m => m.ProfitNonDirectTradeAmt);
-                }
-                else
-                {
-                    YAmtyl = query.Where(m => m.QueryCount == 1).Sum(m => m.ProfitDirectTradeAmt);
-                }
-            }
-
-            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("TotalAmtyl", TotalAmtyl); //刷卡交易总额(盈利期)
-            Obj.Add("DAmtyl", DAmtyl); //贷记卡交易额(盈利期)  
-            Obj.Add("JAmtyl", JAmtyl); //借记卡交易总额(盈利期)
-            Obj.Add("JfAmtyl", JfAmtyl); //借记卡封顶交易额(盈利期)
-            Obj.Add("JCountyl", JCountyl); //借记卡封顶笔数(盈利期)
-            Obj.Add("YAmtyl", YAmtyl); //云闪付小额交易额(盈利期) 
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 80
Areas/Api/Controllers/v1/Pos/UserInviteFriendsController.cs

@@ -1,80 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-using System.Text;
-
-/// <summary>
-/// 邀请好友接口
-/// </summary>
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("/Api/v1/[controller]/[action]")]
-    public class UserInviteFriendsController : BaseController
-    {
-        public UserInviteFriendsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-        #region 获取邀请图片列表
-        [Authorize]
-        public JsonResult InviteFriendsPhotoList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = InviteFriendsPhotoListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> InviteFriendsPhotoListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 1; i <= 4; i++)
-            {
-                Dictionary<string, object> Obj = new Dictionary<string, object>();
-                var photo = DefaultPic("/static/qrcodebg/" + i + ".png");
-                Obj.Add("Id", i);
-                Obj.Add("PicPath", photo);
-                dataList.Add(Obj);
-
-            }
-            return dataList;
-        }
-        #endregion
-
-        #region 根据邀请图片生成信息
-        [Authorize]
-        public JsonResult InviteFriendsList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = InviteFriendsListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> InviteFriendsListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            var photoId = function.CheckInt(data["photoId"].ToString());
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            string result = function.GetWebRequest(Library.ConfigurationManager.AppSettings["QrCodeHost"].ToString() + "/home/getqrcode?uid=" + UserId + "&pid=" + photoId + "");//通过http请求获取数据路径
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Users query = UsersDbconn.Instance.Get(UserId) ?? new Users();
-            Obj.Add("RealName", query.RealName); //创客姓名
-            Obj.Add("MakerCode", query.MakerCode); //创客推荐码
-            Obj.Add("ReferenceQrCode", SourceHost + result); //推广二维码地址
-            return Obj;
-        }
-        #endregion
-
-    }
-}

+ 0 - 117
Areas/Api/Controllers/v1/Pos/UserProfitSubsidySummaryController.cs

@@ -1,117 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class UserProfitSubsidySummaryController : BaseController
-    {
-        public UserProfitSubsidySummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-收益查看-分润补贴
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-            DataTable query = OtherMySqlConn.dtable("select TradeMonth,sum(SubsidyProfitRate) from ProfitSubsidyDetail where BrandId=" + ProductType + " and SubsidyUserId=" + UserId + " and Status>0 GROUP BY TradeMonth order by TradeMonth desc");
-            foreach (DataRow subdata in query.Rows)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", subdata["TradeMonth"].ToString()); //交易月
-                // curData.Add("SubsidyJuniorProfit", subdata.SubsidyJuniorProfit); //下级合伙人直属商户(非云闪付)贷记卡交易分润补贴总金额
-                curData.Add("SubsidyDirectProfit", subdata[1].ToString()); //直营商户(非云闪付)贷记卡交易分润补贴总金额
-                dataList.Add(curData);
-            }
-            OtherMySqlConn.connstr = "";
-            return dataList;
-        }
-        #endregion
-
-        #region 首页-客小爽产品-收益查看-分润补贴
-        [Authorize]
-        public JsonResult List2(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = List2Do(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> List2Do(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            
-            DataTable query = OtherMySqlConn.dtable("select TradeMonth,sum(SubsidyProfitRate) from ProfitSubsidyDetail where BrandId=" + ProductType + " and SubsidyUserId=" + UserId + " and Status>0 GROUP BY TradeMonth order by TradeMonth desc");
-            foreach (DataRow subdata in query.Rows)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", subdata["TradeMonth"].ToString()); //交易月
-                // curData.Add("SubsidyJuniorProfit", subdata.SubsidyJuniorProfit); //下级合伙人直属商户(非云闪付)贷记卡交易分润补贴总金额
-                curData.Add("SubsidyDirectProfit", subdata[1].ToString()); //直营商户(非云闪付)贷记卡交易分润补贴总金额
-                dataList.Add(curData);
-            }
-            OtherMySqlConn.connstr = "";
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 154
Areas/Api/Controllers/v1/Pos/UserStoreChangeController.cs

@@ -1,154 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class UserStoreChangeController : BaseController
-    {
-        public UserStoreChangeController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-客小爽产品-机具管理-未绑定-划拨
-        [Authorize]
-        public JsonResult Transfer(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = TransferDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson TransferDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
-            string SnIds = data["SnIds"].ToString(); //SN列表返回的Id
-            int ToUserId = int.Parse(function.CheckInt(data["ToUserId"].ToString())); //划拨对象创客Id
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            bool checkUser = maindb.Users.Any(m => m.Id == ToUserId);
-            if (!checkUser)
-            { 
-                return new AppResultJson() { Status = "-1", Info = "请输入正确的创客编号", Data = Obj };
-            }
-            Users user = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-            Users touser = maindb.Users.FirstOrDefault(m => m.Id == ToUserId) ?? new Users();            
-            if (!function.CheckNull(touser.ParentNav).Contains("," + UserId + ",") || function.CheckNull(user.ParentNav).Contains("," + ToUserId + ","))
-            {
-                return new AppResultJson() { Status = "-1", Info = "划拨对象不在您的权限范围", Data = Obj };
-            }
-            if (!string.IsNullOrEmpty(SnIds))
-            {
-                string[] SnIdList = SnIds.Split(',');
-                foreach (string SnId in SnIdList)
-                {
-                    int SnIdNum = int.Parse(SnId);
-                    PosMachinesTwo pos = maindb.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.Id == SnIdNum) ?? new PosMachinesTwo();
-                    if (pos.PosSnType == 1)
-                    {
-                        return new AppResultJson() { Status = "-1", Info = "机具" + pos.PosSn + "是循环机,请勿划拨", Data = Obj };
-                    }
-                    StoreHouse store = StoreHouseDbconn.Instance.Get(pos.StoreId) ?? new StoreHouse();
-                    string ChangeRecordNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
-                    UserStoreChange query = maindb.UserStoreChange.Add(new UserStoreChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = UserId, //创客
-                        BrandId = BrandId, //产品类型
-                        ChangeRecordNo = ChangeRecordNo, //变更记录单号
-                        TransType = 11, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        ToUserId = ToUserId, //收货创客
-                        SnStatus = 0, //SN状态
-                        BindStatus = (int)pos.BindingState, //绑定状态
-                        BindMerchantId = pos.BindMerchantId, //绑定商户
-                        ActiveStatus = (int)pos.ActivationState, //激活状态
-                        FromUserId = UserId, //出货创客
-                    }).Entity;
-                    maindb.SaveChanges();
-                    StoreChangeHistory history = maindb.StoreChangeHistory.Add(new StoreChangeHistory()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = UserId, //创客
-                        BrandId = BrandId, //产品类型
-                        ChangeRecordNo = ChangeRecordNo, //变更记录单号
-                        TransType = 2, //交易类型
-                        SnNo = pos.PosSn, //SN编号
-                        SnType = pos.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceVendor = pos.DeviceName, //设备厂商
-                        DeviceModel = pos.DeviceKind, //设备型号
-                        DeviceType = pos.DeviceType, //设备类型
-                        ToUserId = ToUserId, //收货创客
-                        FromUserId = store.UserId, //出货创客
-                        FromDate = DateTime.Now, //出库时间
-                        SourceStoreId = pos.SourceStoreId, //源仓库
-                        StoreId = store.Id, //仓库
-                    }).Entity;
-                    maindb.SaveChanges();
-                    StoreChangeItem item = new StoreChangeItem()
-                    {
-                        SnNo = pos.PosSn,
-                        SnType = pos.PosSnType,
-                        FromDate = DateTime.Now,
-                        Id = query.Id,
-                        UserId = ToUserId,
-                    };
-                    string IdBrand = UserId + "_" + BrandId;
-                    PublicFunction.StatUserMachineData(UserId, BrandId, -1);
-                    PublicFunction.StatUserMachineData(ToUserId, BrandId, 1);
-
-                    pos.BuyUserId = ToUserId;
-                    pos.UserId = ToUserId;
-                    pos.TransferTime = DateTime.Now;
-                    // pos.RecycEndDate = DateTime.Now.AddDays(360); // 循环结束时间
-                    maindb.SaveChanges();
-                }
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 528
Areas/Api/Controllers/v1/Pos/UserTradeDaySummaryController.cs

@@ -1,528 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1.pos
-{
-    [Area("Api")]
-    [Route("Api/v1/pos/[controller]/[action]")]
-    public class UserTradeDaySummaryController : BaseController
-    {
-        public UserTradeDaySummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 首页-本月团队业绩
-        [Authorize]
-        public JsonResult ThisMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ThisMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ThisMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string Month = DateTime.Now.ToString("yyyyMM");
-            IndexTeamPerformance performance = RedisDbconn.Instance.Get<IndexTeamPerformance>("IndexTeamPerformance:" + UserId + ":" + Month) ?? new IndexTeamPerformance();
-            Obj.Add("DirectTradeAmt", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + UserId + ":" + Month)); //团队交易总额
-            Obj.Add("DirectDebitCapNum", RedisDbconn.Instance.Get<int>("TActMerchantCount:" + UserId + ":" + Month)); //直营激活商户数
-            Obj.Add("AddCount", performance.AddCount); //新增创客数
-            return Obj;
-        }
-        #endregion
-
-
-
-
-        #region 首页-客小爽产品-我的业绩-个人业绩
-        [Authorize]
-        public JsonResult PersonalPerformance(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = PersonalPerformanceDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> PersonalPerformanceDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:" + UserId + ":" + TradeMonth)); //总交易额
-            Obj.Add("CardAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:Card:" + UserId + ":" + TradeMonth)); //刷卡总交易
-            Obj.Add("QrPayAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:QrPay:" + UserId + ":" + TradeMonth)); //云闪付小额交易
-            Obj.Add("MakerCount", UserDataDbconn.Instance.GetSelfMakerCount(UserId)); //累计总创客
-            Obj.Add("AddMakerCount", UserDataDbconn.Instance.GetSelfMakerCountForMonth(UserId, TradeMonth)); //新增创客
-            Obj.Add("ActMerchantCount", RedisDbconn.Instance.Get<int>("ActMerchantCount:" + UserId)); //累计激活商户
-            Obj.Add("AddActMerchantCount", RedisDbconn.Instance.Get<int>("ActMerchantCount:" + UserId + ":" + TradeMonth)); //新增激活商户
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-个人业绩-按时间和产品统计
-        [Authorize]
-        public JsonResult PersonalPerformanceForDateAndPro(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = PersonalPerformanceForDateAndProDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> PersonalPerformanceForDateAndProDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeDate = data["TradeDate"].ToString(); //交易月/交易日
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-
-            if (ProductType != "1") //MPOS没有扶持期
-            {
-                //扶持期商户交易
-                Dictionary<string, object> HelpTradeObj = new Dictionary<string, object>();
-                PerformanceForDateAndPro HelpTrade = RedisDbconn.Instance.Get<PerformanceForDateAndPro>("PerformanceForDateAndPro:" + UserId + ":" + ProductType + ":Help:" + TradeDate) ?? new PerformanceForDateAndPro();
-                HelpTradeObj.Add("TradeAmount", HelpTrade.TradeAmount);
-                HelpTradeObj.Add("CreditAmount", HelpTrade.CreditAmount);
-                HelpTradeObj.Add("DebitNotCapAmount", HelpTrade.DebitNotCapAmount);
-                HelpTradeObj.Add("DebitCapAmount", HelpTrade.DebitCapAmount);
-                HelpTradeObj.Add("DebitCapCount", HelpTrade.DebitCapCount);
-                HelpTradeObj.Add("QrTradeAmount", HelpTrade.QrTradeAmount);
-                Obj.Add("HelpTrade", HelpTradeObj);
-            }
-
-            //稳定期商户交易
-            Dictionary<string, object> NotHelpTradeObj = new Dictionary<string, object>();
-            PerformanceForDateAndPro NotHelpTrade = RedisDbconn.Instance.Get<PerformanceForDateAndPro>("PerformanceForDateAndPro:" + UserId + ":" + ProductType + ":NotHelp:" + TradeDate) ?? new PerformanceForDateAndPro();
-            NotHelpTradeObj.Add("TradeAmount", NotHelpTrade.TradeAmount);
-            NotHelpTradeObj.Add("CreditAmount", NotHelpTrade.CreditAmount);
-            NotHelpTradeObj.Add("DebitNotCapAmount", NotHelpTrade.DebitNotCapAmount);
-            NotHelpTradeObj.Add("DebitCapAmount", NotHelpTrade.DebitCapAmount);
-            NotHelpTradeObj.Add("DebitCapCount", NotHelpTrade.DebitCapCount);
-            NotHelpTradeObj.Add("QrTradeAmount", NotHelpTrade.QrTradeAmount);
-            Obj.Add("NotHelpTrade", NotHelpTradeObj);
-
-            //交易商户
-            List<int> TradeMerchants = RedisDbconn.Instance.GetList<int>("PerformanceForDateAndPro:Mer:" + UserId + ":" + ProductType + ":" + TradeDate);
-            List<Dictionary<string, object>> TradeMerchantList = new List<Dictionary<string, object>>();
-            foreach (int TradeMerchantId in TradeMerchants)
-            {
-                PosMerchantInfo merchant = maindb.PosMerchantInfo.FirstOrDefault(m => m.Id == TradeMerchantId) ?? new PosMerchantInfo();
-                Dictionary<string, object> item = new Dictionary<string, object>();
-                item.Add("Name", merchant.MerchantName); //商户名称
-                item.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:" + merchant.UserId + ":" + ProductType + ":" + TradeDate)); //交易额
-                TradeMerchantList.Add(item);
-            }
-            Obj.Add("TradeMerchants", TradeMerchantList); 
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-个人业绩-每月明细
-        [Authorize]
-        public JsonResult PersonalPerformanceForDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalPerformanceForDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalPerformanceForDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddHours(1).AddDays(-1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                string Date = date.ToString("yyyyMMdd");
-                if (Date != DateTime.Now.ToString("yyyyMMdd"))
-                {
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    curData.Add("TradeDate", date.ToString("yyyy-MM-dd")); //交易月份
-                    curData.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:" + UserId + ":" + Date)); //总交易额
-                    curData.Add("CardAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:Card:" + UserId + ":" + Date)); //刷卡总交易
-                    curData.Add("QrPayAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:QrPay:" + UserId + ":" + Date)); //云闪付小额交易
-                    List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                    List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                    foreach (KqProducts sub in list)
-                    {
-                        decimal Amount = RedisDbconn.Instance.Get<decimal>("TradeStat:" + UserId + ":" + sub.Id + ":" + Date);
-                        if (Amount > 0)
-                        {
-                            Dictionary<string, object> item = new Dictionary<string, object>();
-                            item.Add("Id", sub.Id); //产品Id
-                            item.Add("Name", sub.Name); //名称
-                            item.Add("Amount", Amount); //交易额
-                            ProductList.Add(item);
-                        }
-                    }
-                    curData.Add("ProductList", ProductList); //产品列表
-                    dataList.Add(curData);
-                }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-个人业绩-近半年
-        [Authorize]
-        public JsonResult PersonalPerformanceHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalPerformanceHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalPerformanceHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:" + UserId + ":" + Month.ToString("yyyyMM"))); //总交易额
-                curData.Add("CardAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:Card:" + UserId + ":" + Month.ToString("yyyyMM"))); //刷卡总交易
-                curData.Add("QrPayAmount", RedisDbconn.Instance.Get<decimal>("TradeStat:QrPay:" + UserId + ":" + Month.ToString("yyyyMM"))); //云闪付小额交易
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = RedisDbconn.Instance.Get<decimal>("TradeStat:" + UserId + ":" + sub.Id + ":" + Month.ToString("yyyyMM"));
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-团队业绩
-        [Authorize]
-        public JsonResult TeamPerformance(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = TeamPerformanceDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> TeamPerformanceDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            Obj.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + UserId + ":" + TradeMonth)); //总交易额
-            Obj.Add("CardAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:Card:" + UserId + ":" + TradeMonth)); //刷卡总交易
-            Obj.Add("QrPayAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:QrPay:" + UserId + ":" + TradeMonth)); //云闪付小额交易
-            Obj.Add("MakerCount", UserDataDbconn.Instance.GetTeamMakerCount(UserId)); //累计总创客
-            Obj.Add("AddMakerCount", UserDataDbconn.Instance.GetTeamMakerCountForMonth(UserId, TradeMonth)); //新增创客
-            Obj.Add("ActMerchantCount", RedisDbconn.Instance.Get<int>("TActMerchantCount:" + UserId)); //累计激活商户
-            Obj.Add("AddActMerchantCount", RedisDbconn.Instance.Get<int>("TActMerchantCount:" + UserId + ":" + TradeMonth)); //新增激活商户
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-团队业绩-按时间和产品统计
-        [Authorize]
-        public JsonResult TeamPerformanceForDateAndPro(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = TeamPerformanceForDateAndProDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> TeamPerformanceForDateAndProDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeDate = data["TradeDate"].ToString(); //交易月/交易日
-            string ProductType = data["ProductType"].ToString(); //产品类型
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-
-            if (ProductType != "1") //MPOS没有扶持期
-            {
-                //扶持期商户交易
-                Dictionary<string, object> HelpTradeObj = new Dictionary<string, object>();
-                PerformanceForDateAndPro HelpTrade = RedisDbconn.Instance.Get<PerformanceForDateAndPro>("TeamPerformanceForDateAndPro:" + UserId + ":" + ProductType + ":Help:" + TradeDate) ?? new PerformanceForDateAndPro();
-                HelpTradeObj.Add("TradeAmount", HelpTrade.TradeAmount);
-                HelpTradeObj.Add("CreditAmount", HelpTrade.CreditAmount);
-                HelpTradeObj.Add("DebitNotCapAmount", HelpTrade.DebitNotCapAmount);
-                HelpTradeObj.Add("DebitCapAmount", HelpTrade.DebitCapAmount);
-                HelpTradeObj.Add("DebitCapCount", HelpTrade.DebitCapCount);
-                HelpTradeObj.Add("QrTradeAmount", HelpTrade.QrTradeAmount);
-                Obj.Add("HelpTrade", HelpTradeObj);
-            }
-
-            //稳定期商户交易
-            Dictionary<string, object> NotHelpTradeObj = new Dictionary<string, object>();
-            PerformanceForDateAndPro NotHelpTrade = RedisDbconn.Instance.Get<PerformanceForDateAndPro>("TeamPerformanceForDateAndPro:" + UserId + ":" + ProductType + ":NotHelp:" + TradeDate) ?? new PerformanceForDateAndPro();
-            NotHelpTradeObj.Add("TradeAmount", NotHelpTrade.TradeAmount);
-            NotHelpTradeObj.Add("CreditAmount", NotHelpTrade.CreditAmount);
-            NotHelpTradeObj.Add("DebitNotCapAmount", NotHelpTrade.DebitNotCapAmount);
-            NotHelpTradeObj.Add("DebitCapAmount", NotHelpTrade.DebitCapAmount);
-            NotHelpTradeObj.Add("DebitCapCount", NotHelpTrade.DebitCapCount);
-            NotHelpTradeObj.Add("QrTradeAmount", NotHelpTrade.QrTradeAmount);
-            Obj.Add("NotHelpTrade", NotHelpTradeObj); 
-
-            //交易商户
-            // List<int> TradeMerchants = RedisDbconn.Instance.GetList<int>("TeamPerformanceForDateAndPro:Mer:" + UserId + ":" + ProductType + ":" + TradeDate);
-            // List<Dictionary<string, object>> TradeMerchantList = new List<Dictionary<string, object>>();
-            // foreach (int TradeMerchantId in TradeMerchants)
-            // {
-            //     MerchantInfo merchant = RedisDbconn.Instance.Get<MerchantInfo>("MerchantInfo:" + TradeMerchantId) ?? new MerchantInfo();
-            //     Dictionary<string, object> item = new Dictionary<string, object>();
-            //     item.Add("Name", merchant.MerchantName); //商户名称
-            //     item.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + merchant.UserId + ":" + ProductType + ":" + TradeDate)); //交易额
-            //     TradeMerchantList.Add(item);
-            // }
-            // Obj.Add("TradeMerchants", TradeMerchantList); 
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-团队业绩-每月明细
-        [Authorize]
-        public JsonResult TeamPerformanceForDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceForDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceForDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00");
-            DateTime end = start.AddMonths(1).AddDays(-1);
-            int skipNum = 1;
-            if (PageNum > 1)
-            {
-                skipNum = PageSize * (PageNum - 1) + 1;
-            }
-            int index = 0;
-            while (start <= end)
-            {
-                index += 1;
-                if (index >= skipNum && dataList.Count < PageSize)
-                {
-                    string Date = end.ToString("yyyyMMdd");
-                    if (Date != DateTime.Now.ToString("yyyyMMdd"))
-                    {
-                        Dictionary<string, object> curData = new Dictionary<string, object>();
-                        curData.Add("TradeDate", end.ToString("yyyy-MM-dd")); //交易月份
-                        curData.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + UserId + ":" + MerchantId + ":" + Date)); //总交易额
-                        curData.Add("CardAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:Card:" + UserId + ":" + MerchantId + ":" + Date)); //刷卡总交易
-                        curData.Add("QrPayAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:QrPay:" + UserId + ":" + MerchantId + ":" + Date)); //云闪付小额交易
-                        List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                        List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                        foreach (KqProducts sub in list)
-                        {
-                            decimal Amount = RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + UserId + ":" + MerchantId + ":" + sub.Id + ":" + Date);
-                            if (Amount > 0)
-                            {
-                                Dictionary<string, object> item = new Dictionary<string, object>();
-                                item.Add("Id", sub.Id); //产品Id
-                                item.Add("Name", sub.Name); //名称
-                                item.Add("Amount", Amount); //交易额
-                                ProductList.Add(item);
-                            }
-                        }
-                        curData.Add("ProductList", ProductList); //产品列表
-                        dataList.Add(curData);
-                    }
-                }                
-                end = end.AddDays(-1);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-客小爽产品-我的业绩-团队业绩-近半年
-        [Authorize]
-        public JsonResult TeamPerformanceHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + UserId + ":" + MerchantId + ":" + Month.ToString("yyyyMM"))); //总交易额
-                curData.Add("CardAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:Card:" + UserId + ":" + MerchantId + ":" + Month.ToString("yyyyMM"))); //刷卡总交易
-                curData.Add("QrPayAmount", RedisDbconn.Instance.Get<decimal>("TeamTradeStat:QrPay:" + UserId + ":" + MerchantId + ":" + Month.ToString("yyyyMM"))); //云闪付小额交易
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = RedisDbconn.Instance.Get<decimal>("TeamTradeStat:" + UserId + ":" + MerchantId + ":" + sub.Id + ":" + Month.ToString("yyyyMM"));
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //名称
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 首页-我的商户-商户详情-交易记录
-        [Authorize]
-        public JsonResult MerchantTradeList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = MerchantTradeListDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> MerchantTradeListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            PosMerchantInfo merchant = PosMerchantInfoDbconn.Instance.Get(MerchantId) ?? new PosMerchantInfo();
-            DateTime start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00");
-            DateTime end = start.AddMonths(1).AddDays(-1);
-            if (TradeMonth == DateTime.Now.ToString("yyyyMM"))
-            {
-                end = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            }
-            int skipNum = 1;
-            if (PageNum > 1)
-            {
-                skipNum = PageSize * (PageNum - 1) + 1;
-            }
-            int index = 0;
-            while(start <= end)
-            {
-                index += 1;
-                if (index >= skipNum && dataList.Count < PageSize)
-                {
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    curData.Add("TradeDate", end.ToString("yyyy-MM-dd")); //交易日
-                    curData.Add("TradeAmt", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(merchant.Id, end.ToString("yyyyMMdd"))); //交易额
-                    dataList.Add(curData);
-                }
-                end = end.AddDays(-1);
-            }
-            Other = new Dictionary<string, object>();
-            Other.Add("MonthTradeAmt", PosMerchantTradeSummaryDbconn.Instance.GetDateTimeTrade(merchant.Id, TradeMonth));
-            return dataList;
-        }
-        #endregion
-
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 367
Areas/Api/Controllers/v1/School/SchoolMakerStudyController.cs

@@ -1,367 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolMakerStudyController : BaseController
-    {
-        public SchoolMakerStudyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-
-
-
-        #region 商学院-创客学堂列表
-        // [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            // string Month = data["Month"].ToString(); //月份
-            // string Title = data["Title"].ToString(); //标题
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<SchoolMakerStudy> query = maindb.SchoolMakerStudy.Where(m => m.Status > -1);
-            // DateTime start = DateTime.Parse(Month.Substring(0, 4) + "-" + Month.Substring(4, 2) + "-01 00:00:00");
-            // DateTime end = start.AddMonths(1);
-            // if (!string.IsNullOrEmpty(data["Title"].ToString()))
-            // {
-            //     query = query.Where(m => m.Title == Title);
-            // }
-            // if (!string.IsNullOrEmpty(data["Month"].ToString()))
-            // {
-            //     query = query.Where(m => m.CreateDate >= start && m.CreateDate < end);
-            // }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Title", subdata.Title); //标题
-                curData.Add("Detail", subdata.Detail); //介绍
-                curData.Add("Lecturer", subdata.SeoTitle); //主讲人
-                curData.Add("ListPic", StudyOrMeetDefaultPic(subdata.ListPic)); //列表图片
-                curData.Add("Url", subdata.Url); //外链
-                curData.Add("StudyPerson", subdata.QueryCount); //观看次数
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 商学院-创客学堂一级菜单
-        // [Authorize]
-        public JsonResult FirstMenu(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = FirstMenuDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> FirstMenuDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            Models.WebCMSEntities db = new Models.WebCMSEntities();
-            var query = db.Col.Where(m => m.Status > -1 && m.ColId.Contains("00500") && m.ColId.Length < 7);
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            var time = DateTime.Now.AddDays(-3);
-            foreach (var subdata in mydata)
-            {
-                var IsUpdate = 0;
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                var ChildCount = db.Col.Count(m => m.ParentId == subdata.Id);
-                if (ChildCount > 0)
-                {
-                    ChildCount = 1;
-                }
-                else
-                {
-                    ChildCount = 0;
-                }
-                curData.Add("ColName", subdata.ColName); //标题
-                curData.Add("ColPicPath", StudyOrMeetDefaultPic(subdata.ColPicPath)); //图片
-                curData.Add("ColDetail", subdata.ColDetail); //简介
-                curData.Add("Id", subdata.Id); //分类Id
-                var check = maindb.SchoolMakerStudy.Any(m => m.Status > -1 && m.CreateDate >= time && m.SeoKeyword.StartsWith(subdata.ColId));
-                if (check)
-                {
-                    IsUpdate = 1;
-                }
-                curData.Add("IsUpdate", IsUpdate); //是否更新 1 是 0 否
-                curData.Add("ChildCount", ChildCount); //是否有子级 1 是 0 否
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-        #region 商学院-创客学堂二级菜单
-        // [Authorize]
-        public JsonResult SecondMenu(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = SecondMenuDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> SecondMenuDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int ColId = int.Parse(data["ColId"].ToString());//上级菜单Id
-            int ChildCount = int.Parse(data["ChildCount"].ToString());//是否有子级
-            int UserId = int.Parse(data["UserId"].ToString());//创客Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            Other = new Dictionary<string, object>();
-            var time = DateTime.Now.AddDays(-3);
-            var IsAuth = 0;
-            Models.WebCMSEntities db = new Models.WebCMSEntities();
-            if (ChildCount == 1)
-            {
-                var query = db.Col.Where(m => m.Status > -1 && m.ParentId == ColId);
-                query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-                if (PageNum == 1)
-                {
-                    query = query.Take(PageSize);
-                }
-                else
-                {
-                    int skipNum = PageSize * (PageNum - 1);
-                    query = query.Skip(skipNum).Take(PageSize);
-                }
-                var mydata = query.ToList();
-                foreach (var subdata in mydata)
-                {
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    curData.Add("ColName", subdata.ColName); //标题
-                    curData.Add("ColPicPath", subdata.ColPicPath); //图片
-                    curData.Add("ColDetail", subdata.ColDetail); //简介
-                    curData.Add("Id", subdata.Id); //分类Id
-                    dataList.Add(curData);
-                }
-            }
-            else
-            {
-                var IsUpdate = 0;
-                var IsFrst = 0;
-                var query = db.Col.FirstOrDefault(m => m.Status > -1 && m.Id == ColId) ?? new Models.Col();
-                var auth = query.ColId;
-                var userInfo = maindb.UserCardRecord.FirstOrDefault(m => m.Id == UserId) ?? new UserCardRecord();
-                if (query.Recommend == 0)
-                {
-                    if (userInfo.Id > 0)
-                    {
-                        if (userInfo.SeoDescription.Contains("," + auth + ","))
-                        {
-                            IsAuth = 1;
-                        }
-                    }
-                }
-                else
-                {
-                    IsAuth = 1;
-                }
-                var mydata = maindb.SchoolMakerStudy.Where(m => m.Status > -1 && m.SeoKeyword.Contains(query.ColId));
-                mydata = mydata.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-                if (PageNum == 1)
-                {
-                    mydata = mydata.Take(PageSize);
-                }
-                else
-                {
-                    int skipNum = PageSize * (PageNum - 1);
-                    mydata = mydata.Skip(skipNum).Take(PageSize);
-                }
-                foreach (var subdata in mydata.ToList())
-                {
-                    IsUpdate += 1;
-                    var check = mydata.Any(m => m.Id == subdata.Id && m.CreateDate >= time);
-                    if (check)
-                    {
-                        IsFrst = 1;
-                    }
-                    if (IsUpdate == 1 && IsFrst == 1)
-                    {
-                        IsUpdate = 1;
-                    }
-                    Dictionary<string, object> curData = new Dictionary<string, object>();
-                    curData.Add("Title", subdata.Title); //标题
-                    curData.Add("Detail", subdata.Detail); //介绍
-                    curData.Add("Lecturer", subdata.SeoTitle); //主讲人
-                    curData.Add("ListPic", StudyOrMeetDefaultPic(subdata.ListPic)); //列表图片
-                    curData.Add("Url", subdata.Url); //外链
-                    curData.Add("StudyPerson", subdata.QueryCount); //观看次数
-                    curData.Add("IsUpdate", IsUpdate == 1 ? 1 : 0); //是否最新 1 是 0 否
-                    curData.Add("Id", subdata.Id); //Id
-                    curData.Add("IsAuth", IsAuth); //是否开放 1 是 0 否
-                    dataList.Add(curData);
-                }
-                Other.Add("IsAuth", IsAuth);//1 是 0 否
-                Other.Add("Info", "暂无观看权限");
-            }
-            // Other.Add("IsAuth", IsAuth);//1 是 0 否
-            // Other.Add("Info", "暂无观看权限");
-            return dataList;
-        }
-        #endregion
-
-
-        #region 商学院-创客学堂二级菜单对应列表
-        // [Authorize]
-        public JsonResult StudyList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Other = new Dictionary<string, object>();
-            List<Dictionary<string, object>> dataList = StudyListDo(value, out Other);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
-        }
-        public List<Dictionary<string, object>> StudyListDo(string value, out Dictionary<string, object> Other)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int ColId = int.Parse(data["ColId"].ToString());//菜单Id
-            int UserId = int.Parse(data["UserId"].ToString());//创客Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            var time = DateTime.Now.AddDays(-3);
-            Models.WebCMSEntities db = new Models.WebCMSEntities();
-            var query = db.Col.FirstOrDefault(m => m.Status > -1 && m.Id == ColId) ?? new Models.Col();
-            var userInfo = maindb.UserCardRecord.FirstOrDefault(m => m.Id == UserId) ?? new UserCardRecord();
-            var auth = query.ColId;
-            var IsAuth = 0;
-            if (query.Recommend == 0)
-            {
-                if (userInfo.Id > 0)
-                {
-                    if (userInfo.SeoDescription.Contains(auth))
-                    {
-                        IsAuth = 1;
-                    }
-                }
-            }
-            else
-            {
-                IsAuth = 1;
-            }
-
-            var mydata = maindb.SchoolMakerStudy.Where(m => m.Status > -1 && m.SeoKeyword.Contains(query.ColId));
-            mydata = mydata.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                mydata = mydata.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                mydata = mydata.Skip(skipNum).Take(PageSize);
-            }
-            var IsUpdate = 0;
-            var IsFrst = 0;
-            foreach (var subdata in mydata.ToList())
-            {
-                IsUpdate += 1;
-                var check = mydata.Any(m => m.Id == subdata.Id && m.CreateDate >= time);
-                if (check)
-                {
-                    IsFrst = 1;
-                }
-                if (IsUpdate == 1 && IsFrst == 1)
-                {
-                    IsUpdate = 1;
-                }
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Title", subdata.Title); //标题
-                curData.Add("Detail", subdata.Detail); //介绍
-                curData.Add("Lecturer", subdata.SeoTitle); //主讲人
-                curData.Add("ListPic", StudyOrMeetDefaultPic(subdata.ListPic)); //列表图片
-                curData.Add("Url", subdata.Url); //外链
-                curData.Add("StudyPerson", subdata.QueryCount); //观看次数
-                curData.Add("IsUpdate", IsUpdate == 1 ? 1 : 0); //是否最新 1 是 0 否
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            Other = new Dictionary<string, object>();
-            Other.Add("IsAuth", IsAuth);//1 是 0 否
-            Other.Add("Info", "暂无观看权限");
-
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 130
Areas/Api/Controllers/v1/School/SchoolMaterialsController.cs

@@ -1,130 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolMaterialsController : BaseController
-    {
-        public SchoolMaterialsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-推广素材
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<SchoolMaterials> query = maindb.SchoolMaterials.Where(m => m.Status > 0);
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("UserId", subdata.UserId); //创客
-                Dictionary<string, object> UserInfo = new Dictionary<string, object>();
-                Users UsersData = maindb.Users.FirstOrDefault(m => m.Id == subdata.UserId) ?? new Users();
-                UserInfo.Add("HeadPhoto", UsersData.HeadPhoto); //头像
-                UserInfo.Add("MakerCode", UsersData.MakerCode); //创客编号
-                curData.Add("UserInfo", UserInfo);
-
-                curData.Add("TextDetail", subdata.TextDetail); //文字描述
-                curData.Add("Pic", SourceHost + subdata.Pic); //图片
-                curData.Add("Url", subdata.Url); //链接地址
-                curData.Add("UrlParam", subdata.UrlParam); //链接参数
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("ShareCount", ""); //分享数
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 商学院-推广素材分享
-        [Authorize]
-        public JsonResult AddShareCount(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddShareCountDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson AddShareCountDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SchoolMaterials query = new SchoolMaterials();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            query = maindb.SchoolMaterials.FirstOrDefault(m => m.Id == Id);
-            if (query != null)
-            {
-                query.UpdateDate = DateTime.Now; //修改时间
-                maindb.SaveChanges();
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 127
Areas/Api/Controllers/v1/School/SchoolMorningMeetController.cs

@@ -1,127 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolMorningMeetController : BaseController
-    {
-        public SchoolMorningMeetController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-每日晨会
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
-            string Month = data["Month"].ToString(); //月份
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<SchoolMorningMeet> query = maindb.SchoolMorningMeet.Where(m => m.Status > -1);
-            DateTime start = DateTime.Parse(Month.Substring(0, 4) + "-" + Month.Substring(4, 2) + "-01 00:00:00");
-            DateTime end = start.AddMonths(1);
-            var s = function.ConvertDateTimeInt(start) / 60;
-            var e = function.ConvertDateTimeInt(end) / 60;
-
-            if (!string.IsNullOrEmpty(data["Month"].ToString()))
-            {
-                query = query.Where(m => m.Sort >= s && m.QueryCount < e);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                int IsStudy = 0;
-                var Info = maindb.SchoolMorningMeetLog.FirstOrDefault(m => m.MeetId == subdata.Id && m.UserId == UserId);
-                if (Info != null)
-                {
-                    IsStudy = 1;
-                }
-
-                var starts = subdata.Sort;
-                var ends = subdata.QueryCount;
-                long StartDate = (long)starts * 60000L;
-                long EndDate = (long)ends * 60000L;
-
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("Title", subdata.Title); //标题
-                curData.Add("Contents", subdata.Contents); //内容
-                curData.Add("StartDate", StartDate); //开始时间
-                curData.Add("EndDate", EndDate); //结束时间
-                curData.Add("Lecturer", subdata.Lecturer); //主讲
-                curData.Add("Photo", StudyOrMeetDefaultPic(subdata.Photo)); //照片
-                curData.Add("StudyPerson", subdata.StudyPerson); //学习人数
-                curData.Add("Url", subdata.Url); //APP外链
-                curData.Add("XCXId", subdata.SeoTitle); //小程序外链Id
-                curData.Add("XCXUrl", subdata.SeoKeyword); //小程序外链
-                curData.Add("Again", subdata.SeoDescription); //再次观看路径
-                curData.Add("IsStudy", IsStudy); //是否学习
-                curData.Add("Id", subdata.Id); //Id
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("MM-dd")); //CreateDate
-                dataList.Add(curData);
-
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 112
Areas/Api/Controllers/v1/School/SchoolMorningMeetLogController.cs

@@ -1,112 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolMorningMeetLogController : BaseController
-    {
-        public SchoolMorningMeetLogController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-每日晨会确认加入
-        [Authorize]
-        public JsonResult Add(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson AddDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int MeetId = int.Parse(function.CheckInt(data["MeetId"].ToString())); //晨会
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SchoolMorningMeetLog query = maindb.SchoolMorningMeetLog.Add(new SchoolMorningMeetLog()
-            {
-                CreateDate = DateTime.Now, //创建时间
-                MeetId = MeetId, //晨会
-                UserId = UserId, //创客
-            }).Entity;
-            maindb.SaveChanges();
-            Obj.Add("Id", query.Id); //Id
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-        #region 商学院-每日晨会次数添加
-        [Authorize]
-        public JsonResult AddTimes(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = AddTimesDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson AddTimesDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int ParentId = int.Parse(function.CheckInt(data["ParentId"].ToString())); //Id
-            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString())); //类型(1 晨会 2 学堂)
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            if (Kind == 1)
-            {
-                var query = maindb.SchoolMorningMeet.FirstOrDefault(m => m.Id == ParentId);
-                query.StudyPerson += 1;
-                maindb.SaveChanges();
-            }
-            if (Kind == 2)
-            {
-                var query = maindb.SchoolMakerStudy.FirstOrDefault(m => m.Id == ParentId);
-                query.QueryCount += 1;
-                maindb.SaveChanges();
-            }
-
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 104
Areas/Api/Controllers/v1/School/SchoolSignInDataController.cs

@@ -1,104 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolSignInDataController : Controllers.BaseController
-    {
-        public SchoolSignInDataController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-签到主界面数据
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SchoolSignInData query = new SchoolSignInData();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            query = maindb.SchoolSignInData.FirstOrDefault(m => m.Id == Id) ?? new SchoolSignInData();
-            Obj.Add("TotalDays", query.TotalDays); //当月签到天数
-            Obj.Add("ContinueDays", query.ContinueDays); //连续签到天数
-            Obj.Add("RingFlag", query.RingFlag); //签到提醒
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 商学院-签到提醒打开
-        [Authorize]
-        public JsonResult SetRing(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = SetRingDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson SetRingDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            ulong RingFlag = ulong.Parse(data["RingFlag"].ToString()); //签到提醒
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SchoolSignInData query = new SchoolSignInData();
-            int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            query = maindb.SchoolSignInData.FirstOrDefault(m => m.Id == Id);
-            if (query != null)
-            {
-                query.UpdateDate = DateTime.Now; //修改时间
-                query.RingFlag = RingFlag; //签到提醒
-                maindb.SaveChanges();
-            }
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 103
Areas/Api/Controllers/v1/School/SchoolSignInRecordController.cs

@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolSignInRecordController : BaseController
-    {
-        public SchoolSignInRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-签到记录
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string Month = data["Month"].ToString(); //月份
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-
-            var a = Month.Substring(0, 3);
-            var b = Month.Substring(Month.Length - 2);
-            var time = a + "-" + b;
-            DateTime start = DateTime.Parse(time + "-01 00:00:00");
-            DateTime end = start.AddMonths(1);
-
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<SchoolSignInRecord> query = maindb.SchoolSignInRecord.Where(m => m.Status > -1 && m.CreateDate >= start && m.CreateDate < end);
-            if (!string.IsNullOrEmpty(data["UserId"].ToString()))
-            {
-                query = query.Where(m => m.UserId == UserId);
-            }
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 96
Areas/Api/Controllers/v1/School/SchoolSignInTaskController.cs

@@ -1,96 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolSignInTaskController : BaseController
-    {
-        public SchoolSignInTaskController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-签到任务列表
-        [Authorize]
-        public JsonResult List(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = ListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> ListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            IQueryable<SchoolSignInTask> query = maindb.SchoolSignInTask.Where(m => m.Status > 0);
-            int TotalCount = query.Count();
-            query = query.OrderByDescending(m => m.Sort).ThenByDescending(m => m.Id);
-            if (PageNum == 1)
-            {
-                query = query.Take(PageSize);
-            }
-            else
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                query = query.Skip(skipNum).Take(PageSize);
-            }
-            var mydata = query.ToList();
-            foreach (var subdata in mydata)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TaskName", subdata.TaskName); //任务名称
-                curData.Add("Details", subdata.Details); //简介
-                curData.Add("ListPic", SourceHost + subdata.ListPic); //图标
-                curData.Add("Url", subdata.Url); //跳转链接
-                curData.Add("UrlParam", subdata.UrlParam); //跳转参数
-                curData.Add("Recommend", subdata.Recommend); //推荐
-                curData.Add("Id", subdata.Id); //Id
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 80
Areas/Api/Controllers/v1/School/SchoolSignInTaskRecordController.cs

@@ -1,80 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v1
-{
-    [Area("Api")]
-    [Route("Api/v1/[controller]/[action]")]
-    public class SchoolSignInTaskRecordController : BaseController
-    {
-        public SchoolSignInTaskRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-        }
-
-
-
-
-        #region 商学院-任务完成提交
-        [Authorize]
-        public JsonResult FinishPost(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            AppResultJson result = FinishPostDo(value);
-            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
-        }
-        public AppResultJson FinishPostDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int TaskId = int.Parse(function.CheckInt(data["TaskId"].ToString())); //任务
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            SchoolSignInTaskRecord query = new SchoolSignInTaskRecord();
-            query = maindb.SchoolSignInTaskRecord.Add(new SchoolSignInTaskRecord()
-            {
-                CreateDate = DateTime.Now, //创建时间
-                UpdateDate = DateTime.Now, //修改时间
-                UserId = UserId, //创客
-                TaskId = TaskId, //任务
-            }).Entity;
-            maindb.SaveChanges();
-            return new AppResultJson() { Status = "1", Info = "", Data = Obj };
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 179
Areas/Api/Controllers/v2/TradeDaySummaryController.cs

@@ -1,179 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v2
-{
-    [Area("Api")]
-    [Route("Api/v2/[controller]/[action]")]
-    public class TradeDaySummaryController : BaseController
-    {
-        public TradeDaySummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        //数据库链接
-        public string StatConn = Library.ConfigurationManager.AppSettings["TSqlConnStr"].ToString();
-
-
-        #region 创客-首页-交易分析-交易明细
-        [Authorize]
-        public JsonResult Detail(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = DetailDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> DetailDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //品牌
-            string TradeMonthOrDate = data["TradeMonthOrDate"].ToString(); //月份或日期
-            string Kind = data["Kind"].ToString(); //类别
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-
-            List<TradeDaySummary> query = new List<TradeDaySummary>();
-            DataTable dt = new DataTable();
-
-            //扶持期
-            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;
-
-            //盈利期
-            decimal TotalAmtyl = 0;
-            decimal DAmtyl = 0;
-            decimal JAmtyl = 0;
-            decimal JfAmtyl = 0;
-            int JCountyl = 0;
-            decimal YAmtyl = 0;
-
-            if (Kind == "team")
-            {
-                dt = CustomerSqlConn.dtable("SELECT SUM(HelpTradeAmount) TotalAmtfc, SUM(HelpCreditTradeAmount) DAmtfc, SUM(HelpDebitNotCapTradeAmount) JAmtfc, SUM(HelpDebitCapTradeAmount) JfAmtfc, SUM(HelpDebitCapTradeCount) JCountfc, SUM(HelpQrTradeAmount) YAmtfc, SUM(NotHelpTradeAmount) TotalAmtwd, SUM(NotHelpCreditTradeAmount) DAmtwd, SUM(NotHelpDebitNotCapTradeAmount) JAmtwd, SUM(NotHelpDebitCapTradeAmount) JfAmtwd, SUM(NotHelpDebitCapTradeCount) JCountwd, SUM(NotHelpQrTradeAmount) YAmtwd, SUM(ProfitTradeAmount) TotalAmtyl, SUM(ProfitCreditTradeAmount) DAmtyl, SUM(ProfitDebitNotCapTradeAmount) JAmtyl, SUM(ProfitDebitCapTradeAmount) JfAmtyl, SUM(ProfitDebitCapTradeCount) JCountyl, SUM(ProfitQrTradeAmount) YAmtyl FROM TradeStat" + TradeMonthOrDate + " WHERE UserId=" + UserId + " AND DirectFlag=0 AND BrandId=" + BrandId + "", StatConn);
-                if (dt.Rows.Count > 0)
-                {
-                    TotalAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["TotalAmtfc"].ToString()));
-                    DAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["DAmtfc"].ToString()));
-                    JAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["JAmtfc"].ToString()));
-                    JfAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["JfAmtfc"].ToString()));
-                    JCountfc = int.Parse(function.CheckInt(dt.Rows[0]["JCountfc"].ToString()));
-                    YAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["YAmtfc"].ToString()));
-
-                    TotalAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["TotalAmtwd"].ToString()));
-                    DAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["DAmtwd"].ToString()));
-                    JAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["JAmtwd"].ToString()));
-                    JfAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["JfAmtwd"].ToString()));
-                    JCountwd = int.Parse(function.CheckInt(dt.Rows[0]["JCountwd"].ToString()));
-                    YAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["YAmtwd"].ToString()));
-
-                    TotalAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["TotalAmtyl"].ToString()));
-                    DAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["DAmtyl"].ToString()));
-                    JAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["JAmtyl"].ToString()));
-                    JfAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["JfAmtyl"].ToString()));
-                    JCountyl = int.Parse(function.CheckInt(dt.Rows[0]["JCountyl"].ToString()));
-                    YAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["YAmtyl"].ToString()));
-                }
-            }
-            else
-            {
-                dt = CustomerSqlConn.dtable("SELECT SUM(HelpTradeAmount) TotalAmtfc, SUM(HelpCreditTradeAmount) DAmtfc, SUM(HelpDebitNotCapTradeAmount) JAmtfc, SUM(HelpDebitCapTradeAmount) JfAmtfc, SUM(HelpDebitCapTradeCount) JCountfc, SUM(HelpQrTradeAmount) YAmtfc, SUM(NotHelpTradeAmount) TotalAmtwd, SUM(NotHelpCreditTradeAmount) DAmtwd, SUM(NotHelpDebitNotCapTradeAmount) JAmtwd, SUM(NotHelpDebitCapTradeAmount) JfAmtwd, SUM(NotHelpDebitCapTradeCount) JCountwd, SUM(NotHelpQrTradeAmount) YAmtwd, SUM(ProfitTradeAmount) TotalAmtyl, SUM(ProfitCreditTradeAmount) DAmtyl, SUM(ProfitDebitNotCapTradeAmount) JAmtyl, SUM(ProfitDebitCapTradeAmount) JfAmtyl, SUM(ProfitDebitCapTradeCount) JCountyl, SUM(ProfitQrTradeAmount) YAmtyl FROM TradeStat" + TradeMonthOrDate + " WHERE UserId=" + UserId + " AND DirectFlag=1 AND BrandId=" + BrandId + "", StatConn);
-                if (dt.Rows.Count > 0)
-                {
-                    TotalAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["TotalAmtfc"].ToString()));
-                    DAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["DAmtfc"].ToString()));
-                    JAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["JAmtfc"].ToString()));
-                    JfAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["JfAmtfc"].ToString()));
-                    JCountfc = int.Parse(function.CheckInt(dt.Rows[0]["JCountfc"].ToString()));
-                    YAmtfc = decimal.Parse(function.CheckNum(dt.Rows[0]["YAmtfc"].ToString()));
-
-                    TotalAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["TotalAmtwd"].ToString()));
-                    DAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["DAmtwd"].ToString()));
-                    JAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["JAmtwd"].ToString()));
-                    JfAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["JfAmtwd"].ToString()));
-                    JCountwd = int.Parse(function.CheckInt(dt.Rows[0]["JCountwd"].ToString()));
-                    YAmtwd = decimal.Parse(function.CheckNum(dt.Rows[0]["YAmtwd"].ToString()));
-
-                    TotalAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["TotalAmtyl"].ToString()));
-                    DAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["DAmtyl"].ToString()));
-                    JAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["JAmtyl"].ToString()));
-                    JfAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["JfAmtyl"].ToString()));
-                    JCountyl = int.Parse(function.CheckInt(dt.Rows[0]["JCountyl"].ToString()));
-                    YAmtyl = decimal.Parse(function.CheckNum(dt.Rows[0]["YAmtyl"].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("TotalAmtyl", TotalAmtyl); //刷卡交易总额(盈利期)
-            Obj.Add("DAmtyl", DAmtyl); //贷记卡交易额(盈利期)  
-            Obj.Add("JAmtyl", JAmtyl); //借记卡交易总额(盈利期)
-            Obj.Add("JfAmtyl", JfAmtyl); //借记卡封顶交易额(盈利期)
-            Obj.Add("JCountyl", JCountyl); //借记卡封顶笔数(盈利期)
-            Obj.Add("YAmtyl", YAmtyl); //云闪付小额交易额(盈利期) 
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 581
Areas/Api/Controllers/v2/UserTradeDaySummaryController.cs

@@ -1,581 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Data;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using Microsoft.AspNetCore.Authorization;
-
-using System.Web;
-using MySystem.MainModels;
-using LitJson;
-using Library;
-
-namespace MySystem.Areas.Api.Controllers.v2
-{
-    [Area("Api")]
-    [Route("Api/v2/[controller]/[action]")]
-    public class UserTradeDaySummaryController : BaseController
-    {
-        public UserTradeDaySummaryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        //数据库链接
-        public string StatConn = Library.ConfigurationManager.AppSettings["TSqlConnStr"].ToString();
-
-
-        #region 首页-本月团队业绩
-        [Authorize]
-        public JsonResult ThisMonth(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = ThisMonthDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> ThisMonthDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            string Month = DateTime.Now.ToString("yyyyMM");
-            if (DateTime.Now.Day == 1)
-            {
-                Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
-            }
-            decimal HelpAmount = 0;
-            DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + Month + " WHERE UserId=" + UserId + " AND DirectFlag=0", StatConn);
-            if (dt.Rows.Count > 0)
-            {
-                HelpAmount = decimal.Parse(function.CheckNum(dt.Rows[0]["HelpAmount"].ToString()));
-                Obj.Add("HelpAmount", HelpAmount); //助利宝交易额
-            }
-            Obj.Add("DirectTradeAmt", UserTradeDaySummaryVsDbconn.Instance.GetMonthTrade(UserId, Month, "team") + HelpAmount); //团队交易总额
-            Obj.Add("DirectDebitCapNum", UserDataDbconn.Instance.GetTeamPosActCount(UserId, Month)); //直营激活商户数
-            Obj.Add("AddCount", UsersDbconn.Instance.GetTeamNewUserCount(UserId, Month)); //新增创客数
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩
-        [Authorize]
-        public JsonResult PersonalPerformance(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = PersonalPerformanceDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> PersonalPerformanceDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            decimal HelpAmount = 0;
-            DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + TradeMonth + " WHERE UserId=" + UserId + " AND DirectFlag=1", StatConn);
-            foreach (DataRow item in dt.Rows)
-            {
-                HelpAmount = decimal.Parse(function.CheckNum(item["HelpAmount"].ToString()));
-                Obj.Add("HelpAmount", HelpAmount); //助利宝交易额
-            }
-            Obj.Add("TotalAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTrade(UserId, TradeMonth) + HelpAmount); //总交易
-            Obj.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TotalAmount:Active:" + UserId + ":" + TradeMonth)); //总活动交易
-            Obj.Add("TotalUnActiveAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, TradeMonth, 0, 0)); //Pos借记卡交易额
-            Obj.Add("TotalUser", UsersDbconn.Instance.GetNewUserCount(UserId)); //累计总创客
-            Obj.Add("TotalActMerchant", RedisDbconn.Instance.Get<int>("ActMerchantCount:" + UserId + ":" + TradeMonth)); //累计激活商户
-            Obj.Add("TotalWeChatOrder", RedisDbconn.Instance.Get<int>("TotalOrder:WeChat:" + UserId + ":" + TradeMonth)); //微信订单数
-            Obj.Add("TotalAlipayOrder", RedisDbconn.Instance.Get<int>("TotalOrder:Alipay:" + UserId + ":" + TradeMonth)); //支付宝订单数
-
-            Obj.Add("TotalPosAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, TradeMonth, 0, 1)); //Pos贷记卡交易额
-            Obj.Add("TotalCloudPayAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 1)); //云闪付小额交易额
-            Obj.Add("AddUser", UsersDbconn.Instance.GetNewUserCount(UserId, TradeMonth)); //新增创客
-            Obj.Add("TotalPosMerchant", UserDataDbconn.Instance.GetPosActCount(UserId)); //累计激活POS机商户
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩-服务费明细
-        [Authorize]
-        public JsonResult PersonalServiceProfit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalServiceProfitDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalServiceProfitDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeDate = data["TradeDate"].ToString(); //交易日
-            string PayMode = data["PayMode"].ToString(); //支付方式
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserTradeDaySummary> query = RedisDbconn.Instance.GetList<UserTradeDaySummary>("UserTradeDaySummary", PageNum, PageSize);
-            if (!string.IsNullOrEmpty(data["UserId"].ToString()))
-            {
-                query = query.Where(m => m.UserId == UserId).ToList();
-            }
-            if (!string.IsNullOrEmpty(data["TradeDate"].ToString()))
-            {
-                query = query.Where(m => m.TradeDate == TradeDate).ToList();
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("PayMode", ""); //支付方式
-                curData.Add("ServiceProfit", ""); //服务费分润
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩-每月明细
-        [Authorize]
-        public JsonResult PersonalPerformanceForDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalPerformanceForDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalPerformanceForDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddMonths(1).AddDays(-1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                // if (date.ToString("yyyyMMdd") != start.ToString("yyyyMMdd"))
-                // {
-                string Date = date.ToString("yyyyMMdd");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                decimal HelpAmount = 0;
-                DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + TradeMonth + " WHERE UserId=" + UserId + " AND DirectFlag=1", StatConn);
-                foreach (DataRow item in dt.Rows)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(item["HelpAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeDate", date.ToString("yyyy-MM-dd")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTrade(UserId, Date) + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TotalAmount:Active:" + UserId + ":" + Date)); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForClouds(UserId, Date, 0, 0)); //Pos借记卡交易额
-                curData.Add("TotalPosAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForClouds(UserId, Date, 0, 1)); //Pos贷记卡交易额
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForCloud(UserId, Date, 1)); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForBrand(UserId, Date, sub.Id);
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-                // }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-个人业绩-近半年
-        [Authorize]
-        public JsonResult PersonalPerformanceHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = PersonalPerformanceHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> PersonalPerformanceHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                var month = Month.ToString("yyyyMM");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                decimal HelpAmount = 0;
-                DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + Month + " WHERE UserId=" + UserId + " AND DirectFlag=1", StatConn);
-                if (dt.Rows.Count > 0)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(dt.Rows[0]["HelpAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTrade(UserId, Month.ToString("yyyyMM")) + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TotalAmount:Active:" + UserId + ":" + Month.ToString("yyyyMM"))); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, Month.ToString("yyyyMM"), 0, 0)); //Pos借记卡交易额
-                curData.Add("TotalPosAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, Month.ToString("yyyyMM"), 0, 1)); //Pos贷记卡交易额
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 1)); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForBrand(UserId, Month.ToString("yyyyMM"), sub.Id);
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩
-        [Authorize]
-        public JsonResult TeamPerformance(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            Dictionary<string, object> Obj = TeamPerformanceDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
-        }
-        public Dictionary<string, object> TeamPerformanceDo(string value)
-        {
-            // TODO:每月1号显示上月数据,2号显示本月数据
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            Dictionary<string, object> Obj = new Dictionary<string, object>();
-            decimal HelpAmount = 0;
-            DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + TradeMonth + " WHERE UserId=" + UserId + " AND DirectFlag=0", StatConn);
-            if (dt.Rows.Count > 0)
-            {
-                HelpAmount = decimal.Parse(function.CheckNum(dt.Rows[0]["HelpAmount"].ToString()));
-                Obj.Add("HelpAmount", HelpAmount); //助利宝交易额
-            }
-            Obj.Add("TotalAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTrade(UserId, TradeMonth, "team") + HelpAmount); //总交易
-            Obj.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TeamTotalAmount:Active:" + UserId + ":" + TradeMonth)); //总活动交易
-            Obj.Add("TotalUnActiveAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, TradeMonth, 0, 0, "team")); //Pos借记卡交易额
-            Obj.Add("TotalUser", UsersDbconn.Instance.GetTeamNewUserCount(UserId)); //累计总创客
-            Obj.Add("TotalActMerchant", RedisDbconn.Instance.Get<int>("TeamActMerchantCount:" + UserId + ":" + TradeMonth)); //累计激活商户
-            Obj.Add("TotalWeChatOrder", RedisDbconn.Instance.Get<int>("TeamTotalOrder:WeChat:" + UserId + ":" + TradeMonth)); //微信订单数
-            Obj.Add("TotalAlipayOrder", RedisDbconn.Instance.Get<int>("TeamTotalOrder:Alipay:" + UserId + ":" + TradeMonth)); //支付宝订单数
-
-            Obj.Add("TotalPosAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, TradeMonth, 0, 1, "team")); //Pos贷记卡交易额
-            Obj.Add("TotalCloudPayAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForCloud(UserId, TradeMonth, 1, "team")); //云闪付小额交易额
-            Obj.Add("AddUser", UsersDbconn.Instance.GetTeamNewUserCount(UserId, TradeMonth)); //新增创客
-            Obj.Add("TotalPosMerchant", UserDataDbconn.Instance.GetTeamPosActCount(UserId)); //累计激活POS机商户
-
-            return Obj;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩-服务费明细
-        [Authorize]
-        public JsonResult TeamServiceProfit(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamServiceProfitDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamServiceProfitDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeDate = data["TradeDate"].ToString(); //交易日
-            string PayMode = data["PayMode"].ToString(); //支付方式
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserTradeDaySummary> query = RedisDbconn.Instance.GetList<UserTradeDaySummary>("UserTradeDaySummary", PageNum, PageSize);
-            if (!string.IsNullOrEmpty(data["UserId"].ToString()))
-            {
-                query = query.Where(m => m.UserId == UserId).ToList();
-            }
-            if (!string.IsNullOrEmpty(data["TradeDate"].ToString()))
-            {
-                query = query.Where(m => m.TradeDate == TradeDate).ToList();
-            }
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("CreateDate", subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //CreateDate
-                curData.Add("PayMode", ""); //支付方式
-                curData.Add("ServiceProfit", ""); //服务费分润
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩-每月明细
-        [Authorize]
-        public JsonResult TeamPerformanceForDay(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceForDayDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceForDayDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
-            if (DateTime.Now.ToString("yyyyMM") != TradeMonth)
-            {
-                start = DateTime.Parse(TradeMonth.Substring(0, 4) + "-" + TradeMonth.Substring(4, 2) + "-01 00:00:00").AddMonths(1).AddDays(-1);
-            }
-            if (PageNum > 1)
-            {
-                int skipNum = PageSize * (PageNum - 1);
-                start = start.AddDays(-skipNum);
-            }
-            for (int i = 0; i < PageSize; i++)
-            {
-                DateTime date = start.AddDays(-i);
-                // if (date.ToString("yyyyMMdd") != start.ToString("yyyyMMdd"))
-                // {
-                string Date = date.ToString("yyyyMMdd");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-
-                decimal HelpAmount = 0;
-                DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + TradeMonth + " WHERE UserId=" + UserId + " AND DirectFlag=0", StatConn);
-                if (dt.Rows.Count > 0)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(dt.Rows[0]["HelpAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeDate", date.ToString("yyyy-MM-dd")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTrade(UserId, Date, "team") + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TeamTotalAmount:Active:" + UserId + ":" + Date)); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForClouds(UserId, Date, 0, 0, "team")); //Pos借记卡交易额
-                curData.Add("TotalPosAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForClouds(UserId, Date, 0, 1, "team")); //Pos贷记卡交易额
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForCloud(UserId, Date, 1, "team")); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryVsDbconn.Instance.GetDateTradeForBrand(UserId, Date, sub.Id, "team");
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //交易额
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-                // }
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-交易分析-团队业绩-近半年
-        [Authorize]
-        public JsonResult TeamPerformanceHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = TeamPerformanceHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> TeamPerformanceHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            for (int i = 0; i < 6; i++)
-            {
-                DateTime Month = DateTime.Now.AddMonths(-i);
-                var month = Month.ToString("yyyyMM");
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                decimal HelpAmount = 0;
-                DataTable dt = CustomerSqlConn.dtable("SELECT SUM(TradeAmount) HelpAmount FROM ProfitTradeStat" + month + " WHERE UserId=" + UserId + " AND DirectFlag=0", StatConn);
-                if (dt.Rows.Count > 0)
-                {
-                    HelpAmount = decimal.Parse(function.CheckNum(dt.Rows[0]["HelpAmount"].ToString()));
-                    curData.Add("HelpAmount", HelpAmount); //助利宝交易额
-                }
-                curData.Add("TradeMonth", Month.ToString("yyyy-MM")); //交易月份
-                curData.Add("TradeAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTrade(UserId, Month.ToString("yyyyMM"), "team") + HelpAmount); //总交易额
-                curData.Add("TotalActiveAmount", RedisDbconn.Instance.Get<decimal>("TeamTotalAmount:Active:" + UserId + ":" + Month.ToString("yyyyMM"))); //码牌活动交易
-                curData.Add("TotalUnActiveAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, Month.ToString("yyyyMM"), 0, 0, "team")); //Pos借记卡交易额
-                curData.Add("TotalPosAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForClouds(UserId, Month.ToString("yyyyMM"), 0, 1, "team")); //Pos贷记卡交易额
-                curData.Add("TotalCloudPayAmount", UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForCloud(UserId, Month.ToString("yyyyMM"), 1, "team")); //云闪付小额交易
-
-                List<Dictionary<string, object>> ProductList = new List<Dictionary<string, object>>();
-                List<KqProducts> list = RedisDbconn.Instance.GetList<KqProducts>("KqProducts", 1, 100);
-                foreach (KqProducts sub in list)
-                {
-                    decimal Amount = UserTradeDaySummaryVsDbconn.Instance.GetMonthTradeForBrand(UserId, Month.ToString("yyyyMM"), sub.Id, "team");
-                    if (Amount > 0)
-                    {
-                        Dictionary<string, object> item = new Dictionary<string, object>();
-                        item.Add("Id", sub.Id); //产品Id
-                        item.Add("Name", sub.Name); //名称
-                        item.Add("Amount", Amount); //名称
-                        ProductList.Add(item);
-                    }
-                }
-                curData.Add("ProductList", ProductList); //产品列表
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-我的商户-商户详情-交易统计
-        [Authorize]
-        public JsonResult MerchantTradeList(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = MerchantTradeListDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> MerchantTradeListDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string TradeMonth = data["TradeMonth"].ToString(); //交易月
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<string> query = RedisDbconn.Instance.GetList<string>("MerchantTradeList:" + MerchantId + ":" + TradeMonth, PageNum, PageSize);
-            foreach (string DateString in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeDate", DateString); //交易日
-                curData.Add("TradeAmt", RedisDbconn.Instance.Get<decimal>("MerchantTradeAmount:" + MerchantId + ":" + DateString)); //交易额
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 创客-首页-我的商户-商户详情-交易统计-近半年
-        [Authorize]
-        public JsonResult MerchantTradeListForHalfYear(string value)
-        {
-            value = DesDecrypt(value);
-            JsonData data = JsonMapper.ToObject(value);
-            List<Dictionary<string, object>> dataList = MerchantTradeListForHalfYearDo(value);
-            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
-        }
-        public List<Dictionary<string, object>> MerchantTradeListForHalfYearDo(string value)
-        {
-            JsonData data = JsonMapper.ToObject(value);
-            string MerchantId = data["MerchantId"].ToString(); //商户Id
-            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
-            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
-            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<UserTradeDaySummary> query = RedisDbconn.Instance.GetList<UserTradeDaySummary>("UserTradeDaySummary", PageNum, PageSize);
-            foreach (var subdata in query)
-            {
-                Dictionary<string, object> curData = new Dictionary<string, object>();
-                curData.Add("TradeMonth", subdata.TradeMonth); //交易月
-                curData.Add("TradeAmt", ""); //交易额
-                curData.Add("TradeCount", ""); //交易数
-                dataList.Add(curData);
-            }
-            return dataList;
-        }
-        #endregion
-
-
-
-        #region 检查签名是否合法,合法返回1,不合法返回提示信息
-
-        /// <summary>
-        /// 检查签名是否合法,合法返回1,不合法返回提示信息
-        /// </summary>
-        /// <param name="value">请求的参数(json字符串)</param>
-        /// <param name="signField">要签名的字段</param>
-        /// <returns></returns>
-        private string CheckSign(string value, string[] signField)
-        {
-            JsonData json = JsonMapper.ToObject(value);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            for (int i = 0; i < signField.Length; i++)
-            {
-                dic.Add(signField[i], json[signField[i]].ToString());
-            }
-            string sign = json["sign"].ToString(); //客户端签名字符串
-            return new Sign().sign(dic, sign);
-        }
-
-        #endregion
-
-    }
-}
-

+ 9 - 11
appsettings.json

@@ -9,16 +9,14 @@
   "AllowedHosts": "*",
   "Setting": {
     "ConnectionStrings": "",
-    "Host": "http://localhost:5045/",
-    "SourceHost": "http://localhost:5045/",
-    "OssHost": "http://oss.kexiaoshuang.com",
-    "QrCodeHost": "http://localhost:5045/",
+    "Host": "http://localhost:5301/",
+    "SourceHost": "http://localhost:5301/",
+    "OssHost": "http://oss.qrcodeplate.com",
+    "QrCodeHost": "http://localhost:5301/",
     "Database": "ApServer",
-    "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
-    "TSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=mzeqjriUWore0dwT;database=KxsStatServer;charset=utf8;",
-    "BsSqlConnStr": "server=47.109.31.237;port=3306;user=KxsBsServer;password=wyA1bEhi6aAkN8SB;database=KxsBsServer;charset=utf8;",
-    "OpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsOpServer;password=r7jwZ8ydLoeswDR4;database=KxsOpServer;charset=utf8;",
-    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
+    "SqlConnStr": "server=47.109.31.237;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer;charset=utf8;",
+    "BsSqlConnStr": "server=47.109.31.237;port=3306;user=QrCodePlateBsServer;password=ld5Px33wvhyEz44P;database=QrCodePlateBsServer;charset=utf8;",
+    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=4,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "",
@@ -31,8 +29,8 @@
     "JwtAud": "api",
     "MqUserName": "skb@rabbitmq",
     "MqPassword": "skb@rabbitmq",
-    "MqHostName": "47.108.231.170:5672,47.108.225.92:5672",
-    "MqOneHostName": "47.108.225.92",
+    "MqHostName": "47.109.31.237:5672,47.109.31.237:5672",
+    "MqOneHostName": "47.109.31.237",
     "MqOnePort": "5672"
   }
 }