Prechádzať zdrojové kódy

Es存入内容去除格式

xingzai 2 rokov pred
rodič
commit
3243230349

+ 7 - 1
controllers/report.go

@@ -1210,11 +1210,17 @@ func (this *ReportController) IsShow() {
 		return
 	}
 	var resp models.IsShow
-
+	IsShowFreeButton, err := services.GetfreeButtonIsShow(user)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,GetfreeButtonIsShow Err:" + err.Error()
+		return
+	}
 	resp.IsShowChart = true
 	resp.IsShowResearch = true
 	resp.LinkWxExplain = utils.LINK_WX_EXPLAIN
 	resp.YanXuan_Explain = true
+	resp.IsShowFreeButton = IsShowFreeButton
 	mobile := user.Mobile
 	if mobile == "" {
 		br.Ret = 200

+ 3 - 2
models/article.go

@@ -261,8 +261,9 @@ func GetArticleAll() (item []*ArticleDetail, err error) {
 }
 func GetArticleAllDate(endDate string) (item []*ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_article WHERE is_summary=1 AND publish_date >= ?  `
-	_, err = o.Raw(sql, endDate).QueryRows(&item)
+	sql := `SELECT * FROM cygx_article WHERE is_summary=1 AND publish_date >= ? AND  article_id = 7297  `
+	sql = `SELECT * FROM cygx_article WHERE article_id = ?  `
+	_, err = o.Raw(sql, 7297).QueryRows(&item)
 	return
 }
 

+ 8 - 7
models/report.go

@@ -208,13 +208,14 @@ func GetWhichDepartmentCount(condition string) (count int, err error) {
 }
 
 type IsShow struct {
-	IsShow          bool      `description:"绝密内参按钮是否展示"`
-	IsShowResearch  bool      `description:"研选是否展示限免"`
-	IsShowChart     bool      `description:"图表是否展示限免"`
-	IsShowList      bool      `description:"榜单是否展示"`
-	LinkWxExplain   string    `description:"关注微信公众号链接说明地址"`
-	YanXuan_Explain bool      `description:"研选说明"`
-	SearchTxtList   SearchTxt `description:"搜索栏回显内容说明"`
+	IsShow           bool      `description:"绝密内参按钮是否展示"`
+	IsShowFreeButton bool      `description:"免费送月卡按钮是否展示"`
+	IsShowResearch   bool      `description:"研选是否展示限免"`
+	IsShowChart      bool      `description:"图表是否展示限免"`
+	IsShowList       bool      `description:"榜单是否展示"`
+	LinkWxExplain    string    `description:"关注微信公众号链接说明地址"`
+	YanXuan_Explain  bool      `description:"研选说明"`
+	SearchTxtList    SearchTxt `description:"搜索栏回显内容说明"`
 }
 
 type SearchTxt struct {

+ 1 - 0
services/tactics.go

@@ -745,6 +745,7 @@ func GetSummarytoEs(cont context.Context) (err error) {
 		item.ArticleId = v.ArticleId
 		item.Title = v.Title
 		item.PublishDate = v.PublishDate
+		bodyText, _ = GetReportContentTextSub(v.Body)
 		item.BodyText = bodyText
 		item.CategoryId = strconv.Itoa(v.CategoryId)
 		item.ExpertBackground = v.ExpertBackground

+ 28 - 0
services/user_freee_button.go

@@ -0,0 +1,28 @@
+package services
+
+import (
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+)
+
+// GetfreeButtonIsShow 用户免费分享按钮是否回显
+func GetfreeButtonIsShow(user *models.WxUserItem) (isShow bool, err error) {
+	detail, err := models.GetConfigByCode("free_trial_card")
+	if err != nil {
+		return
+	}
+	companyDetail, err := models.GetCompanyDetailByIdGroup(user.CompanyId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	count, err := models.CountCygxUserFreeeButton(user.UserId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	if companyDetail != nil && companyDetail.IsSuspend == 0 {
+		if detail.ConfigValue == "1" && (companyDetail.Status == "正式" || companyDetail.Status == "试用" || companyDetail.Status == "永续") && count == 0 {
+			isShow = true
+		}
+	}
+	return
+}