backend/app/brahma/api/murder/internal/model/journey.go

29 lines
752 B
Go

package model
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
}