123456789101112131415161718192021222324252627 |
- package merchant
- import (
- "eta/eta_mini_ht_api/models"
- "time"
- )
- // Merchant 商户信息结构体
- type Merchant struct {
- ID int `gorm:"column:id;primary_key;comment:商户ID"`
- MerchantID string `gorm:"column:merchant_id;type:varchar(255);comment:外部商户ID"`
- MerchantName string `gorm:"column:merchant_name;type:varchar(255);comment:商户名称"`
- Enabled bool `gorm:"column:enabled;type:tinyint(1);comment:是否启用"`
- CreatedTime time.Time `gorm:"column:created_time;type:datetime;comment:创建时间"`
- UpdatedTime time.Time `gorm:"column:updated_time;type:datetime;comment:更新时间"`
- }
- // TableName 指定表名
- func (Merchant) TableName() string {
- return "merchants"
- }
- func GetEnablerMerchants() (merchant []Merchant, err error) {
- db := models.Main()
- err = db.Select("*").Where("enabled=?", 1).Find(&merchant).Error
- return
- }
|