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.
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type User struct {
|
|
|
|
ID int
|
|
|
|
OrderNo string
|
|
|
|
Mobile string
|
|
|
|
Username string
|
|
|
|
UserID string
|
|
|
|
UnitID string
|
|
|
|
UnitName string
|
|
|
|
BeiandiquCode string
|
|
|
|
BankName string
|
|
|
|
BankCardNum string
|
|
|
|
BankUserName string
|
|
|
|
Order *Order `gorm:"foreignKey:OrderNo;references:OrderNo"`
|
|
|
|
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),
|
|
|
|
})
|
|
|
|
}
|