12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxUserInteractionNum struct {
- Id int `orm:"column(id);pk"`
- UserId 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 AddCygxUserInteractionNum(item *CygxUserInteractionNum) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- // 修改
- func UpdateCygxUserInteractionNum(item *CygxUserInteractionNum) (err error) {
- updateParams := make(map[string]interface{})
- updateParams["UserId"] = item.UserId
- 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{}{"user_id": item.UserId}
- err = UpdateByExpr(CygxUserInteractionNum{}, whereParam, updateParams)
- return
- }
- // 获取列表
- func GetCygxUserInteractionNumList() (items []*CygxUserInteractionNum, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_user_interaction_num `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 批量添加用户互动信息
- func AddCygxUserInteractionNumList(items []*CygxUserInteractionNum) (lastId int64, err error) {
- o := orm.NewOrm()
- _, err = o.InsertMulti(1, items)
- return
- }
|