2022-01-25 17:03:14 +08:00
|
|
|
package model
|
|
|
|
|
2022-01-27 18:30:14 +08:00
|
|
|
import (
|
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Journey struct {
|
|
|
|
ID int `json:"id" gorm:"column:id"`
|
|
|
|
Shop Shop `gorm:"foreignKey:MID;references:ShopID"`
|
|
|
|
Scripts Scripts `gorm:"foreignKey:Uuid;references:ScriptID"`
|
|
|
|
Persons strs `json:"persons" gorm:"column:persons"`
|
|
|
|
ScriptID string `json:"script_id" gorm:"column:script_id"`
|
|
|
|
Owner string `json:"owner" gorm:"column:owner"`
|
|
|
|
ShopID string `json:"shop_id" gorm:"column:shop_id"`
|
|
|
|
Status int `json:"status" gorm:"column:status"` // 1:进行中 2:已开始 3:已结束
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Journey) TableName() string {
|
|
|
|
return "journey"
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetJourneyM(db *gorm.DB) (*Journey, error) {
|
|
|
|
j := new(Journey)
|
|
|
|
|
|
|
|
db.Joins("Shop").Joins("Scripts").First(j)
|
|
|
|
|
|
|
|
return j, nil
|
2022-01-25 17:03:14 +08:00
|
|
|
}
|