12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxIndustryTop struct {
- Id int `orm:"column(id);pk"`
- IndustrialManagementId int `description:"产业D"`
- UserId int `description:"用户ID"`
- CreateTime time.Time `description:"创建时间"`
- }
- type CygxIndustryTopRep struct {
- IndustrialManagementId int `description:"产业D"`
- }
- //添加收藏信息
- func AddCygxIndustryTop(item *CygxIndustryTop) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type CygxIndustryTopResp struct {
- Status int `description:"1:收藏,2:取消收藏"`
- CollectCount int `description:"收藏总数"`
- }
- func RemoveCygxIndustryTop(userId, industrialManagementId int) (err error) {
- o := orm.NewOrm()
- sql := `DELETE FROM cygx_industry_top WHERE user_id=? AND industrial_management_id=? `
- _, err = o.Raw(sql, userId, industrialManagementId).Exec()
- return
- }
- //判断这篇文章是否被用户收藏
- func GetCygxIndustryTop(userId, industrialManagementId int) (count int, err error) {
- sql := `SELECT COUNT(1) AS count FROM cygx_industry_top WHERE user_id=? AND industrial_management_id=? `
- err = orm.NewOrm().Raw(sql, userId, industrialManagementId).QueryRow(&count)
- return
- }
|