merchant.go 892 B

123456789101112131415161718192021222324252627
  1. package merchant
  2. import (
  3. "eta/eta_mini_ht_api/models"
  4. "time"
  5. )
  6. // Merchant 商户信息结构体
  7. type Merchant struct {
  8. ID int `gorm:"column:id;primary_key;comment:商户ID"`
  9. MerchantID string `gorm:"column:merchant_id;type:varchar(255);comment:外部商户ID"`
  10. MerchantName string `gorm:"column:merchant_name;type:varchar(255);comment:商户名称"`
  11. Enabled bool `gorm:"column:enabled;type:tinyint(1);comment:是否启用"`
  12. CreatedTime time.Time `gorm:"column:created_time;type:datetime;comment:创建时间"`
  13. UpdatedTime time.Time `gorm:"column:updated_time;type:datetime;comment:更新时间"`
  14. }
  15. // TableName 指定表名
  16. func (Merchant) TableName() string {
  17. return "merchants"
  18. }
  19. func GetEnablerMerchants() (merchant []Merchant, err error) {
  20. db := models.Main()
  21. err = db.Select("*").Where("enabled=?", 1).Find(&merchant).Error
  22. return
  23. }