user.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. CreateAt time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
  21. UpdateAt time.Time `json:"-" gorm:"autoUpdateTime"`
  22. }
  23. func (p *UserAccount) TableName() string {
  24. return "user_account"
  25. }
  26. type UserMoneyRecord struct {
  27. ID int `json:"id" gorm:"primaryKey"`
  28. AppID string `json:"app_id"`
  29. Before int `json:"before"`
  30. After int `json:"after"`
  31. TradeMoney int `json:"tarde_money"`
  32. CreateAt time.Time `json:"-" gorm:"autoCreateTime"`
  33. }
  34. func (p *UserMoneyRecord) TableName() string {
  35. return "user_money_record"
  36. }
  37. type UserBuyRecord struct {
  38. ID int `json:"id" gorm:"primaryKey"`
  39. AppID string `json:"app_id"`
  40. ProductId int `json:"product_id"`
  41. UserProductId int `json:"user_product_id"`
  42. Before int `json:"before"`
  43. After int `json:"after"`
  44. TradeMoney int `json:"tarde_money"`
  45. BuyType int `json:"buy_type"`
  46. HistoryUnitPrice int `json:"history_unit_price"`
  47. CreateAt time.Time `json:"-" gorm:"autoCreateTime"`
  48. }
  49. func (p *UserBuyRecord) TableName() string {
  50. return "user_buy_record"
  51. }
  52. type UserCallRecord struct {
  53. ID int `json:"id" gorm:"primaryKey"`
  54. AppID string `json:"app_id"`
  55. ProductId int `json:"product_id"`
  56. UserProductId int `json:"user_product_id"`
  57. Status int `json:"status"`
  58. Ip string `json:"ip"`
  59. Param string `json:"param"`
  60. OrderCode string `json:"order_code"`
  61. CreateAt time.Time `json:"-" gorm:"autoCreateTime"`
  62. }
  63. func (p *UserCallRecord) TableName() string {
  64. return "user_call_record"
  65. }