SwaggerGroupAttribute.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Microsoft.AspNetCore.Mvc.ApiExplorer;
  2. namespace AI.Platform.Service.Common;
  3. /// <summary>
  4. /// 系统分组特性
  5. /// </summary>
  6. public class ApiGroupAttribute : Attribute, IApiDescriptionGroupNameProvider
  7. {
  8. public ApiGroupAttribute(ApiGroupNames name)
  9. {
  10. GroupName = name.ToString();
  11. }
  12. public string GroupName { get; set; }
  13. }
  14. /// <summary>
  15. /// 系统分组枚举值
  16. /// </summary>
  17. public enum ApiGroupNames
  18. {
  19. [GroupInfo(Title = "登录认证", Description = "登录认证相关接口", Version = "v1")]
  20. Auth,
  21. [GroupInfo(Title = "业务", Description = "业务相关接口")]
  22. Bussiness,
  23. [GroupInfo(Title = "系统", Description = "系统相关接口")]
  24. System,
  25. [GroupInfo(Title = "广告", Description = "广告相关接口")]
  26. Media,
  27. [GroupInfo(Title = "统计", Description = "统计相关接口")]
  28. Statistics,
  29. [GroupInfo(Title = "测试", Description = "测试相关接口")]
  30. Test
  31. }
  32. /// <summary>
  33. /// 系统模块枚举注释
  34. /// </summary>
  35. public class GroupInfoAttribute : Attribute
  36. {
  37. public string Title { get; set; }
  38. public string Version { get; set; }
  39. public string Description { get; set; }
  40. }