正在显示
3 个修改的文件
包含
507 行增加
和
54 行删除
@@ -15,6 +15,119 @@ | @@ -15,6 +15,119 @@ | ||
15 | "application/json" | 15 | "application/json" |
16 | ], | 16 | ], |
17 | "paths": { | 17 | "paths": { |
18 | + "v1/mini/article_tag": { | ||
19 | + "delete": { | ||
20 | + "summary": "后台删除文章标签", | ||
21 | + "operationId": "DeleteTag", | ||
22 | + "responses": { | ||
23 | + "200": { | ||
24 | + "description": "A successful response.", | ||
25 | + "schema": { | ||
26 | + "$ref": "#/definitions/TagDeleteResponse" | ||
27 | + } | ||
28 | + } | ||
29 | + }, | ||
30 | + "parameters": [ | ||
31 | + { | ||
32 | + "name": "body", | ||
33 | + "in": "body", | ||
34 | + "required": true, | ||
35 | + "schema": { | ||
36 | + "$ref": "#/definitions/TagDeleteRequest" | ||
37 | + } | ||
38 | + } | ||
39 | + ], | ||
40 | + "requestBody": {}, | ||
41 | + "tags": [ | ||
42 | + "tags" | ||
43 | + ] | ||
44 | + }, | ||
45 | + "post": { | ||
46 | + "summary": "后台创建文章标签", | ||
47 | + "operationId": "CreateTag", | ||
48 | + "responses": { | ||
49 | + "200": { | ||
50 | + "description": "A successful response.", | ||
51 | + "schema": { | ||
52 | + "$ref": "#/definitions/TagCreateResponse" | ||
53 | + } | ||
54 | + } | ||
55 | + }, | ||
56 | + "parameters": [ | ||
57 | + { | ||
58 | + "name": "body", | ||
59 | + "in": "body", | ||
60 | + "required": true, | ||
61 | + "schema": { | ||
62 | + "$ref": "#/definitions/TagCreateRequest" | ||
63 | + } | ||
64 | + } | ||
65 | + ], | ||
66 | + "requestBody": {}, | ||
67 | + "tags": [ | ||
68 | + "tags" | ||
69 | + ] | ||
70 | + }, | ||
71 | + "put": { | ||
72 | + "summary": "后台编辑文章标签", | ||
73 | + "operationId": "EditTag", | ||
74 | + "responses": { | ||
75 | + "200": { | ||
76 | + "description": "A successful response.", | ||
77 | + "schema": { | ||
78 | + "$ref": "#/definitions/TagEditResponse" | ||
79 | + } | ||
80 | + } | ||
81 | + }, | ||
82 | + "parameters": [ | ||
83 | + { | ||
84 | + "name": "body", | ||
85 | + "in": "body", | ||
86 | + "required": true, | ||
87 | + "schema": { | ||
88 | + "$ref": "#/definitions/TagEditRequest" | ||
89 | + } | ||
90 | + } | ||
91 | + ], | ||
92 | + "requestBody": {}, | ||
93 | + "tags": [ | ||
94 | + "tags" | ||
95 | + ] | ||
96 | + } | ||
97 | + }, | ||
98 | + "v1/mini/article_tag/{id}": { | ||
99 | + "get": { | ||
100 | + "summary": "后台获取文章标签", | ||
101 | + "operationId": "GetTag", | ||
102 | + "responses": { | ||
103 | + "200": { | ||
104 | + "description": "A successful response.", | ||
105 | + "schema": { | ||
106 | + "$ref": "#/definitions/TagGetResponse" | ||
107 | + } | ||
108 | + } | ||
109 | + }, | ||
110 | + "parameters": [ | ||
111 | + { | ||
112 | + "name": "id", | ||
113 | + "in": "path", | ||
114 | + "required": true, | ||
115 | + "type": "string" | ||
116 | + }, | ||
117 | + { | ||
118 | + "name": "id", | ||
119 | + "in": "query", | ||
120 | + "required": true, | ||
121 | + "type": "integer", | ||
122 | + "format": "int64" | ||
123 | + } | ||
124 | + ], | ||
125 | + "requestBody": {}, | ||
126 | + "tags": [ | ||
127 | + "tags" | ||
128 | + ] | ||
129 | + } | ||
130 | + }, | ||
18 | "v1/mini/comment": { | 131 | "v1/mini/comment": { |
19 | "get": { | 132 | "get": { |
20 | "summary": "小程序评论", | 133 | "summary": "小程序评论", |
@@ -97,7 +210,7 @@ | @@ -97,7 +210,7 @@ | ||
97 | "200": { | 210 | "200": { |
98 | "description": "A successful response.", | 211 | "description": "A successful response.", |
99 | "schema": { | 212 | "schema": { |
100 | - "$ref": "#/definitions/MessageBusinessResponse" | 213 | + "$ref": "#/definitions/MessageSystemResponse" |
101 | } | 214 | } |
102 | } | 215 | } |
103 | }, | 216 | }, |
@@ -589,11 +702,6 @@ | @@ -589,11 +702,6 @@ | ||
589 | "type": "integer", | 702 | "type": "integer", |
590 | "format": "int64" | 703 | "format": "int64" |
591 | }, | 704 | }, |
592 | - "companyId": { | ||
593 | - "type": "integer", | ||
594 | - "format": "int64", | ||
595 | - "description": " 公司ID" | ||
596 | - }, | ||
597 | "type": { | 705 | "type": { |
598 | "type": "integer", | 706 | "type": "integer", |
599 | "format": "int32", | 707 | "format": "int32", |
@@ -604,10 +712,15 @@ | @@ -604,10 +712,15 @@ | ||
604 | "format": "int32", | 712 | "format": "int32", |
605 | "description": " 操作类型(1针对文章、1针对评论、2针对圆桌)" | 713 | "description": " 操作类型(1针对文章、1针对评论、2针对圆桌)" |
606 | }, | 714 | }, |
607 | - "triggerId": { | 715 | + "companyId": { |
716 | + "type": "integer", | ||
717 | + "format": "int64", | ||
718 | + "description": " 操作人公司ID" | ||
719 | + }, | ||
720 | + "userId": { | ||
608 | "type": "integer", | 721 | "type": "integer", |
609 | "format": "int64", | 722 | "format": "int64", |
610 | - "description": " 触发者ID" | 723 | + "description": " 操作人用户ID" |
611 | }, | 724 | }, |
612 | "recipientId": { | 725 | "recipientId": { |
613 | "type": "integer", | 726 | "type": "integer", |
@@ -643,18 +756,26 @@ | @@ -643,18 +756,26 @@ | ||
643 | "format": "int64", | 756 | "format": "int64", |
644 | "description": " 创建时间" | 757 | "description": " 创建时间" |
645 | }, | 758 | }, |
646 | - "userTrigger": { | 759 | + "user": { |
647 | "$ref": "#/definitions/User", | 760 | "$ref": "#/definitions/User", |
648 | - "description": " 触发者" | 761 | + "description": " 操作人" |
762 | + }, | ||
763 | + "article": { | ||
764 | + "$ref": "#/definitions/SimpleArticle", | ||
765 | + "description": " 文章" | ||
766 | + }, | ||
767 | + "comment": { | ||
768 | + "$ref": "#/definitions/Comment", | ||
769 | + "description": " 评论(不一定是自己,可能是被人@到)" | ||
649 | } | 770 | } |
650 | }, | 771 | }, |
651 | "title": "MessageBusinessItem", | 772 | "title": "MessageBusinessItem", |
652 | "required": [ | 773 | "required": [ |
653 | "id", | 774 | "id", |
654 | - "companyId", | ||
655 | "type", | 775 | "type", |
656 | "optType", | 776 | "optType", |
657 | - "triggerId", | 777 | + "companyId", |
778 | + "userId", | ||
658 | "recipientId", | 779 | "recipientId", |
659 | "articleId", | 780 | "articleId", |
660 | "commentId", | 781 | "commentId", |
@@ -662,12 +783,18 @@ | @@ -662,12 +783,18 @@ | ||
662 | "discussionOpinionId", | 783 | "discussionOpinionId", |
663 | "content", | 784 | "content", |
664 | "createdAt", | 785 | "createdAt", |
665 | - "userTrigger" | 786 | + "user", |
787 | + "article", | ||
788 | + "comment" | ||
666 | ] | 789 | ] |
667 | }, | 790 | }, |
668 | "MessageBusinessRequest": { | 791 | "MessageBusinessRequest": { |
669 | "type": "object", | 792 | "type": "object", |
670 | "properties": { | 793 | "properties": { |
794 | + "type": { | ||
795 | + "type": "integer", | ||
796 | + "format": "int32" | ||
797 | + }, | ||
671 | "page": { | 798 | "page": { |
672 | "type": "integer", | 799 | "type": "integer", |
673 | "format": "int32" | 800 | "format": "int32" |
@@ -679,6 +806,7 @@ | @@ -679,6 +806,7 @@ | ||
679 | }, | 806 | }, |
680 | "title": "MessageBusinessRequest", | 807 | "title": "MessageBusinessRequest", |
681 | "required": [ | 808 | "required": [ |
809 | + "type", | ||
682 | "page", | 810 | "page", |
683 | "size" | 811 | "size" |
684 | ] | 812 | ] |
@@ -723,6 +851,11 @@ | @@ -723,6 +851,11 @@ | ||
723 | "content": { | 851 | "content": { |
724 | "type": "string", | 852 | "type": "string", |
725 | "description": " 内容" | 853 | "description": " 内容" |
854 | + }, | ||
855 | + "createdAt": { | ||
856 | + "type": "integer", | ||
857 | + "format": "int64", | ||
858 | + "description": " 创建时间" | ||
726 | } | 859 | } |
727 | }, | 860 | }, |
728 | "title": "MessageSystemItem", | 861 | "title": "MessageSystemItem", |
@@ -730,7 +863,8 @@ | @@ -730,7 +863,8 @@ | ||
730 | "id", | 863 | "id", |
731 | "type", | 864 | "type", |
732 | "title", | 865 | "title", |
733 | - "content" | 866 | + "content", |
867 | + "createdAt" | ||
734 | ] | 868 | ] |
735 | }, | 869 | }, |
736 | "MessageSystemRequest": { | 870 | "MessageSystemRequest": { |
@@ -938,6 +1072,277 @@ | @@ -938,6 +1072,277 @@ | ||
938 | "success" | 1072 | "success" |
939 | ] | 1073 | ] |
940 | }, | 1074 | }, |
1075 | + "SimpleArticle": { | ||
1076 | + "type": "object", | ||
1077 | + "properties": { | ||
1078 | + "id": { | ||
1079 | + "type": "integer", | ||
1080 | + "format": "int64" | ||
1081 | + }, | ||
1082 | + "title": { | ||
1083 | + "type": "string", | ||
1084 | + "description": " 文章标题" | ||
1085 | + }, | ||
1086 | + "countLove": { | ||
1087 | + "type": "integer", | ||
1088 | + "format": "int32", | ||
1089 | + "description": " 点赞数量" | ||
1090 | + }, | ||
1091 | + "countComment": { | ||
1092 | + "type": "integer", | ||
1093 | + "format": "int32", | ||
1094 | + "description": " 评论数量" | ||
1095 | + } | ||
1096 | + }, | ||
1097 | + "title": "SimpleArticle", | ||
1098 | + "required": [ | ||
1099 | + "id", | ||
1100 | + "title", | ||
1101 | + "countLove", | ||
1102 | + "countComment" | ||
1103 | + ] | ||
1104 | + }, | ||
1105 | + "TagCreateRequest": { | ||
1106 | + "type": "object", | ||
1107 | + "properties": { | ||
1108 | + "companyId": { | ||
1109 | + "type": "integer", | ||
1110 | + "format": "int64" | ||
1111 | + }, | ||
1112 | + "image": { | ||
1113 | + "type": "string" | ||
1114 | + }, | ||
1115 | + "name": { | ||
1116 | + "type": "string", | ||
1117 | + "description": " 标签名称" | ||
1118 | + }, | ||
1119 | + "group": { | ||
1120 | + "type": "string", | ||
1121 | + "description": " 标签分类" | ||
1122 | + }, | ||
1123 | + "remark": { | ||
1124 | + "type": "string", | ||
1125 | + "description": " 备注" | ||
1126 | + } | ||
1127 | + }, | ||
1128 | + "title": "TagCreateRequest", | ||
1129 | + "required": [ | ||
1130 | + "companyId", | ||
1131 | + "image", | ||
1132 | + "name", | ||
1133 | + "group", | ||
1134 | + "remark" | ||
1135 | + ] | ||
1136 | + }, | ||
1137 | + "TagCreateResponse": { | ||
1138 | + "type": "object", | ||
1139 | + "properties": { | ||
1140 | + "id": { | ||
1141 | + "type": "integer", | ||
1142 | + "format": "int64" | ||
1143 | + } | ||
1144 | + }, | ||
1145 | + "title": "TagCreateResponse", | ||
1146 | + "required": [ | ||
1147 | + "id" | ||
1148 | + ] | ||
1149 | + }, | ||
1150 | + "TagDeleteRequest": { | ||
1151 | + "type": "object", | ||
1152 | + "properties": { | ||
1153 | + "id": { | ||
1154 | + "type": "integer", | ||
1155 | + "format": "int64" | ||
1156 | + } | ||
1157 | + }, | ||
1158 | + "title": "TagDeleteRequest", | ||
1159 | + "required": [ | ||
1160 | + "id" | ||
1161 | + ] | ||
1162 | + }, | ||
1163 | + "TagDeleteResponse": { | ||
1164 | + "type": "object", | ||
1165 | + "properties": { | ||
1166 | + "id": { | ||
1167 | + "type": "integer", | ||
1168 | + "format": "int64" | ||
1169 | + } | ||
1170 | + }, | ||
1171 | + "title": "TagDeleteResponse", | ||
1172 | + "required": [ | ||
1173 | + "id" | ||
1174 | + ] | ||
1175 | + }, | ||
1176 | + "TagEditRequest": { | ||
1177 | + "type": "object", | ||
1178 | + "properties": { | ||
1179 | + "id": { | ||
1180 | + "type": "integer", | ||
1181 | + "format": "int64" | ||
1182 | + }, | ||
1183 | + "companyId": { | ||
1184 | + "type": "integer", | ||
1185 | + "format": "int64" | ||
1186 | + }, | ||
1187 | + "image": { | ||
1188 | + "type": "string" | ||
1189 | + }, | ||
1190 | + "name": { | ||
1191 | + "type": "string", | ||
1192 | + "description": " 标签名称" | ||
1193 | + }, | ||
1194 | + "group": { | ||
1195 | + "type": "string", | ||
1196 | + "description": " 标签分类" | ||
1197 | + }, | ||
1198 | + "remark": { | ||
1199 | + "type": "string", | ||
1200 | + "description": " 备注" | ||
1201 | + } | ||
1202 | + }, | ||
1203 | + "title": "TagEditRequest", | ||
1204 | + "required": [ | ||
1205 | + "id", | ||
1206 | + "companyId", | ||
1207 | + "image", | ||
1208 | + "name", | ||
1209 | + "group", | ||
1210 | + "remark" | ||
1211 | + ] | ||
1212 | + }, | ||
1213 | + "TagEditResponse": { | ||
1214 | + "type": "object", | ||
1215 | + "properties": { | ||
1216 | + "id": { | ||
1217 | + "type": "integer", | ||
1218 | + "format": "int64" | ||
1219 | + } | ||
1220 | + }, | ||
1221 | + "title": "TagEditResponse", | ||
1222 | + "required": [ | ||
1223 | + "id" | ||
1224 | + ] | ||
1225 | + }, | ||
1226 | + "TagGetRequest": { | ||
1227 | + "type": "object", | ||
1228 | + "properties": { | ||
1229 | + "id": { | ||
1230 | + "type": "integer", | ||
1231 | + "format": "int64" | ||
1232 | + } | ||
1233 | + }, | ||
1234 | + "title": "TagGetRequest", | ||
1235 | + "required": [ | ||
1236 | + "id" | ||
1237 | + ] | ||
1238 | + }, | ||
1239 | + "TagGetResponse": { | ||
1240 | + "type": "object", | ||
1241 | + "properties": { | ||
1242 | + "id": { | ||
1243 | + "type": "integer", | ||
1244 | + "format": "int64" | ||
1245 | + }, | ||
1246 | + "image": { | ||
1247 | + "type": "string" | ||
1248 | + }, | ||
1249 | + "name": { | ||
1250 | + "type": "string", | ||
1251 | + "description": " 标签名称" | ||
1252 | + }, | ||
1253 | + "group": { | ||
1254 | + "type": "string", | ||
1255 | + "description": " 标签分类" | ||
1256 | + }, | ||
1257 | + "remark": { | ||
1258 | + "type": "string", | ||
1259 | + "description": " 备注" | ||
1260 | + } | ||
1261 | + }, | ||
1262 | + "title": "TagGetResponse", | ||
1263 | + "required": [ | ||
1264 | + "id", | ||
1265 | + "image", | ||
1266 | + "name", | ||
1267 | + "group", | ||
1268 | + "remark" | ||
1269 | + ] | ||
1270 | + }, | ||
1271 | + "TagItem": { | ||
1272 | + "type": "object", | ||
1273 | + "properties": { | ||
1274 | + "id": { | ||
1275 | + "type": "integer", | ||
1276 | + "format": "int64" | ||
1277 | + }, | ||
1278 | + "image": { | ||
1279 | + "type": "string" | ||
1280 | + }, | ||
1281 | + "name": { | ||
1282 | + "type": "string", | ||
1283 | + "description": " 标签名称" | ||
1284 | + }, | ||
1285 | + "group": { | ||
1286 | + "type": "string", | ||
1287 | + "description": " 标签分类" | ||
1288 | + }, | ||
1289 | + "remark": { | ||
1290 | + "type": "string", | ||
1291 | + "description": " 备注" | ||
1292 | + }, | ||
1293 | + "createdAt": { | ||
1294 | + "type": "integer", | ||
1295 | + "format": "int64" | ||
1296 | + } | ||
1297 | + }, | ||
1298 | + "title": "TagItem", | ||
1299 | + "required": [ | ||
1300 | + "id", | ||
1301 | + "image", | ||
1302 | + "name", | ||
1303 | + "group", | ||
1304 | + "remark", | ||
1305 | + "createdAt" | ||
1306 | + ] | ||
1307 | + }, | ||
1308 | + "TagListRequest": { | ||
1309 | + "type": "object", | ||
1310 | + "properties": { | ||
1311 | + "page": { | ||
1312 | + "type": "integer", | ||
1313 | + "format": "int32" | ||
1314 | + }, | ||
1315 | + "size": { | ||
1316 | + "type": "integer", | ||
1317 | + "format": "int32" | ||
1318 | + } | ||
1319 | + }, | ||
1320 | + "title": "TagListRequest", | ||
1321 | + "required": [ | ||
1322 | + "page", | ||
1323 | + "size" | ||
1324 | + ] | ||
1325 | + }, | ||
1326 | + "TagListResponse": { | ||
1327 | + "type": "object", | ||
1328 | + "properties": { | ||
1329 | + "total": { | ||
1330 | + "type": "integer", | ||
1331 | + "format": "int32" | ||
1332 | + }, | ||
1333 | + "list": { | ||
1334 | + "type": "array", | ||
1335 | + "items": { | ||
1336 | + "$ref": "#/definitions/TagItem" | ||
1337 | + } | ||
1338 | + } | ||
1339 | + }, | ||
1340 | + "title": "TagListResponse", | ||
1341 | + "required": [ | ||
1342 | + "total", | ||
1343 | + "list" | ||
1344 | + ] | ||
1345 | + }, | ||
941 | "User": { | 1346 | "User": { |
942 | "type": "object", | 1347 | "type": "object", |
943 | "properties": { | 1348 | "properties": { |
@@ -950,10 +1355,9 @@ | @@ -950,10 +1355,9 @@ | ||
950 | "format": "int64", | 1355 | "format": "int64", |
951 | "description": " 公司ID" | 1356 | "description": " 公司ID" |
952 | }, | 1357 | }, |
953 | - "departmentId": { | ||
954 | - "type": "integer", | ||
955 | - "format": "int64", | ||
956 | - "description": " 部门ID" | 1358 | + "companyName": { |
1359 | + "type": "string", | ||
1360 | + "description": " 公司名称" | ||
957 | }, | 1361 | }, |
958 | "name": { | 1362 | "name": { |
959 | "type": "string", | 1363 | "type": "string", |
@@ -972,7 +1376,7 @@ | @@ -972,7 +1376,7 @@ | ||
972 | "required": [ | 1376 | "required": [ |
973 | "id", | 1377 | "id", |
974 | "companyId", | 1378 | "companyId", |
975 | - "departmentId", | 1379 | + "companyName", |
976 | "name", | 1380 | "name", |
977 | "avatar", | 1381 | "avatar", |
978 | "position" | 1382 | "position" |
@@ -2,10 +2,11 @@ package message | @@ -2,10 +2,11 @@ package message | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | - "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | - | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
9 | 10 | ||
10 | "github.com/zeromicro/go-zero/core/logx" | 11 | "github.com/zeromicro/go-zero/core/logx" |
11 | ) | 12 | ) |
@@ -137,29 +138,26 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res | @@ -137,29 +138,26 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res | ||
137 | } | 138 | } |
138 | } | 139 | } |
139 | 140 | ||
140 | - // 只有这个才需要 | ||
141 | - if msgType == int(domain.MsgTypeReply) || msgType == int(domain.MsgTypeLike) { | ||
142 | - // 获取文章数据 | ||
143 | - if len(articleIds) > 0 { | ||
144 | - _, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), | ||
145 | - domain.NewQueryOptions(). | ||
146 | - WithFindOnly(). | ||
147 | - WithKV("ids", articleIds). | ||
148 | - WithKV("limit", len(articleIds))) | ||
149 | - if err != nil { | ||
150 | - return nil, err | ||
151 | - } | ||
152 | - for i := range articleList { | ||
153 | - articleIdMap[articleList[i].Id] = articleList[i] | ||
154 | - } | 141 | + // 获取文章数据 |
142 | + if len(articleIds) > 0 { | ||
143 | + _, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), | ||
144 | + domain.NewQueryOptions(). | ||
145 | + WithFindOnly(). | ||
146 | + WithKV("ids", articleIds). | ||
147 | + WithKV("limit", len(articleIds))) | ||
148 | + if err != nil { | ||
149 | + return nil, err | ||
150 | + } | ||
151 | + for i := range articleList { | ||
152 | + articleIdMap[articleList[i].Id] = articleList[i] | ||
155 | } | 153 | } |
156 | } | 154 | } |
157 | 155 | ||
158 | for _, item := range list { | 156 | for _, item := range list { |
159 | to := types.MessageBusinessItem{ | 157 | to := types.MessageBusinessItem{ |
160 | Id: item.Id, | 158 | Id: item.Id, |
161 | - Type: item.Type, | ||
162 | - OptType: item.OptType, | 159 | + Type: int(item.Type), |
160 | + OptType: int(item.OptType), | ||
163 | CompanyId: item.CompanyId, | 161 | CompanyId: item.CompanyId, |
164 | UserId: item.UserId, | 162 | UserId: item.UserId, |
165 | RecipientId: item.RecipientId, | 163 | RecipientId: item.RecipientId, |
@@ -177,6 +175,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res | @@ -177,6 +175,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res | ||
177 | CompanyId: v.CompanyId, | 175 | CompanyId: v.CompanyId, |
178 | Position: v.Position, | 176 | Position: v.Position, |
179 | Name: v.Name, | 177 | Name: v.Name, |
178 | + Avatar: v.Avatar, | ||
180 | } | 179 | } |
181 | 180 | ||
182 | if v, ok := companyIdMap[item.CompanyId]; ok { | 181 | if v, ok := companyIdMap[item.CompanyId]; ok { |
@@ -206,3 +205,53 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res | @@ -206,3 +205,53 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res | ||
206 | } | 205 | } |
207 | return resp, nil | 206 | return resp, nil |
208 | } | 207 | } |
208 | + | ||
209 | +// CommentArticle 评论文章 | ||
210 | +func (l *MiniBusinessLogic) CommentArticle(conn transaction.Conn, articleId int64, content string, at []int64) (err error) { | ||
211 | + return l.submit(conn, domain.MsgTypeReply, domain.OptTypeArticle, articleId, 0, content, at) | ||
212 | +} | ||
213 | + | ||
214 | +// CommentReply 评论回复 | ||
215 | +func (l *MiniBusinessLogic) CommentReply(conn transaction.Conn, articleId int64, commentId int64, content string, at []int64) (err error) { | ||
216 | + return l.submit(conn, domain.MsgTypeReply, domain.OptTypeComment, articleId, commentId, content, at) | ||
217 | +} | ||
218 | + | ||
219 | +// LikeArticle 点赞文章 | ||
220 | +func (l *MiniBusinessLogic) LikeArticle(conn transaction.Conn, articleId int64, at int64) (err error) { | ||
221 | + return l.submit(conn, domain.MsgTypeLike, domain.OptTypeArticle, articleId, 0, "", []int64{at}) | ||
222 | +} | ||
223 | + | ||
224 | +// LikeComment 点赞评论 | ||
225 | +func (l *MiniBusinessLogic) LikeComment(conn transaction.Conn, articleId int64, commentId int64, at int64) (err error) { | ||
226 | + return l.submit(conn, domain.MsgTypeLike, domain.OptTypeComment, articleId, commentId, "", []int64{at}) | ||
227 | +} | ||
228 | + | ||
229 | +func (l *MiniBusinessLogic) submit( | ||
230 | + conn transaction.Conn, | ||
231 | + msgType domain.MsgBusinessType, | ||
232 | + optType domain.MsgBusinessOpt, | ||
233 | + articleId int64, | ||
234 | + commentId int64, | ||
235 | + content string, | ||
236 | + at []int64) (err error) { | ||
237 | + | ||
238 | + var userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
239 | + // 评论中携带了 @其他用户 | ||
240 | + for i := range at { | ||
241 | + var msg = &domain.MessageBusiness{ | ||
242 | + Type: msgType, | ||
243 | + OptType: optType, | ||
244 | + CompanyId: userToken.CompanyId, | ||
245 | + UserId: userToken.UserId, | ||
246 | + RecipientId: at[i], | ||
247 | + ArticleId: articleId, | ||
248 | + CommentId: commentId, | ||
249 | + Content: content, | ||
250 | + } | ||
251 | + msg, err = l.svcCtx.MessageBusinessRepository.Insert(l.ctx, conn, msg) | ||
252 | + if err != nil { | ||
253 | + return err | ||
254 | + } | ||
255 | + } | ||
256 | + return nil | ||
257 | +} |
@@ -6,28 +6,28 @@ import ( | @@ -6,28 +6,28 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type MessageBusiness struct { | 8 | type MessageBusiness struct { |
9 | - Id int64 // 唯一标识 | ||
10 | - Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳) | ||
11 | - OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) | ||
12 | - CompanyId int64 `json:"companyId"` // 操作人公司ID | ||
13 | - UserId int64 `json:"userId"` // 操作人用户ID | ||
14 | - RecipientId int64 `json:"recipientId"` // 接收人用户ID | ||
15 | - ArticleId int64 `json:"articleId"` // 文章ID | ||
16 | - CommentId int64 `json:"commentId"` // 评论ID | ||
17 | - DiscussionId int64 `json:"discussionId"` // 圆桌ID | ||
18 | - DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID | ||
19 | - Content string `json:"content"` // 消息内容 | ||
20 | - CreatedAt int64 `json:",omitempty"` | ||
21 | - UpdatedAt int64 `json:",omitempty"` | ||
22 | - DeletedAt int64 `json:",omitempty"` | ||
23 | - Version int `json:",omitempty"` | 9 | + Id int64 // 唯一标识 |
10 | + Type MsgBusinessType `json:"type"` // 分类 (1回复 2点赞 3被采纳) | ||
11 | + OptType MsgBusinessOpt `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) | ||
12 | + CompanyId int64 `json:"companyId"` // 操作人公司ID | ||
13 | + UserId int64 `json:"userId"` // 操作人用户ID | ||
14 | + RecipientId int64 `json:"recipientId"` // 接收人用户ID | ||
15 | + ArticleId int64 `json:"articleId"` // 文章ID | ||
16 | + CommentId int64 `json:"commentId"` // 评论ID | ||
17 | + DiscussionId int64 `json:"discussionId"` // 圆桌ID | ||
18 | + DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID | ||
19 | + Content string `json:"content"` // 消息内容 | ||
20 | + CreatedAt int64 `json:",omitempty"` | ||
21 | + UpdatedAt int64 `json:",omitempty"` | ||
22 | + DeletedAt int64 `json:",omitempty"` | ||
23 | + Version int `json:",omitempty"` | ||
24 | } | 24 | } |
25 | 25 | ||
26 | type MsgBusinessType int | 26 | type MsgBusinessType int |
27 | type MsgBusinessOpt int | 27 | type MsgBusinessOpt int |
28 | 28 | ||
29 | const ( | 29 | const ( |
30 | - MsgTypeReply MsgBusinessType = 1 // 消息分类-回复 | 30 | + MsgTypeReply MsgBusinessType = 1 // 消息分类-评论 |
31 | MsgTypeLike MsgBusinessType = 2 // 消息分类-点赞 | 31 | MsgTypeLike MsgBusinessType = 2 // 消息分类-点赞 |
32 | MsgTypeAccept MsgBusinessType = 3 // 消息分类-被采纳 | 32 | MsgTypeAccept MsgBusinessType = 3 // 消息分类-被采纳 |
33 | ) | 33 | ) |
-
请 注册 或 登录 后发表评论