12345678910111213141516171819202122232425262728293031 |
- package models
- import (
- "ppgo/common"
- "time"
- )
- // Config undefined
- type Config struct {
- ID int64 `json:"id" gorm:"id"`
- AppId int64 `json:"app_id" gorm:"app_id"`
- Env string `json:"env" gorm:"env"`
- Value []byte `json:"value" gorm:"value"`
- Status int64 `json:"status" gorm:"status"` // 0 不可用 1可用
- CreatedAt time.Time `json:"created_at" gorm:"created_at"`
- UpdatedAt time.Time `json:"updated_at" gorm:"updated_at"`
- }
- // TableName 表名称
- func (*Config) TableName() string {
- return "config"
- }
- func FindConfigByAppKey(appId int64, env string) *Config {
- a := &Config{}
- common.GetDb().Where("app_id", appId).Where("env", env).First(&a)
- if a.ID == 0 {
- return nil
- }
- return a
- }
|