service.xpcool.com/internal/model/entity/notice.go

72 lines
4.6 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package entity 定义通知模块与自动任务模块的表结构(手写,未跑 gf gen
package entity
// NoticeChannel 通知渠道配置。
type NoticeChannel struct {
Id uint64 `json:"id" orm:"id" description:"主键"`
Code string `json:"code" orm:"code" description:"渠道编码"`
Name string `json:"name" orm:"name" description:"渠道名称"`
Enabled int `json:"enabled" orm:"enabled" description:"是否启用"`
Config string `json:"config" orm:"config" description:"渠道配置JSON"`
Remark string `json:"remark" orm:"remark" description:"备注"`
CreatedAt string `json:"createdAt" orm:"created_at" description:"创建时间"`
UpdatedAt string `json:"updatedAt" orm:"updated_at" description:"更新时间"`
}
// NoticeRule 通知规则(事件→渠道→人员→启用→模板)。
type NoticeRule struct {
Id uint64 `json:"id" orm:"id" description:"主键"`
Name string `json:"name" orm:"name" description:"规则名称"`
EventType string `json:"eventType" orm:"event_type" description:"事件类型"`
ChannelCodes string `json:"channelCodes" orm:"channel_codes" description:"渠道编码JSON数组"`
UserIds string `json:"userIds" orm:"user_ids" description:"接收用户ID JSON数组"`
TitleTemplate string `json:"titleTemplate" orm:"title_template" description:"标题模板"`
BodyTemplate string `json:"bodyTemplate" orm:"body_template" description:"内容模板"`
Enabled int `json:"enabled" orm:"enabled" description:"是否启用"`
CreatedAt string `json:"createdAt" orm:"created_at" description:"创建时间"`
UpdatedAt string `json:"updatedAt" orm:"updated_at" description:"更新时间"`
}
// NoticeLog 通知发送记录。
type NoticeLog struct {
Id uint64 `json:"id" orm:"id" description:"主键"`
RuleId uint64 `json:"ruleId" orm:"rule_id" description:"规则ID"`
EventType string `json:"eventType" orm:"event_type" description:"事件类型"`
ChannelCode string `json:"channelCode" orm:"channel_code" description:"渠道编码"`
UserId uint64 `json:"userId" orm:"user_id" description:"接收用户ID"`
Target string `json:"target" orm:"target" description:"发送目标"`
Title string `json:"title" orm:"title" description:"标题"`
Body string `json:"body" orm:"body" description:"内容"`
Result int `json:"result" orm:"result" description:"1成功 0失败"`
Error string `json:"error" orm:"error" description:"错误信息"`
CreatedAt string `json:"createdAt" orm:"created_at" description:"创建时间"`
}
// AutoJob 自动任务定义。
type AutoJob struct {
Id uint64 `json:"id" orm:"id" description:"主键"`
Name string `json:"name" orm:"name" description:"任务名称"`
Code string `json:"code" orm:"code" description:"任务编码"`
JobType string `json:"jobType" orm:"job_type" description:"任务类型"`
CronExpr string `json:"cronExpr" orm:"cron_expr" description:"cron表达式"`
Enabled int `json:"enabled" orm:"enabled" description:"是否启用"`
Remark string `json:"remark" orm:"remark" description:"备注"`
LastRunAt string `json:"lastRunAt" orm:"last_run_at" description:"上次运行时间"`
LastResult int `json:"lastResult" orm:"last_result" description:"0未运行 1成功 2失败"`
LastError string `json:"lastError" orm:"last_error" description:"上次错误"`
CreatedAt string `json:"createdAt" orm:"created_at" description:"创建时间"`
UpdatedAt string `json:"updatedAt" orm:"updated_at" description:"更新时间"`
}
// AutoJobLog 自动任务运行日志。
type AutoJobLog struct {
Id uint64 `json:"id" orm:"id" description:"主键"`
JobId uint64 `json:"jobId" orm:"job_id" description:"任务ID"`
RunAt string `json:"runAt" orm:"run_at" description:"运行时间"`
Result int `json:"result" orm:"result" description:"1成功 2失败"`
Error string `json:"error" orm:"error" description:"错误信息"`
Summary string `json:"summary" orm:"summary" description:"运行摘要"`
DurationMs int `json:"durationMs" orm:"duration_ms" description:"耗时毫秒"`
CreatedAt string `json:"createdAt" orm:"created_at" description:"创建时间"`
}