109 lines
4.1 KiB
Go
109 lines
4.1 KiB
Go
package model
|
|
|
|
import (
|
|
"SciencesServer/app/basic/config"
|
|
"encoding/json"
|
|
)
|
|
|
|
// TechnologyAchievement 技术成果数据模型
|
|
type TechnologyAchievement struct {
|
|
Model
|
|
ModelTenant
|
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
|
Mode TechnologyAchievementMode `gorm:"column:mode;type:tinyint(1);default:1;comment:成果模式" json:"mode"`
|
|
Title string `gorm:"column:title;type:varchar(100);default:'';comment:成果名称" json:"title"`
|
|
Description string `gorm:"source:description;type:varchar(255);comment:成果描述" json:"description"`
|
|
Image
|
|
File string `gorm:"column:file;type:varchar(255);default:'';comment:证明材料" json:"file"`
|
|
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"-"`
|
|
Customer string `gorm:"column:customer;type:varchar(255);default:'';comment:应用客户" json:"-"`
|
|
Maturity config.TechnologyMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:技术成熟度" json:"maturity"`
|
|
LeadStandard TechnologyProductLeadStandard `gorm:"column:lead_standard;type:tinyint(1);default:0;comment:领先标准" json:"lead_standard"`
|
|
CooperationMode config.TechnologyCooperationMode `gorm:"column:cooperation_mode;type:tinyint(1);default:0;comment:合作模式" json:"cooperation_mode"`
|
|
Config string `gorm:"column:config;type:varchar(255);default:'';comment:配置信息" json:"config"`
|
|
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
|
|
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
|
Shelf
|
|
TechnologyStatus
|
|
ModelDeleted
|
|
ModelAt
|
|
}
|
|
|
|
// TechnologyAchievementConfig 成果收费参数信息
|
|
type TechnologyAchievementConfig struct {
|
|
VideoFile string `json:"video_file"` // 视频文件
|
|
VideoPrice float64 `json:"video_price"` // 视频价格
|
|
VideoFreeTime int `json:"video_free_time"` // 视频观看免费时长
|
|
}
|
|
|
|
// TechnologyAchievementMode 技术成本模式
|
|
type TechnologyAchievementMode int
|
|
|
|
const (
|
|
// TechnologyAchievementModeForFree 免费模式
|
|
TechnologyAchievementModeForFree TechnologyAchievementMode = iota + 1
|
|
// TechnologyAchievementModeForCharge 收费模式
|
|
TechnologyAchievementModeForCharge
|
|
)
|
|
|
|
func (m *TechnologyAchievement) TableName() string {
|
|
return "technology_achievement"
|
|
}
|
|
|
|
func (m *TechnologyAchievement) GetModeTitle() string {
|
|
if m.Mode == TechnologyAchievementModeForFree {
|
|
return "免费模式"
|
|
} else if m.Mode == TechnologyAchievementModeForCharge {
|
|
return "收费模式"
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *TechnologyAchievement) GetConfigAttribute() *TechnologyAchievementConfig {
|
|
out := new(TechnologyAchievementConfig)
|
|
_ = json.Unmarshal([]byte(m.Config), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyAchievement) SetConfigAttribute(value *TechnologyAchievementConfig) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Config = string(_bytes)
|
|
}
|
|
|
|
func (m *TechnologyAchievement) GetIndustryAttribute() []string {
|
|
out := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(m.Industry), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyAchievement) SetIndustryAttribute(value []string) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Industry = string(_bytes)
|
|
}
|
|
|
|
func (m *TechnologyAchievement) GetCustomerAttribute() []string {
|
|
out := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(m.Customer), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyAchievement) SetCustomerAttribute(value []string) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Customer = string(_bytes)
|
|
}
|
|
|
|
func (m *TechnologyAchievement) GetKeywordAttribute() []string {
|
|
out := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(m.Keyword), &out)
|
|
return out
|
|
}
|
|
|
|
func (m *TechnologyAchievement) SetKeywordAttribute(value []string) {
|
|
_bytes, _ := json.Marshal(value)
|
|
m.Keyword = string(_bytes)
|
|
}
|
|
|
|
func NewTechnologyAchievement() *TechnologyAchievement {
|
|
return &TechnologyAchievement{}
|
|
}
|