package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxCompanyInteractionNum struct { Id int `orm:"column(id);pk"` CompanyId int `description:"用户ID"` ArticleHistoryNum int `description:"文章浏览数量"` ArticleCountNum int `description:"文章收藏数量"` ChartCountNum int `description:"图表收藏"` IndustryFllowNum int `description:"产业关注数量"` DepartmentFollowNum int `description:"作者关注数量"` KeyWordNum int `description:"关键词搜索次数"` ActivityOnLineNum int `description:"线上活动报名次数"` ActivityOfficeNum int `description:"线下活动报名次数"` ActivityNum int `description:"活动报名次数"` TripNum int `description:"专项产业调研数量"` RoadshowVideoNum int `description:"产业视频播放量"` ActivityVideoNum int `description:"活动视频播放量"` ActivityVoiceNum int `description:"活动音频播放量"` RoadshowNum int `description:"路演播放总数量"` TagNum int `description:"标签点击次数"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"更新时间"` } // 添加 func AddCygxCompanyInteractionNum(item *CygxCompanyInteractionNum) (lastId int64, err error) { o := orm.NewOrm() lastId, err = o.Insert(item) return } // 修改 func UpdateCygxCompanyInteractionNum(item *CygxCompanyInteractionNum) (err error) { updateParams := make(map[string]interface{}) updateParams["CompanyId"] = item.CompanyId updateParams["ArticleHistoryNum"] = item.ArticleHistoryNum updateParams["ArticleCountNum"] = item.ArticleCountNum updateParams["ChartCountNum"] = item.ChartCountNum updateParams["IndustryFllowNum"] = item.IndustryFllowNum updateParams["DepartmentFollowNum"] = item.DepartmentFollowNum updateParams["KeyWordNum"] = item.KeyWordNum updateParams["ActivityOnLineNum"] = item.ActivityOnLineNum updateParams["ActivityOfficeNum"] = item.ActivityOfficeNum updateParams["ActivityNum"] = item.ActivityNum updateParams["TripNum"] = item.TripNum updateParams["RoadshowVideoNum"] = item.RoadshowVideoNum updateParams["ActivityVideoNum"] = item.ActivityVideoNum updateParams["ActivityVoiceNum"] = item.ActivityVoiceNum updateParams["RoadshowNum"] = item.RoadshowNum updateParams["TagNum"] = item.TagNum updateParams["CreateTime"] = time.Now() updateParams["ModifyTime"] = time.Now() whereParam := map[string]interface{}{"company_id": item.CompanyId} err = UpdateByExpr(CygxCompanyInteractionNum{}, whereParam, updateParams) return } // 获取列表 func GetCygxCompanyInteractionNumList() (items []*CygxCompanyInteractionNum, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_company_interaction_num ` _, err = o.Raw(sql).QueryRows(&items) return } // 批量添加用户互动信息 func AddCygxCompanyInteractionNumList(items []*CygxCompanyInteractionNum) (lastId int64, err error) { o := orm.NewOrm() _, err = o.InsertMulti(1, items) return }