package model import ( "encoding/json" "time" ) type UserBankCard struct { ID int UserID int Mobile string AccountName string AccountNo string IdCardNo string AgreeID string BankCode string BankName string Status int ErrorMessage string CreatedAt time.Time UpdatedAt time.Time `json:"-"` } func (UserBankCard) TableName() string { return "user_bank_cards" } func (c UserBankCard) MarshalJSON() ([]byte, error) { type Alias UserBankCard return json.Marshal(&struct { CreatedAt string UpdatedAt string *Alias }{ CreatedAt: c.CreatedAt.Format("2006-01-02 15:04:05"), UpdatedAt: c.UpdatedAt.Format("2006-01-02 15:04:05"), Alias: (*Alias)(&c), }) }