You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
919 B
Go
40 lines
919 B
Go
package model
|
|
|
|
import (
|
|
"joybuywork/internal/plugins/jsonm"
|
|
"joybuywork/internal/repository/mtype"
|
|
)
|
|
|
|
func (s *FissionCampaign) SetLangTypes(val []int8) {
|
|
s.LangTypes, _ = jsonm.MarshalToString(val)
|
|
}
|
|
|
|
func (s *FissionCampaign) GetLangTypes() (val []int8) {
|
|
_ = jsonm.StrUnmarshal(s.LangTypes, &val)
|
|
return
|
|
}
|
|
|
|
func (s *FissionCampaign) GetLangMarks() (val []string) {
|
|
for _, v := range s.GetLangTypes() {
|
|
val = append(val, mtype.FissionLangTypeToMark[v])
|
|
}
|
|
return
|
|
}
|
|
|
|
func (s *FissionCampaign) GetDefaultLangType() int8 {
|
|
langTypes := s.GetLangTypes()
|
|
if len(langTypes) == 0 {
|
|
return 0
|
|
}
|
|
return langTypes[0]
|
|
}
|
|
|
|
func (s *FissionCampaign) GetDefaultLangMark() string {
|
|
return mtype.FissionLangTypeToMark[s.GetDefaultLangType()]
|
|
}
|
|
|
|
// IsPub 是否已经发布了
|
|
func (s *FissionCampaign) IsPub() bool {
|
|
return s.Status == mtype.FissionCampaignStatusPub || s.Status == mtype.FissionCampaignStatusPubPre
|
|
}
|