package model import ( "encoding/json" "time" ) type Revoke struct { ID int PolicyNo string BankName string AccountName string ContactName string ContactPhone string FileList string BankCardNum string BackPremium string Reason string Status string Msg string CreatedAt time.Time UpdatedAt time.Time `json:"-"` } func (Revoke) TableName() string { return "revoke" } func (a Revoke) MarshalJSON() ([]byte, error) { type Alias Revoke return json.Marshal(&struct { CreatedAt string UpdatedAt string *Alias }{ CreatedAt: a.CreatedAt.Format("2006-01-02 15:04:05"), UpdatedAt: a.UpdatedAt.Format("2006-01-02 15:04:05"), Alias: (*Alias)(&a), }) }