generated from pkg/go-template
@@ -1,4 +1,28 @@
|
||||
package model
|
||||
|
||||
type model struct {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
type Shop struct {
|
||||
ShopName string `json:"shop_name" gorm:"column:shop_name"`
|
||||
ShopAddr string `json:"shop_addr" gorm:"column:shop_addr"`
|
||||
ShopScore float64 `json:"shop_score" gorm:"column:shop_score"`
|
||||
Numone string `json:"numone" gorm:"column:numone"`
|
||||
Numtwo string `json:"numtwo" gorm:"column:numtwo"`
|
||||
ShopLogo string `json:"shop_logo" gorm:"column:shop_logo"`
|
||||
ShopCover string `json:"shop_cover" gorm:"column:shop_cover"`
|
||||
MID string `json:"m_id" gorm:"column:m_id"`
|
||||
Longtitude float64 `json:"longtitude" gorm:"column:longtitude"`
|
||||
Latitude float64 `json:"latitude" gorm:"column:latitude"`
|
||||
ID int `json:"id" gorm:"column:id"`
|
||||
}
|
||||
|
||||
func (m *Shop) TableName() string {
|
||||
return "shop"
|
||||
}
|
||||
Reference in New Issue
Block a user