|
@@ -2,32 +2,43 @@ package models
|
|
|
|
|
|
import (
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
+ "html"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+const (
|
|
|
+ BusinessConfDisclaimer = "Disclaimer"
|
|
|
)
|
|
|
|
|
|
// BusinessConf 商户配置表
|
|
|
type BusinessConf struct {
|
|
|
- Id int `orm:"column(id);pk"`
|
|
|
- CompanyName string `description:"公司名称"`
|
|
|
- CompanyWatermark string `description:"公司水印"`
|
|
|
- WatermarkChart int `description:"是否在研报图表使用水印"`
|
|
|
- CnPptCoverImgs string `description:"中文PPT封面图(多图)"`
|
|
|
- CnPptBackgroundImg string `description:"中文PPT背景图"`
|
|
|
- CnPptBottomImg string `description:"中文PPT封底图"`
|
|
|
- Disclaimer string `description:"免责声明"`
|
|
|
- EnPptCoverImgs string `description:"英文PPT封面图(多图)"`
|
|
|
- EnPptBackgroundImg string `description:"英文PPT背景图"`
|
|
|
- EnPptBottomImg string `description:"英文PPT封底图"`
|
|
|
- UseXf int `description:"是否使用科大讯飞:0-否;1-是"`
|
|
|
- XfAppid string `description:"科大讯飞Appid"`
|
|
|
- XfApiKey string `description:"科大讯飞ApiKey"`
|
|
|
- XfApiSecret string `description:"科大讯飞ApiSecret"`
|
|
|
- XfVcn string `description:"科大讯飞Vcn"`
|
|
|
+ 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() (item *BusinessConf, err error) {
|
|
|
- o := orm.NewOrmUsingDB("eta")
|
|
|
- sql := `SELECT * FROM business_conf LIMIT 1`
|
|
|
- err = o.Raw(sql).QueryRow(&item)
|
|
|
+func GetBusinessConf() (list map[string]string, err error) {
|
|
|
+ list = make(map[string]string)
|
|
|
+
|
|
|
+ var items []*BusinessConf
|
|
|
+ o := orm.NewOrm()
|
|
|
+ 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
|
|
|
}
|