namespace YLErp.Helpers { /// /// 数据保护帮助类 /// public static class DataProtectHelper { public static string Encrypt(int id) { return YieldChain.Security.DataProtect.Encrypt(id.ToString()); } public static string Encrypt(string data) { return YieldChain.Security.DataProtect.Encrypt(data); } public static string Decrypt(string secretData) { return string.IsNullOrWhiteSpace(secretData) ? string.Empty : YieldChain.Security.DataProtect.Decrypt(secretData); } public static int DecryptInt(string secretData) { if (string.IsNullOrWhiteSpace(secretData)) { return 0; } var data = YieldChain.Security.DataProtect.Decrypt(secretData); return int.TryParse(data, out var nn) ? nn : 0; } public static long DecryptLong(string secretData) { if (string.IsNullOrWhiteSpace(secretData)) { return 0; } var data = YieldChain.Security.DataProtect.Decrypt(secretData); return long.TryParse(data, out var nn) ? nn : 0; } } }