package yb_activity

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

// Activity 活动表
type Activity struct {
	ActivityId            int       `orm:"column(activity_id);pk" description:"活动ID"`
	FirstActivityTypeId   int       `description:"第一级的活动类型ID"`
	FirstActivityTypeName string    `description:"第一级的活动类型名称"`
	ActivityTypeId        int       `description:"活动类型ID"`
	ActivityTypeName      string    `description:"活动类型名称"`
	ActivityName          string    `description:"活动标题"`
	StartTime             time.Time `description:"活动开始时间"`
	EndTime               time.Time `description:"活动结束时间"`
	Speaker               string    `description:"主讲人"`
	SpeakerHeadPic        string    `description:"主讲人头像"`
	SpeakerBackgroundPic  string    `description:"主讲人背景图"`
	MainlandTel           string    `description:"大陆拨入"`
	HongKongTel           string    `description:"香港拨入"`
	TaiwanTel             string    `description:"台湾拨入"`
	AmericaTel            string    `description:"美国拨入"`
	SingaporeTel          string    `description:"新加坡拨入"`
	ParticipationCode     string    `description:"参会密码"`
	LinkParticipants      string    `description:"参会链接"`
	IsLimitPeople         int8      `description:"是否限制人数 1是，0否"`
	LimitPeopleNum        int       `description:"限制人数数量"`
	ReportId              int       `description:"报告链接所关联的文章ID"`
	ReportLink            string    `description:"报告链接"`
	ReportName            string    `description:"报告标题"`
	City                  string    `description:"城市"`
	Address               string    `description:"活动地址"`
	Remarks               string    `description:"备注"`
	UserId                int       `description:"创建者id"`
	PublishStatus         int8      `description:"发布状态，0未发布，1已发布"`
	IsSendWxMsg           int8      `description:"是否推送过会议提醒微信消息，未推送：0，已推送：1"`
	IsSendSalonWxMsg      int8      `description:"是否推送过沙龙提醒微信消息，未推送：0，已推送：1"`
	IsDelete              int8      `description:"是否删除，0：未删除，1：已删除"`
	ModifyTime            time.Time `description:"修改时间"`
	CreateTime            time.Time `description:"创建时间"`
	QsId                  int       `description:"全时会议关系id"`
	HostCode              string    `description:"主持人入会密码"`
}

// TableName 表名变更
func (activityInfo *Activity) TableName() string {
	return "yb_activity"
}

// GetById 根据id获取活动详情
func GetById(activityId int) (item *Activity, err error) {
	o := orm.NewOrm()
	sql := "select * from yb_activity where activity_id=? AND is_delete = 0 "
	err = o.Raw(sql, activityId).QueryRow(&item)
	return
}

// Update 更新活动
func (activityInfo *Activity) Update(cols []string) (err error) {
	o := orm.NewOrm()
	_, err = o.Update(activityInfo, cols...)
	return
}
