product.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package model
  2. import "time"
  3. type Product struct {
  4. BaseModel
  5. Name string `json:"name"`
  6. Path string `json:"url" gorm:"column:url"`
  7. UnitPrice int `json:"unit_price"` //单价
  8. MinUnit int `json:"min_unit"` //最小单位
  9. ProductType int `json:"product_type"` //产品类型 按次-0,按条-1
  10. TestNum int `json:"test_num"` //试用量
  11. }
  12. func (p *Product) TableName() string {
  13. return "product"
  14. }
  15. type UserProduct struct {
  16. ID int `json:"id" gorm:"primaryKey"`
  17. AppID string `json:"app_id"`
  18. ProductID int `json:"product_id"`
  19. CreateAt time.Time `json:"-" gorm:"autoCreateTime"` //标签autoCreateTime设置如果字段名字不为CreatAt时候自动插入当前时间
  20. StartAt time.Time `json:"start_at" grom:"start_at"`
  21. EndAt time.Time `json:"end_at" grom:"end_at"`
  22. LeftNum int `json:"left_num"` //剩余量 加锁处理
  23. CostModel int `json:"cost_model"` //扣费模式(0-按剩余量扣,1-按账户余额扣,2-优先扣剩余量,量为0扣余额)
  24. InterfaceStatus int `json:"interface_status"` //接口状态(0开启|-1停用|-2异常|-3维护)
  25. CallTimesLimitDay int `json:"call_times_limit_day"` //接口调用次数每日上限
  26. DataNumLimitOneTimes int `json:"data_num_limit_one_times"` //接口每次返回数据量上限
  27. }
  28. func (p *UserProduct) TableName() string {
  29. return "user_product"
  30. }