SysTimer.cs 2.8 KB

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