作者 tangxvhui

更新模型

  1 +syntax = "v1"
1 import "core/comment.api" 2 import "core/comment.api"
2 import "core/message.api" 3 import "core/message.api"
3 import "core/article_tag.api" 4 import "core/article_tag.api"
1 syntax = "v1" 1 syntax = "v1"
2 2
  3 +import "article_type.api"
  4 +
3 info( 5 info(
4 title: "文章内容处理" 6 title: "文章内容处理"
5 desc: "编辑处理文章内容" 7 desc: "编辑处理文章内容"
@@ -31,128 +33,18 @@ service Core { @@ -31,128 +33,18 @@ service Core {
31 @doc "小程序获取我发布的文章" 33 @doc "小程序获取我发布的文章"
32 @handler MiniArticleSearchMe 34 @handler MiniArticleSearchMe
33 post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse) 35 post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
34 -}  
35 -  
36 -// 坐标地点描述  
37 -type Location {  
38 - Longitude float64 `json:"longitude,optional"` //经度  
39 - Latitude float64 `json:"latitude,optional"` //纬度  
40 - Descript string `json:"descript,optional"` //地点描述  
41 -}  
42 36
43 -// 人员的简单展示信息  
44 -type Author {  
45 - Id int64 `json:"id"` // 人员id  
46 - Name string `json:"name"` // 人员的名字  
47 - Avatar string `json:"avatar"` // 人员头像URL  
48 - Group string `json:"group"` // 人员的分组  
49 - Position string `json:"position"` // 职位  
50 - Company string `json:"company"` // 公司  
51 } 37 }
52 38
53 -//小程序端创建发布文章  
54 -type (  
55 - MiniArticleCreateRequest {  
56 - Title string `json:"title"` //标题  
57 - Section []string `json:"section"` //文章的文本内容  
58 - AuthorId int64 `json:"authorId,optional"` //发布人id  
59 - Images []string `json:"images,optional"` //图片  
60 - WhoRead []int64 `json:"whoRead,optional"` //谁可查看  
61 - WhoReview []int64 `json:"whoReview,optional"` //谁可评论  
62 - Location Location `json:"location,optional"` //定位坐标  
63 - }  
64 - MiniArticleCreateResponse {  
65 - Id int64 `json:"id"`  
66 - }  
67 -)  
68 -  
69 -//小程序端查看文章的详情  
70 -type (  
71 - MiniArticleGetRequest {  
72 - Id int64 `path:"id"` //id  
73 - CompanyId int64 `path:",optional"`  
74 - }  
75 - MiniArticleGetResponse {  
76 - Id int64 `json:"id"` //id  
77 - Title string `json:"title"` //标题  
78 - AuthorId int64 `json:"authorId"` //发布人id  
79 - Author Author `json:"author"` //发布人  
80 - CreatedAt int64 `json:"createdAt"` //文章的发布时间  
81 - Section []ArticleSection `json:"section"` //文章的文本内容  
82 - Images []string `json:"images"` //图片  
83 - WhoRead []int64 `json:"whoRead"` //谁可查看  
84 - WhoReview []int64 `json:"whoReview"` //谁可评论  
85 - Location Location `json:"location"` //定位坐标  
86 - CountLove int `json:"countLove"` // 点赞数量  
87 - CountComment int `json:"countComment"` // 评论数量  
88 - CountRead int `json:"countRead"` // 浏览数量  
89 - Show int `json:"show"` // 评论的展示状态(0显示、1不显示)  
90 - }  
91 - ArticleSection {  
92 - Id int64 `json:"id"` //段落id  
93 - Content string `json:"content"` // 文本内容  
94 - SortBy int `json:"sortBy"` // 排序  
95 - TotalComment int `json:"totalComment"` // 评论的数量  
96 - }  
97 -)  
98 -  
99 -// 获取我的发文章记录  
100 -type (  
101 - MiniArticleSearchMeRequest {  
102 - AuthorId int64 `json:",optional"`  
103 - CompanyId int64 `json:",optional"`  
104 - Page int `json:"page"`  
105 - Size int `json:"size"`  
106 - }  
107 -  
108 - MiniArticleSearchMeResponse {  
109 - Total int `json:"total"`  
110 - List []ArticleSearchMe `json:"list"`  
111 - }  
112 -  
113 - ArticleSearchMe {  
114 - Id int64 `json:"id"` //id  
115 - Title string `json:"title"` //标题  
116 - Images []string `json:"images"` //图片  
117 - CreatedAt int64 `json:"createdAt"` //文章的创建日期  
118 - CountLove int `json:"countLove"` //点赞数量  
119 - CountComment int `json:"CountComment"` //评论数量  
120 - Show int `json:"show"` //是否隐藏 [0显示、1不显示]  
121 - }  
122 -)  
123 -  
124 -//获取列表,文章有哪些人进行了点赞  
125 -type (  
126 - MiniUserLikeArticleRequest {  
127 - ArticleId int64 `json:"articleId"` // 文章id  
128 - CompanyId int64 `json:",optional"` //公司id  
129 - Page int `json:"page"` //分页,第几页  
130 - Size int `json:"size"` //分页,每页几条  
131 - }  
132 - MiniUserLikeArticleResponse {  
133 - Total int64 `json:"total"` //总数  
134 - List []WhichUserLikeArticle `json:"list"` //列表  
135 - }  
136 - WhichUserLikeArticle {  
137 - ArticleId int64 `json:"articleId"` // 文章id  
138 - UserId int64 `json:"userId"` // 人员id  
139 - Name string `json:"name"` // 人员名称  
140 - Avatar string `json:"avatar"` // 人员头像  
141 - CreatedAt int64 `json:"createdAt"` // 点赞记录的时间  
142 - }  
143 -) 39 +// 管理后台接口
  40 +// @server(
  41 +// prefix: v1/system
  42 +// group: article
  43 +// jwt: MiniAuth
  44 +// )
  45 +// service Core {
  46 +// @doc "管理后台获取文章内容详情"
  47 +// @handler SystemGetArticle
  48 +// get /article/:id (SystemArticleGetRequest) returns (SystemArticleGetResponse)
  49 +// }
144 50
145 -// 人员点赞文章/评论  
146 -type (  
147 - MiniSetUserLikeRequset {  
148 - ArticleId int64 `json:"articleId"` //文章id  
149 - CommentId int64 `json:"commentId"` //评论id  
150 - UserId int64 `json:",optional"` //操作人  
151 - Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞  
152 - }  
153 - MiniSetUserLikeResponse {  
154 - ArticleId int64 `json:"articleId"` //文章id  
155 - CommentId int64 `json:"commentId"` //评论id  
156 - Count int `json:"count"` //现有的点赞数量  
157 - }  
158 -)  
  1 +syntax = "v1"
  2 +
  3 +// 坐标地点描述
  4 +type Location {
  5 + Longitude float64 `json:"longitude,optional"` //经度
  6 + Latitude float64 `json:"latitude,optional"` //纬度
  7 + Descript string `json:"descript,optional"` //地点描述
  8 +}
  9 +
  10 +// 人员的简单展示信息
  11 +type Author {
  12 + Id int64 `json:"id"` // 人员id
  13 + Name string `json:"name"` // 人员的名字
  14 + Avatar string `json:"avatar"` // 人员头像URL
  15 + Group string `json:"group"` // 人员的分组
  16 + Position string `json:"position"` // 职位
  17 + Company string `json:"company"` // 公司
  18 +}
  19 +
  20 +//小程序端创建发布文章
  21 +type (
  22 + MiniArticleCreateRequest {
  23 + Title string `json:"title"` //标题
  24 + Section []string `json:"section"` //文章的文本内容
  25 + AuthorId int64 `json:"authorId,optional"` //发布人id
  26 + Images []string `json:"images,optional"` //图片
  27 + WhoRead []int64 `json:"whoRead,optional"` //谁可查看
  28 + WhoReview []int64 `json:"whoReview,optional"` //谁可评论
  29 + Location Location `json:"location,optional"` //定位坐标
  30 + }
  31 + MiniArticleCreateResponse {
  32 + Id int64 `json:"id"`
  33 + }
  34 +)
  35 +
  36 +//小程序端查看文章的详情
  37 +type (
  38 + MiniArticleGetRequest {
  39 + Id int64 `path:"id"` //id
  40 + CompanyId int64 `path:",optional"`
  41 + }
  42 + MiniArticleGetResponse {
  43 + Id int64 `json:"id"` //id
  44 + Title string `json:"title"` //标题
  45 + AuthorId int64 `json:"authorId"` //发布人id
  46 + Author Author `json:"author"` //发布人
  47 + CreatedAt int64 `json:"createdAt"` //文章的发布时间
  48 + Section []ArticleSection `json:"section"` //文章的文本内容
  49 + Images []string `json:"images"` //图片
  50 + WhoRead []int64 `json:"whoRead"` //谁可查看
  51 + WhoReview []int64 `json:"whoReview"` //谁可评论
  52 + Location Location `json:"location"` //定位坐标
  53 + CountLove int `json:"countLove"` // 点赞数量
  54 + CountComment int `json:"countComment"` // 评论数量
  55 + CountRead int `json:"countRead"` // 浏览数量
  56 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  57 + Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
  58 + }
  59 + ArticleSection {
  60 + Id int64 `json:"id"` //段落id
  61 + Content string `json:"content"` // 文本内容
  62 + SortBy int `json:"sortBy"` // 排序
  63 + TotalComment int `json:"totalComment"` // 评论的数量
  64 + }
  65 +)
  66 +
  67 +// 小程序获取我的发文章记录
  68 +type (
  69 + MiniArticleSearchMeRequest {
  70 + AuthorId int64 `json:",optional"`
  71 + CompanyId int64 `json:",optional"`
  72 + Page int `json:"page"`
  73 + Size int `json:"size"`
  74 + }
  75 +
  76 + MiniArticleSearchMeResponse {
  77 + Total int `json:"total"`
  78 + List []ArticleSearchMe `json:"list"`
  79 + }
  80 +
  81 + ArticleSearchMe {
  82 + Id int64 `json:"id"` //id
  83 + Title string `json:"title"` //标题
  84 + Images []string `json:"images"` //图片
  85 + CreatedAt int64 `json:"createdAt"` //文章的创建日期
  86 + CountLove int `json:"countLove"` //点赞数量
  87 + CountComment int `json:"CountComment"` //评论数量
  88 + Show int `json:"show"` //是否隐藏 [0显示、1不显示]
  89 + }
  90 +)
  91 +
  92 +//小程序端获取文章有哪些人进行了点赞
  93 +type (
  94 + MiniUserLikeArticleRequest {
  95 + ArticleId int64 `json:"articleId"` // 文章id
  96 + CompanyId int64 `json:",optional"` //公司id
  97 + Page int `json:"page"` //分页,第几页
  98 + Size int `json:"size"` //分页,每页几条
  99 + }
  100 + MiniUserLikeArticleResponse {
  101 + Total int64 `json:"total"` //总数
  102 + List []WhichUserLikeArticle `json:"list"` //列表
  103 + }
  104 + WhichUserLikeArticle {
  105 + ArticleId int64 `json:"articleId"` // 文章id
  106 + UserId int64 `json:"userId"` // 人员id
  107 + Name string `json:"name"` // 人员名称
  108 + Avatar string `json:"avatar"` // 人员头像
  109 + CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
  110 + }
  111 +)
  112 +
  113 +// 小程序端人员点赞文章/评论
  114 +type (
  115 + MiniSetUserLikeRequset {
  116 + ArticleId int64 `json:"articleId"` //文章id
  117 + CommentId int64 `json:"commentId"` //评论id
  118 + UserId int64 `json:",optional"` //操作人
  119 + Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
  120 + }
  121 + MiniSetUserLikeResponse {
  122 + ArticleId int64 `json:"articleId"` //文章id
  123 + CommentId int64 `json:"commentId"` //评论id
  124 + Count int `json:"count"` //现有的点赞数量
  125 + }
  126 +)
  127 +
  128 +//管理后台获取文章详情
  129 +type (
  130 + SystemArticleGetRequest {
  131 + Id int64 `path:"id"` //id
  132 + CompanyId int64 `path:",optional"`
  133 + }
  134 +
  135 + UserShowName {
  136 + Id int `json:"id"`
  137 + Name int `json:"name"`
  138 + }
  139 +
  140 + SystemArticleGetResponse {
  141 + Id int64 `json:"id"` // id
  142 + Title string `json:"title"` // 标题
  143 + AuthorId int64 `json:"authorId"` // 发布人id
  144 + Author Author `json:"author"` // 发布人
  145 + CreatedAt int64 `json:"createdAt"` // 文章的发布时间
  146 + Section []ArticleSection `json:"section"` // 文章的文本内容
  147 + Images []string `json:"images"` // 图片
  148 + WhoRead []int64 `json:"whoRead"` // 谁可查看
  149 + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
  150 + WhoReview []int64 `json:"whoReview"` // 谁可评论
  151 + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
  152 + Location Location `json:"location"` // 定位坐标
  153 + CountLove int `json:"countLove"` // 点赞数量
  154 + CountComment int `json:"countComment"` // 评论数量
  155 + CountRead int `json:"countRead"` // 浏览数量
  156 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  157 + }
  158 +)
  159 +
  160 +//管理后台获取文章列表
1 syntax = "v1" 1 syntax = "v1"
2 2
3 info( 3 info(
4 - title: "天联鹰蜓"  
5 - desc: "天联鹰蜓"  
6 - author: "email"  
7 - email: "email"  
8 - version: "v1" 4 + title: "天联鹰蜓"
  5 + desc: "天联鹰蜓"
  6 + author: "email"
  7 + email: "email"
  8 + version: "v1"
9 ) 9 )
10 10
11 -  
12 // 小程序接口 11 // 小程序接口
13 @server( 12 @server(
14 - prefix: v1  
15 - group: comment  
16 - jwt: MiniAuth 13 + prefix: v1
  14 + group: comment
  15 + jwt: MiniAuth
17 ) 16 )
18 service Core { 17 service Core {
19 - @doc "小程序评论"  
20 - @handler miniComment  
21 - get /mini/comment (CommentRequest) returns (CommentResposne) 18 + @doc "小程序评论"
  19 + @handler miniComment
  20 + get /mini/comment (CommentRequest) returns (CommentResposne)
22 } 21 }
23 22
24 -  
25 // 后台接口 23 // 后台接口
26 @server( 24 @server(
27 - prefix: v1  
28 - group: comment  
29 - jwt: SystemAuth 25 + prefix: v1
  26 + group: comment
  27 + jwt: SystemAuth
30 ) 28 )
31 service Core { 29 service Core {
32 - @doc "系统评论"  
33 - @handler systemComment  
34 - get /system/comment (CommentRequest) returns (CommentResposne) 30 + @doc "系统评论"
  31 + @handler systemComment
  32 + get /system/comment (CommentRequest) returns (CommentResposne)
35 } 33 }
36 34
37 -type(  
38 - CommentRequest struct{  
39 -  
40 - }  
41 - CommentResposne struct{  
42 - List []Comment `json:"list"`  
43 - }  
44 -  
45 - Comment struct{ 35 +type (
  36 + CommentRequest {
  37 + }
  38 + CommentResposne {
  39 + List []Comment `json:"list"`
  40 + }
46 41
47 - } 42 + Comment {
  43 + }
48 ) 44 )
@@ -24,7 +24,7 @@ service Core { @@ -24,7 +24,7 @@ service Core {
24 } 24 }
25 25
26 type ( 26 type (
27 - MessageSystemRequest struct { 27 + MessageSystemRequest {
28 Page int `json:"page"` 28 Page int `json:"page"`
29 Size int `json:"size"` 29 Size int `json:"size"`
30 } 30 }
@@ -32,7 +32,7 @@ type ( @@ -32,7 +32,7 @@ type (
32 List []MessageSystemItem `json:"list"` 32 List []MessageSystemItem `json:"list"`
33 Total int64 `json:"total"` 33 Total int64 `json:"total"`
34 } 34 }
35 - MessageSystemItem struct { 35 + MessageSystemItem {
36 Id int64 `json:"id"` // ID 36 Id int64 `json:"id"` // ID
37 Type int `json:"type"` // 系统分类 37 Type int `json:"type"` // 系统分类
38 Title string `json:"title"` // 标题 38 Title string `json:"title"` // 标题
@@ -40,7 +40,7 @@ type ( @@ -40,7 +40,7 @@ type (
40 CreatedAt int64 `json:"createdAt"` // 创建时间 40 CreatedAt int64 `json:"createdAt"` // 创建时间
41 } 41 }
42 42
43 - MessageBusinessRequest struct { 43 + MessageBusinessRequest {
44 Type int `json:"type"` 44 Type int `json:"type"`
45 Page int `json:"page"` 45 Page int `json:"page"`
46 Size int `json:"size"` 46 Size int `json:"size"`
@@ -49,7 +49,7 @@ type ( @@ -49,7 +49,7 @@ type (
49 List []MessageBusinessItem `json:"list"` 49 List []MessageBusinessItem `json:"list"`
50 Total int64 `json:"total"` 50 Total int64 `json:"total"`
51 } 51 }
52 - MessageBusinessItem struct { 52 + MessageBusinessItem {
53 Id int64 `json:"id"` 53 Id int64 `json:"id"`
54 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳) 54 Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
55 OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) 55 OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
@@ -67,7 +67,7 @@ type ( @@ -67,7 +67,7 @@ type (
67 Comment *Comment `json:"comment"` // 评论(不一定是自己,可能是被人@到) 67 Comment *Comment `json:"comment"` // 评论(不一定是自己,可能是被人@到)
68 } 68 }
69 69
70 - User struct { 70 + User {
71 Id int64 `json:"id"` 71 Id int64 `json:"id"`
72 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 72 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
73 CompanyName string `json:"companyName,omitempty"` // 公司名称 73 CompanyName string `json:"companyName,omitempty"` // 公司名称
@@ -77,10 +77,11 @@ type ( @@ -77,10 +77,11 @@ type (
77 } 77 }
78 78
79 79
80 - SimpleArticle struct { 80 + SimpleArticle {
81 Id int64 `json:"id"` 81 Id int64 `json:"id"`
82 Title string `json:"title"` // 文章标题 82 Title string `json:"title"` // 文章标题
83 CountLove int `json:"countLove"` // 点赞数量 83 CountLove int `json:"countLove"` // 点赞数量
84 CountComment int `json:"countComment"` // 评论数量 84 CountComment int `json:"countComment"` // 评论数量
85 } 85 }
86 ) 86 )
  87 +
@@ -92,8 +92,11 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( @@ -92,8 +92,11 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
92 CountComment: articleInfo.CountComment, 92 CountComment: articleInfo.CountComment,
93 CountRead: articleInfo.CountRead, 93 CountRead: articleInfo.CountRead,
94 Show: int(articleInfo.Show), 94 Show: int(articleInfo.Show),
  95 + Edit: 0,
  96 + }
  97 + if articleInfo.CreatedAt != articleInfo.UpdatedAt {
  98 + resp.Edit = 1
95 } 99 }
96 -  
97 for _, val := range articleInfo.Images { 100 for _, val := range articleInfo.Images {
98 resp.Images = append(resp.Images, val.Url) 101 resp.Images = append(resp.Images, val.Url)
99 } 102 }
@@ -226,10 +226,12 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ @@ -226,10 +226,12 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ
226 } 226 }
227 err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { 227 err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error {
228 flagInfo := domain.UserLoveFlag{ 228 flagInfo := domain.UserLoveFlag{
229 - Id: 0,  
230 - ArticleId: req.ArticleId,  
231 - CommentId: req.CommentId,  
232 - UserId: req.UserId, 229 + Id: 0,
  230 + ArticleId: req.ArticleId,
  231 + ArticleAuthor: articleInfo.AuthorId,
  232 + CommentId: 0,
  233 + CommentAuthor: 0,
  234 + UserId: req.UserId,
233 } 235 }
234 // 去除点赞标识 236 // 去除点赞标识
235 _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) 237 _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo)
@@ -305,10 +307,12 @@ func (l *MiniSetUserLikeLogic) setUserLikeComment(req *types.MiniSetUserLikeRequ @@ -305,10 +307,12 @@ func (l *MiniSetUserLikeLogic) setUserLikeComment(req *types.MiniSetUserLikeRequ
305 307
306 err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { 308 err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error {
307 flagInfo := domain.UserLoveFlag{ 309 flagInfo := domain.UserLoveFlag{
308 - Id: 0,  
309 - ArticleId: req.ArticleId,  
310 - CommentId: req.CommentId,  
311 - UserId: req.UserId, 310 + Id: 0,
  311 + ArticleId: req.ArticleId,
  312 + ArticleAuthor: articleInfo.AuthorId,
  313 + CommentId: req.CommentId,
  314 + CommentAuthor: commentInfo.FromUserId,
  315 + UserId: req.UserId,
312 } 316 }
313 // 设置赞标识 317 // 设置赞标识
314 _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo) 318 _, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo)
@@ -319,6 +319,7 @@ type MiniArticleGetResponse struct { @@ -319,6 +319,7 @@ type MiniArticleGetResponse struct {
319 CountComment int `json:"countComment"` // 评论数量 319 CountComment int `json:"countComment"` // 评论数量
320 CountRead int `json:"countRead"` // 浏览数量 320 CountRead int `json:"countRead"` // 浏览数量
321 Show int `json:"show"` // 评论的展示状态(0显示、1不显示) 321 Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  322 + Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
322 } 323 }
323 324
324 type ArticleSection struct { 325 type ArticleSection struct {
@@ -382,3 +383,32 @@ type MiniSetUserLikeResponse struct { @@ -382,3 +383,32 @@ type MiniSetUserLikeResponse struct {
382 CommentId int64 `json:"commentId"` //评论id 383 CommentId int64 `json:"commentId"` //评论id
383 Count int `json:"count"` //现有的点赞数量 384 Count int `json:"count"` //现有的点赞数量
384 } 385 }
  386 +
  387 +type SystemArticleGetRequest struct {
  388 + Id int64 `path:"id"` //id
  389 + CompanyId int64 `path:",optional"`
  390 +}
  391 +
  392 +type UserShowName struct {
  393 + Id int `json:"id"`
  394 + Name int `json:"name"`
  395 +}
  396 +
  397 +type SystemArticleGetResponse struct {
  398 + Id int64 `json:"id"` // id
  399 + Title string `json:"title"` // 标题
  400 + AuthorId int64 `json:"authorId"` // 发布人id
  401 + Author Author `json:"author"` // 发布人
  402 + CreatedAt int64 `json:"createdAt"` // 文章的发布时间
  403 + Section []ArticleSection `json:"section"` // 文章的文本内容
  404 + Images []string `json:"images"` // 图片
  405 + WhoRead []int64 `json:"whoRead"` // 谁可查看
  406 + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
  407 + WhoReview []int64 `json:"whoReview"` // 谁可评论
  408 + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
  409 + Location Location `json:"location"` // 定位坐标
  410 + CountLove int `json:"countLove"` // 点赞数量
  411 + CountComment int `json:"countComment"` // 评论数量
  412 + CountRead int `json:"countRead"` // 浏览数量
  413 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  414 +}
@@ -10,15 +10,17 @@ import ( @@ -10,15 +10,17 @@ import (
10 ) 10 )
11 11
12 type UserLoveFlag struct { 12 type UserLoveFlag struct {
13 - Id int64 `gorm:"primaryKey"` // 唯一标识  
14 - ArticleId int64 // 点赞文章时,文章id  
15 - CommentId int64 // 点赞评论时,填评论id  
16 - UserId int64  
17 - CreatedAt int64  
18 - UpdatedAt int64  
19 - DeletedAt int64  
20 - Version int  
21 - IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` 13 + Id int64 `gorm:"primaryKey"` // 唯一标识
  14 + ArticleId int64 // 点赞文章时,文章id
  15 + CommentId int64 // 点赞评论时,填评论id
  16 + ArticleAuthor int64 // 文章的发布人
  17 + CommentAuthor int64 // 评论的填写人
  18 + UserId int64
  19 + CreatedAt int64
  20 + UpdatedAt int64
  21 + DeletedAt int64
  22 + Version int
  23 + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
22 } 24 }
23 25
24 func (m *UserLoveFlag) TableName() string { 26 func (m *UserLoveFlag) TableName() string {
@@ -151,14 +151,16 @@ func (repository *UserLoveFlagRepository) Find(ctx context.Context, conn transac @@ -151,14 +151,16 @@ func (repository *UserLoveFlagRepository) Find(ctx context.Context, conn transac
151 151
152 func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLoveFlag) (*domain.UserLoveFlag, error) { 152 func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLoveFlag) (*domain.UserLoveFlag, error) {
153 to := &domain.UserLoveFlag{ 153 to := &domain.UserLoveFlag{
154 - Id: from.Id,  
155 - ArticleId: from.ArticleId,  
156 - CommentId: from.CommentId,  
157 - UserId: from.UserId,  
158 - CreatedAt: from.CreatedAt,  
159 - UpdatedAt: from.UpdatedAt,  
160 - DeletedAt: from.DeletedAt,  
161 - Version: from.Version, 154 + Id: from.Id,
  155 + ArticleId: from.ArticleId,
  156 + ArticleAuthor: from.ArticleAuthor,
  157 + CommentAuthor: from.CommentAuthor,
  158 + CommentId: from.CommentId,
  159 + UserId: from.UserId,
  160 + CreatedAt: from.CreatedAt,
  161 + UpdatedAt: from.UpdatedAt,
  162 + DeletedAt: from.DeletedAt,
  163 + Version: from.Version,
162 } 164 }
163 // err := copier.Copy(to, from) 165 // err := copier.Copy(to, from)
164 return to, nil 166 return to, nil
@@ -166,14 +168,17 @@ func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLo @@ -166,14 +168,17 @@ func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLo
166 168
167 func (repository *UserLoveFlagRepository) DomainModelToModel(from *domain.UserLoveFlag) (*models.UserLoveFlag, error) { 169 func (repository *UserLoveFlagRepository) DomainModelToModel(from *domain.UserLoveFlag) (*models.UserLoveFlag, error) {
168 to := &models.UserLoveFlag{ 170 to := &models.UserLoveFlag{
169 - Id: from.Id,  
170 - ArticleId: from.ArticleId,  
171 - CommentId: from.CommentId,  
172 - UserId: from.UserId,  
173 - CreatedAt: from.CreatedAt,  
174 - UpdatedAt: from.UpdatedAt,  
175 - DeletedAt: from.DeletedAt,  
176 - Version: from.Version, 171 + Id: from.Id,
  172 + ArticleId: from.ArticleId,
  173 + CommentId: from.CommentId,
  174 + ArticleAuthor: from.ArticleAuthor,
  175 + CommentAuthor: from.CommentAuthor,
  176 + UserId: from.UserId,
  177 + CreatedAt: from.CreatedAt,
  178 + UpdatedAt: from.UpdatedAt,
  179 + DeletedAt: from.DeletedAt,
  180 + Version: from.Version,
  181 + IsDel: 0,
177 } 182 }
178 // err := copier.Copy(to, from) 183 // err := copier.Copy(to, from)
179 return to, nil 184 return to, nil
@@ -81,7 +81,7 @@ func (a ArticleShow) Named() string { @@ -81,7 +81,7 @@ func (a ArticleShow) Named() string {
81 func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *ArticleBackup { 81 func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *ArticleBackup {
82 b := ArticleBackup{ 82 b := ArticleBackup{
83 Id: 0, 83 Id: 0,
84 - CompanyId: 0, 84 + CompanyId: m.CompanyId,
85 CreatedAt: 0, 85 CreatedAt: 0,
86 UpdatedAt: 0, 86 UpdatedAt: 0,
87 DeletedAt: 0, 87 DeletedAt: 0,
@@ -9,14 +9,16 @@ import ( @@ -9,14 +9,16 @@ import (
9 // 人员点赞标记 9 // 人员点赞标记
10 10
11 type UserLoveFlag struct { 11 type UserLoveFlag struct {
12 - Id int64 `json:"id"`  
13 - ArticleId int64 `json:"articleId"` // 点赞文章时,文章id  
14 - CommentId int64 `json:"commentId"` // 点赞评论时,填评论id  
15 - UserId int64 `json:"userId"`  
16 - CreatedAt int64 `json:"createdAt,omitempty"`  
17 - UpdatedAt int64 `json:"updatedAt,omitempty"`  
18 - DeletedAt int64 `json:"deletedAt,omitempty"`  
19 - Version int `json:"version,omitempty"` 12 + Id int64 `json:"id"`
  13 + ArticleId int64 `json:"articleId"` // 点赞文章时,文章id
  14 + ArticleAuthor int64 `json:"articleAuthor"` // 文章的发布人
  15 + CommentId int64 `json:"commentId"` // 点赞评论时,填评论id
  16 + CommentAuthor int64 `json:"commentAuthor"` // 评论的填写人
  17 + UserId int64 `json:"userId"`
  18 + CreatedAt int64 `json:"createdAt,omitempty"`
  19 + UpdatedAt int64 `json:"updatedAt,omitempty"`
  20 + DeletedAt int64 `json:"deletedAt,omitempty"`
  21 + Version int `json:"version,omitempty"`
20 } 22 }
21 type UserLoveFlagRepository interface { 23 type UserLoveFlagRepository interface {
22 Insert(ctx context.Context, conn transaction.Conn, dm *UserLoveFlag) (*UserLoveFlag, error) 24 Insert(ctx context.Context, conn transaction.Conn, dm *UserLoveFlag) (*UserLoveFlag, error)