public static string EncryptId(int?id) { if (!id.HasValue || id.Value == -1) { return(string.Empty); } //使用62进制加种子 Number62 int62 = id + CardSeed; return(int62.ToString()); }
private static int _DecryptId(string idCode, int defaultVal) { try { if (string.IsNullOrEmpty(idCode)) { return(defaultVal); } Number62 int62 = idCode; return(int62.ToInt32() - CardSeed); } catch { return(0); } }
public static List <string> EncryptIdList(List <int> list) { List <string> list2 = new List <string>(); if (list.Count > 0) { foreach (int?id in list) { if (!id.HasValue || id.Value == -1) { continue; } //使用62进制加种子 Number62 int62 = id + CardSeed; list2.Add(int62.ToString()); } } return(list2); }
public static string EncryptId2(int id) { Number62 int62 = id + CardSeed; return(int62.ToString()); }