32 lines
1.2 KiB
Go
32 lines
1.2 KiB
Go
// Package model 定义领域模型。
|
|
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
|
|
"portal-mini-go/internal/pkg/types"
|
|
)
|
|
|
|
// MiniProgram 是被后台纳管的微信小程序配置。
|
|
// 一个租户/运营方可在此登记多个小程序,AppID 全局唯一。
|
|
type MiniProgram struct {
|
|
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
Name string `gorm:"type:varchar(128);not null" json:"name"`
|
|
Description string `gorm:"type:varchar(512)" json:"description"`
|
|
AppID string `gorm:"column:app_id;type:varchar(64);uniqueIndex;not null" json:"app_id"`
|
|
AppSecret string `gorm:"column:app_secret;type:varchar(128);not null" json:"-"`
|
|
Status int8 `gorm:"type:tinyint;not null;default:1" json:"status"`
|
|
Ext string `gorm:"type:text" json:"ext"`
|
|
CreatedAt types.Time `json:"created_at"`
|
|
UpdatedAt types.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
}
|
|
|
|
func (MiniProgram) TableName() string { return "mini_programs" }
|
|
|
|
// 小程序状态。
|
|
const (
|
|
MiniProgramStatusDisabled int8 = 0 // 停用
|
|
MiniProgramStatusEnabled int8 = 1 // 启用
|
|
)
|