123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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"
- }
|