123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- 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 {
- Item *CygxConfig
- List []*KeyWord `description:"图表搜索推荐"`
- ListHot []*KeyWord `description:"热搜关键词"`
- }
- type ConfigImgListResp struct {
- List []*ConfigImgResp
- }
- type ConfigImgResp struct {
- Img string `description:"图片"`
- Height string `description:"高度"`
- }
- type ConfigImgHbResp struct {
- HbImg string `description:"海报"`
- ButtonImg string `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
- }
- // HomeHeaderTabList 首页头部导航列表
- type HomeHeaderTabList struct {
- Home []*HomeHeaderTab `description:"首页"`
- SearchPage []*HomeHeaderTab `description:"搜索页"`
- }
- // HomeHeaderTab 首页头部导航
- type HomeHeaderTab struct {
- Id int `description:"导航ID"`
- Name string `description:"导航名称"`
- IsShow bool `description:"是否展示"`
- }
- // 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:"分享图"`
- }
- // CheckOcrBusinessCard OCR 名片校验
- type CheckOcrBusinessCard struct {
- CheckMobile bool `description:"是否校验手机号"`
- CheckCompany bool `description:"是否校验公司名称"`
- }
- type AliyunOcrLog struct {
- Id int `orm:"column(id);pk"`
- ImgUrl string `description:"图片地址"`
- Result string `description:"返回内容"`
- CreateTime time.Time `description:"创建时间"`
- }
- func AddAliyunOcrLog(item *AliyunOcrLog) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
|