Browse Source

fix:免责声明返回

Roc 7 months ago
parent
commit
a4156999aa

+ 26 - 0
controller/english_report/english_report.go

@@ -7,6 +7,7 @@ import (
 	"hongze/hongze_yb_en_api/controller/resp"
 	"hongze/hongze_yb_en_api/global"
 	"hongze/hongze_yb_en_api/models/base"
+	"hongze/hongze_yb_en_api/models/business_conf"
 	"hongze/hongze_yb_en_api/models/english_classify"
 	"hongze/hongze_yb_en_api/models/english_report"
 	"hongze/hongze_yb_en_api/models/english_video"
@@ -455,5 +456,30 @@ func (er *EnglishReportController) Detail(c *gin.Context) {
 	baseData := new(english_report.ReportDetailResp)
 	baseData.Report = reportDetail
 	baseData.AuthOk = authOk
+
+	// 配置信息
+	{
+		obj := business_conf.BusinessConf{}
+		conf, e := obj.GetBusinessConf()
+		if e != nil {
+			resp.FailMsg("获取失败", "获取免责声明失败,Err:"+err.Error(), c)
+			return
+		}
+
+		// 免责声明
+		if conf[business_conf.BusinessConfDisclaimerEn] != "" {
+			baseData.Disclaimer = conf[business_conf.BusinessConfDisclaimerEn]
+		}
+
+		// 报告Logo
+		if v, ok := conf[business_conf.BusinessConfReportEnLogoShow]; ok {
+			if v == `true` {
+				if reportLogo, ok := conf[business_conf.BusinessConfReportLogo]; ok {
+					baseData.ReportLogo = reportLogo
+				}
+			}
+		}
+	}
+
 	resp.OkData("查询成功", baseData, c)
 }

+ 63 - 0
models/business_conf/business_conf.go

@@ -0,0 +1,63 @@
+package business_conf
+
+import (
+	"hongze/hongze_yb_en_api/global"
+	"html"
+	"time"
+)
+
+type BusinessConf struct {
+	Id         int       `gorm:"primaryKey;column:id" json:"id"`
+	ConfKey    string    `gorm:"column:conf_key" json:"conf_key"`                      // 配置Key
+	ConfVal    string    `gorm:"column:conf_val" json:"conf_val"`                      // 配置值
+	ValType    int       `gorm:"column:val_type" json:"val_type"`                      // 1-字符串;2-数值;3-字符串数组;4-富文本;
+	Necessary  int       `gorm:"column:Necessary" json:"Necessary"`                    // 是否必填:0-否;1-是
+	Remark     string    `gorm:"column:remark" json:"remark"`                          // 备注
+	CreateTime time.Time `gorm:"autoCreateTime;column:create_time" json:"create_time"` //创建时间
+}
+
+func (c *BusinessConf) TableName() string {
+	return "en_company_permission"
+}
+
+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"         // 英文免责声明
+)
+
+func (c *BusinessConf) GetList(condition string, pars []interface{}) (list []*BusinessConf, err error) {
+	err = global.MYSQL["master"].Model(c).Where(condition, pars).Order("create_time DESC").Scan(&list).Error
+	return
+}
+
+// GetBusinessConf 获取商家配置
+func (c *BusinessConf) GetBusinessConf() (list map[string]string, err error) {
+	list = make(map[string]string)
+
+	var items []*BusinessConf
+	err = global.MYSQL["master"].Model(c).Order("create_time DESC").Scan(&list).Error
+	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
+}

+ 4 - 2
models/english_report/report.go

@@ -114,8 +114,10 @@ type ReportDetail struct {
 }
 
 type ReportDetailResp struct {
-	Report *ReportDetail `json:"report"`
-	AuthOk bool          `json:"auth_ok"`
+	Report     *ReportDetail `json:"report"`
+	AuthOk     bool          `json:"auth_ok"`
+	Disclaimer string        `json:"disclaimer" description:"免责声明"`
+	ReportLogo string        `description:"报告logo"`
 }
 
 type SearchEnglishReportItem struct {