package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxUserLabelLogRedis struct { UserId int `description:"用户ID"` SourceId int `description:"资源ID"` SourceType int `description:"1:文章阅读、 2产业关注、3:活动到会、4系列关注、5专项调研活动到会。"` IsFllow int `description:"1关注、0取消关注"` CreateTime time.Time `description:"创建时间"` } type CygxUserLabel struct { Id int `orm:"column(id);pk"` UserId int `description:"用户ID"` CompanyId int `description:"公司id"` RealName string `description:"用户实际名称"` Mobile string `description:"手机号"` Email string `description:"邮箱"` Label string `description:"标签内容"` Weight int `description:"权重"` SourceId int `description:"来源ID(产业ID,系列ID)"` Source int `description:"来源1:产业、2:系列"` IsFollow int `description:"是否关注,1是,0否"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"更新时间"` } // UpdateCygxUserLabelNofollow 全部取消关注 func UpdateCygxUserLabelNofollow(userId int) (err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `UPDATE cygx_user_label SET is_follow = 0 , modify_time=NOW() WHERE user_id = ? ` _, err = o.Raw(sql, userId).Exec() return } // 列表 func GetCygxUserLabelList(condition string, pars []interface{}) (items []*CygxUserLabel, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_user_label as art WHERE 1= 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return }