You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
709 B
Go

package model
import (
"encoding/json"
"time"
)
type User struct {
ID int
OrderSn string
Mobile string
Username string
UserID string
UnitID string
UnitName string
BeiandiquCode string
BankName string
BankCardNum string
BankUserName string
Order *Order `gorm:"foreignKey:OrderSn;references:OrderSn"`
CreatedAt time.Time
UpdatedAt time.Time `json:"-"`
}
func (User) TableName() string {
return "user"
}
func (u User) MarshalJSON() ([]byte, error) {
type Alias User
return json.Marshal(&struct {
CreatedAt string
*Alias
}{
CreatedAt: u.CreatedAt.Format("2006-01-02 15:04:05"),
Alias: (*Alias)(&u),
})
}