浏览代码

no message

xingzai 1 年之前
父节点
当前提交
a2b51b07e4
共有 3 个文件被更改,包括 31 次插入3 次删除
  1. 1 0
      controllers/yanxuan_special.go
  2. 5 3
      models/cygx_yanxuan_special_user.go
  3. 25 0
      services/cygx_yanxuan_special.go

+ 1 - 0
controllers/yanxuan_special.go

@@ -1017,6 +1017,7 @@ func (this *YanxuanSpecialController) AuthorList() {
 	}
 	resp := new(models.SpecialAuthorListResp)
 	isAuthor, _ := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
+	resp.MomentsImg = services.GetSpecialAuthorListMomentsImg()  //获取作者列表朋友圈分享封面图
 	resp.IsAuthor = isAuthor
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp.List = list

+ 5 - 3
models/cygx_yanxuan_special_user.go

@@ -46,6 +46,7 @@ type CygxYanxuanSpecialAuthorItem struct {
 	LatestPublishDate    string                              // 最近更新时间
 	IsFollow             int                                 // 是否已关注 1已关注 0 未关注
 	HasChangeHeadImg     int                                 // 是否更换过默认头像 1是,0否
+	MomentsImg           string                              `description:"分享到朋友圈的封面图片"`
 	YanxuanSpecialCenter *CygxYanxuanSpecialCenterAuthorResp // 研选专栏文章内容
 }
 
@@ -149,9 +150,10 @@ WHERE 1= 1 `
 }
 
 type SpecialAuthorListResp struct {
-	Paging   *paging.PagingItem `description:"分页数据"`
-	List     []*CygxYanxuanSpecialAuthorItem
-	IsAuthor bool
+	Paging     *paging.PagingItem `description:"分页数据"`
+	List       []*CygxYanxuanSpecialAuthorItem
+	IsAuthor   bool
+	MomentsImg string `description:"分享到朋友圈的封面图片"`
 }
 
 type SaveCygxYanxuanSpecialAuthoHeadImgrReq struct {

+ 25 - 0
services/cygx_yanxuan_special.go

@@ -504,3 +504,28 @@ func UdpateYanxuanSpecialauthorArticleNum(authoruserId int) {
 	}
 	return
 }
+
+// 获取作者列表朋友圈分享封面图
+func GetSpecialAuthorListMomentsImg() (imgUrl string) {
+	var err error
+	//time.Sleep(3*time.Second) // 有时候同时添加多个活动,延迟三秒
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go utils.SendAlarmMsg("获取作者列表朋友圈分享封面图,GetSpecialAuthorListMomentsImg Err:"+err.Error(), 3)
+		}
+	}()
+	configCode := "special_author_list_moments_img"
+	detailConfig, e := models.GetConfigByCode(configCode)
+	if e != nil {
+		err = errors.New("GetConfigByCode 获取作者列表朋友圈分享封面图, Err: " + e.Error())
+		return
+	}
+	imgUrl = detailConfig.ConfigValue
+	fmt.Println(imgUrl)
+	return
+}
+
+//func init() {
+//	GetSpecialAuthorListMomentsImg()
+//}