SysTimer.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. namespace Admin.NET.Core;
  2. /// <summary>
  3. /// 定时任务
  4. /// </summary>
  5. [SugarTable("sys_timer", "定时任务表")]
  6. [SqlSugarEntity]
  7. public class SysTimer : EntityBase
  8. {
  9. /// <summary>
  10. /// 任务名称
  11. /// </summary>
  12. [SugarColumn(ColumnDescription = "任务名称", Length = 20)]
  13. [Required, MaxLength(20)]
  14. public virtual string TimerName { get; set; }
  15. /// <summary>
  16. /// 是否只执行一次
  17. /// </summary>
  18. [SugarColumn(ColumnDescription = "是否只执行一次")]
  19. public bool DoOnce { get; set; } = false;
  20. /// <summary>
  21. /// 是否立即执行
  22. /// </summary>
  23. [SugarColumn(ColumnDescription = "是否立即执行")]
  24. public bool StartNow { get; set; } = false;
  25. /// <summary>
  26. /// 执行类型(串行并行)
  27. /// </summary>
  28. [SugarColumn(ColumnDescription = "执行类型")]
  29. public SpareTimeExecuteTypes ExecuteType { get; set; } = SpareTimeExecuteTypes.Parallel;
  30. /// <summary>
  31. /// 执行间隔(单位秒)
  32. /// </summary>
  33. /// <example>5</example>
  34. [SugarColumn(ColumnDescription = "执行间隔")]
  35. public int? Interval { get; set; } = 5;
  36. /// <summary>
  37. /// Cron表达式
  38. /// </summary>
  39. [SugarColumn(ColumnDescription = "Cron表达式", Length = 20)]
  40. [MaxLength(20)]
  41. public string Cron { get; set; }
  42. /// <summary>
  43. /// 定时器类型
  44. /// </summary>
  45. [SugarColumn(ColumnDescription = "定时器类型")]
  46. public SpareTimeTypes TimerType { get; set; } = SpareTimeTypes.Interval;
  47. /// <summary>
  48. /// 请求url
  49. /// </summary>
  50. [SugarColumn(ColumnDescription = "请求url", Length = 200)]
  51. [MaxLength(200)]
  52. public string RequestUrl { get; set; }
  53. /// <summary>
  54. /// 请求类型
  55. /// </summary>
  56. [SugarColumn(ColumnDescription = "请求类型")]
  57. public RequestTypeEnum RequestType { get; set; } = RequestTypeEnum.Post;
  58. /// <summary>
  59. /// 请求参数
  60. /// </summary>
  61. [SugarColumn(ColumnDescription = "请求参数")]
  62. public string RequestPara { get; set; }
  63. /// <summary>
  64. /// Headers参数 比如{"Authorization":"userpassword"}
  65. /// </summary>
  66. [SugarColumn(ColumnDescription = "Headers参数")]
  67. public string Headers { get; set; }
  68. /// <summary>
  69. /// 备注
  70. /// </summary>
  71. [SugarColumn(ColumnDescription = "备注", Length = 100)]
  72. [MaxLength(100)]
  73. public string Remark { get; set; }
  74. }