| 1234567891011121314151617181920212223242526272829 |
- package channel
- import (
- "time"
- "github.com/kamva/mgm/v3"
- )
- // Channel 渠道模型
- type Channel struct {
- mgm.DefaultModel `bson:",inline"`
- Name string `bson:"name" json:"name"`
- Code string `bson:"code" json:"code"`
- Description string `bson:"description" json:"description"`
- Status bool `bson:"status" json:"status"`
- }
- // CollectionName 指定 MongoDB 集合名
- func (Channel) CollectionName() string {
- return "channels"
- }
- // GetCreateTime 返回格式化的创建时间,供前端使用
- func (c *Channel) GetCreateTime() string {
- if c.CreatedAt.IsZero() {
- return ""
- }
- return c.CreatedAt.In(time.Local).Format("2006-01-02 15:04:05")
- }
|