user_subscription_access_flow.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package merchant
  2. import (
  3. "eta/eta_mini_ht_api/models"
  4. "time"
  5. )
  6. type OpenType string
  7. const (
  8. OpenTypeValid OpenType = "open"
  9. OpenTypeExpired OpenType = "expired"
  10. OpenTypeClose OpenType = "close"
  11. )
  12. // UserSubscriptionAccessFlow 用户订阅访问列表
  13. type UserSubscriptionAccessFlow struct {
  14. ID int `gorm:"column:id;primaryKey"`
  15. TemplateUserId int `gorm:"column:template_user_id"`
  16. ProductID int `gorm:"column:product_id"`
  17. ProductType string `gorm:"column:product_type"`
  18. ProductOrderId string `gorm:"column:product_order_id"`
  19. OpenType OpenType `gorm:"column:open_type;type:enum('open','expired','closed');default:'open'"`
  20. CreatedTime time.Time `gorm:"column:created_time"`
  21. UpdatedTime time.Time `gorm:"column:updated_time"`
  22. }
  23. func (UserSubscriptionAccessFlow) TableName() string {
  24. return "user_subscription_access_flow"
  25. }
  26. func CreateAccessFlow(userSubscriptionAccessFlow UserSubscriptionAccessFlow) (err error) {
  27. db := models.Main()
  28. err = db.Create(&userSubscriptionAccessFlow).Error
  29. return
  30. }