HiddenAccountCore.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. namespace molilian.core
  2. {
  3. /// <summary>
  4. /// 隐藏号判断:隐藏号命中的转链只返回 deeplink,不产生任何日志、统计、上报数据
  5. /// </summary>
  6. public static class HiddenAccountCore
  7. {
  8. public static Task<bool> IsHiddenAsync(TkChannelEnum channel, int accountId)
  9. {
  10. return IsHiddenAsync(channel.ToString(), accountId);
  11. }
  12. public static async Task<bool> IsHiddenAsync(string channel, int accountId)
  13. {
  14. if (accountId <= 0) return false;
  15. switch ((channel ?? string.Empty).ToLowerInvariant())
  16. {
  17. case "tb":
  18. var tbAccount = await TkPoolCore.ALLGetOneAsync(accountId);
  19. return tbAccount != null && tbAccount.is_hide;
  20. case "pdd":
  21. var pddAccounts = await PddPoolCore.AllListAsync();
  22. var pddAccount = pddAccounts?.FirstOrDefault(e => e.id == accountId);
  23. return pddAccount != null && pddAccount.is_hide;
  24. default:
  25. return false;
  26. }
  27. }
  28. }
  29. }