package model import ( "dy-admin/internal/pcmserver/common" "dy-admin/internal/pcmserver/utils" "gorm.io/gorm" "time" ) // WorkTime 工作时段设置。应用于所有柜子。如果柜子存在单独的时间管理配置,此配置不生效 type WorkTime struct { common.Model WeekDay string `json:"weekDay" gorm:"size:32;comment:'星期几'"` StartTime *time.Time `json:"-" gorm:"type:time"` StartTimeStr string `json:"startTimeStr" gorm:"-"` EndTime *time.Time `json:"-" gorm:"type:time"` EndTimeStr string `json:"endTimeStr" gorm:"-"` WorkDay string `json:"workDay" gorm:"size:10;comment:1-工作日 2-非工作日"` Sort uint64 `json:"sort" gorm:"not null;comment:'排序'"` common.ControlBy common.ModelTime } func (m *WorkTime) TableName() string { return "bus_work_time" } func (m *WorkTime) AfterFind(_ *gorm.DB) error { m.StartTimeStr = utils.FormatTime(m.StartTime) m.EndTimeStr = utils.FormatTime(m.EndTime) return nil }