作者 tangxvhui

接口调试

1 # 说明 1 # 说明
2 2
3 ### 测试环境 3 ### 测试环境
  4 +
4 服务端域名 http://sumifcc-discuss-test.sumifcc.com/ 5 服务端域名 http://sumifcc-discuss-test.sumifcc.com/
5 日志地址 https://sumifcc-discuss-test.sumifcc.com/v1/log/access 6 日志地址 https://sumifcc-discuss-test.sumifcc.com/v1/log/access
6 7
  8 +管理后台“易数家“前端入口:https://digital-front-platform-dev.fjmaimaimai.com/
  9 +跳转后的实际管理后台地址:
  10 +
7 ### 可设置环境变量 11 ### 可设置环境变量
8 - DataSource 12 - DataSource
9 数据库连接,样例 13 数据库连接,样例
@@ -56,7 +56,8 @@ type ( @@ -56,7 +56,8 @@ type (
56 Show int `json:"show"` // 评论的展示状态(1显示、2不显示) 56 Show int `json:"show"` // 评论的展示状态(1显示、2不显示)
57 Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在) 57 Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
58 MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) 58 MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
59 - Tags []string `json:"tags"` //文章的标签 59 + MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
  60 + Tags []string `json:"tags"` // 文章的标签
60 } 61 }
61 ArticleSection { 62 ArticleSection {
62 Id int64 `json:"id"` //段落id 63 Id int64 `json:"id"` //段落id
@@ -22,6 +22,7 @@ func MiniGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { @@ -22,6 +22,7 @@ func MiniGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
22 l := article.NewMiniGetArticleLogic(r.Context(), svcCtx) 22 l := article.NewMiniGetArticleLogic(r.Context(), svcCtx)
23 token := contextdata.GetUserTokenFromCtx(r.Context()) 23 token := contextdata.GetUserTokenFromCtx(r.Context())
24 req.CompanyId = token.CompanyId 24 req.CompanyId = token.CompanyId
  25 + req.UserId = int(token.UserId)
25 resp, err := l.MiniGetArticle(&req) 26 resp, err := l.MiniGetArticle(&req)
26 result.HttpResult(r, w, resp, err) 27 result.HttpResult(r, w, resp, err)
27 } 28 }
@@ -77,6 +77,9 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( @@ -77,6 +77,9 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
77 tags = append(tags, val.Name) 77 tags = append(tags, val.Name)
78 } 78 }
79 } 79 }
  80 + // 查询我是否已关注文章的作者
  81 +
  82 + follow, _ := l.svcCtx.UserFollowRepository.FindOneUserFollowing(l.ctx, conn, int64(req.UserId), articleInfo.AuthorId)
80 83
81 sortBy := domain.SortArticleSection(sectionList) 84 sortBy := domain.SortArticleSection(sectionList)
82 sort.Sort(sortBy) 85 sort.Sort(sortBy)
@@ -117,6 +120,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( @@ -117,6 +120,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
117 Show: int(articleInfo.Show), 120 Show: int(articleInfo.Show),
118 Edit: 0, 121 Edit: 0,
119 MeLoveFlag: meLoveFlag, 122 MeLoveFlag: meLoveFlag,
  123 + MeFollowFlag: 0,
120 Tags: tags, 124 Tags: tags,
121 } 125 }
122 if articleInfo.CreatedAt != articleInfo.UpdatedAt { 126 if articleInfo.CreatedAt != articleInfo.UpdatedAt {
@@ -125,6 +129,8 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( @@ -125,6 +129,8 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
125 for _, val := range articleInfo.Images { 129 for _, val := range articleInfo.Images {
126 resp.Images = append(resp.Images, val.Url) 130 resp.Images = append(resp.Images, val.Url)
127 } 131 }
128 - 132 + if follow != nil {
  133 + resp.MeFollowFlag = 1
  134 + }
129 return 135 return
130 } 136 }
@@ -793,7 +793,8 @@ type MiniArticleGetResponse struct { @@ -793,7 +793,8 @@ type MiniArticleGetResponse struct {
793 Show int `json:"show"` // 评论的展示状态(1显示、2不显示) 793 Show int `json:"show"` // 评论的展示状态(1显示、2不显示)
794 Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在) 794 Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
795 MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) 795 MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
796 - Tags []string `json:"tags"` //文章的标签 796 + MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
  797 + Tags []string `json:"tags"` // 文章的标签
797 } 798 }
798 799
799 type ArticleSection struct { 800 type ArticleSection struct {