Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
41 个修改的文件
包含
199 行增加
和
27 行删除
@@ -49,6 +49,7 @@ type ( | @@ -49,6 +49,7 @@ type ( | ||
49 | Category string `json:"category"` // 标签分类 | 49 | Category string `json:"category"` // 标签分类 |
50 | Remark string `json:"remark,optional"` // 备注 | 50 | Remark string `json:"remark,optional"` // 备注 |
51 | Other string `json:"other,optional"` | 51 | Other string `json:"other,optional"` |
52 | + SortBy int `json:"sortBy,optional"` //排序 | ||
52 | } | 53 | } |
53 | 54 | ||
54 | TagCreateResponse { | 55 | TagCreateResponse { |
@@ -66,6 +67,7 @@ type ( | @@ -66,6 +67,7 @@ type ( | ||
66 | Category string `json:"category"` // 标签分类 | 67 | Category string `json:"category"` // 标签分类 |
67 | Remark string `json:"remark,optional"` // 备注 | 68 | Remark string `json:"remark,optional"` // 备注 |
68 | Other string `json:"other,optional"` | 69 | Other string `json:"other,optional"` |
70 | + SortBy int `json:"sortBy,optional"` // 排序 | ||
69 | } | 71 | } |
70 | 72 | ||
71 | TagEditResponse { | 73 | TagEditResponse { |
@@ -86,6 +88,7 @@ type ( | @@ -86,6 +88,7 @@ type ( | ||
86 | Category string `json:"category"` // 标签分类 | 88 | Category string `json:"category"` // 标签分类 |
87 | Remark string `json:"remark"` // 备注 | 89 | Remark string `json:"remark"` // 备注 |
88 | Other string `json:"other"` | 90 | Other string `json:"other"` |
91 | + SortBy int `json:"sortBy,optional"` // 排序 | ||
89 | } | 92 | } |
90 | ) | 93 | ) |
91 | 94 | ||
@@ -110,6 +113,7 @@ type ( | @@ -110,6 +113,7 @@ type ( | ||
110 | Category string `json:"category"` // 标签分类 | 113 | Category string `json:"category"` // 标签分类 |
111 | Remark string `json:"remark"` // 备注 | 114 | Remark string `json:"remark"` // 备注 |
112 | CreatedAt int64 `json:"createdAt"` | 115 | CreatedAt int64 `json:"createdAt"` |
116 | + SortBy int `json:"sortBy,optional"` // 排序 | ||
113 | } | 117 | } |
114 | ) | 118 | ) |
115 | 119 |
@@ -26,6 +26,7 @@ type ( | @@ -26,6 +26,7 @@ type ( | ||
26 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 26 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
27 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 27 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
28 | Location Location `json:"location,optional"` //定位坐标 | 28 | Location Location `json:"location,optional"` //定位坐标 |
29 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
29 | } | 30 | } |
30 | MiniArticleCreateResponse { | 31 | MiniArticleCreateResponse { |
31 | Id int64 `json:"id"` | 32 | Id int64 `json:"id"` |
@@ -58,6 +59,7 @@ type ( | @@ -58,6 +59,7 @@ type ( | ||
58 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) | 59 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) |
59 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 60 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
60 | Tags []string `json:"tags"` // 文章的标签 | 61 | Tags []string `json:"tags"` // 文章的标签 |
62 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
61 | } | 63 | } |
62 | ArticleSection { | 64 | ArticleSection { |
63 | Id int64 `json:"id"` //段落id | 65 | Id int64 `json:"id"` //段落id |
@@ -189,6 +191,7 @@ type ( | @@ -189,6 +191,7 @@ type ( | ||
189 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 191 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
190 | WhoReview []int64 `json:"whoReview"` // 评论人 | 192 | WhoReview []int64 `json:"whoReview"` // 评论人 |
191 | Location Location `json:"location"` // 坐标 | 193 | Location Location `json:"location"` // 坐标 |
194 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
192 | } | 195 | } |
193 | 196 | ||
194 | MiniArticleDraftCreateResponse { | 197 | MiniArticleDraftCreateResponse { |
@@ -209,6 +212,7 @@ type ( | @@ -209,6 +212,7 @@ type ( | ||
209 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 212 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
210 | WhoReview []int64 `json:"whoReview"` // 评论人 | 213 | WhoReview []int64 `json:"whoReview"` // 评论人 |
211 | Location Location `json:"location"` // 坐标 | 214 | Location Location `json:"location"` // 坐标 |
215 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
212 | } | 216 | } |
213 | 217 | ||
214 | MiniArticleDraftUpdateResponse { | 218 | MiniArticleDraftUpdateResponse { |
@@ -235,7 +239,8 @@ type ( | @@ -235,7 +239,8 @@ type ( | ||
235 | Section []string `json:"section"` // 填写的内容 | 239 | Section []string `json:"section"` // 填写的内容 |
236 | Title string `json:"title"` // 标题 | 240 | Title string `json:"title"` // 标题 |
237 | Images []string `json:"images"` // 图片 | 241 | Images []string `json:"images"` // 图片 |
238 | - CreatedAt int64 `json:"createdAt"` | 242 | + CreatedAt int64 `json:"createdAt"`// |
243 | + MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | ||
239 | } | 244 | } |
240 | ) | 245 | ) |
241 | 246 | ||
@@ -256,6 +261,7 @@ type ( | @@ -256,6 +261,7 @@ type ( | ||
256 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 261 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
257 | WhoReview []int64 `json:"whoReview"` // 评论人 | 262 | WhoReview []int64 `json:"whoReview"` // 评论人 |
258 | Location Location `json:"location"` // 坐标 | 263 | Location Location `json:"location"` // 坐标 |
264 | + MatchUrl map[string]string `json:"matchUrl"` // | ||
259 | } | 265 | } |
260 | ) | 266 | ) |
261 | 267 | ||
@@ -325,6 +331,7 @@ type ( | @@ -325,6 +331,7 @@ type ( | ||
325 | Category string `json:"category"` | 331 | Category string `json:"category"` |
326 | Name string `json:"name"` | 332 | Name string `json:"name"` |
327 | Image string `json:"image"` | 333 | Image string `json:"image"` |
334 | + SortBy int `json:"sortBy"` | ||
328 | } | 335 | } |
329 | ) | 336 | ) |
330 | 337 | ||
@@ -496,6 +503,7 @@ type ( | @@ -496,6 +503,7 @@ type ( | ||
496 | TagRemark string `json:"tagRemark"` // 标签备注 | 503 | TagRemark string `json:"tagRemark"` // 标签备注 |
497 | TotalArticle int `json:"totalArticle"` // 总的文章数量 | 504 | TotalArticle int `json:"totalArticle"` // 总的文章数量 |
498 | ReadArticle int `json:"readArticle"` // 已读的标签数量 | 505 | ReadArticle int `json:"readArticle"` // 已读的标签数量 |
506 | + SortBy int `json:"sortBy"` // 排序 | ||
499 | } | 507 | } |
500 | ) | 508 | ) |
501 | 509 |
@@ -90,9 +90,10 @@ type ( | @@ -90,9 +90,10 @@ type ( | ||
90 | SectionId int64 `json:"sectionId"` // 段落id | 90 | SectionId int64 `json:"sectionId"` // 段落id |
91 | FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取 | 91 | FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取 |
92 | CompanyId int64 `json:",optional"` // 服务端自动获取 | 92 | CompanyId int64 `json:",optional"` // 服务端自动获取 |
93 | - Pid int64 `json:"pid"` // 回复那个评论的id | 93 | + Pid int64 `json:"pid,optional"` // 回复那个评论的id |
94 | Content string `json:"content"` // 评论的内容 | 94 | Content string `json:"content"` // 评论的内容 |
95 | - AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 95 | + AtWho []CommentAtWho `json:"atWho,optional"` // 填写评论时@的人 |
96 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 评论内容中的url文本 | ||
96 | } | 97 | } |
97 | 98 | ||
98 | CommentAtWho { | 99 | CommentAtWho { |
@@ -115,6 +116,7 @@ type ( | @@ -115,6 +116,7 @@ type ( | ||
115 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 | 116 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 |
116 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 117 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
117 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 118 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 |
119 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本 | ||
118 | CreatedAt int64 `json:"createdAt"` // | 120 | CreatedAt int64 `json:"createdAt"` // |
119 | } | 121 | } |
120 | ) | 122 | ) |
@@ -155,6 +157,7 @@ type ( | @@ -155,6 +157,7 @@ type ( | ||
155 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 | 157 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 |
156 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 158 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
157 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 159 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 |
160 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本 | ||
158 | CreatedAt int64 `json:"createdAt"` // | 161 | CreatedAt int64 `json:"createdAt"` // |
159 | MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) | 162 | MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) |
160 | Content string `json:"content"` // 评论的内容 | 163 | Content string `json:"content"` // 评论的内容 |
@@ -253,6 +256,8 @@ type ( | @@ -253,6 +256,8 @@ type ( | ||
253 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 256 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
254 | CreatedAt int64 `json:"createdAt"` // 评论时间 | 257 | CreatedAt int64 `json:"createdAt"` // 评论时间 |
255 | Content string `json:"content"` // 评论的内容 | 258 | Content string `json:"content"` // 评论的内容 |
259 | + AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | ||
260 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本 | ||
256 | Show int `json:"show"` // 显示状态 | 261 | Show int `json:"show"` // 显示状态 |
257 | } | 262 | } |
258 | ) | 263 | ) |
@@ -42,6 +42,7 @@ func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagR | @@ -42,6 +42,7 @@ func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagR | ||
42 | Category: val.Category, | 42 | Category: val.Category, |
43 | Name: val.Name, | 43 | Name: val.Name, |
44 | Image: val.Image.Url, | 44 | Image: val.Image.Url, |
45 | + SortBy: int(val.SortBy), | ||
45 | }) | 46 | }) |
46 | tagMap[val.Category] = m | 47 | tagMap[val.Category] = m |
47 | } else { | 48 | } else { |
@@ -52,6 +53,7 @@ func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagR | @@ -52,6 +53,7 @@ func (l *MiniAllArticleTagLogic) MiniAllArticleTag(req *types.MiniAllArticleTagR | ||
52 | Category: val.Category, | 53 | Category: val.Category, |
53 | Name: val.Name, | 54 | Name: val.Name, |
54 | Image: val.Image.Url, | 55 | Image: val.Image.Url, |
56 | + SortBy: int(val.SortBy), | ||
55 | }, | 57 | }, |
56 | } | 58 | } |
57 | } | 59 | } |
@@ -50,8 +50,19 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | @@ -50,8 +50,19 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | ||
50 | if err != nil { | 50 | if err != nil { |
51 | return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) | 51 | return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) |
52 | } | 52 | } |
53 | + author, _ := l.svcCtx.UserRepository.FindOne(l.ctx, conn, articleData.AuthorId) | ||
54 | + company, _ := l.svcCtx.CompanyRepository.FindOne(l.ctx, conn, req.CompanyId) | ||
53 | if len(markRecord) > 0 { | 55 | if len(markRecord) > 0 { |
54 | - markRecord[0].Author = articleData.Author | 56 | + if author != nil { |
57 | + markRecord[0].Author = domain.UserSimple{ | ||
58 | + Id: author.Id, | ||
59 | + Name: author.Name, | ||
60 | + Avatar: author.Avatar, | ||
61 | + Position: author.Position, | ||
62 | + Company: company.Name, | ||
63 | + CompanyId: company.Id, | ||
64 | + } | ||
65 | + } | ||
55 | markRecord[0].Title = articleData.Title | 66 | markRecord[0].Title = articleData.Title |
56 | _, err = l.svcCtx.UserReadArticleRepository.Update(l.ctx, conn, markRecord[0]) | 67 | _, err = l.svcCtx.UserReadArticleRepository.Update(l.ctx, conn, markRecord[0]) |
57 | if err != nil { | 68 | if err != nil { |
@@ -61,14 +72,6 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | @@ -61,14 +72,6 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | ||
61 | return resp, nil | 72 | return resp, nil |
62 | } | 73 | } |
63 | // 新建一个标记 | 74 | // 新建一个标记 |
64 | - | ||
65 | - articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId) | ||
66 | - if err != nil { | ||
67 | - return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) | ||
68 | - } | ||
69 | - if articleInfo.CompanyId != req.CompanyId { | ||
70 | - return nil, xerr.NewErrMsg("标记浏览记录失败") | ||
71 | - } | ||
72 | newMark := domain.UserReadArticle{ | 75 | newMark := domain.UserReadArticle{ |
73 | Id: 0, | 76 | Id: 0, |
74 | CompanyId: req.CompanyId, | 77 | CompanyId: req.CompanyId, |
@@ -81,13 +84,23 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | @@ -81,13 +84,23 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | ||
81 | DeletedAt: 0, | 84 | DeletedAt: 0, |
82 | Version: 0, | 85 | Version: 0, |
83 | } | 86 | } |
87 | + if author != nil { | ||
88 | + newMark.Author = domain.UserSimple{ | ||
89 | + Id: author.Id, | ||
90 | + Name: author.Name, | ||
91 | + Avatar: author.Avatar, | ||
92 | + Position: author.Position, | ||
93 | + Company: company.Name, | ||
94 | + CompanyId: company.Id, | ||
95 | + } | ||
96 | + } | ||
84 | err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | 97 | err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { |
85 | _, err = l.svcCtx.UserReadArticleRepository.Insert(ctx, c, &newMark) | 98 | _, err = l.svcCtx.UserReadArticleRepository.Insert(ctx, c, &newMark) |
86 | if err != nil { | 99 | if err != nil { |
87 | return err | 100 | return err |
88 | } | 101 | } |
89 | //增加浏览计数 | 102 | //增加浏览计数 |
90 | - err = l.svcCtx.ArticleRepository.IncreaseCountRead(ctx, c, 1, articleInfo.Id) | 103 | + err = l.svcCtx.ArticleRepository.IncreaseCountRead(ctx, c, 1, articleData.Id) |
91 | return err | 104 | return err |
92 | }, true) | 105 | }, true) |
93 | if err != nil { | 106 | if err != nil { |
@@ -53,6 +53,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | @@ -53,6 +53,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | ||
53 | Latitude: req.Location.Latitude, | 53 | Latitude: req.Location.Latitude, |
54 | Descript: req.Location.Descript, | 54 | Descript: req.Location.Descript, |
55 | }, | 55 | }, |
56 | + MatchUrl: map[string]string{}, | ||
56 | } | 57 | } |
57 | for _, val := range req.Images { | 58 | for _, val := range req.Images { |
58 | newDraft.Images = append(newDraft.Images, domain.Image{ | 59 | newDraft.Images = append(newDraft.Images, domain.Image{ |
@@ -60,6 +61,10 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | @@ -60,6 +61,10 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | ||
60 | }) | 61 | }) |
61 | } | 62 | } |
62 | 63 | ||
64 | + for k, v := range req.MatchUrl { | ||
65 | + newDraft.MatchUrl[k] = v | ||
66 | + } | ||
67 | + | ||
63 | _, err = l.svcCtx.ArticleDraftRepository.Insert(l.ctx, conn, &newDraft) | 68 | _, err = l.svcCtx.ArticleDraftRepository.Insert(l.ctx, conn, &newDraft) |
64 | if err != nil { | 69 | if err != nil { |
65 | return nil, xerr.NewErrMsgErr("保存草稿失败", err) | 70 | return nil, xerr.NewErrMsgErr("保存草稿失败", err) |
@@ -164,10 +164,14 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -164,10 +164,14 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
164 | CountRead: 0, | 164 | CountRead: 0, |
165 | Show: domain.ArticleShowEnable, | 165 | Show: domain.ArticleShowEnable, |
166 | Tags: []int64{}, | 166 | Tags: []int64{}, |
167 | + MatchUrl: map[string]string{}, | ||
167 | } | 168 | } |
168 | if len(whoRead) > 0 { | 169 | if len(whoRead) > 0 { |
169 | newArticle.TargetUser = domain.ArticleTargetLimit | 170 | newArticle.TargetUser = domain.ArticleTargetLimit |
170 | } | 171 | } |
172 | + for k, v := range req.MatchUrl { | ||
173 | + newArticle.MatchUrl[k] = v | ||
174 | + } | ||
171 | //设置内容概要 | 175 | //设置内容概要 |
172 | if len(sectionList) > 0 { | 176 | if len(sectionList) > 0 { |
173 | // 截取内容 50个字 | 177 | // 截取内容 50个字 |
@@ -50,6 +50,10 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | @@ -50,6 +50,10 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | ||
50 | Latitude: draftInfo.Location.Latitude, | 50 | Latitude: draftInfo.Location.Latitude, |
51 | Descript: draftInfo.Location.Descript, | 51 | Descript: draftInfo.Location.Descript, |
52 | }, | 52 | }, |
53 | + MatchUrl: map[string]string{}, | ||
54 | + } | ||
55 | + for k, v := range draftInfo.MatchUrl { | ||
56 | + resp.MatchUrl[k] = v | ||
53 | } | 57 | } |
54 | for _, val := range draftInfo.Images { | 58 | for _, val := range draftInfo.Images { |
55 | resp.Images = append(resp.Images, val.Url) | 59 | resp.Images = append(resp.Images, val.Url) |
@@ -122,10 +122,15 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -122,10 +122,15 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
122 | MeLoveFlag: meLoveFlag, | 122 | MeLoveFlag: meLoveFlag, |
123 | MeFollowFlag: 0, | 123 | MeFollowFlag: 0, |
124 | Tags: tags, | 124 | Tags: tags, |
125 | + MatchUrl: map[string]string{}, | ||
125 | } | 126 | } |
126 | if articleInfo.CreatedAt != articleInfo.UpdatedAt { | 127 | if articleInfo.CreatedAt != articleInfo.UpdatedAt { |
127 | resp.Edit = 1 | 128 | resp.Edit = 1 |
128 | } | 129 | } |
130 | + | ||
131 | + for k, v := range articleInfo.MatchUrl { | ||
132 | + resp.MatchUrl[k] = v | ||
133 | + } | ||
129 | for _, val := range articleInfo.Images { | 134 | for _, val := range articleInfo.Images { |
130 | resp.Images = append(resp.Images, val.Url) | 135 | resp.Images = append(resp.Images, val.Url) |
131 | } | 136 | } |
@@ -54,6 +54,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | @@ -54,6 +54,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | ||
54 | Title: draftList[i].Title, | 54 | Title: draftList[i].Title, |
55 | Images: images, | 55 | Images: images, |
56 | CreatedAt: draftList[i].CreatedAt, | 56 | CreatedAt: draftList[i].CreatedAt, |
57 | + MatchUrl: draftList[i].MatchUrl, | ||
57 | } | 58 | } |
58 | } | 59 | } |
59 | return resp, nil | 60 | return resp, nil |
@@ -251,6 +251,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ | @@ -251,6 +251,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ | ||
251 | CommentAuthor: 0, | 251 | CommentAuthor: 0, |
252 | UserId: req.UserId, | 252 | UserId: req.UserId, |
253 | ToUserId: articleInfo.AuthorId, | 253 | ToUserId: articleInfo.AuthorId, |
254 | + CompanyId: userInfo.CompanyId, | ||
254 | } | 255 | } |
255 | // 添加点赞标识 | 256 | // 添加点赞标识 |
256 | _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) | 257 | _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) |
@@ -341,6 +342,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeComment(req *types.MiniSetUserLikeRequ | @@ -341,6 +342,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeComment(req *types.MiniSetUserLikeRequ | ||
341 | CommentAuthor: commentInfo.FromUserId, | 342 | CommentAuthor: commentInfo.FromUserId, |
342 | UserId: req.UserId, | 343 | UserId: req.UserId, |
343 | ToUserId: commentInfo.FromUserId, | 344 | ToUserId: commentInfo.FromUserId, |
345 | + CompanyId: userInfo.CompanyId, | ||
344 | } | 346 | } |
345 | // 设置赞标识 | 347 | // 设置赞标识 |
346 | _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) | 348 | _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) |
@@ -56,6 +56,7 @@ func (l *MiniShowHomePageLogic) MiniShowHomePage(req *types.MiniHomePageRequest) | @@ -56,6 +56,7 @@ func (l *MiniShowHomePageLogic) MiniShowHomePage(req *types.MiniHomePageRequest) | ||
56 | TagRemark: val.Remark, | 56 | TagRemark: val.Remark, |
57 | TotalArticle: 0, | 57 | TotalArticle: 0, |
58 | ReadArticle: 0, | 58 | ReadArticle: 0, |
59 | + SortBy: int(val.SortBy), | ||
59 | } | 60 | } |
60 | if count, ok := countDataMap[val.Id]; ok { | 61 | if count, ok := countDataMap[val.Id]; ok { |
61 | m.TotalArticle = count.TotalArticle | 62 | m.TotalArticle = count.TotalArticle |
@@ -58,6 +58,10 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti | @@ -58,6 +58,10 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti | ||
58 | Url: val, | 58 | Url: val, |
59 | }) | 59 | }) |
60 | } | 60 | } |
61 | + draftInfo.MatchUrl = make(map[string]string) | ||
62 | + for k, v := range req.MatchUrl { | ||
63 | + draftInfo.MatchUrl[k] = v | ||
64 | + } | ||
61 | _, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo) | 65 | _, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo) |
62 | if err != nil { | 66 | if err != nil { |
63 | return nil, xerr.NewErrMsgErr("更新草稿失败", err) | 67 | return nil, xerr.NewErrMsgErr("更新草稿失败", err) |
@@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + | ||
5 | "github.com/samber/lo" | 6 | "github.com/samber/lo" |
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
@@ -42,6 +43,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | @@ -42,6 +43,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | ||
42 | article.Version = article.Version + 1 | 43 | article.Version = article.Version + 1 |
43 | article.Images = backup.Images | 44 | article.Images = backup.Images |
44 | article.Title = backup.Title | 45 | article.Title = backup.Title |
46 | + article.MatchUrl = backup.MatchUrl | ||
45 | articleSections := make([]domain.ArticleSection, 0) | 47 | articleSections := make([]domain.ArticleSection, 0) |
46 | lo.ForEach(backup.Section, func(item domain.ArticleSection, index int) { | 48 | lo.ForEach(backup.Section, func(item domain.ArticleSection, index int) { |
47 | articleSections = append(articleSections, domain.ArticleSection{ | 49 | articleSections = append(articleSections, domain.ArticleSection{ |
@@ -132,6 +132,11 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | @@ -132,6 +132,11 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | ||
132 | CountAdminLove: 0, | 132 | CountAdminLove: 0, |
133 | Show: domain.CommentShowEnable, | 133 | Show: domain.CommentShowEnable, |
134 | AtWho: []domain.UserSimple{}, | 134 | AtWho: []domain.UserSimple{}, |
135 | + MatchUrl: map[string]string{}, | ||
136 | + } | ||
137 | + | ||
138 | + for k, v := range req.MatchUrl { | ||
139 | + newComment.MatchUrl[k] = v | ||
135 | } | 140 | } |
136 | 141 | ||
137 | if selctionInfo != nil { | 142 | if selctionInfo != nil { |
@@ -238,6 +243,7 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | @@ -238,6 +243,7 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | ||
238 | CountUserLove: 0, | 243 | CountUserLove: 0, |
239 | CountAdminLove: 0, | 244 | CountAdminLove: 0, |
240 | AtWho: []types.CommentAtWho{}, | 245 | AtWho: []types.CommentAtWho{}, |
246 | + MatchUrl: newComment.MatchUrl, | ||
241 | CreatedAt: newComment.CreatedAt, | 247 | CreatedAt: newComment.CreatedAt, |
242 | } | 248 | } |
243 | 249 |
@@ -89,12 +89,17 @@ func (l *MiniGetArticleCommentLogic) MiniGetArticleComment(req *types.MiniGetArt | @@ -89,12 +89,17 @@ func (l *MiniGetArticleCommentLogic) MiniGetArticleComment(req *types.MiniGetArt | ||
89 | CountUserLove: commentInfo.CountUserLove, | 89 | CountUserLove: commentInfo.CountUserLove, |
90 | CountAdminLove: commentInfo.CountAdminLove, | 90 | CountAdminLove: commentInfo.CountAdminLove, |
91 | AtWho: []types.CommentAtWho{}, | 91 | AtWho: []types.CommentAtWho{}, |
92 | + MatchUrl: map[string]string{}, | ||
92 | CreatedAt: commentInfo.CreatedAt, | 93 | CreatedAt: commentInfo.CreatedAt, |
93 | MeLoveFlag: 0, | 94 | MeLoveFlag: 0, |
95 | + Content: commentInfo.Content, | ||
94 | } | 96 | } |
95 | if _, ok := flagMap[commentInfo.Id]; ok { | 97 | if _, ok := flagMap[commentInfo.Id]; ok { |
96 | commentResp.MeLoveFlag = 1 | 98 | commentResp.MeLoveFlag = 1 |
97 | } | 99 | } |
100 | + for k, v := range commentInfo.MatchUrl { | ||
101 | + commentResp.MatchUrl[k] = v | ||
102 | + } | ||
98 | for _, val := range commentInfo.AtWho { | 103 | for _, val := range commentInfo.AtWho { |
99 | commentResp.AtWho = append(commentResp.AtWho, types.CommentAtWho{ | 104 | commentResp.AtWho = append(commentResp.AtWho, types.CommentAtWho{ |
100 | Id: val.Id, | 105 | Id: val.Id, |
@@ -131,12 +136,16 @@ func (l *MiniGetArticleCommentLogic) MiniGetArticleComment(req *types.MiniGetArt | @@ -131,12 +136,16 @@ func (l *MiniGetArticleCommentLogic) MiniGetArticleComment(req *types.MiniGetArt | ||
131 | CountUserLove: val.CountUserLove, | 136 | CountUserLove: val.CountUserLove, |
132 | CountAdminLove: val.CountAdminLove, | 137 | CountAdminLove: val.CountAdminLove, |
133 | AtWho: []types.CommentAtWho{}, | 138 | AtWho: []types.CommentAtWho{}, |
139 | + MatchUrl: map[string]string{}, | ||
134 | CreatedAt: val.CreatedAt, | 140 | CreatedAt: val.CreatedAt, |
135 | MeLoveFlag: 0, | 141 | MeLoveFlag: 0, |
136 | } | 142 | } |
137 | if _, ok := flagMap[val.Id]; ok { | 143 | if _, ok := flagMap[val.Id]; ok { |
138 | reply.MeLoveFlag = 1 | 144 | reply.MeLoveFlag = 1 |
139 | } | 145 | } |
146 | + for key, url := range val.MatchUrl { | ||
147 | + reply.MatchUrl[key] = url | ||
148 | + } | ||
140 | for _, val2 := range val.AtWho { | 149 | for _, val2 := range val.AtWho { |
141 | reply.AtWho = append(reply.AtWho, types.CommentAtWho{ | 150 | reply.AtWho = append(reply.AtWho, types.CommentAtWho{ |
142 | Id: val2.Id, | 151 | Id: val2.Id, |
@@ -37,10 +37,12 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList | @@ -37,10 +37,12 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList | ||
37 | WithOffsetLimit(req.Page, req.Size). | 37 | WithOffsetLimit(req.Page, req.Size). |
38 | MustWithKV("topId", 0). | 38 | MustWithKV("topId", 0). |
39 | MustWithKV("articleId", req.ArticleId). | 39 | MustWithKV("articleId", req.ArticleId). |
40 | - MustWithKV("sectionId", req.SectionId). | ||
41 | - MustWithKV("show", domain.CommentShowEnable). | 40 | + MustWithKV("show", int(domain.CommentShowEnable)). |
42 | MustWithKV("companyId", req.CompanyId) | 41 | MustWithKV("companyId", req.CompanyId) |
43 | - | 42 | + if req.SectionId > 0 { |
43 | + //专门获取段落评论 | ||
44 | + queryOption.MustWithKV("sectionId", req.SectionId) | ||
45 | + } | ||
44 | cnt, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOption) | 46 | cnt, commentList, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOption) |
45 | if err != nil { | 47 | if err != nil { |
46 | return nil, xerr.NewErrMsgErr("获取评论信息失败", err) | 48 | return nil, xerr.NewErrMsgErr("获取评论信息失败", err) |
@@ -100,6 +102,7 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList | @@ -100,6 +102,7 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList | ||
100 | CountUserLove: val.CountUserLove, | 102 | CountUserLove: val.CountUserLove, |
101 | CountAdminLove: val.CountAdminLove, | 103 | CountAdminLove: val.CountAdminLove, |
102 | AtWho: []types.CommentAtWho{}, | 104 | AtWho: []types.CommentAtWho{}, |
105 | + MatchUrl: map[string]string{}, | ||
103 | CreatedAt: val.CreatedAt, | 106 | CreatedAt: val.CreatedAt, |
104 | MeLoveFlag: 0, | 107 | MeLoveFlag: 0, |
105 | Content: val.Content, | 108 | Content: val.Content, |
@@ -111,7 +114,9 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList | @@ -111,7 +114,9 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList | ||
111 | if _, ok := flagMap[val.Id]; ok { | 114 | if _, ok := flagMap[val.Id]; ok { |
112 | item.Comment.MeLoveFlag = 1 | 115 | item.Comment.MeLoveFlag = 1 |
113 | } | 116 | } |
114 | - | 117 | + for key2, val2 := range val.MatchUrl { |
118 | + item.Comment.MatchUrl[key2] = val2 | ||
119 | + } | ||
115 | for _, val2 := range val.AtWho { | 120 | for _, val2 := range val.AtWho { |
116 | item.Comment.AtWho = append(item.Comment.AtWho, types.CommentAtWho{ | 121 | item.Comment.AtWho = append(item.Comment.AtWho, types.CommentAtWho{ |
117 | Id: val2.Id, | 122 | Id: val2.Id, |
@@ -174,6 +179,7 @@ func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlag | @@ -174,6 +179,7 @@ func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlag | ||
174 | CountUserLove: val.CountUserLove, | 179 | CountUserLove: val.CountUserLove, |
175 | CountAdminLove: val.CountAdminLove, | 180 | CountAdminLove: val.CountAdminLove, |
176 | AtWho: []types.CommentAtWho{}, | 181 | AtWho: []types.CommentAtWho{}, |
182 | + MatchUrl: map[string]string{}, | ||
177 | CreatedAt: val.CreatedAt, | 183 | CreatedAt: val.CreatedAt, |
178 | MeLoveFlag: 0, | 184 | MeLoveFlag: 0, |
179 | Content: val.Content, | 185 | Content: val.Content, |
@@ -182,6 +188,9 @@ func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlag | @@ -182,6 +188,9 @@ func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlag | ||
182 | if _, ok := loveFlagMap[val.Id]; ok { | 188 | if _, ok := loveFlagMap[val.Id]; ok { |
183 | item.MeLoveFlag = 1 | 189 | item.MeLoveFlag = 1 |
184 | } | 190 | } |
191 | + for key2, val2 := range val.MatchUrl { | ||
192 | + item.MatchUrl[key2] = val2 | ||
193 | + } | ||
185 | for _, val2 := range val.AtWho { | 194 | for _, val2 := range val.AtWho { |
186 | item.AtWho = append(item.AtWho, types.CommentAtWho{ | 195 | item.AtWho = append(item.AtWho, types.CommentAtWho{ |
187 | Id: val2.Id, | 196 | Id: val2.Id, |
@@ -56,6 +56,9 @@ func (l *MiniTop5ArticleCommentLogic) MiniTop5ArticleComment(req *types.MiniTop5 | @@ -56,6 +56,9 @@ func (l *MiniTop5ArticleCommentLogic) MiniTop5ArticleComment(req *types.MiniTop5 | ||
56 | if _, ok := flagMap[val.Id]; ok { | 56 | if _, ok := flagMap[val.Id]; ok { |
57 | item.MeLoveFlag = 1 | 57 | item.MeLoveFlag = 1 |
58 | } | 58 | } |
59 | + for key, url := range val.MatchUrl { | ||
60 | + item.MatchUrl[key] = url | ||
61 | + } | ||
59 | for _, val2 := range val.AtWho { | 62 | for _, val2 := range val.AtWho { |
60 | item.AtWho = append(item.AtWho, types.CommentAtWho{ | 63 | item.AtWho = append(item.AtWho, types.CommentAtWho{ |
61 | Id: val2.Id, | 64 | Id: val2.Id, |
@@ -95,6 +98,7 @@ func NewArticleCommentItem(val *domain.ArticleComment) types.ArticleCommentItem | @@ -95,6 +98,7 @@ func NewArticleCommentItem(val *domain.ArticleComment) types.ArticleCommentItem | ||
95 | CountUserLove: val.CountUserLove, | 98 | CountUserLove: val.CountUserLove, |
96 | CountAdminLove: val.CountAdminLove, | 99 | CountAdminLove: val.CountAdminLove, |
97 | AtWho: []types.CommentAtWho{}, | 100 | AtWho: []types.CommentAtWho{}, |
101 | + MatchUrl: map[string]string{}, | ||
98 | CreatedAt: val.CreatedAt, | 102 | CreatedAt: val.CreatedAt, |
99 | MeLoveFlag: 0, | 103 | MeLoveFlag: 0, |
100 | Content: val.Content, | 104 | Content: val.Content, |
@@ -56,6 +56,11 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | @@ -56,6 +56,11 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | ||
56 | Category: req.Category, | 56 | Category: req.Category, |
57 | Remark: req.Remark, | 57 | Remark: req.Remark, |
58 | Other: req.Other, | 58 | Other: req.Other, |
59 | + SortBy: int64(req.SortBy), | ||
60 | + } | ||
61 | + err = newTag.SetCategory(req.Category) | ||
62 | + if err != nil { | ||
63 | + return nil, xerr.NewErrMsgErr("添加标签失败", err) | ||
59 | } | 64 | } |
60 | if len(req.Image) > 0 { | 65 | if len(req.Image) > 0 { |
61 | //获取图片的尺寸大小 | 66 | //获取图片的尺寸大小 |
@@ -70,6 +70,11 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | @@ -70,6 +70,11 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | ||
70 | oldTag.Name = req.Name | 70 | oldTag.Name = req.Name |
71 | oldTag.Remark = req.Remark | 71 | oldTag.Remark = req.Remark |
72 | oldTag.Other = req.Other | 72 | oldTag.Other = req.Other |
73 | + oldTag.SortBy = int64(req.SortBy) | ||
74 | + err = oldTag.SetCategory(req.Category) | ||
75 | + if err != nil { | ||
76 | + return nil, xerr.NewErrMsgErr("添加标签失败", err) | ||
77 | + } | ||
73 | oldTag, err = l.svcCtx.ArticleTagRepository.Update(l.ctx, conn, oldTag) | 78 | oldTag, err = l.svcCtx.ArticleTagRepository.Update(l.ctx, conn, oldTag) |
74 | if err != nil { | 79 | if err != nil { |
75 | return nil, xerr.NewErrMsgErr("添加标签失败", err) | 80 | return nil, xerr.NewErrMsgErr("添加标签失败", err) |
@@ -41,6 +41,7 @@ func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetRespon | @@ -41,6 +41,7 @@ func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetRespon | ||
41 | Category: oldTag.Category, | 41 | Category: oldTag.Category, |
42 | Remark: oldTag.Remark, | 42 | Remark: oldTag.Remark, |
43 | Other: oldTag.Other, | 43 | Other: oldTag.Other, |
44 | + SortBy: int(oldTag.SortBy), | ||
44 | } | 45 | } |
45 | return | 46 | return |
46 | } | 47 | } |
@@ -53,6 +53,7 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | @@ -53,6 +53,7 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | ||
53 | Category: tagList[i].Category, | 53 | Category: tagList[i].Category, |
54 | Remark: tagList[i].Remark, | 54 | Remark: tagList[i].Remark, |
55 | CreatedAt: tagList[i].CreatedAt, | 55 | CreatedAt: tagList[i].CreatedAt, |
56 | + SortBy: int(tagList[i].SortBy), | ||
56 | } | 57 | } |
57 | } | 58 | } |
58 | return resp, nil | 59 | return resp, nil |
@@ -45,30 +45,35 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp | @@ -45,30 +45,35 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp | ||
45 | return resp, nil | 45 | return resp, nil |
46 | } | 46 | } |
47 | 47 | ||
48 | + var companyMap = make(map[int64]*domain.Company) | ||
48 | var userMap = make(map[int64]*domain.User) | 49 | var userMap = make(map[int64]*domain.User) |
49 | var articleMap = make(map[int64]*domain.Article) | 50 | var articleMap = make(map[int64]*domain.Article) |
50 | var commentMap = make(map[int64]*domain.ArticleComment) | 51 | var commentMap = make(map[int64]*domain.ArticleComment) |
51 | 52 | ||
52 | lo.ForEach(list, func(item *domain.UserLoveFlag, index int) { | 53 | lo.ForEach(list, func(item *domain.UserLoveFlag, index int) { |
53 | var ( | 54 | var ( |
55 | + company *domain.Company | ||
54 | user *domain.User | 56 | user *domain.User |
55 | article *domain.Article | 57 | article *domain.Article |
56 | comment *domain.ArticleComment | 58 | comment *domain.ArticleComment |
57 | ) | 59 | ) |
58 | user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.UserId, l.svcCtx.UserRepository.FindOne) | 60 | user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.UserId, l.svcCtx.UserRepository.FindOne) |
61 | + if user != nil { | ||
62 | + company, _ = domain.LazyLoad(companyMap, l.ctx, conn, user.CompanyId, l.svcCtx.CompanyRepository.FindOne) | ||
63 | + } | ||
59 | article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne) | 64 | article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne) |
60 | // 点赞评论 | 65 | // 点赞评论 |
61 | if item.CommentId != 0 { | 66 | if item.CommentId != 0 { |
62 | comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) | 67 | comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) |
63 | } | 68 | } |
64 | 69 | ||
65 | - resp.List = append(resp.List, l.NewItemSimple(item, user, article, comment)) | 70 | + resp.List = append(resp.List, l.NewItemSimple(item, company, user, article, comment)) |
66 | }) | 71 | }) |
67 | 72 | ||
68 | return resp, nil | 73 | return resp, nil |
69 | } | 74 | } |
70 | 75 | ||
71 | -func (l *MiniMyBeLikedLogic) NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyBeLikedItem { | 76 | +func (l *MiniMyBeLikedLogic) NewItemSimple(love *domain.UserLoveFlag, company *domain.Company, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyBeLikedItem { |
72 | item := types.MyBeLikedItem{ | 77 | item := types.MyBeLikedItem{ |
73 | UserId: love.UserId, | 78 | UserId: love.UserId, |
74 | ArticleId: love.ArticleId, | 79 | ArticleId: love.ArticleId, |
@@ -84,6 +89,9 @@ func (l *MiniMyBeLikedLogic) NewItemSimple(love *domain.UserLoveFlag, user *doma | @@ -84,6 +89,9 @@ func (l *MiniMyBeLikedLogic) NewItemSimple(love *domain.UserLoveFlag, user *doma | ||
84 | Avatar: user.Avatar, | 89 | Avatar: user.Avatar, |
85 | Position: user.Position, | 90 | Position: user.Position, |
86 | } | 91 | } |
92 | + if company != nil { | ||
93 | + item.User.CompanyName = company.Name | ||
94 | + } | ||
87 | } | 95 | } |
88 | 96 | ||
89 | if article != nil { | 97 | if article != nil { |
@@ -45,30 +45,35 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types. | @@ -45,30 +45,35 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types. | ||
45 | return resp, nil | 45 | return resp, nil |
46 | } | 46 | } |
47 | 47 | ||
48 | + var companyMap = make(map[int64]*domain.Company) | ||
48 | var userMap = make(map[int64]*domain.User) | 49 | var userMap = make(map[int64]*domain.User) |
49 | var articleMap = make(map[int64]*domain.Article) | 50 | var articleMap = make(map[int64]*domain.Article) |
50 | var commentMap = make(map[int64]*domain.ArticleComment) | 51 | var commentMap = make(map[int64]*domain.ArticleComment) |
51 | 52 | ||
52 | lo.ForEach(list, func(item *domain.UserLoveFlag, index int) { | 53 | lo.ForEach(list, func(item *domain.UserLoveFlag, index int) { |
53 | var ( | 54 | var ( |
55 | + company *domain.Company | ||
54 | user *domain.User | 56 | user *domain.User |
55 | article *domain.Article | 57 | article *domain.Article |
56 | comment *domain.ArticleComment | 58 | comment *domain.ArticleComment |
57 | ) | 59 | ) |
58 | user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.ToUserId, l.svcCtx.UserRepository.FindOne) | 60 | user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.ToUserId, l.svcCtx.UserRepository.FindOne) |
61 | + if user != nil { | ||
62 | + company, _ = domain.LazyLoad(companyMap, l.ctx, conn, user.CompanyId, l.svcCtx.CompanyRepository.FindOne) | ||
63 | + } | ||
59 | article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne) | 64 | article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne) |
60 | // 点赞评论 | 65 | // 点赞评论 |
61 | if item.CommentId != 0 { | 66 | if item.CommentId != 0 { |
62 | comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) | 67 | comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) |
63 | } | 68 | } |
64 | 69 | ||
65 | - resp.List = append(resp.List, l.NewItemSimple(item, user, article, comment)) | 70 | + resp.List = append(resp.List, l.NewItemSimple(item, company, user, article, comment)) |
66 | }) | 71 | }) |
67 | 72 | ||
68 | return resp, nil | 73 | return resp, nil |
69 | } | 74 | } |
70 | 75 | ||
71 | -func (l *MiniMyLikeLogic) NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyLikeItem { | 76 | +func (l *MiniMyLikeLogic) NewItemSimple(love *domain.UserLoveFlag, company *domain.Company, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyLikeItem { |
72 | item := types.MyLikeItem{ | 77 | item := types.MyLikeItem{ |
73 | UserId: love.ToUserId, | 78 | UserId: love.ToUserId, |
74 | ArticleId: love.ArticleId, | 79 | ArticleId: love.ArticleId, |
@@ -84,6 +89,9 @@ func (l *MiniMyLikeLogic) NewItemSimple(love *domain.UserLoveFlag, user *domain. | @@ -84,6 +89,9 @@ func (l *MiniMyLikeLogic) NewItemSimple(love *domain.UserLoveFlag, user *domain. | ||
84 | Avatar: user.Avatar, | 89 | Avatar: user.Avatar, |
85 | Position: user.Position, | 90 | Position: user.Position, |
86 | } | 91 | } |
92 | + if company != nil { | ||
93 | + item.User.CompanyName = company.Name | ||
94 | + } | ||
87 | } | 95 | } |
88 | 96 | ||
89 | if article != nil { | 97 | if article != nil { |
@@ -21,9 +21,10 @@ type MiniCreateArticleCommentRequest struct { | @@ -21,9 +21,10 @@ type MiniCreateArticleCommentRequest struct { | ||
21 | SectionId int64 `json:"sectionId"` // 段落id | 21 | SectionId int64 `json:"sectionId"` // 段落id |
22 | FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取 | 22 | FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取 |
23 | CompanyId int64 `json:",optional"` // 服务端自动获取 | 23 | CompanyId int64 `json:",optional"` // 服务端自动获取 |
24 | - Pid int64 `json:"pid"` // 回复那个评论的id | 24 | + Pid int64 `json:"pid,optional"` // 回复那个评论的id |
25 | Content string `json:"content"` // 评论的内容 | 25 | Content string `json:"content"` // 评论的内容 |
26 | - AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 26 | + AtWho []CommentAtWho `json:"atWho,optional"` // 填写评论时@的人 |
27 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 评论内容中的url文本 | ||
27 | } | 28 | } |
28 | 29 | ||
29 | type CommentAtWho struct { | 30 | type CommentAtWho struct { |
@@ -47,6 +48,7 @@ type MiniCreateArticleCommentResponse struct { | @@ -47,6 +48,7 @@ type MiniCreateArticleCommentResponse struct { | ||
47 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 | 48 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 |
48 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 49 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
49 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 50 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 |
51 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本 | ||
50 | CreatedAt int64 `json:"createdAt"` // | 52 | CreatedAt int64 `json:"createdAt"` // |
51 | } | 53 | } |
52 | 54 | ||
@@ -85,6 +87,7 @@ type ArticleCommentItem struct { | @@ -85,6 +87,7 @@ type ArticleCommentItem struct { | ||
85 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 | 87 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 |
86 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 88 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
87 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | 89 | AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 |
90 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本 | ||
88 | CreatedAt int64 `json:"createdAt"` // | 91 | CreatedAt int64 `json:"createdAt"` // |
89 | MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) | 92 | MeLoveFlag int `json:"meLoveFlag"` //当前人员对评论的点赞标识 (0 没有点赞 1有点赞) |
90 | Content string `json:"content"` // 评论的内容 | 93 | Content string `json:"content"` // 评论的内容 |
@@ -172,6 +175,8 @@ type SystemArticleCommentSearchItem struct { | @@ -172,6 +175,8 @@ type SystemArticleCommentSearchItem struct { | ||
172 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 175 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
173 | CreatedAt int64 `json:"createdAt"` // 评论时间 | 176 | CreatedAt int64 `json:"createdAt"` // 评论时间 |
174 | Content string `json:"content"` // 评论的内容 | 177 | Content string `json:"content"` // 评论的内容 |
178 | + AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人 | ||
179 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本 | ||
175 | Show int `json:"show"` // 显示状态 | 180 | Show int `json:"show"` // 显示状态 |
176 | } | 181 | } |
177 | 182 | ||
@@ -318,6 +323,7 @@ type TagCreateRequest struct { | @@ -318,6 +323,7 @@ type TagCreateRequest struct { | ||
318 | Category string `json:"category"` // 标签分类 | 323 | Category string `json:"category"` // 标签分类 |
319 | Remark string `json:"remark,optional"` // 备注 | 324 | Remark string `json:"remark,optional"` // 备注 |
320 | Other string `json:"other,optional"` | 325 | Other string `json:"other,optional"` |
326 | + SortBy int `json:"sortBy,optional"` //排序 | ||
321 | } | 327 | } |
322 | 328 | ||
323 | type TagCreateResponse struct { | 329 | type TagCreateResponse struct { |
@@ -332,6 +338,7 @@ type TagEditRequest struct { | @@ -332,6 +338,7 @@ type TagEditRequest struct { | ||
332 | Category string `json:"category"` // 标签分类 | 338 | Category string `json:"category"` // 标签分类 |
333 | Remark string `json:"remark,optional"` // 备注 | 339 | Remark string `json:"remark,optional"` // 备注 |
334 | Other string `json:"other,optional"` | 340 | Other string `json:"other,optional"` |
341 | + SortBy int `json:"sortBy,optional"` // 排序 | ||
335 | } | 342 | } |
336 | 343 | ||
337 | type TagEditResponse struct { | 344 | type TagEditResponse struct { |
@@ -350,6 +357,7 @@ type TagGetResponse struct { | @@ -350,6 +357,7 @@ type TagGetResponse struct { | ||
350 | Category string `json:"category"` // 标签分类 | 357 | Category string `json:"category"` // 标签分类 |
351 | Remark string `json:"remark"` // 备注 | 358 | Remark string `json:"remark"` // 备注 |
352 | Other string `json:"other"` | 359 | Other string `json:"other"` |
360 | + SortBy int `json:"sortBy,optional"` // 排序 | ||
353 | } | 361 | } |
354 | 362 | ||
355 | type TagListRequest struct { | 363 | type TagListRequest struct { |
@@ -373,6 +381,7 @@ type TagItem struct { | @@ -373,6 +381,7 @@ type TagItem struct { | ||
373 | Category string `json:"category"` // 标签分类 | 381 | Category string `json:"category"` // 标签分类 |
374 | Remark string `json:"remark"` // 备注 | 382 | Remark string `json:"remark"` // 备注 |
375 | CreatedAt int64 `json:"createdAt"` | 383 | CreatedAt int64 `json:"createdAt"` |
384 | + SortBy int `json:"sortBy,optional"` // 排序 | ||
376 | } | 385 | } |
377 | 386 | ||
378 | type TagDeleteRequest struct { | 387 | type TagDeleteRequest struct { |
@@ -799,6 +808,7 @@ type MiniArticleCreateRequest struct { | @@ -799,6 +808,7 @@ type MiniArticleCreateRequest struct { | ||
799 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 808 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
800 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 809 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
801 | Location Location `json:"location,optional"` //定位坐标 | 810 | Location Location `json:"location,optional"` //定位坐标 |
811 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
802 | } | 812 | } |
803 | 813 | ||
804 | type MiniArticleCreateResponse struct { | 814 | type MiniArticleCreateResponse struct { |
@@ -830,6 +840,7 @@ type MiniArticleGetResponse struct { | @@ -830,6 +840,7 @@ type MiniArticleGetResponse struct { | ||
830 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) | 840 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) |
831 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 841 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
832 | Tags []string `json:"tags"` // 文章的标签 | 842 | Tags []string `json:"tags"` // 文章的标签 |
843 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
833 | } | 844 | } |
834 | 845 | ||
835 | type ArticleSection struct { | 846 | type ArticleSection struct { |
@@ -950,6 +961,7 @@ type MiniArticleDraftCreateRequest struct { | @@ -950,6 +961,7 @@ type MiniArticleDraftCreateRequest struct { | ||
950 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 961 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
951 | WhoReview []int64 `json:"whoReview"` // 评论人 | 962 | WhoReview []int64 `json:"whoReview"` // 评论人 |
952 | Location Location `json:"location"` // 坐标 | 963 | Location Location `json:"location"` // 坐标 |
964 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
953 | } | 965 | } |
954 | 966 | ||
955 | type MiniArticleDraftCreateResponse struct { | 967 | type MiniArticleDraftCreateResponse struct { |
@@ -967,6 +979,7 @@ type MiniArticleDraftUpdateRequest struct { | @@ -967,6 +979,7 @@ type MiniArticleDraftUpdateRequest struct { | ||
967 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 979 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
968 | WhoReview []int64 `json:"whoReview"` // 评论人 | 980 | WhoReview []int64 `json:"whoReview"` // 评论人 |
969 | Location Location `json:"location"` // 坐标 | 981 | Location Location `json:"location"` // 坐标 |
982 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
970 | } | 983 | } |
971 | 984 | ||
972 | type MiniArticleDraftUpdateResponse struct { | 985 | type MiniArticleDraftUpdateResponse struct { |
@@ -991,7 +1004,8 @@ type MiniArticleDraftItem struct { | @@ -991,7 +1004,8 @@ type MiniArticleDraftItem struct { | ||
991 | Section []string `json:"section"` // 填写的内容 | 1004 | Section []string `json:"section"` // 填写的内容 |
992 | Title string `json:"title"` // 标题 | 1005 | Title string `json:"title"` // 标题 |
993 | Images []string `json:"images"` // 图片 | 1006 | Images []string `json:"images"` // 图片 |
994 | - CreatedAt int64 `json:"createdAt"` | 1007 | + CreatedAt int64 `json:"createdAt"` // |
1008 | + MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | ||
995 | } | 1009 | } |
996 | 1010 | ||
997 | type MiniArticleDraftGetMeRequest struct { | 1011 | type MiniArticleDraftGetMeRequest struct { |
@@ -1009,6 +1023,7 @@ type MiniArticleDraftGetMeResponse struct { | @@ -1009,6 +1023,7 @@ type MiniArticleDraftGetMeResponse struct { | ||
1009 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 1023 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
1010 | WhoReview []int64 `json:"whoReview"` // 评论人 | 1024 | WhoReview []int64 `json:"whoReview"` // 评论人 |
1011 | Location Location `json:"location"` // 坐标 | 1025 | Location Location `json:"location"` // 坐标 |
1026 | + MatchUrl map[string]string `json:"matchUrl"` // | ||
1012 | } | 1027 | } |
1013 | 1028 | ||
1014 | type MiniArticleDraftDeleteMeRequest struct { | 1029 | type MiniArticleDraftDeleteMeRequest struct { |
@@ -1071,6 +1086,7 @@ type ArticleTagItem struct { | @@ -1071,6 +1086,7 @@ type ArticleTagItem struct { | ||
1071 | Category string `json:"category"` | 1086 | Category string `json:"category"` |
1072 | Name string `json:"name"` | 1087 | Name string `json:"name"` |
1073 | Image string `json:"image"` | 1088 | Image string `json:"image"` |
1089 | + SortBy int `json:"sortBy"` | ||
1074 | } | 1090 | } |
1075 | 1091 | ||
1076 | type SystemArticleGetRequest struct { | 1092 | type SystemArticleGetRequest struct { |
@@ -1230,6 +1246,7 @@ type ArticleTagCount struct { | @@ -1230,6 +1246,7 @@ type ArticleTagCount struct { | ||
1230 | TagRemark string `json:"tagRemark"` // 标签备注 | 1246 | TagRemark string `json:"tagRemark"` // 标签备注 |
1231 | TotalArticle int `json:"totalArticle"` // 总的文章数量 | 1247 | TotalArticle int `json:"totalArticle"` // 总的文章数量 |
1232 | ReadArticle int `json:"readArticle"` // 已读的标签数量 | 1248 | ReadArticle int `json:"readArticle"` // 已读的标签数量 |
1249 | + SortBy int `json:"sortBy"` // 排序 | ||
1233 | } | 1250 | } |
1234 | 1251 | ||
1235 | type MiniSearchArticleRequest struct { | 1252 | type MiniSearchArticleRequest struct { |
@@ -31,6 +31,7 @@ type Article struct { | @@ -31,6 +31,7 @@ type Article struct { | ||
31 | Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签 | 31 | Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签 |
32 | Show int // 评论的展示状态(0显示、1不显示) | 32 | Show int // 评论的展示状态(0显示、1不显示) |
33 | Summary string // 内容概要 | 33 | Summary string // 内容概要 |
34 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
34 | } | 35 | } |
35 | 36 | ||
36 | func (m *Article) TableName() string { | 37 | func (m *Article) TableName() string { |
@@ -28,6 +28,7 @@ type ArticleBackup struct { | @@ -28,6 +28,7 @@ type ArticleBackup struct { | ||
28 | Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签 | 28 | Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签 |
29 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 | 29 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 |
30 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 | 30 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 |
31 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
31 | } | 32 | } |
32 | 33 | ||
33 | func (m *ArticleBackup) TableName() string { | 34 | func (m *ArticleBackup) TableName() string { |
@@ -27,11 +27,13 @@ type ArticleComment struct { | @@ -27,11 +27,13 @@ type ArticleComment struct { | ||
27 | ToUserId int64 // 回复谁的评论 | 27 | ToUserId int64 // 回复谁的评论 |
28 | ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论 | 28 | ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论 |
29 | AtWho []domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 填写评论@的人 | 29 | AtWho []domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 填写评论@的人 |
30 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 评论内容中出现的url. 用于页面上进行匹配文本后进行特殊显示处理 | ||
30 | Content string // 评论内容 | 31 | Content string // 评论内容 |
31 | CountReply int // 回复数量 | 32 | CountReply int // 回复数量 |
32 | CountUserLove int // 用户点赞数量 | 33 | CountUserLove int // 用户点赞数量 |
33 | CountAdminLove int // 运营点赞数量 | 34 | CountAdminLove int // 运营点赞数量 |
34 | Show int // 评论的展示状态(0显示、1不显示) | 35 | Show int // 评论的展示状态(0显示、1不显示) |
36 | + | ||
35 | } | 37 | } |
36 | 38 | ||
37 | func (m *ArticleComment) TableName() string { | 39 | func (m *ArticleComment) TableName() string { |
@@ -25,6 +25,7 @@ type ArticleDraft struct { | @@ -25,6 +25,7 @@ type ArticleDraft struct { | ||
25 | WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 | 25 | WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 |
26 | WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 | 26 | WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 |
27 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 | 27 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 |
28 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
28 | } | 29 | } |
29 | 30 | ||
30 | func (m *ArticleDraft) TableName() string { | 31 | func (m *ArticleDraft) TableName() string { |
@@ -17,6 +17,7 @@ type UserLoveFlag struct { | @@ -17,6 +17,7 @@ type UserLoveFlag struct { | ||
17 | CommentAuthor int64 // 评论的填写人 | 17 | CommentAuthor int64 // 评论的填写人 |
18 | UserId int64 | 18 | UserId int64 |
19 | ToUserId int64 | 19 | ToUserId int64 |
20 | + CompanyId int64 | ||
20 | CreatedAt int64 | 21 | CreatedAt int64 |
21 | UpdatedAt int64 | 22 | UpdatedAt int64 |
22 | DeletedAt int64 | 23 | DeletedAt int64 |
@@ -171,6 +171,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | @@ -171,6 +171,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | ||
171 | WhoRead: from.WhoRead, | 171 | WhoRead: from.WhoRead, |
172 | WhoReview: from.WhoReview, | 172 | WhoReview: from.WhoReview, |
173 | Tags: from.Tags, | 173 | Tags: from.Tags, |
174 | + MatchUrl: from.MatchUrl, | ||
174 | } | 175 | } |
175 | // err := copier.Copy(to, from) | 176 | // err := copier.Copy(to, from) |
176 | return to, nil | 177 | return to, nil |
@@ -193,9 +194,10 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | @@ -193,9 +194,10 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | ||
193 | Action: from.Action, | 194 | Action: from.Action, |
194 | WhoRead: from.WhoRead, | 195 | WhoRead: from.WhoRead, |
195 | WhoReview: from.WhoReview, | 196 | WhoReview: from.WhoReview, |
196 | - Location: from.Location, | ||
197 | Tags: from.Tags, | 197 | Tags: from.Tags, |
198 | + Location: from.Location, | ||
198 | TargetUser: int(from.TargetUser), | 199 | TargetUser: int(from.TargetUser), |
200 | + MatchUrl: from.MatchUrl, | ||
199 | } | 201 | } |
200 | // err := copier.Copy(to, from) | 202 | // err := copier.Copy(to, from) |
201 | return to, nil | 203 | return to, nil |
@@ -199,6 +199,7 @@ func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.Arti | @@ -199,6 +199,7 @@ func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.Arti | ||
199 | CountAdminLove: from.CountAdminLove, | 199 | CountAdminLove: from.CountAdminLove, |
200 | Show: domain.CommentShow(from.Show), | 200 | Show: domain.CommentShow(from.Show), |
201 | AtWho: from.AtWho, | 201 | AtWho: from.AtWho, |
202 | + MatchUrl: from.MatchUrl, | ||
202 | } | 203 | } |
203 | // err := copier.Copy(to, from) | 204 | // err := copier.Copy(to, from) |
204 | return to, nil | 205 | return to, nil |
@@ -228,6 +229,7 @@ func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.Arti | @@ -228,6 +229,7 @@ func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.Arti | ||
228 | CountUserLove: from.CountUserLove, | 229 | CountUserLove: from.CountUserLove, |
229 | CountAdminLove: from.CountAdminLove, | 230 | CountAdminLove: from.CountAdminLove, |
230 | Show: int(from.Show), | 231 | Show: int(from.Show), |
232 | + MatchUrl: from.MatchUrl, | ||
231 | } | 233 | } |
232 | // err := copier.Copy(to, from) | 234 | // err := copier.Copy(to, from) |
233 | return to, nil | 235 | return to, nil |
@@ -156,6 +156,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl | @@ -156,6 +156,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl | ||
156 | WhoRead: from.WhoRead, | 156 | WhoRead: from.WhoRead, |
157 | WhoReview: from.WhoReview, | 157 | WhoReview: from.WhoReview, |
158 | Location: from.Location, | 158 | Location: from.Location, |
159 | + MatchUrl: from.MatchUrl, | ||
159 | } | 160 | } |
160 | // err := copier.Copy(to, from) | 161 | // err := copier.Copy(to, from) |
161 | return to, nil | 162 | return to, nil |
@@ -177,6 +178,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl | @@ -177,6 +178,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl | ||
177 | WhoRead: from.WhoRead, | 178 | WhoRead: from.WhoRead, |
178 | WhoReview: from.WhoReview, | 179 | WhoReview: from.WhoReview, |
179 | Location: from.Location, | 180 | Location: from.Location, |
181 | + MatchUrl: from.MatchUrl, | ||
180 | } | 182 | } |
181 | // err := copier.Copy(to, from) | 183 | // err := copier.Copy(to, from) |
182 | return to, nil | 184 | return to, nil |
@@ -304,6 +304,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | @@ -304,6 +304,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | ||
304 | Show: domain.ArticleShow(from.Show), | 304 | Show: domain.ArticleShow(from.Show), |
305 | Tags: from.Tags, | 305 | Tags: from.Tags, |
306 | Summary: from.Summary, | 306 | Summary: from.Summary, |
307 | + MatchUrl: from.MatchUrl, | ||
307 | } | 308 | } |
308 | return to, nil | 309 | return to, nil |
309 | } | 310 | } |
@@ -328,9 +329,10 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | @@ -328,9 +329,10 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | ||
328 | CountLove: from.CountLove, | 329 | CountLove: from.CountLove, |
329 | CountRead: from.CountRead, | 330 | CountRead: from.CountRead, |
330 | CountComment: from.CountComment, | 331 | CountComment: from.CountComment, |
331 | - Show: int(from.Show), | ||
332 | Tags: from.Tags, | 332 | Tags: from.Tags, |
333 | + Show: int(from.Show), | ||
333 | Summary: from.Summary, | 334 | Summary: from.Summary, |
335 | + MatchUrl: from.MatchUrl, | ||
334 | } | 336 | } |
335 | // err := copier.Copy(to, from) | 337 | // err := copier.Copy(to, from) |
336 | return to, nil | 338 | return to, nil |
@@ -164,6 +164,7 @@ func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLo | @@ -164,6 +164,7 @@ func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLo | ||
164 | CommentId: from.CommentId, | 164 | CommentId: from.CommentId, |
165 | UserId: from.UserId, | 165 | UserId: from.UserId, |
166 | ToUserId: from.ToUserId, | 166 | ToUserId: from.ToUserId, |
167 | + CompanyId: from.CompanyId, | ||
167 | CreatedAt: from.CreatedAt, | 168 | CreatedAt: from.CreatedAt, |
168 | UpdatedAt: from.UpdatedAt, | 169 | UpdatedAt: from.UpdatedAt, |
169 | DeletedAt: from.DeletedAt, | 170 | DeletedAt: from.DeletedAt, |
@@ -182,6 +183,7 @@ func (repository *UserLoveFlagRepository) DomainModelToModel(from *domain.UserLo | @@ -182,6 +183,7 @@ func (repository *UserLoveFlagRepository) DomainModelToModel(from *domain.UserLo | ||
182 | CommentAuthor: from.CommentAuthor, | 183 | CommentAuthor: from.CommentAuthor, |
183 | UserId: from.UserId, | 184 | UserId: from.UserId, |
184 | ToUserId: from.ToUserId, | 185 | ToUserId: from.ToUserId, |
186 | + CompanyId: from.CompanyId, | ||
185 | CreatedAt: from.CreatedAt, | 187 | CreatedAt: from.CreatedAt, |
186 | UpdatedAt: from.UpdatedAt, | 188 | UpdatedAt: from.UpdatedAt, |
187 | DeletedAt: from.DeletedAt, | 189 | DeletedAt: from.DeletedAt, |
@@ -28,6 +28,7 @@ type Article struct { | @@ -28,6 +28,7 @@ type Article struct { | ||
28 | Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) | 28 | Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) |
29 | Tags []int64 `json:"tags"` // 定性标签 | 29 | Tags []int64 `json:"tags"` // 定性标签 |
30 | Summary string `json:"summary"` // 内容概要 | 30 | Summary string `json:"summary"` // 内容概要 |
31 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
31 | // ...more | 32 | // ...more |
32 | } | 33 | } |
33 | 34 | ||
@@ -110,6 +111,11 @@ func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *Art | @@ -110,6 +111,11 @@ func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *Art | ||
110 | WhoRead: m.WhoRead, | 111 | WhoRead: m.WhoRead, |
111 | WhoReview: m.WhoReview, | 112 | WhoReview: m.WhoReview, |
112 | Tags: m.Tags, | 113 | Tags: m.Tags, |
114 | + MatchUrl: map[string]string{}, | ||
115 | + } | ||
116 | + | ||
117 | + for k, v := range m.MatchUrl { | ||
118 | + b.MatchUrl[k] = v | ||
113 | } | 119 | } |
114 | return &b | 120 | return &b |
115 | } | 121 | } |
@@ -25,6 +25,7 @@ type ArticleBackup struct { | @@ -25,6 +25,7 @@ type ArticleBackup struct { | ||
25 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 25 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
26 | WhoReview []int64 `json:"whoReview"` // 评论人 | 26 | WhoReview []int64 `json:"whoReview"` // 评论人 |
27 | Tags []int64 `json:"tags"` // 标签 | 27 | Tags []int64 `json:"tags"` // 标签 |
28 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
28 | } | 29 | } |
29 | 30 | ||
30 | type ArticleBackupRepository interface { | 31 | type ArticleBackupRepository interface { |
@@ -28,7 +28,8 @@ type ArticleComment struct { | @@ -28,7 +28,8 @@ type ArticleComment struct { | ||
28 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 | 28 | CountUserLove int `json:"countUserLove"` // 用户点赞数量 |
29 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 | 29 | CountAdminLove int `json:"countAdminLove"` // 运营点赞数量 |
30 | Show CommentShow `json:"showState"` // 评论的展示状态(1显示、2不显示) | 30 | Show CommentShow `json:"showState"` // 评论的展示状态(1显示、2不显示) |
31 | - AtWho []UserSimple `json:"atWho"` // 填写评论时@的人 | 31 | + AtWho []UserSimple `json:"atWho"` // 填写评论时@的人. 评论内容中出现的@人,用于页面上进行匹配文本后进行特殊显示处理 |
32 | + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中出现的url. 用于页面上进行匹配文本后进行特殊显示处理 | ||
32 | // ...more | 33 | // ...more |
33 | } | 34 | } |
34 | 35 |
@@ -23,6 +23,7 @@ type ArticleDraft struct { | @@ -23,6 +23,7 @@ type ArticleDraft struct { | ||
23 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 23 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
24 | WhoReview []int64 `json:"whoReview"` // 评论人 | 24 | WhoReview []int64 `json:"whoReview"` // 评论人 |
25 | Location Location `json:"location"` // 坐标 | 25 | Location Location `json:"location"` // 坐标 |
26 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
26 | } | 27 | } |
27 | type ArticleDraftRepository interface { | 28 | type ArticleDraftRepository interface { |
28 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) | 29 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) |
@@ -2,6 +2,7 @@ package domain | @@ -2,6 +2,7 @@ package domain | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + "fmt" | ||
5 | 6 | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
7 | ) | 8 | ) |
@@ -22,6 +23,7 @@ type ArticleTag struct { | @@ -22,6 +23,7 @@ type ArticleTag struct { | ||
22 | SortBy int64 `json:"sortBy"` // 顺序 | 23 | SortBy int64 `json:"sortBy"` // 顺序 |
23 | Other string `json:"other"` // | 24 | Other string `json:"other"` // |
24 | } | 25 | } |
26 | + | ||
25 | type ArticleTagRepository interface { | 27 | type ArticleTagRepository interface { |
26 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) | 28 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) |
27 | CreateInBatches(ctx context.Context, conn transaction.Conn, dm []*ArticleTag) error | 29 | CreateInBatches(ctx context.Context, conn transaction.Conn, dm []*ArticleTag) error |
@@ -31,3 +33,14 @@ type ArticleTagRepository interface { | @@ -31,3 +33,14 @@ type ArticleTagRepository interface { | ||
31 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTag, error) | 33 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTag, error) |
32 | Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*ArticleTag, error) | 34 | Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*ArticleTag, error) |
33 | } | 35 | } |
36 | + | ||
37 | +func (m *ArticleTag) SetCategory(str string) error { | ||
38 | + var err error | ||
39 | + switch str { | ||
40 | + case "紧急重要", "机会风险": | ||
41 | + m.Category = str | ||
42 | + default: | ||
43 | + err = fmt.Errorf("ArticleTag.Category error") | ||
44 | + } | ||
45 | + return err | ||
46 | +} |
@@ -16,6 +16,7 @@ type UserLoveFlag struct { | @@ -16,6 +16,7 @@ type UserLoveFlag struct { | ||
16 | CommentAuthor int64 `json:"commentAuthor"` // 评论的填写人 | 16 | CommentAuthor int64 `json:"commentAuthor"` // 评论的填写人 |
17 | ToUserId int64 `json:"toUserId"` // 点赞的接受人 | 17 | ToUserId int64 `json:"toUserId"` // 点赞的接受人 |
18 | UserId int64 `json:"userId"` // 点赞的人 | 18 | UserId int64 `json:"userId"` // 点赞的人 |
19 | + CompanyId int64 `json:"companyId"` // | ||
19 | CreatedAt int64 `json:"createdAt,omitempty"` | 20 | CreatedAt int64 `json:"createdAt,omitempty"` |
20 | UpdatedAt int64 `json:"updatedAt,omitempty"` | 21 | UpdatedAt int64 `json:"updatedAt,omitempty"` |
21 | DeletedAt int64 `json:"deletedAt,omitempty"` | 22 | DeletedAt int64 `json:"deletedAt,omitempty"` |
-
请 注册 或 登录 后发表评论