package models

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

type CygxAskserieVideoCollection struct {
	Id               int       `orm:"column(id);pk"`
	AskserieVideoId  int       `description:"askserie_video_id"`
	UserId           int       `description:"用户ID"`
	CreateTime       time.Time `description:"创建时间"`
	Mobile           string    `description:"手机号"`
	Email            string    `description:"邮箱"`
	CompanyId        int       `description:"公司id"`
	CompanyName      string    `description:"公司名称"`
	RealName         string    `description:"用户实际名称"`
	SellerName       string    `description:"所属销售"`
	RegisterPlatform int       `description:"来源 1小程序，2：网页"`
	ModifyTime       time.Time `description:"更新时间"`
	Content          string    `description:"留言内容"`
}

// 添加
func AddCygxAskserieVideoCollection(item *CygxAskserieVideoCollection) (err error) {
	o := orm.NewOrm()
	_, err = o.Insert(item)
	return
}

func UpdateAskserieVideoCommentNum(askserieVideoId int) (err error) {
	sql := `UPDATE cygx_askserie_video SET comment_num = comment_num+1 WHERE askserie_video_id = ?  `
	o := orm.NewOrm()
	_, err = o.Raw(sql, askserieVideoId).Exec()
	return
}
