浏览代码

机具补录根据月份限制sp交易记录Id,admin账号补录不受30天时间限制

lichunlei 3 年之前
父节点
当前提交
c9670c0411
共有 1 个文件被更改,包括 6 次插入12 次删除
  1. 6 12
      Areas/Admin/Controllers/MainServer/SysToolsController.cs

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

@@ -150,11 +150,8 @@ namespace MySystem.Areas.Admin.Controllers
             bool check = spdb.TradeRecord.Any(m => m.TradeSnNo == pos.PosSn);
             if (check)
             {
-                string SpTradeRecordId = function.ReadInstance("/PublicParams/SpTradeRecordId.txt");
-                if(string.IsNullOrEmpty(SpTradeRecordId))
-                {
-                    SpTradeRecordId = "2780299";
-                }
+                string BindingTime = pos.BindingTime == null ? DateTime.Now.AddMonths(-1).ToString("yyyyMM") : pos.BindingTime.Value.ToString("yyyyMM");
+                string SpTradeRecordId = function.ReadInstance("/PublicParams/SpTradeRecordId" + BindingTime + ".txt");
                 int StartId = int.Parse(function.CheckInt(SpTradeRecordId));
                 if (pos.BrandId == 1)
                 {
@@ -231,7 +228,7 @@ namespace MySystem.Areas.Admin.Controllers
                 if (pos.BindingTime != null && pos.ActivationTime != null)
                 {
                     TimeSpan ts = pos.ActivationTime.Value - pos.BindingTime.Value;
-                    if (ts.TotalDays > 30)
+                    if (ts.TotalDays > 30 && SysUserName != "admin")
                     {
                         return "机具划拨后已超过30天";
                     }
@@ -275,7 +272,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
             pos.UserId = user.Id;
             pos.BuyUserId = user.Id;
-            if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && pos.BindingTime > DateTime.Now.AddDays(-30))
+            if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && (pos.BindingTime > DateTime.Now.AddDays(-30) || SysUserName == "admin"))
             {
                 // pos.IsPurchase = 0;
                 pos.ActivationState = 1;
@@ -406,11 +403,8 @@ namespace MySystem.Areas.Admin.Controllers
             bool check = spdb.TradeRecord.Any(m => m.TradeSnNo == pos.PosSn);
             if (check)
             {
-                string SpTradeRecordId = function.ReadInstance("/PublicParams/SpTradeRecordId.txt");
-                if(string.IsNullOrEmpty(SpTradeRecordId))
-                {
-                    SpTradeRecordId = "2780299";
-                }
+                string BindingTime = pos.BindingTime == null ? DateTime.Now.AddMonths(-1).ToString("yyyyMM") : pos.BindingTime.Value.ToString("yyyyMM");
+                string SpTradeRecordId = function.ReadInstance("/PublicParams/SpTradeRecordId" + BindingTime + ".txt");
                 int StartId = int.Parse(function.CheckInt(SpTradeRecordId));
                 if (pos.BrandId == 1)
                 {