Zeus/model/script.go

64 lines
1.9 KiB
Go
Raw Normal View History

2021-12-13 21:39:15 +08:00
package model
import (
"database/sql/driver"
"encoding/json"
)
type (
Script struct {
ScriptInfo SInfo `json:"sinfo" gorm:"column:sinfo"`
}
SInfo struct {
//uuid
ScriptId string `json:"scriptId"`
ScriptName string `json:"scriptName"`
ScriptCoverUrl string `json:"scriptCoverUrl"`
ScriptIntro string `json:"scriptIntro"`
ScriptPlayerLimit int `json:"scriptPlayerLimit"`
ScriptMalePlayerLimit int `json:"scriptMalePlayerLimit"`
ScriptFemalePlayerLimit int `json:"scriptFemalePlayerLimit"`
//根据剧本标签组装成数组
ScriptTag []int `json:"scriptTag"`
ScriptScore float64 `json:"scriptScore"`
ScriptScoreCount int `json:"scriptScoreCount"`
ScriptInferenceScore float64 `json:"scriptInferenceScore"`
ScriptPlotScore float64 `json:"scriptPlotScore"`
ScriptComplexScore float64 `json:"scriptComplexScore"`
//根据scriptImageContent组装好-->数组形式
ScriptImageContent []string `json:"scriptImageContent"`
PlayerRoleReversalStatus int `json:"playerRoleReversalStatus"`
//剧本text内容
ScriptTextContent string `json:"scriptTextContent"`
//想玩
ScriptWantPlayerCount int `json:"scriptWantPlayerCount"`
//玩过
ScriptPlayedCount int `json:"scriptPlayedCount"`
//本时长:分钟计算
GroupDuration int `json:"groupDuration"`
//本难度
ScriptDifficultyDegreeName string `json:"scriptDifficultyDegreeName"`
//qzj id
Qid string `json:"qid"`
}
)
func (p Script) Value() (driver.Value, error) {
return json.Marshal(p)
}
func (p *Script) Scan(input interface{}) error {
return json.Unmarshal(input.([]byte), &p)
}
func (p SInfo) Value() (driver.Value, error) {
return json.Marshal(p)
}
func (p *SInfo) Scan(input interface{}) error {
return json.Unmarshal(input.([]byte), &p)
}
func (p Script) TableName() string {
return "script"
}