瀏覽代碼

wifi解绑逻辑优化

lcl 1 月之前
父節點
當前提交
41e1b3396f
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      AppStart/Helper/SycnSpServer/SycnSpBindService.cs
  2. 3 3
      AppStart/WifiUnBindHelper.cs

+ 1 - 1
AppStart/Helper/SycnSpServer/SycnSpBindService.cs

@@ -54,7 +54,7 @@ namespace MySystem
                                 {
                                     string fileName = function.MD5_16(Guid.NewGuid().ToString());
                                     string content = "{\"posSn\":\"" + Bind.MerSnNo + "\"}";
-                                    RedisDbconn.Instance.AddList("kxs_unbindwifi_list", content + "#cut#" + fileName);
+                                    RedisDbconn.Instance.AddList("kxs_unbindwifi_list", fileName + "#cut#" + content + "#cut#" + fileName);
                                 }
                             }
                             else

+ 3 - 3
AppStart/WifiUnBindHelper.cs

@@ -51,13 +51,13 @@ public class WifiUnBindHelper
         JsonData jsonObj = JsonMapper.ToObject(data[1]);
         string posSn = jsonObj["posSn"].ToString();
         WebCMSEntities db = new WebCMSEntities();
-        WifiTradeRecord edit = db.WifiTradeRecord.FirstOrDefault(m => m.SnNo == posSn);
-        if(edit != null)
+        IQueryable<WifiTradeRecord> list = db.WifiTradeRecord.Where(m => m.SnNo == posSn);
+        foreach(WifiTradeRecord edit in list)
         {
             edit.DoMonths = edit.Duration + 1;
             edit.Status = -1;
-            db.SaveChanges();
         }
+        db.SaveChanges();
         db.Dispose();
     }
 }