123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- var (
- HomeHeaderTabConfigKey = "home_header_tab"
- MicroRoadShowListDataRatioConfigKey = "micro_roadshow_list_data_ratio"
- HomeNewListAudioNumKey = "home_new_list_audio_num"
- MicroRoadshowDefaultImgKey = "micro_roadshow_default_img"
- )
- type CygxConfig struct {
- ConfigId int `json:"-" orm:"column(config_id);pk"`
- ConfigCode string `json:"-"`
- ConfigValue string
- Remark string `json:"-"`
- CreateTime time.Time `json:"-"`
- }
- type KeyWord struct {
- KeyWord string `description:"关键词"`
- }
- func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
- sql := `SELECT * FROM cygx_config WHERE config_code=? `
- err = orm.NewOrm().Raw(sql, configCode).QueryRow(&item)
- return
- }
- // 更改配置信息
- func UpdateConfigByCode(configValue, countryCode string) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE cygx_config SET config_value= ? WHERE config_code=? `
- _, err = o.Raw(sql, configValue, countryCode).Exec()
- return
- }
- type ConfigResp struct {
- ListRecommend []*KeyWord `description:"图表搜索推荐"`
- ListHot []*KeyWord `description:"热搜关键词"`
- ListHistory []*KeyWord `description:"关键词搜索记录"`
- }
- // 获取是否展示限免标签
- func GetShowSustainable() (count int, err error) {
- o := orm.NewOrm()
- sqlCount := ` SELECT COUNT(1) FROM cygx_config WHERE config_code= 'is_show_sustainable' AND config_value = 1 `
- err = o.Raw(sqlCount).QueryRow(&count)
- return
- }
- // 通过报告精选来获取最新的推荐搜索词
- func GetHotSearch() (permission string, err error) {
- sql := `SELECT
- GROUP_CONCAT( DISTINCT rl.subject_name ORDER BY rl.article_sun_id ASC SEPARATOR ',' ) AS subject_name
- FROM
- cygx_report_selection_log AS rl
- WHERE
- rl.article_id = (
- SELECT
- MAX( article_id )
- FROM
- cygx_report_selection
- WHERE
- publish_status = 1)`
- o := orm.NewOrm()
- err = o.Raw(sql).QueryRow(&permission)
- return
- }
- // MicroRoadShowDefaultImgList 微路演行业默认背景图列表
- type MicroRoadShowDefaultImgList struct {
- Audio []*MicroRoadShowDefaultImg `description:"音频"`
- Video []*MicroRoadShowDefaultImg `description:"视频"`
- }
- // MicroRoadShowDefaultImg 微路演行业默认背景图
- type MicroRoadShowDefaultImg struct {
- ChartPermissionId int `description:"行业ID"`
- ChartPermissionName string `description:"行业名称"`
- ImgUrl string `description:"背景图"`
- ShareImg string `description:"分享图"`
- }
- type IsShow struct {
- IsBelongRai bool `description:"是否属于权益内部人员"`
- IsShowResearchPoints bool `description:"是否展示研选扣点搜索"`
- }
- // 关于我们
- type AboutUs struct {
- Title string `description:"标题"`
- Url string `description:"链接"`
- }
- type ConfigImgListResp struct {
- List []*ConfigImgResp
- }
- type ConfigImgResp struct {
- Img string `description:"图片"`
- Height string `description:"高度"`
- }
- type ConfigImgHbResp struct {
- HbImg string `description:"海报"`
- ButtonImg string `description:"按钮图片"`
- }
|