feat:完善项目信息
This commit is contained in:
@ -1,18 +1,27 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ActivityInstance 活动数据模型
|
||||
type ActivityInstance struct {
|
||||
Model
|
||||
ModelTenant
|
||||
Mode ActivityInstanceMode `gorm:"column:mode;type:tinyint(1);default:1;comment:活动模式" json:"mode"`
|
||||
Image
|
||||
ActivityInstanceBasic
|
||||
Amount float64 `gorm:"column:amount;type:decimal(10,2);default:0;comment:活动收费金额" json:"amount"`
|
||||
Content string `gorm:"column:content;type:text;comment:活动详情" json:"content"`
|
||||
MaxNumber int `gorm:"column:max_number;type:int(6);default:0;comment:报名限制人数,0不做限制" json:"max_number"`
|
||||
Status ActivityInstanceStatus `gorm:"column:status;type:tinyint(1);default:1;comment:活动状态(1:显示,2:隐藏)" json:"status"`
|
||||
Contact string `gorm:"column:contact;type:varchar(20);default:'';comment:联系人" json:"contact"`
|
||||
ContactMobile string `gorm:"column:contact_mobile;type:varchar(15);default:'';comment:联系方式" json:"contact_mobile"`
|
||||
Image
|
||||
Area
|
||||
Industry string `gorm:"column:industry;type:varchar(255);comment:所属领域;行业信息" json:"-"`
|
||||
Amount float64 `gorm:"column:amount;type:decimal(10,2);default:0;comment:活动收费金额" json:"amount"`
|
||||
Content string `gorm:"column:content;type:text;comment:活动详情" json:"content"`
|
||||
MaxNumber int `gorm:"column:max_number;type:int(6);default:0;comment:报名限制人数,0不做限制" json:"max_number"`
|
||||
NotifyCrowd int `gorm:"column:notify_crowd;type:tinyint(3);default:0;comment:通知人群" json:"notify_crowd"`
|
||||
IsHome int `gorm:"column:is_home;type:tinyint(1);default:0;comment:首页展示(0:不展示,1:展示)" json:"is_home"`
|
||||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序,数值越小,优先排序" json:"sort"`
|
||||
Status ActivityInstanceStatus `gorm:"column:status;type:tinyint(1);default:1;comment:活动状态(1:显示,2:隐藏)" json:"status"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
@ -25,17 +34,6 @@ type ActivityInstanceBasic struct {
|
||||
JoinDeadline time.Time `gorm:"column:join_deadline;type:datetime;not null;comment:报名截止时间" json:"join_deadline"`
|
||||
}
|
||||
|
||||
// ActivityInstanceMode 活动类型
|
||||
type ActivityInstanceMode int
|
||||
|
||||
const (
|
||||
// ActivityInstanceModeForOrdinary 普通活动
|
||||
ActivityInstanceModeForOrdinary ActivityInstanceMode = iota + 1
|
||||
// ActivityInstanceModeForCharge 收费活动
|
||||
ActivityInstanceModeForCharge
|
||||
)
|
||||
|
||||
// ActivityInstanceStatus 活动状态
|
||||
type ActivityInstanceStatus int
|
||||
|
||||
const (
|
||||
@ -58,6 +56,17 @@ func (m *ActivityInstanceBasic) IsCanJoin() bool {
|
||||
return m.JoinDeadline.After(time.Now())
|
||||
}
|
||||
|
||||
func (m *ActivityInstance) SetIndustryAttribute(value []string) {
|
||||
_bytes, _ := json.Marshal(value)
|
||||
m.Industry = string(_bytes)
|
||||
}
|
||||
|
||||
func (m *ActivityInstance) GetIndustryAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = json.Unmarshal([]byte(m.Industry), &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func NewActivityInstance() *ActivityInstance {
|
||||
return &ActivityInstance{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user