2 Star 0 Fork 0

hero/momo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
schedule.go 4.94 KB
一键复制 编辑 原始数据 按行查看 历史
hero 提交于 2024-11-04 11:45 . upd:目录结构调整
package schema
import (
"gitee.com/linqwen/momo/base"
)
type ScheduleDTO struct {
Name string `gorm:"column:name" json:"Name" form:"Name" comment:"任务名"`
Url string `gorm:"column:url" json:"Url" form:"Url" comment:"url" validate:"required"`
Method string `gorm:"column:method" json:"Method" form:"Method" comment:"method" validate:"required"`
Params string `gorm:"column:params" json:"Params" form:"Params" comment:"Params"`
Headers string `gorm:"column:headers" json:"Headers" form:"Headers" comment:"Headers"`
Timeout int `gorm:"column:timeout" json:"Timeout" form:"Timeout" comment:"Timeout"`
Cron string `gorm:"column:cron" json:"Cron" form:"Cron" comment:"cron" validate:"omitempty,min=6,max=20"`
ExecutorStrategy int `gorm:"column:executor_strategy" json:"ExecutorStrategy" form:"ExecutorStrategy" comment:"执行策略"`
Status int `gorm:"column:status;default:0" json:"Status" form:"Status" comment:"状态"`
CronId int `gorm:"column:cron_id" json:"CronId" form:"CronId" comment:"CronId"`
LastRun string `gorm:"column:last_run" json:"LastRun" form:"LastRun" comment:"LastRun"`
NextRun string `gorm:"column:next_run" json:"NextRun" form:"NextRun" comment:"NextRun"`
}
type ScheduleVO struct {
Id int64 `gorm:"primaryKey;autoIncrement:false" json:"Id,string"`
Name string `gorm:"column:name" json:"Name" form:"Name" comment:"任务名"`
Url string `gorm:"column:url" json:"Url" form:"Url" comment:"url"`
Method string `gorm:"column:method" json:"Method" form:"Method" comment:"method"`
Params string `gorm:"column:params" json:"Params" form:"Params" comment:"Params"`
Headers string `gorm:"column:headers" json:"Headers" form:"Headers" comment:"Headers"`
Timeout int `gorm:"column:timeout" json:"Timeout" form:"Timeout" comment:"Timeout"`
Cron string `gorm:"column:cron" json:"Cron" form:"Cron" comment:"cron"`
ExecutorStrategy int `gorm:"column:executor_strategy" json:"ExecutorStrategy" form:"ExecutorStrategy" comment:"执行策略"`
Status int `gorm:"column:status;default:0" json:"Status" form:"Status" comment:"状态"`
CronId int `gorm:"column:cron_id" json:"CronId" form:"CronId" comment:"CronId"`
LastRun string `gorm:"column:last_run" json:"LastRun" form:"LastRun" comment:"LastRun"`
NextRun string `gorm:"column:next_run" json:"NextRun" form:"NextRun" comment:"NextRun"`
CreatedAt base.ISO8601Time
UpdatedAt base.ISO8601Time
}
func (c ScheduleVO) GetDetailVO() interface{} {
// createTime := c.CreatedAt.WithFormat("2006-01-02 15:04:05")
// c.CreatedAt = createTime
return c
}
func (c ScheduleVO) GetListVO() interface{} {
// createTime := c.CreatedAt.WithFormat("2006-01-02 15:04:05")
// c.CreatedAt = createTime
// fmt.Printf("c is %+v\n", c)
return c
}
type ScheduleLogDTO struct {
ScheduleId int64 `gorm:"column:schedule_id" json:"ScheduleId,string" form:"ScheduleId" comment:"ScheduleId"`
EndAt base.ISO8601Time `gorm:"column:end_at" json:"EndAt" form:"EndAt" comment:"EndAt"`
StatusCode int `gorm:"column:status_code;default:0" json:"StatusCode" form:"StatusCode" comment:"StatusCode"`
Message string `gorm:"column:message" json:"Message" form:"Message" comment:"Message"`
RunStatus string `gorm:"column:run_status" json:"RunStatus" form:"RunStatus" comment:"RunStatus"`
CronId int `gorm:"column:cron_id" json:"CronId" form:"CronId" comment:"CronId"`
LastRun string `gorm:"column:last_run" json:"LastRun" form:"LastRun" comment:"LastRun"`
NextRun string `gorm:"column:next_run" json:"NextRun" form:"NextRun" comment:"NextRun"`
CreatedAt base.ISO8601Time
}
type ScheduleLogVO struct {
Id int64 `gorm:"primaryKey;autoIncrement:false" json:"Id,string"`
ScheduleId int64 `gorm:"column:schedule_id" json:"ScheduleId,string" form:"ScheduleId" comment:"ScheduleId"`
EndAt base.ISO8601Time `gorm:"column:end_at" json:"EndAt" form:"EndAt" comment:"EndAt"`
StatusCode int `gorm:"column:status_code;default:0" json:"StatusCode" form:"StatusCode" comment:"StatusCode"`
Message string `gorm:"column:message" json:"Message" form:"Message" comment:"Message"`
RunStatus string `gorm:"column:run_status" json:"RunStatus" form:"RunStatus" comment:"RunStatus"`
CronId int `gorm:"column:cron_id" json:"CronId" form:"CronId" comment:"CronId"`
LastRun string `gorm:"column:last_run" json:"LastRun" form:"LastRun" comment:"LastRun"`
NextRun string `gorm:"column:next_run" json:"NextRun" form:"NextRun" comment:"NextRun"`
CreatedAt base.ISO8601Time
UpdatedAt base.ISO8601Time
}
func (c ScheduleLogVO) GetDetailVO() interface{} { return c }
func (c ScheduleLogVO) GetListVO() interface{} { return c }
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/linqwen/momo.git
git@gitee.com:linqwen/momo.git
linqwen
momo
momo
v1.1.20

搜索帮助