SysTimer.cs 2.4 KB

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