12345678910111213141516171819202122232425262728293031323334 |
- package base_config
- import (
- "context"
- "fmt"
- "hongze/hongze_yb/global"
- "hongze/hongze_yb/models/tables/business_conf"
- "hongze/hongze_yb/utils"
- "html"
- "time"
- )
- func GetBusinessConfDisclaimer() (disclaimer string, err error) {
- cacheKey := utils.HONGZEYB_ + "business_conf:disclaimer"
- disclaimer, _ = global.Redis.Get(context.TODO(), cacheKey).Result()
- if disclaimer != "" {
- disclaimer = html.UnescapeString(disclaimer)
- return
- }
- obj := new(business_conf.BusinessConf)
- item, err := obj.GetItemByConfKey("Disclaimer")
- if err != nil {
- err = fmt.Errorf("GetBusinessConfDisclaimer err:%v", err)
- return
- }
- if item.Id <= 0 {
- err = fmt.Errorf("研报声明未配置")
- return
- }
- disclaimer = item.ConfVal
- _ = global.Redis.Set(context.TODO(), cacheKey, disclaimer, 24*time.Hour)
- disclaimer = html.UnescapeString(disclaimer)
- return
- }
|