Browse Source

no message

xingzai 1 year ago
parent
commit
6e9b721d66

+ 1 - 1
controllers/article.go

@@ -69,7 +69,6 @@ func (this *ArticleController) Detail() {
 	if strings.Contains(detail.CategoryName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 		resp.IsResearch = true
 	}
-	detail.ShareImg = services.GetArticleShareImg(articleId)
 
 	// 高毅资产的联系人,有权限的行业也不能查看报告详情页。提示无权限页面
 	if detail.ArticleTypeId == 0 && user.CompanyId == utils.GAO_YI_ZI_CHAN_COMPANY_ID {
@@ -344,6 +343,7 @@ Loop:
 	if detail.SubCategoryName == "专项调研" {
 		detail.IsSpecialArticle = true
 	}
+	detail.ShareImg = services.GetArticleShareImg(articleId)
 	resp.HasPermission = hasPermission
 	resp.IsSpecialArticle = detail.IsSpecialArticle
 	resp.Detail = detail

+ 12 - 0
controllers/yanxuan_special.go

@@ -255,6 +255,18 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
 			resp.IsApprovalAdmin = true
 		}
 	}
+
+	if sysUser.UserId > 0 {
+		followCount, err := models.GetCygxYanxuanSpecialFollowCountByUser(sysUser.UserId, item.UserId)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败, Err:" + err.Error()
+			return
+		}
+		if followCount == 1 {
+			resp.IsFollowAuthor = true
+		}
+	}
 	//
 	//if resp.HasPermission != 1 || sysUser.UserId == 0 {
 	//	resp.Content = utils.InterceptHtmlLength(resp.Content, 240)

+ 1 - 0
models/cygx_yanxuan_special.go

@@ -71,6 +71,7 @@ type CygxYanxuanSpecialResp struct {
 	HasPermission   int    `description:"1:正常展示,2:不展示"`
 	IsApprovalAdmin bool   // 是否是审批人员
 	ShareImg        string `description:"分享图片"`
+	IsFollowAuthor  bool   // 是否已关注专栏
 }
 
 type Doc struct {

+ 8 - 0
models/cygx_yanxuan_special_follow.go

@@ -66,3 +66,11 @@ func GetCygxYanxuanSpecialFollowCount(condition string, pars []interface{}) (cou
 	err = o.Raw(sqlCount, pars).QueryRow(&count)
 	return
 }
+
+// 获取数量判断用户是否关注专栏
+func GetCygxYanxuanSpecialFollowCountByUser(userId, followUserId int) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_yanxuan_special_follow as a WHERE user_id=? AND follow_user_id=? `
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, userId, followUserId).QueryRow(&count)
+	return
+}