SnowflakeHelper.cs 367 B

1234567891011121314151617
  1. using Snowflake.Core;
  2. namespace GxPress.Common.Tools
  3. {
  4. /// <summary>
  5. /// 雪花算法生成不同的ID
  6. /// </summary>
  7. public static class SnowflakeHelper
  8. {
  9. public static string MakeSnowflake()
  10. {
  11. var worker = new IdWorker(1, 1);
  12. long id = worker.NextId();
  13. return id.ToString();
  14. }
  15. }
  16. }