123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- 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
- }
- type ConfigResp struct {
- Item *CygxConfig
- List []*KeyWord `description:"图表搜索推荐"`
- ListHot []*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
- }
|