package model import ( "time" ) type User struct { BaseModel Name string `json:"name" form:"name" binding:"required"` Phone string `json:"phone" form:"phone" binding:"required"` AppID string `json:"app_id"` SecretKey string `json:"secret_key"` IpWhiteList string `json:"ip_white_list" form:"ip_white_list" binding:"required"` } func (user *User) TableName() string { return "user" } type UserAccount struct { ID int `json:"id" gorm:"primaryKey"` AppID string `json:"app_id"` Money int `json:"money"` CreateAt time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间 UpdateAt time.Time `json:"-" gorm:"autoUpdateTime"` } func (p *UserAccount) TableName() string { return "user_account" } type UserMoneyRecord struct { ID int `json:"id" gorm:"primaryKey"` AppID string `json:"app_id"` Before int `json:"before"` After int `json:"after"` TradeMoney int `json:"tarde_money"` CreateAt time.Time `json:"-" gorm:"autoCreateTime"` } func (p *UserMoneyRecord) TableName() string { return "user_money_record" } type UserBuyRecord struct { ID int `json:"id" gorm:"primaryKey"` AppID string `json:"app_id"` ProductId int `json:"product_id"` UserProductId int `json:"user_product_id"` Before int `json:"before"` After int `json:"after"` TradeMoney int `json:"tarde_money"` BuyType int `json:"buy_type"` HistoryUnitPrice int `json:"history_unit_price"` CreateAt time.Time `json:"-" gorm:"autoCreateTime"` } func (p *UserBuyRecord) TableName() string { return "user_buy_record" } type UserCallRecord struct { ID int `json:"id" gorm:"primaryKey"` AppID string `json:"app_id"` ProductId int `json:"product_id"` UserProductId int `json:"user_product_id"` Status int `json:"status"` Ip string `json:"ip"` Param string `json:"param"` OrderCode string `json:"order_code"` CreateAt time.Time `json:"-" gorm:"autoCreateTime"` } func (p *UserCallRecord) TableName() string { return "user_call_record" } type InterfaceOrder struct { ID int `json:"id" gorm:"primaryKey"` AppID string `json:"app_id"` ProductId int `json:"product_id"` UserProductId int `json:"user_product_id"` OrderCode string `json:"order_code"` OrderType string `json:"order_type"` Before int `json:"before"` After int `json:"after"` CostModel int `json:"cost_model"` TradeNum int `json:"trade_num"` CreateAt time.Time `json:"-" gorm:"autoCreateTime"` } func (p *InterfaceOrder) TableName() string { return "interface_order" }