123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "html"
- "time"
- )
- 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" // 英文免责声明
- BusinessConfReport2ImgReplace = "Report2ImgReplace" // 报告转图替换地址
- )
- // BusinessConf 商户配置表
- type BusinessConf struct {
- Id int `orm:"column(id);pk"`
- ConfKey string `description:"配置Key"`
- ConfVal string `description:"配置值"`
- ValType int `description:"1-字符串;2-数值;3-字符串数组;4-富文本;"`
- Necessary int `description:"是否必填:0-否;1-是"`
- Remark string `description:"备注"`
- CreateTime time.Time
- }
- // GetBusinessConf 获取商家配置
- func GetBusinessConf() (list map[string]string, err error) {
- list = make(map[string]string)
- var items []*BusinessConf
- o := orm.NewOrmUsingDB("eta")
- sql := `SELECT * FROM business_conf`
- _, err = o.Raw(sql).QueryRows(&items)
- if err != nil {
- return
- }
- for _, v := range items {
- if v.ValType == 4 {
- list[v.ConfKey] = html.UnescapeString(v.ConfVal)
- continue
- }
- list[v.ConfKey] = v.ConfVal
- }
- return
- }
- type Report2ImgReplace struct {
- IsReplace bool `description:"是否替换"`
- OssUrlOrigin string `description:"被替换的资源地址"`
- OssUrlNew string `description:"新的资源地址"`
- ChartUrlOrigin string `description:"被替换的图表地址"`
- ChartUrlNew string `description:"新的图表地址"`
- }
|