|
@@ -2,10 +2,16 @@ package business_conf
|
|
|
|
|
|
import (
|
|
import (
|
|
"hongze/hongze_yb_en_api/global"
|
|
"hongze/hongze_yb_en_api/global"
|
|
|
|
+ "hongze/hongze_yb_en_api/utils"
|
|
"html"
|
|
"html"
|
|
|
|
+ "strconv"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+var (
|
|
|
|
+ BusinessConfMap map[string]string
|
|
|
|
+)
|
|
|
|
+
|
|
type BusinessConf struct {
|
|
type BusinessConf struct {
|
|
Id int `gorm:"primaryKey;column:id" json:"id"`
|
|
Id int `gorm:"primaryKey;column:id" json:"id"`
|
|
ConfKey string `gorm:"column:conf_key" json:"conf_key"` // 配置Key
|
|
ConfKey string `gorm:"column:conf_key" json:"conf_key"` // 配置Key
|
|
@@ -21,21 +27,22 @@ func (c *BusinessConf) TableName() string {
|
|
}
|
|
}
|
|
|
|
|
|
const (
|
|
const (
|
|
- BusinessConfDisclaimer = "Disclaimer"
|
|
|
|
- BusinessConfH5ShareName = "H5ShareName"
|
|
|
|
- BusinessConfH5ShareEnName = "H5ShareEnName"
|
|
|
|
- BusinessConfH5ReportShareImg = "H5ReportShareImg"
|
|
|
|
- BusinessConfWatermarkChart = "WatermarkChart"
|
|
|
|
- BusinessConfWatermarkReport = "WatermarkReport"
|
|
|
|
- BusinessConfWxAppId = "WxAppId"
|
|
|
|
- BusinessConfWxAppSecret = "WxAppSecret"
|
|
|
|
- BusinessConfReportViewUrl = "ReportViewUrl"
|
|
|
|
- BusinessConfReport2ImgUrl = "Report2ImgUrl"
|
|
|
|
- BusinessConfReportLogo = "ReportLogo" // 报告logo
|
|
|
|
- BusinessConfReportCenterLogoShow = "ReportCenterLogoShow" // 报告logo
|
|
|
|
- BusinessConfReportEnLogoShow = "ReportEnLogoShow" // 报告logo
|
|
|
|
- BusinessConfDisclaimerEn = "DisclaimerEn" // 英文免责声明
|
|
|
|
- BusinessConfIsOpenChartExpired = "IsOpenChartExpired" // 图表是否鉴权
|
|
|
|
|
|
+ BusinessConfDisclaimer = "Disclaimer"
|
|
|
|
+ BusinessConfH5ShareName = "H5ShareName"
|
|
|
|
+ BusinessConfH5ShareEnName = "H5ShareEnName"
|
|
|
|
+ BusinessConfH5ReportShareImg = "H5ReportShareImg"
|
|
|
|
+ BusinessConfWatermarkChart = "WatermarkChart"
|
|
|
|
+ BusinessConfWatermarkReport = "WatermarkReport"
|
|
|
|
+ BusinessConfWxAppId = "WxAppId"
|
|
|
|
+ BusinessConfWxAppSecret = "WxAppSecret"
|
|
|
|
+ BusinessConfReportViewUrl = "ReportViewUrl"
|
|
|
|
+ BusinessConfReport2ImgUrl = "Report2ImgUrl"
|
|
|
|
+ BusinessConfReportLogo = "ReportLogo" // 报告logo
|
|
|
|
+ BusinessConfReportCenterLogoShow = "ReportCenterLogoShow" // 报告logo
|
|
|
|
+ BusinessConfReportEnLogoShow = "ReportEnLogoShow" // 报告logo
|
|
|
|
+ BusinessConfDisclaimerEn = "DisclaimerEn" // 英文免责声明
|
|
|
|
+ BusinessConfIsOpenChartExpired = "IsOpenChartExpired" // 图表是否鉴权
|
|
|
|
+ BusinessConfReportChartExpiredTime = "ReportChartExpiredTime" // 图表有效期鉴权时间,单位:分钟
|
|
)
|
|
)
|
|
|
|
|
|
func (c *BusinessConf) GetList(condition string, pars []interface{}) (list []*BusinessConf, err error) {
|
|
func (c *BusinessConf) GetList(condition string, pars []interface{}) (list []*BusinessConf, err error) {
|
|
@@ -62,3 +69,24 @@ func (c *BusinessConf) GetBusinessConf() (list map[string]string, err error) {
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func InitBusinessConf() {
|
|
|
|
+ obj := &BusinessConf{}
|
|
|
|
+ var e error
|
|
|
|
+ BusinessConfMap, e = obj.GetBusinessConf()
|
|
|
|
+ if e != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 图表有效期的过期时间
|
|
|
|
+ if BusinessConfMap[BusinessConfReportChartExpiredTime] != "" {
|
|
|
|
+ reportChartExpiredTime, _ := strconv.Atoi(BusinessConfMap[BusinessConfReportChartExpiredTime])
|
|
|
|
+ if reportChartExpiredTime <= 0 {
|
|
|
|
+ reportChartExpiredTime = 30
|
|
|
|
+ }
|
|
|
|
+ utils.BusinessConfReportChartExpiredTime = time.Duration(reportChartExpiredTime) * time.Minute
|
|
|
|
+ } else {
|
|
|
|
+ utils.BusinessConfReportChartExpiredTime = 30 * time.Minute
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|