You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
package jyy
|
|
|
|
import (
|
|
"github.com/golangkit/formatime"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Goods struct {
|
|
ID int `json:"id"`
|
|
GoodsID uint `json:"-"`
|
|
Status int `json:"status"`
|
|
Min int `json:""`
|
|
}
|
|
|
|
func (o Goods) TableName() string {
|
|
return "jyy_goods_info"
|
|
}
|
|
|
|
type Banner struct {
|
|
ID int `json:"id"`
|
|
GoodsID uint `json:"goods_id" validate:"required"`
|
|
Photo string `json:"photo" validate:"required"`
|
|
OrderSort int `json:"order_sort"`
|
|
Start formatime.Second `json:"start" validate:"required"`
|
|
End formatime.Second `json:"end" validate:"required"`
|
|
Valid bool `json:"valid" gorm:"-"`
|
|
}
|
|
|
|
func (o Banner) TableName() string {
|
|
return "jyy_banner"
|
|
}
|
|
|
|
func (o *Banner) AfterFind(db *gorm.DB) error {
|
|
o.Valid = formatime.NewSecondNow().Time.Before(o.End.Time) && formatime.NewSecondNow().Time.After(o.Start.Time)
|
|
return nil
|
|
}
|
|
|
|
type Activity struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
Icon string `json:"icon"`
|
|
OrderSort int `json:"order_sort"`
|
|
Status bool `json:"status"`
|
|
}
|
|
|
|
func (o Activity) TableName() string {
|
|
return "jyy_activity"
|
|
}
|
|
|
|
type ActivityGoods struct {
|
|
ID uint `json:"id"`
|
|
ActivityID uint `json:"activity_id"`
|
|
GoodsID uint `json:"goods_id"`
|
|
}
|
|
|
|
func (o ActivityGoods) TableName() string {
|
|
return "jyy_activity_goods"
|
|
}
|