package models import ( "github.com/beego/beego/v2/client/orm" "github.com/rdlucklib/rdluck_tools/paging" "time" ) type CygxResourceData struct { Id int `orm:"column(id);pk"` SourceId int `description:"资源ID"` Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"` Title string `description:"标题"` Annotation string `description:"核心观点"` CreateTime time.Time `description:"创建时间"` PublishDate string `description:"发布时间"` Abstract string `description:"摘要"` SearchTag string `description:"搜索标签"` ChartPermissionId int `description:"行业id"` SearchTitle string `description:"搜索匹配用的标题"` SearchContent string `description:"搜索匹配用的内容"` SearchOrderTime string `description:"搜索排序时间"` } type CygxResourceDataResp struct { Id int `orm:"column(id);pk"` SourceId int `description:"资源ID"` Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"` Title string `description:"标题"` IsResearch bool `description:"是否属于研选"` BodyImg string `description:"文章封面图片"` Pv int `description:"PV"` Annotation string `description:"核心观点"` PublishDate string `description:"发布时间"` Abstract string `description:"摘要"` IsTop bool `description:"是否置顶"` IsCollection bool `description:"是否收藏 "` BackgroundImg string `description:"背景图"` City string `description:"城市"` IsSignup int `description:"是否已报名 1是 ,0 否"` IsAppointment int `description:"是否已预约纪要 1是 ,0 否"` IsCancelMeetingReminder int `description:"是否添加了消息消息提醒 1是 ,0 否"` ActiveState string `description:"活动进行状态 未开始:1、进行中2、已结束3"` ImgUrl string `description:"行业图片链接"` ImgUrlText string `description:"活动类型图片链接"` ActivityType int `description:"活动线上线下类型 1线上,0 线下,2线下"` IsShowOutboundCall bool `description:"是否展示预约外呼"` IsShowMeetingReminder bool `description:"是否展示会议提醒"` IsShowHelpSsk bool `description:"是否展示帮我带问"` IsShowSignup bool `description:"是否展示我要报名"` IsShowAppointment bool `description:"是否展示预约纪要"` IsLimitPeople int `description:"是否限制人数 1是,0否"` IsShowDetails bool `description:"是否展示查看详情按钮"` YidongActivityUrl string `description:"易董活动跳转地址"` IsYidongActivity bool `description:"是否属于易董同步过来的活动"` TripStatus int `description:"行程进行状态 1:预报名,2:确定行程"` IsTrip int `description:"确定行程是否报名 1是 ,0 否"` ActivityTimeText string `description:"活动预期时间带文字"` TripImgLink string `description:"行程图片链接"` ChartPermissionId int `description:"权限id"` Expert string `description:"专家"` Speaker string `description:"主讲人"` DistinguishedGuest string `description:"嘉宾"` ActivityTime string `description:"活动预期时间"` ResourceUrl string `description:"链接"` AuthInfo *UserPermissionAuthInfo VoiceDetail *CygxActivityVoiceReq `description:"音频数据"` VideoDetail *CygxActivityVideoListResp `description:"视频数据"` AudioLink bool `description:"是否展示回放按钮"` FileType int `description:"类型: 1-音频; 2-视频"` SignupType int `description:"报名方式,1预约外呼,2自主拨入,3我要报名"` ActivityTypeId int `description:"活动类型id"` IsYidongConduct bool `description:"是否属于易董办会 1:是 、0:否"` IsCanOutboundCall int `description:"是否提供外呼 1:是 、0:否"` TencentConferenceNumber string `description:"腾讯会议号"` IsResearchSpecial bool `description:"是否属于特殊的研选"` IsExternalLabel bool `description:"是否为外部资源"` IsResearchPoints bool `description:"是否为研选扣点"` SiginupDeadline string `description:"报名截止时间"` } type HomeResourceDataListResp struct { Paging *paging.PagingItem List []*CygxResourceDataResp `description:"列表"` } // Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"` type HomeResourceDataListNewResp struct { Paging *paging.PagingItem List []*CygxResourceDataNewResp `description:"列表"` } type CygxResourceDataNewResp struct { Id int `orm:"column(id);pk"` BodyHighlight []string `description:"搜索高亮展示结果"` TitleHighlight string `description:"搜索高亮展示结果"` SourceId int `description:"资源ID"` Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"` PublishDate string `description:"发布时间"` Article *ArticleListResp `description:"文章"` Newchart *HomeChartListResp `description:"图表"` Roadshow *MicroRoadShowPageList `description:"微路演"` Activity *ActivityListResp `description:"活动"` Activityvideo *MicroRoadShowPageList `description:"活动视频"` Activityvoice *MicroRoadShowPageList `description:"活动音频"` Activityspecial *CygxActivitySpecialDetail `description:"专项调研活动"` Researchsummary *CygxReportSelectionRep `description:"本周研究汇总"` Minutessummary *CygxReportSelectionRep `description:"上周纪要汇总"` Meetingreviewchapt *CygxMorningMeetingGatherDetailListResp `description:"晨会精华"` ProductInterior *CygxProductInteriorResp `description:"产品内测"` IndustrialResource *IndustrialManagement `description:"产业资源包"` ReportSelection *CygxReportSelectionRep `description:"重点公司(原报告精选)"` YanxuanSpecial *CygxYanxuanSpecialItem `description:"研选专栏"` AskserieVideo *MicroRoadShowPageList `description:"活动音频"` FiccReport *ArticleListResp `description:"FICC研报"` } // 列表 func GetResourceDataList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxResourceDataNewResp, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_resource_data WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` ORDER BY publish_date DESC , id DESC LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 列表 func GetResourceDataListCondition(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxResourceData, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_resource_data WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` ORDER BY search_order_time DESC LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 获取用户报名成功数量 func GetResourceDataCount(condition string, pars []interface{}) (count int, err error) { sqlCount := `SELECT COUNT(1) AS count FROM cygx_resource_data WHERE 1= 1 ` + condition o := orm.NewOrm() err = o.Raw(sqlCount, pars).QueryRow(&count) return } // 删除数据 func DeleteResourceData(sourceId int, source string) (err error) { o := orm.NewOrm() sql := ` DELETE FROM cygx_resource_data WHERE source_id = ? AND source =? ` _, err = o.Raw(sql, sourceId, source).Exec() return } // 获取数量 func GetCygxResourceDataBySourceAndIdCount(sourceId int, source string) (count int, err error) { o := orm.NewOrm() sqlCount := ` SELECT COUNT(1) AS count FROM cygx_resource_data WHERE source_id = ? AND source =? ` err = o.Raw(sqlCount, sourceId, source).QueryRow(&count) return } // 添加 func AddCygxResourceData(item *CygxResourceData) (lastId int64, err error) { o := orm.NewOrm() lastId, err = o.Insert(item) return } // 修改 func UpdateResourceDataByItem(item *CygxResourceData) (err error) { o := orm.NewOrm() updateParams := make(map[string]interface{}) updateParams["PublishDate"] = item.PublishDate updateParams["SearchTag"] = item.SearchTag ptrStructOrTableName := "cygx_resource_data" whereParam := map[string]interface{}{"source_id": item.SourceId, "source": item.Source} qs := o.QueryTable(ptrStructOrTableName) for expr, exprV := range whereParam { qs = qs.Filter(expr, exprV) } _, err = qs.Update(updateParams) if err != nil { return } return }