liujiandao
2023-11-16 d20acf38c36c11ee4428c3e74a17f5870dc61b51
global/model.go
@@ -11,4 +11,13 @@
   CreatedAt *time.Time     `json:"-"`              // 创建时间
   UpdatedAt *time.Time     `json:"-"`              // 更新时间
   DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
   FormattedCreatedAt string `gorm:"-" json:"created_at"`
   FormattedUpdatedAt string `gorm:"-" json:"updated_at"`
}
func (m *GVA_MODEL) AfterFind(tx *gorm.DB) (err error) {
   m.FormattedCreatedAt = m.CreatedAt.Format("2006-01-02 15:04:05")
   m.FormattedUpdatedAt = m.UpdatedAt.Format("2006-01-02 15:04:05")
   return
}