user.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package model
  2. import (
  3. "time"
  4. )
  5. type User struct {
  6. BaseModel
  7. Name string `json:"name" form:"name" binding:"required"`
  8. Phone string `json:"phone" form:"phone" binding:"required"`
  9. AppID string `json:"app_id"`
  10. SecretKey string `json:"secret_key"`
  11. IpWhiteList string `json:"ip_white_list" form:"ip_white_list" binding:"required"`
  12. }
  13. func (user *User) TableName() string {
  14. return "user"
  15. }
  16. type UserAccount struct {
  17. ID int `json:"id" gorm:"primaryKey"`
  18. AppID string `json:"app_id"`
  19. Money int `json:"money"`
  20. }
  21. func (p *UserAccount) TableName() string {
  22. return "user_account"
  23. }
  24. type UserMoneyRecord struct {
  25. ID int `json:"id" gorm:"primaryKey"`
  26. AppID string `json:"app_id"`
  27. Before int `json:"before"`
  28. After int `json:"after"`
  29. TradeMoney int `json:"tarde_money"`
  30. CreateAt time.Time `json:"-" gorm:"autoCreateTime"`
  31. }
  32. func (p *UserMoneyRecord) TableName() string {
  33. return "user_money_record"
  34. }
  35. type UserBuyRecord struct {
  36. ID int `json:"id" gorm:"primaryKey"`
  37. AppID string `json:"app_id"`
  38. ProductId int `json:"product_id"`
  39. UserProductId int `json:"user_product_id"`
  40. Before int `json:"before"`
  41. After int `json:"after"`
  42. TradeMoney int `json:"tarde_money"`
  43. BuyType int `json:"buy_type"`
  44. HistoryUnitPrice int `json:"history_unit_price"`
  45. CreateAt time.Time `json:"-" gorm:"autoCreateTime"`
  46. }
  47. func (p *UserBuyRecord) TableName() string {
  48. return "user_buy_record"
  49. }