作者 yangfu
正在显示 30 个修改的文件 包含 1291 行增加103 行删除
@@ -3,3 +3,4 @@ import "core/message.api" @@ -3,3 +3,4 @@ import "core/message.api"
3 import "core/article_tag.api" 3 import "core/article_tag.api"
4 import "core/user.api" 4 import "core/user.api"
5 import "core/company.api" 5 import "core/company.api"
  6 +import "core/article.api"
@@ -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"
@@ -10,9 +10,9 @@ info( @@ -10,9 +10,9 @@ info(
10 10
11 // 坐标地点描述 11 // 坐标地点描述
12 type Location { 12 type Location {
13 - Longitude float64 `json:"longitude"` //经度  
14 - Latitude float64 `json:"latitude"` //纬度  
15 - Descript string `json:"descript"` //地点描述 13 + Longitude float64 `json:"longitude,optional"` //经度
  14 + Latitude float64 `json:"latitude,optional"` //纬度
  15 + Descript string `json:"descript,optional"` //地点描述
16 } 16 }
17 17
18 // 人员的简单展示信息 18 // 人员的简单展示信息
@@ -24,36 +24,36 @@ type Author { @@ -24,36 +24,36 @@ type Author {
24 Position string `json:"position"` // 职位 24 Position string `json:"position"` // 职位
25 } 25 }
26 26
27 -// 创建发布文章 27 +//小程序端创建发布文章
28 type ( 28 type (
29 - ArticleCreateRequest { 29 + MiniArticleCreateRequest {
30 Title string `json:"title"` //标题 30 Title string `json:"title"` //标题
31 Section []string `json:"section"` //文章的文本内容 31 Section []string `json:"section"` //文章的文本内容
32 - AuthorId int `json:"authorId"` //发布人id  
33 - Images []string `json:"images"` //图片  
34 - WhoRead []int `json:"whoRead"` //谁可查看  
35 - WhoReview []int `json:"whoReview"` //谁可评论  
36 - Location Location `json:"location"` //定位坐标 32 + AuthorId int64 `json:"authorId,optional"` //发布人id
  33 + Images []string `json:"images,optional"` //图片
  34 + WhoRead []int64 `json:"whoRead,optional"` //谁可查看
  35 + WhoReview []int64 `json:"whoReview,optional"` //谁可评论
  36 + Location Location `json:"location,optional"` //定位坐标
37 } 37 }
38 - ArticleCreateResponse { 38 + MiniArticleCreateResponse {
39 Id int64 `json:"id"` 39 Id int64 `json:"id"`
40 } 40 }
41 ) 41 )
42 42
43 -// 查看文章的详情 43 +//小程序端查看文章的详情
44 type ( 44 type (
45 - ArticleGetRequest {  
46 - Id int64 `json:"id"` //id 45 + MiniArticleGetRequest {
  46 + Id int64 `path:"id"` //id
47 } 47 }
48 - ArticleGetResponse { 48 + MiniArticleGetResponse {
49 Title string `json:"title"` //标题 49 Title string `json:"title"` //标题
50 AuthorId int `json:"authorId"` //发布人id 50 AuthorId int `json:"authorId"` //发布人id
51 Author Author `json:"author"` //发布人 51 Author Author `json:"author"` //发布人
52 CreatedAt int64 `json:"createdAt"` //文章的发布时间 52 CreatedAt int64 `json:"createdAt"` //文章的发布时间
53 Section []string `json:"section"` //文章的文本内容 53 Section []string `json:"section"` //文章的文本内容
54 Images []string `json:"images"` //图片 54 Images []string `json:"images"` //图片
55 - WhoRead []int `json:"whoRead"` //谁可查看  
56 - WhoReview []int `json:"whoReview"` //谁可评论 55 + WhoRead []int64 `json:"whoRead"` //谁可查看
  56 + WhoReview []int64 `json:"whoReview"` //谁可评论
57 Location Location `json:"location"` //定位坐标 57 Location Location `json:"location"` //定位坐标
58 CountLove int `json:"countLove"` // 点赞数量 58 CountLove int `json:"countLove"` // 点赞数量
59 CountComment int `json:"countComment"` // 评论数量 59 CountComment int `json:"countComment"` // 评论数量
@@ -61,6 +61,31 @@ type ( @@ -61,6 +61,31 @@ type (
61 } 61 }
62 ) 62 )
63 63
  64 +// 获取我的发文章记录
  65 +type (
  66 + MiniArticleSearchMeRequest {
  67 + AuthorId int64 `json:"-"`
  68 + CompanyId int64 `json:"-"`
  69 + Page int `json:"page"`
  70 + Size int `json:"size"`
  71 + }
  72 +
  73 + MiniArticleSearchMeResponse {
  74 + Total int `json:"total"`
  75 + List []ArticleSearchMe `json:"list"`
  76 + }
  77 +
  78 + ArticleSearchMe {
  79 + Id int64 `json:"id"` //id
  80 + Title string `json:"title"` //标题
  81 + Images []string `json:"images"` //图片
  82 + CreatedAt int64 `json:"createdAt"` //文章的创建日期
  83 + CountLove int `json:"countLove"` //点赞数量
  84 + CountComment int `json:"CountComment"` //评论数量
  85 + Show int `json:"show"` //是否隐藏 [0显示、1不显示]
  86 + }
  87 +)
  88 +
64 // 小程序接口 89 // 小程序接口
65 @server( 90 @server(
66 prefix: v1/mini 91 prefix: v1/mini
@@ -69,9 +94,12 @@ type ( @@ -69,9 +94,12 @@ type (
69 ) 94 )
70 service Core { 95 service Core {
71 @doc "小程序创建发布内容" 96 @doc "小程序创建发布内容"
72 - @handler CreateArticle  
73 - post /article (ArticleCreateRequest) returns (ArticleCreateResponse) 97 + @handler MiniCreateArticle
  98 + post /article (MiniArticleCreateRequest) returns (MiniArticleCreateResponse)
  99 + @doc "小程序获取我发布的文章"
  100 + @handler MiniArticleSearchMe
  101 + post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
74 @doc "小程序获取文章内容详情" 102 @doc "小程序获取文章内容详情"
75 - @handler GetArticle  
76 - get /article/:id (ArticleGetRequest) returns (ArticleGetResponse) 103 + @handler MiniGetArticle
  104 + get /article/:id (MiniArticleGetRequest) returns (MiniArticleGetResponse)
77 } 105 }
@@ -15,7 +15,7 @@ type ( @@ -15,7 +15,7 @@ type (
15 Image string `json:"image"` 15 Image string `json:"image"`
16 Name string `json:"name"` // 标签名称 16 Name string `json:"name"` // 标签名称
17 Group string `json:"group"` // 标签分类 17 Group string `json:"group"` // 标签分类
18 - Remark string `json:"remark"` // 备注 18 + Remark string `json:"remark,optional"` // 备注
19 } 19 }
20 20
21 TagCreateResponse { 21 TagCreateResponse {
@@ -27,11 +27,11 @@ type ( @@ -27,11 +27,11 @@ type (
27 type ( 27 type (
28 TagEditRequest { 28 TagEditRequest {
29 Id int64 `json:"id"` 29 Id int64 `json:"id"`
30 - CompanyId int64 `json:"companyId"` 30 + CompanyId int64 `json:"-"`
31 Image string `json:"image"` 31 Image string `json:"image"`
32 Name string `json:"name"` // 标签名称 32 Name string `json:"name"` // 标签名称
33 Group string `json:"group"` // 标签分类 33 Group string `json:"group"` // 标签分类
34 - Remark string `json:"remark"` // 备注 34 + Remark string `json:"remark,optional"` // 备注
35 } 35 }
36 36
37 TagEditResponse { 37 TagEditResponse {
@@ -42,7 +42,8 @@ type ( @@ -42,7 +42,8 @@ type (
42 // 获取标签详情 42 // 获取标签详情
43 type ( 43 type (
44 TagGetRequest { 44 TagGetRequest {
45 - Id int64 `json:"id"` 45 + Id int64 `path:"id"`
  46 + CompanyId int64 `path:"-"`
46 } 47 }
47 TagGetResponse { 48 TagGetResponse {
48 Id int64 `json:"id"` 49 Id int64 `json:"id"`
@@ -58,9 +59,13 @@ type ( @@ -58,9 +59,13 @@ type (
58 TagListRequest { 59 TagListRequest {
59 Page int `json:"page"` 60 Page int `json:"page"`
60 Size int `json:"size"` 61 Size int `json:"size"`
  62 + CompanyId int64 `json:"-"`
  63 + TagName string `json:"tagName,optional"`
  64 + Group string `json:"group,optional"`
  65 + Remark string `json:"remark,optional"`
61 } 66 }
62 TagListResponse { 67 TagListResponse {
63 - Total int `json:"total"` 68 + Total int64 `json:"total"`
64 List []TagItem `json:"list"` 69 List []TagItem `json:"list"`
65 } 70 }
66 TagItem { 71 TagItem {
@@ -76,7 +81,8 @@ type ( @@ -76,7 +81,8 @@ type (
76 //删除标签 81 //删除标签
77 type ( 82 type (
78 TagDeleteRequest { 83 TagDeleteRequest {
79 - Id int64 `json:"id"` 84 + Id int64 `path:"id"`
  85 + CompanyId int64 `path:"-"`
80 } 86 }
81 TagDeleteResponse { 87 TagDeleteResponse {
82 Id int64 `json:"id"` 88 Id int64 `json:"id"`
@@ -84,7 +90,7 @@ type ( @@ -84,7 +90,7 @@ type (
84 ) 90 )
85 91
86 @server( 92 @server(
87 - prefix: v1/mini 93 + prefix: v1/system
88 group: tags 94 group: tags
89 jwt: MiniAuth 95 jwt: MiniAuth
90 ) 96 )
@@ -92,13 +98,20 @@ service Core { @@ -92,13 +98,20 @@ service Core {
92 @doc "后台创建文章标签" 98 @doc "后台创建文章标签"
93 @handler CreateTag 99 @handler CreateTag
94 post /article_tag (TagCreateRequest) returns (TagCreateResponse) 100 post /article_tag (TagCreateRequest) returns (TagCreateResponse)
  101 +
95 @doc "后台编辑文章标签" 102 @doc "后台编辑文章标签"
96 @handler EditTag 103 @handler EditTag
97 put /article_tag (TagEditRequest) returns (TagEditResponse) 104 put /article_tag (TagEditRequest) returns (TagEditResponse)
  105 +
98 @doc "后台获取文章标签" 106 @doc "后台获取文章标签"
99 @handler GetTag 107 @handler GetTag
100 get /article_tag/:id (TagGetRequest) returns (TagGetResponse) 108 get /article_tag/:id (TagGetRequest) returns (TagGetResponse)
  109 +
101 @doc "后台删除文章标签" 110 @doc "后台删除文章标签"
102 @handler DeleteTag 111 @handler DeleteTag
103 - delete /article_tag (TagDeleteRequest) returns (TagDeleteResponse) 112 + delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse)
  113 +
  114 + @doc "后台搜索标签"
  115 + @handler SearchTag
  116 + post/article_tag/search (TagListRequest) returns (TagListResponse)
104 } 117 }
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 +)
  12 +
  13 +func MiniArticleSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniArticleSearchMeRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := article.NewMiniArticleSearchMeLogic(r.Context(), svcCtx)
  22 + token := contextdata.GetUserTokenFromCtx(r.Context())
  23 + req.AuthorId = token.UserId
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.MiniArticleSearchMe(&req)
  26 + if err != nil {
  27 + httpx.ErrorCtx(r.Context(), w, err)
  28 + } else {
  29 + httpx.OkJsonCtx(r.Context(), w, resp)
  30 + }
  31 + }
  32 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 +)
  12 +
  13 +func MiniCreateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniArticleCreateRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 + token := contextdata.GetUserTokenFromCtx(r.Context())
  21 +
  22 + l := article.NewMiniCreateArticleLogic(r.Context(), svcCtx)
  23 + req.AuthorId = token.UserId
  24 + resp, err := l.MiniCreateArticle(&req)
  25 + if err != nil {
  26 + httpx.ErrorCtx(r.Context(), w, err)
  27 + } else {
  28 + httpx.OkJsonCtx(r.Context(), w, resp)
  29 + }
  30 + }
  31 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 +)
  11 +
  12 +func MiniGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.MiniArticleGetRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := article.NewMiniGetArticleLogic(r.Context(), svcCtx)
  21 +
  22 + resp, err := l.MiniGetArticle(&req)
  23 + if err != nil {
  24 + httpx.ErrorCtx(r.Context(), w, err)
  25 + } else {
  26 + httpx.OkJsonCtx(r.Context(), w, resp)
  27 + }
  28 + }
  29 +}
@@ -4,6 +4,7 @@ package handler @@ -4,6 +4,7 @@ package handler
4 import ( 4 import (
5 "net/http" 5 "net/http"
6 6
  7 + article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article"
7 comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" 8 comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
8 company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" 9 company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
9 message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" 10 message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
@@ -75,12 +76,17 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -75,12 +76,17 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
75 }, 76 },
76 { 77 {
77 Method: http.MethodDelete, 78 Method: http.MethodDelete,
78 - Path: "/article_tag", 79 + Path: "/article_tag/:id",
79 Handler: tags.DeleteTagHandler(serverCtx), 80 Handler: tags.DeleteTagHandler(serverCtx),
80 }, 81 },
  82 + {
  83 + Method: http.MethodPost,
  84 + Path: "/article_tag/search",
  85 + Handler: tags.SearchTagHandler(serverCtx),
  86 + },
81 }, 87 },
82 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), 88 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
83 - rest.WithPrefix("/v1/mini"), 89 + rest.WithPrefix("/v1/system"),
84 ) 90 )
85 91
86 server.AddRoutes( 92 server.AddRoutes(
@@ -168,4 +174,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -168,4 +174,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
168 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), 174 rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
169 rest.WithPrefix("/v1"), 175 rest.WithPrefix("/v1"),
170 ) 176 )
  177 +
  178 + server.AddRoutes(
  179 + []rest.Route{
  180 + {
  181 + Method: http.MethodPost,
  182 + Path: "/article",
  183 + Handler: article.MiniCreateArticleHandler(serverCtx),
  184 + },
  185 + {
  186 + Method: http.MethodPost,
  187 + Path: "/article/search/me",
  188 + Handler: article.MiniArticleSearchMeHandler(serverCtx),
  189 + },
  190 + {
  191 + Method: http.MethodGet,
  192 + Path: "/article/:id",
  193 + Handler: article.MiniGetArticleHandler(serverCtx),
  194 + },
  195 + },
  196 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  197 + rest.WithPrefix("/v1/mini"),
  198 + )
171 } 199 }
  1 +package tags
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 +)
  11 +
  12 +func SearchTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.TagListRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := tags.NewSearchTagLogic(r.Context(), svcCtx)
  21 + resp, err := l.SearchTag(&req)
  22 + if err != nil {
  23 + httpx.ErrorCtx(r.Context(), w, err)
  24 + } else {
  25 + httpx.OkJsonCtx(r.Context(), w, resp)
  26 + }
  27 + }
  28 +}
  1 +package article
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  10 +
  11 + "github.com/zeromicro/go-zero/core/logx"
  12 +)
  13 +
  14 +type MiniArticleSearchMeLogic struct {
  15 + logx.Logger
  16 + ctx context.Context
  17 + svcCtx *svc.ServiceContext
  18 +}
  19 +
  20 +func NewMiniArticleSearchMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleSearchMeLogic {
  21 + return &MiniArticleSearchMeLogic{
  22 + Logger: logx.WithContext(ctx),
  23 + ctx: ctx,
  24 + svcCtx: svcCtx,
  25 + }
  26 +}
  27 +
  28 +// MiniArticleSearchMe 获取我发布的文章
  29 +func (l *MiniArticleSearchMeLogic) MiniArticleSearchMe(req *types.MiniArticleSearchMeRequest) (resp *types.MiniArticleSearchMeResponse, err error) {
  30 + var conn = l.svcCtx.DefaultDBConn()
  31 + queryOptions := domain.NewQueryOptions().
  32 + WithOffsetLimit(req.Page, req.Size).
  33 + MustWithKV("authorId", req.AuthorId)
  34 +
  35 + cnt, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, req.CompanyId, queryOptions)
  36 + if err != nil {
  37 + return &types.MiniArticleSearchMeResponse{}, xerr.NewErrMsgErr("获取文章列表失败", err)
  38 + }
  39 +
  40 + resp = &types.MiniArticleSearchMeResponse{
  41 + Total: int(cnt),
  42 + List: make([]types.ArticleSearchMe, len(articleList)),
  43 + }
  44 + for i := range articleList {
  45 + images := []string{}
  46 + for _, val2 := range articleList[i].Images {
  47 + images = append(images, val2.Url)
  48 + }
  49 + resp.List[i] = types.ArticleSearchMe{
  50 + Id: articleList[i].Id,
  51 + Title: articleList[i].Title,
  52 + Images: images,
  53 + CreatedAt: articleList[i].CreatedAt,
  54 + CountLove: articleList[i].CountLove,
  55 + CountComment: articleList[i].CountComment,
  56 + Show: int(articleList[i].Show),
  57 + }
  58 + }
  59 + return
  60 +}
  1 +package article
  2 +
  3 +import (
  4 + "context"
  5 + "strings"
  6 +
  7 + "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"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  12 +
  13 + "github.com/samber/lo"
  14 + "github.com/zeromicro/go-zero/core/logx"
  15 +)
  16 +
  17 +type MiniCreateArticleLogic struct {
  18 + logx.Logger
  19 + ctx context.Context
  20 + svcCtx *svc.ServiceContext
  21 +}
  22 +
  23 +func NewMiniCreateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCreateArticleLogic {
  24 + return &MiniCreateArticleLogic{
  25 + Logger: logx.WithContext(ctx),
  26 + ctx: ctx,
  27 + svcCtx: svcCtx,
  28 + }
  29 +}
  30 +
  31 +func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateRequest) (resp *types.MiniArticleCreateResponse, err error) {
  32 + var conn = l.svcCtx.DefaultDBConn()
  33 + // 检查发布人
  34 + author, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.AuthorId)
  35 + if err != nil {
  36 + return nil, xerr.NewErrMsgErr("创建文章内容失败", err)
  37 + }
  38 + //TODO 获取人员信息
  39 + articleAuthor := domain.UserSimple{
  40 + Id: author.Id,
  41 + Name: author.Name,
  42 + Avatar: author.Avatar,
  43 + GroupId: 0,
  44 + Group: "",
  45 + Position: author.Position,
  46 + Company: "",
  47 + CompanyId: author.CompanyId,
  48 + }
  49 +
  50 + //TODO 获取图片的尺寸大小
  51 + images := []domain.Image{}
  52 + for _, val := range req.Images {
  53 + images = append(images, domain.Image{
  54 + Url: val,
  55 + Width: 0,
  56 + Height: 0,
  57 + })
  58 + }
  59 + //检查文章可被哪些人查看
  60 + whoRead := []int64{}
  61 + if len(req.WhoRead) > 0 {
  62 + whoRead = lo.Uniq(req.WhoRead)
  63 + var u *domain.User
  64 + for _, val := range whoRead {
  65 + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val)
  66 + if err != nil {
  67 + return nil, xerr.NewErrMsgErr("文章可查看人设置错误", err)
  68 + }
  69 + if u.CompanyId != author.CompanyId {
  70 + return nil, xerr.NewErrMsg("文章可查看人设置错误")
  71 + }
  72 + }
  73 + }
  74 + //检查文章可被哪些人评论
  75 + whoReview := []int64{}
  76 + //有指定可查看人的情况
  77 + if len(whoRead) > 0 {
  78 + if len(whoReview) > 0 {
  79 + whoReview = lo.Uniq(req.WhoReview)
  80 + // 检查 whoRead 是否 完全包含 whoReview
  81 + ok := lo.Every(whoRead, whoReview)
  82 + if !ok {
  83 + return nil, xerr.NewErrMsg("文章可评论人设置错误")
  84 + }
  85 + }
  86 + if len(whoReview) == 0 {
  87 + //有指定可查看人 ,但未指定可评论人
  88 + return nil, xerr.NewErrMsg("文章可评论人设置错误")
  89 + }
  90 + }
  91 + //没有指定可查看人的情况
  92 + if len(whoRead) == 0 {
  93 + if len(whoReview) > 0 {
  94 + // 未指定可查看人(全员可看),有指定可评论人,
  95 + var u *domain.User
  96 + for _, val := range whoReview {
  97 + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val)
  98 + if err != nil {
  99 + return nil, xerr.NewErrMsgErr("文章可评论人设置错误", err)
  100 + }
  101 + if u.CompanyId != author.CompanyId {
  102 + return nil, xerr.NewErrMsg("文章可评论人设置错误")
  103 + }
  104 + }
  105 + }
  106 + // if len(whoReview) == 0 {
  107 + // 未指定可查看人(全员可看),未指定可评论人 ,忽略判断
  108 + // }
  109 + }
  110 +
  111 + //切分文章分段
  112 + sectionList := []domain.ArticleSection{}
  113 + for i := range req.Section {
  114 + strList := strings.Split(req.Section[i], "\n")
  115 + for i2 := range strList {
  116 + newStr := strings.TrimSpace(strList[i2])
  117 + if len(newStr) == 0 {
  118 + continue
  119 + }
  120 + newSection := domain.ArticleSection{
  121 + Id: 0,
  122 + CompanyId: author.CompanyId,
  123 + ArticleId: 0,
  124 + Content: newStr,
  125 + SortBy: len(sectionList),
  126 + TotalComment: 0,
  127 + }
  128 + sectionList = append(sectionList, newSection)
  129 + }
  130 + }
  131 +
  132 + newArticle := &domain.Article{
  133 + Id: 0,
  134 + CompanyId: author.CompanyId,
  135 + AuthorId: author.Id,
  136 + Author: articleAuthor,
  137 + Title: req.Title,
  138 + Images: images,
  139 + WhoRead: whoRead,
  140 + WhoReview: whoReview,
  141 + Location: domain.Location{
  142 + Longitude: req.Location.Latitude,
  143 + Latitude: req.Location.Latitude,
  144 + Descript: req.Location.Descript,
  145 + },
  146 + TargetUser: domain.ArticleTargetAll,
  147 + }
  148 + if len(whoRead) > 0 {
  149 + newArticle.TargetUser = domain.ArticleTargetLimit
  150 + }
  151 +
  152 + err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error {
  153 + newArticle, err = l.svcCtx.ArticleRepository.Insert(ctx, c, newArticle)
  154 + if err != nil {
  155 + return xerr.NewErrMsgErr("创建文章失败", err)
  156 + }
  157 +
  158 + for i := range sectionList {
  159 + sectionList[i].ArticleId = newArticle.Id
  160 + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, &sectionList[i])
  161 + if err != nil {
  162 + return xerr.NewErrMsgErr("创建文章内容失败", err)
  163 + }
  164 + }
  165 + // 设置保存备份
  166 + backup := newArticle.MakeBackup(newArticle.Author, sectionList)
  167 + backup.Action = "新增"
  168 + _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, backup)
  169 + if err != nil {
  170 + return xerr.NewErrMsgErr("创建文章内容失败", err)
  171 + }
  172 + return nil
  173 + }, true)
  174 + if err != nil {
  175 + return nil, xerr.NewErrMsgErr("创建文章失败", err)
  176 + }
  177 +
  178 + resp = &types.MiniArticleCreateResponse{
  179 + Id: newArticle.Id,
  180 + }
  181 + return
  182 +}
  1 +package article
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniGetArticleLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniGetArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniGetArticleLogic {
  19 + return &MiniGetArticleLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (resp *types.MiniArticleGetResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
@@ -2,10 +2,12 @@ package message @@ -2,10 +2,12 @@ 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 5
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 6 "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" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
9 11
10 "github.com/zeromicro/go-zero/core/logx" 12 "github.com/zeromicro/go-zero/core/logx"
11 ) 13 )
@@ -25,9 +27,11 @@ func NewMiniBusinessLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Mini @@ -25,9 +27,11 @@ func NewMiniBusinessLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Mini
25 } 27 }
26 28
27 func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (resp *types.MessageBusinessResponse, err error) { 29 func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (resp *types.MessageBusinessResponse, err error) {
  30 + var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  31 + var conn = l.svcCtx.DefaultDBConn()
28 var msgType = req.Type 32 var msgType = req.Type
29 33
30 - total, list, err := l.svcCtx.MessageBusinessRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), domain.NewQueryOptions(). 34 + total, list, err := l.svcCtx.MessageBusinessRepository.Find(l.ctx, conn, domain.NewQueryOptions().
31 WithOffsetLimit(req.Page, req.Size). 35 WithOffsetLimit(req.Page, req.Size).
32 WithKV("type", msgType)) 36 WithKV("type", msgType))
33 if err != nil { 37 if err != nil {
@@ -94,8 +98,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -94,8 +98,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
94 98
95 // 获取公司 99 // 获取公司
96 if len(companyIds) > 0 { 100 if len(companyIds) > 0 {
97 - _, companyList, err := l.svcCtx.CompanyRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(),  
98 - domain.NewQueryOptions(). 101 + _, companyList, err := l.svcCtx.CompanyRepository.Find(l.ctx, conn, domain.NewQueryOptions().
99 WithFindOnly(). 102 WithFindOnly().
100 WithKV("ids", userIds). 103 WithKV("ids", userIds).
101 WithKV("limit", len(userIds))) 104 WithKV("limit", len(userIds)))
@@ -109,8 +112,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -109,8 +112,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
109 112
110 // 获取用户 113 // 获取用户
111 if len(userIds) > 0 { 114 if len(userIds) > 0 {
112 - _, userList, err := l.svcCtx.UserRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(),  
113 - domain.NewQueryOptions(). 115 + _, userList, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
114 WithFindOnly(). 116 WithFindOnly().
115 WithKV("ids", userIds). 117 WithKV("ids", userIds).
116 WithKV("limit", len(userIds))) 118 WithKV("limit", len(userIds)))
@@ -124,8 +126,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -124,8 +126,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
124 126
125 // 获取评论 127 // 获取评论
126 if len(commentIds) > 0 { 128 if len(commentIds) > 0 {
127 - _, commentList, err := l.svcCtx.CommentRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(),  
128 - domain.NewQueryOptions(). 129 + _, commentList, err := l.svcCtx.CommentRepository.Find(l.ctx, conn, domain.NewQueryOptions().
129 WithFindOnly(). 130 WithFindOnly().
130 WithKV("ids", commentIds). 131 WithKV("ids", commentIds).
131 WithKV("limit", len(commentIds))) 132 WithKV("limit", len(commentIds)))
@@ -137,12 +138,9 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -137,12 +138,9 @@ 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 // 获取文章数据 141 // 获取文章数据
143 if len(articleIds) > 0 { 142 if len(articleIds) > 0 {
144 - _, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(),  
145 - domain.NewQueryOptions(). 143 + _, articleList, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().
146 WithFindOnly(). 144 WithFindOnly().
147 WithKV("ids", articleIds). 145 WithKV("ids", articleIds).
148 WithKV("limit", len(articleIds))) 146 WithKV("limit", len(articleIds)))
@@ -153,20 +151,19 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -153,20 +151,19 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
153 articleIdMap[articleList[i].Id] = articleList[i] 151 articleIdMap[articleList[i].Id] = articleList[i]
154 } 152 }
155 } 153 }
156 - }  
157 154
158 for _, item := range list { 155 for _, item := range list {
159 to := types.MessageBusinessItem{ 156 to := types.MessageBusinessItem{
160 Id: item.Id, 157 Id: item.Id,
161 - Type: item.Type,  
162 - OptType: item.OptType, 158 + Type: int(item.Type),
  159 + OptType: int(item.OptType),
163 CompanyId: item.CompanyId, 160 CompanyId: item.CompanyId,
164 UserId: item.UserId, 161 UserId: item.UserId,
165 RecipientId: item.RecipientId, 162 RecipientId: item.RecipientId,
166 ArticleId: item.ArticleId, 163 ArticleId: item.ArticleId,
167 CommentId: item.CommentId, 164 CommentId: item.CommentId,
168 - DiscussionId: item.DiscussionId,  
169 - DiscussionOpinionId: item.DiscussionOpinionId, 165 + //DiscussionId: item.DiscussionId,
  166 + //DiscussionOpinionId: item.DiscussionOpinionId,
170 Content: item.Content, 167 Content: item.Content,
171 CreatedAt: item.CreatedAt, 168 CreatedAt: item.CreatedAt,
172 } 169 }
@@ -177,6 +174,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -177,6 +174,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
177 CompanyId: v.CompanyId, 174 CompanyId: v.CompanyId,
178 Position: v.Position, 175 Position: v.Position,
179 Name: v.Name, 176 Name: v.Name,
  177 + Avatar: v.Avatar,
180 } 178 }
181 179
182 if v, ok := companyIdMap[item.CompanyId]; ok { 180 if v, ok := companyIdMap[item.CompanyId]; ok {
@@ -206,3 +204,53 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res @@ -206,3 +204,53 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (res
206 } 204 }
207 return resp, nil 205 return resp, nil
208 } 206 }
  207 +
  208 +// CommentArticle 评论文章
  209 +func (l *MiniBusinessLogic) CommentArticle(conn transaction.Conn, articleId int64, content string, at []int64) (err error) {
  210 + return l.submit(conn, domain.MsgTypeReply, domain.OptTypeArticle, articleId, 0, content, at)
  211 +}
  212 +
  213 +// CommentReply 评论回复
  214 +func (l *MiniBusinessLogic) CommentReply(conn transaction.Conn, articleId int64, commentId int64, content string, at []int64) (err error) {
  215 + return l.submit(conn, domain.MsgTypeReply, domain.OptTypeComment, articleId, commentId, content, at)
  216 +}
  217 +
  218 +// LikeArticle 点赞文章
  219 +func (l *MiniBusinessLogic) LikeArticle(conn transaction.Conn, articleId int64, at int64) (err error) {
  220 + return l.submit(conn, domain.MsgTypeLike, domain.OptTypeArticle, articleId, 0, "", []int64{at})
  221 +}
  222 +
  223 +// LikeComment 点赞评论
  224 +func (l *MiniBusinessLogic) LikeComment(conn transaction.Conn, articleId int64, commentId int64, at int64) (err error) {
  225 + return l.submit(conn, domain.MsgTypeLike, domain.OptTypeComment, articleId, commentId, "", []int64{at})
  226 +}
  227 +
  228 +func (l *MiniBusinessLogic) submit(
  229 + conn transaction.Conn,
  230 + msgType domain.MsgBusinessType,
  231 + optType domain.MsgBusinessOpt,
  232 + articleId int64,
  233 + commentId int64,
  234 + content string,
  235 + at []int64) (err error) {
  236 +
  237 + var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
  238 + // 评论中携带了 @其他用户
  239 + for i := range at {
  240 + var msg = &domain.MessageBusiness{
  241 + Type: msgType,
  242 + OptType: optType,
  243 + CompanyId: userToken.CompanyId,
  244 + UserId: userToken.UserId,
  245 + RecipientId: at[i],
  246 + ArticleId: articleId,
  247 + CommentId: commentId,
  248 + Content: content,
  249 + }
  250 + msg, err = l.svcCtx.MessageBusinessRepository.Insert(l.ctx, conn, msg)
  251 + if err != nil {
  252 + return err
  253 + }
  254 + }
  255 + return nil
  256 +}
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 6
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 7 "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" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
10 11
11 "github.com/zeromicro/go-zero/core/logx" 12 "github.com/zeromicro/go-zero/core/logx"
@@ -25,8 +26,8 @@ func NewCreateTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateT @@ -25,8 +26,8 @@ func NewCreateTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateT
25 } 26 }
26 } 27 }
27 28
  29 +// 创建标签
28 func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.TagCreateResponse, err error) { 30 func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.TagCreateResponse, err error) {
29 - // todo: add your logic here and delete this line  
30 var conn = l.svcCtx.DefaultDBConn() 31 var conn = l.svcCtx.DefaultDBConn()
31 //检查重复 32 //检查重复
32 cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, map[string]interface{}{ 33 cnt, _, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, map[string]interface{}{
@@ -40,5 +41,29 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag @@ -40,5 +41,29 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag
40 if cnt > 0 { 41 if cnt > 0 {
41 return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name)) 42 return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name))
42 } 43 }
  44 + //TODO 获取图片的尺寸大小
  45 +
  46 + newTag := &domain.ArticleTag{
  47 + Id: 0,
  48 + CompanyId: req.CompanyId,
  49 + CreatedAt: 0,
  50 + UpdatedAt: 0,
  51 + DeletedAt: 0,
  52 + Version: 0,
  53 + Image: domain.Image{
  54 + Url: req.Image,
  55 + Width: 0,
  56 + Height: 0,
  57 + },
  58 + Name: req.Name,
  59 + Group: req.Group,
  60 + Remark: req.Remark,
  61 + }
  62 +
  63 + newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag)
  64 + if err != nil {
  65 + return nil, xerr.NewErrMsgErr("添加标签失败", err)
  66 + }
  67 + resp = &types.TagCreateResponse{Id: newTag.Id}
43 return 68 return
44 } 69 }
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 5
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
8 9
9 "github.com/zeromicro/go-zero/core/logx" 10 "github.com/zeromicro/go-zero/core/logx"
10 ) 11 )
@@ -24,7 +25,18 @@ func NewDeleteTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteT @@ -24,7 +25,18 @@ func NewDeleteTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteT
24 } 25 }
25 26
26 func (l *DeleteTagLogic) DeleteTag(req *types.TagDeleteRequest) (resp *types.TagDeleteResponse, err error) { 27 func (l *DeleteTagLogic) DeleteTag(req *types.TagDeleteRequest) (resp *types.TagDeleteResponse, err error) {
27 - // todo: add your logic here and delete this line  
28 - 28 + var conn = l.svcCtx.DefaultDBConn()
  29 + oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id)
  30 + if err != nil {
  31 + return nil, xerr.NewErrMsgErr("不存在待修改的标签", err)
  32 + }
  33 + if oldTag.CompanyId != req.CompanyId {
  34 + return nil, xerr.NewErrMsg("删除标签失败")
  35 + }
  36 + _, err = l.svcCtx.ArticleTagRepository.Delete(l.ctx, conn, oldTag)
  37 + if err != nil {
  38 + return nil, xerr.NewErrMsg("删除标签失败")
  39 + }
  40 + resp = &types.TagDeleteResponse{Id: oldTag.Id}
29 return 41 return
30 } 42 }
@@ -2,9 +2,12 @@ package tags @@ -2,9 +2,12 @@ package tags
2 2
3 import ( 3 import (
4 "context" 4 "context"
  5 + "fmt"
5 6
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
8 11
9 "github.com/zeromicro/go-zero/core/logx" 12 "github.com/zeromicro/go-zero/core/logx"
10 ) 13 )
@@ -23,8 +26,44 @@ func NewEditTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditTagLo @@ -23,8 +26,44 @@ func NewEditTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditTagLo
23 } 26 }
24 } 27 }
25 28
  29 +// 编辑标签
26 func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditResponse, err error) { 30 func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditResponse, err error) {
27 - // todo: add your logic here and delete this line 31 + var conn = l.svcCtx.DefaultDBConn()
  32 + //检查重复
  33 + queryOptions := domain.NewQueryOptions().
  34 + WithFindOnly().
  35 + MustWithKV("name", req.Name).
  36 + MustWithKV("group", req.Group).
  37 + WithOffsetLimit(1, 1)
28 38
  39 + _, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOptions)
  40 + if err != nil {
  41 + return nil, xerr.NewErrMsgErr("修改标签失败", err)
  42 + }
  43 + if len(tagList) > 0 {
  44 + if tagList[0].Id != req.Id {
  45 + return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Group, req.Name))
  46 + }
  47 + }
  48 + oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id)
  49 + if err != nil {
  50 + return nil, xerr.NewErrMsgErr("不存在待修改的标签", err)
  51 + }
  52 + if oldTag.CompanyId != req.CompanyId {
  53 + return nil, xerr.NewErrMsg("修改标签失败")
  54 + }
  55 +
  56 + //TODO 获取图片的尺寸大小
  57 +
  58 + oldTag.Group = req.Group
  59 + oldTag.Image.Url = req.Image
  60 + oldTag.Name = req.Name
  61 + oldTag.Remark = req.Remark
  62 +
  63 + oldTag, err = l.svcCtx.ArticleTagRepository.Update(l.ctx, conn, oldTag)
  64 + if err != nil {
  65 + return nil, xerr.NewErrMsgErr("添加标签失败", err)
  66 + }
  67 + resp = &types.TagEditResponse{Id: oldTag.Id}
29 return 68 return
30 } 69 }
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 5
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
8 9
9 "github.com/zeromicro/go-zero/core/logx" 10 "github.com/zeromicro/go-zero/core/logx"
10 ) 11 )
@@ -23,8 +24,22 @@ func NewGetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTagLogi @@ -23,8 +24,22 @@ func NewGetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTagLogi
23 } 24 }
24 } 25 }
25 26
  27 +// 获取详情
26 func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetResponse, err error) { 28 func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetResponse, err error) {
27 - // todo: add your logic here and delete this line  
28 - 29 + var conn = l.svcCtx.DefaultDBConn()
  30 + oldTag, err := l.svcCtx.ArticleTagRepository.FindOne(l.ctx, conn, req.Id)
  31 + if err != nil {
  32 + return nil, xerr.NewErrMsgErr("不存在的标签", err)
  33 + }
  34 + if oldTag.CompanyId != req.CompanyId {
  35 + return nil, xerr.NewErrMsg("获取标签失败")
  36 + }
  37 + resp = &types.TagGetResponse{
  38 + Id: oldTag.Id,
  39 + Image: oldTag.Image.Url,
  40 + Name: oldTag.Name,
  41 + Group: oldTag.Group,
  42 + Remark: oldTag.Remark,
  43 + }
29 return 44 return
30 } 45 }
  1 +package tags
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "github.com/zeromicro/go-zero/core/logx"
  7 + "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"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  10 +)
  11 +
  12 +type SearchTagLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewSearchTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SearchTagLogic {
  19 + return &SearchTagLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagListResponse, err error) {
  27 + var conn = l.svcCtx.DefaultDBConn()
  28 + queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size)
  29 +
  30 + if len(req.Group) > 0 {
  31 + queryOptions = queryOptions.MustWithKV("group", req.Group)
  32 + }
  33 + if len(req.TagName) > 0 {
  34 + queryOptions = queryOptions.MustWithKV("name", req.TagName)
  35 + }
  36 +
  37 + if len(req.Remark) > 0 {
  38 + queryOptions = queryOptions.MustWithKV("remark", "%"+req.Remark+"%")
  39 + }
  40 + cnt, tagList, err := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, queryOptions)
  41 + if err != nil {
  42 + return &types.TagListResponse{}, nil
  43 + }
  44 + resp = &types.TagListResponse{
  45 + Total: cnt,
  46 + List: make([]types.TagItem, len(tagList)),
  47 + }
  48 + for i := range tagList {
  49 + resp.List[i] = types.TagItem{
  50 + Id: tagList[i].Id,
  51 + Image: tagList[i].Image.Url,
  52 + Name: tagList[i].Name,
  53 + Group: tagList[i].Group,
  54 + Remark: tagList[i].Remark,
  55 + CreatedAt: tagList[i].CreatedAt,
  56 + }
  57 + }
  58 + return
  59 +}
@@ -79,7 +79,7 @@ type TagCreateRequest struct { @@ -79,7 +79,7 @@ type TagCreateRequest struct {
79 Image string `json:"image"` 79 Image string `json:"image"`
80 Name string `json:"name"` // 标签名称 80 Name string `json:"name"` // 标签名称
81 Group string `json:"group"` // 标签分类 81 Group string `json:"group"` // 标签分类
82 - Remark string `json:"remark"` // 备注 82 + Remark string `json:"remark,optional"` // 备注
83 } 83 }
84 84
85 type TagCreateResponse struct { 85 type TagCreateResponse struct {
@@ -88,11 +88,11 @@ type TagCreateResponse struct { @@ -88,11 +88,11 @@ type TagCreateResponse struct {
88 88
89 type TagEditRequest struct { 89 type TagEditRequest struct {
90 Id int64 `json:"id"` 90 Id int64 `json:"id"`
91 - CompanyId int64 `json:"companyId"` 91 + CompanyId int64 `json:"-"`
92 Image string `json:"image"` 92 Image string `json:"image"`
93 Name string `json:"name"` // 标签名称 93 Name string `json:"name"` // 标签名称
94 Group string `json:"group"` // 标签分类 94 Group string `json:"group"` // 标签分类
95 - Remark string `json:"remark"` // 备注 95 + Remark string `json:"remark,optional"` // 备注
96 } 96 }
97 97
98 type TagEditResponse struct { 98 type TagEditResponse struct {
@@ -100,7 +100,8 @@ type TagEditResponse struct { @@ -100,7 +100,8 @@ type TagEditResponse struct {
100 } 100 }
101 101
102 type TagGetRequest struct { 102 type TagGetRequest struct {
103 - Id int64 `json:"id"` 103 + Id int64 `path:"id"`
  104 + CompanyId int64 `path:"-"`
104 } 105 }
105 106
106 type TagGetResponse struct { 107 type TagGetResponse struct {
@@ -114,10 +115,14 @@ type TagGetResponse struct { @@ -114,10 +115,14 @@ type TagGetResponse struct {
114 type TagListRequest struct { 115 type TagListRequest struct {
115 Page int `json:"page"` 116 Page int `json:"page"`
116 Size int `json:"size"` 117 Size int `json:"size"`
  118 + CompanyId int64 `json:"-"`
  119 + TagName string `json:"tagName,optional"`
  120 + Group string `json:"group,optional"`
  121 + Remark string `json:"remark,optional"`
117 } 122 }
118 123
119 type TagListResponse struct { 124 type TagListResponse struct {
120 - Total int `json:"total"` 125 + Total int64 `json:"total"`
121 List []TagItem `json:"list"` 126 List []TagItem `json:"list"`
122 } 127 }
123 128
@@ -131,7 +136,8 @@ type TagItem struct { @@ -131,7 +136,8 @@ type TagItem struct {
131 } 136 }
132 137
133 type TagDeleteRequest struct { 138 type TagDeleteRequest struct {
134 - Id int64 `json:"id"` 139 + Id int64 `path:"id"`
  140 + CompanyId int64 `path:"-"`
135 } 141 }
136 142
137 type TagDeleteResponse struct { 143 type TagDeleteResponse struct {
@@ -263,3 +269,72 @@ type Company struct { @@ -263,3 +269,72 @@ type Company struct {
263 Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) 269 Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
264 Logo string `json:"logo,omitempty"` // 公司LOGO 270 Logo string `json:"logo,omitempty"` // 公司LOGO
265 } 271 }
  272 +
  273 +type Location struct {
  274 + Longitude float64 `json:"longitude,optional"` //经度
  275 + Latitude float64 `json:"latitude,optional"` //纬度
  276 + Descript string `json:"descript,optional"` //地点描述
  277 +}
  278 +
  279 +type Author struct {
  280 + Id int64 `json:"id"` // 人员id
  281 + Name string `json:"name"` // 人员的名字
  282 + Avatar string `json:"avatar"` // 人员头像URL
  283 + Group string `json:"group"` // 人员的分组
  284 + Position string `json:"position"` // 职位
  285 +}
  286 +
  287 +type MiniArticleCreateRequest struct {
  288 + Title string `json:"title"` //标题
  289 + Section []string `json:"section"` //文章的文本内容
  290 + AuthorId int64 `json:"authorId,optional"` //发布人id
  291 + Images []string `json:"images,optional"` //图片
  292 + WhoRead []int64 `json:"whoRead,optional"` //谁可查看
  293 + WhoReview []int64 `json:"whoReview,optional"` //谁可评论
  294 + Location Location `json:"location,optional"` //定位坐标
  295 +}
  296 +
  297 +type MiniArticleCreateResponse struct {
  298 + Id int64 `json:"id"`
  299 +}
  300 +
  301 +type MiniArticleGetRequest struct {
  302 + Id int64 `path:"id"` //id
  303 +}
  304 +
  305 +type MiniArticleGetResponse struct {
  306 + Title string `json:"title"` //标题
  307 + AuthorId int `json:"authorId"` //发布人id
  308 + Author Author `json:"author"` //发布人
  309 + CreatedAt int64 `json:"createdAt"` //文章的发布时间
  310 + Section []string `json:"section"` //文章的文本内容
  311 + Images []string `json:"images"` //图片
  312 + WhoRead []int64 `json:"whoRead"` //谁可查看
  313 + WhoReview []int64 `json:"whoReview"` //谁可评论
  314 + Location Location `json:"location"` //定位坐标
  315 + CountLove int `json:"countLove"` // 点赞数量
  316 + CountComment int `json:"countComment"` // 评论数量
  317 + Show int `json:"showState"` // 评论的展示状态(0显示、1不显示)
  318 +}
  319 +
  320 +type MiniArticleSearchMeRequest struct {
  321 + AuthorId int64 `json:"-"`
  322 + CompanyId int64 `json:"-"`
  323 + Page int `json:"page"`
  324 + Size int `json:"size"`
  325 +}
  326 +
  327 +type MiniArticleSearchMeResponse struct {
  328 + Total int `json:"total"`
  329 + List []ArticleSearchMe `json:"list"`
  330 +}
  331 +
  332 +type ArticleSearchMe struct {
  333 + Id int64 `json:"id"` //id
  334 + Title string `json:"title"` //标题
  335 + Images []string `json:"images"` //图片
  336 + CreatedAt int64 `json:"createdAt"` //文章的创建日期
  337 + CountLove int `json:"countLove"` //点赞数量
  338 + CountComment int `json:"CountComment"` //评论数量
  339 + Show int `json:"show"` //是否隐藏 [0显示、1不显示]
  340 +}
@@ -26,7 +26,9 @@ type Article struct { @@ -26,7 +26,9 @@ type Article struct {
26 Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 26 Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
27 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 27 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
28 CountLove int // 点赞数量 28 CountLove int // 点赞数量
  29 + CountRead int // 浏览数量
29 CountComment int // 评论数量 30 CountComment int // 评论数量
  31 + Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签
30 Show int // 评论的展示状态(0显示、1不显示) 32 Show int // 评论的展示状态(0显示、1不显示)
31 } 33 }
32 34
@@ -35,8 +37,9 @@ func (m *Article) TableName() string { @@ -35,8 +37,9 @@ func (m *Article) TableName() string {
35 } 37 }
36 38
37 func (m *Article) BeforeCreate(tx *gorm.DB) (err error) { 39 func (m *Article) BeforeCreate(tx *gorm.DB) (err error) {
38 - m.CreatedAt = time.Now().Unix()  
39 - m.UpdatedAt = time.Now().Unix() 40 + nowTime := time.Now().Unix()
  41 + m.CreatedAt = nowTime
  42 + m.UpdatedAt = nowTime
40 return 43 return
41 } 44 }
42 45
@@ -24,7 +24,7 @@ type ArticleBackup struct { @@ -24,7 +24,7 @@ type ArticleBackup struct {
24 Action string // 操作 24 Action string // 操作
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 - Tags []int `gorm:"type:jsonb;serializer:json"` // 标签 27 + Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签
28 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 28 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
29 } 29 }
30 30
@@ -16,16 +16,16 @@ type MessageBusiness struct { @@ -16,16 +16,16 @@ type MessageBusiness struct {
16 CompanyId int64 `json:"companyId"` // 操作人公司ID 16 CompanyId int64 `json:"companyId"` // 操作人公司ID
17 UserId int64 `json:"userId"` // 操作人用户ID 17 UserId int64 `json:"userId"` // 操作人用户ID
18 RecipientId int64 `json:"recipientId"` // 接收人用户ID 18 RecipientId int64 `json:"recipientId"` // 接收人用户ID
19 - ArticleId int64 `json:"articleId"` // 文章ID 19 + ArticleId int64 `json:"articleId,omitempty"` // 文章ID
20 CommentId int64 `json:"commentId,omitempty"` // 评论ID 20 CommentId int64 `json:"commentId,omitempty"` // 评论ID
21 - DiscussionId int64 `json:"discussionId,omitempty"` // 圆桌ID  
22 - DiscussionOpinionId int64 `json:"discussionOpinionId,omitempty"` // 观点ID  
23 Content string `json:"content,omitempty"` // 消息内容 21 Content string `json:"content,omitempty"` // 消息内容
24 CreatedAt int64 `json:",omitempty"` 22 CreatedAt int64 `json:",omitempty"`
25 UpdatedAt int64 `json:",omitempty"` 23 UpdatedAt int64 `json:",omitempty"`
26 DeletedAt int64 `json:",omitempty"` 24 DeletedAt int64 `json:",omitempty"`
27 Version int `json:",omitempty"` 25 Version int `json:",omitempty"`
28 IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` 26 IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
  27 + //DiscussionId int64 `json:"discussionId,omitempty"` // 圆桌ID
  28 + //DiscussionOpinionId int64 `json:"discussionOpinionId,omitempty"` // 观点ID
29 } 29 }
30 30
31 func (m *MessageBusiness) TableName() string { 31 func (m *MessageBusiness) TableName() string {
@@ -111,7 +111,7 @@ func (repository *ArticleRepository) FindOne(ctx context.Context, conn transacti @@ -111,7 +111,7 @@ func (repository *ArticleRepository) FindOne(ctx context.Context, conn transacti
111 return repository.ModelToDomainModel(m) 111 return repository.ModelToDomainModel(m)
112 } 112 }
113 113
114 -func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*domain.Article, error) { 114 +func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*domain.Article, error) {
115 var ( 115 var (
116 tx = conn.DB() 116 tx = conn.DB()
117 ms []*models.Article 117 ms []*models.Article
@@ -119,10 +119,15 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. @@ -119,10 +119,15 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.
119 total int64 119 total int64
120 ) 120 )
121 queryFunc := func() (interface{}, error) { 121 queryFunc := func() (interface{}, error) {
122 - tx = tx.Model(&ms).Order("id desc") 122 + tx = tx.Model(&ms).Order("id desc").Where("company_id=?", companyId)
123 if v, ok := queryOptions["ids"]; ok { 123 if v, ok := queryOptions["ids"]; ok {
124 tx.Where("id in (?)", v) 124 tx.Where("id in (?)", v)
125 } 125 }
  126 +
  127 + if v, ok := queryOptions["authorId"]; ok {
  128 + tx = tx.Where("author_id = ?", v)
  129 + }
  130 +
126 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 131 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
127 return dms, tx.Error 132 return dms, tx.Error
128 } 133 }
@@ -161,6 +166,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* @@ -161,6 +166,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*
161 TargetUser: domain.ArticleTarget(from.TargetUser), 166 TargetUser: domain.ArticleTarget(from.TargetUser),
162 CountLove: from.CountLove, 167 CountLove: from.CountLove,
163 CountComment: from.CountComment, 168 CountComment: from.CountComment,
  169 + CountRead: from.CountRead,
164 Show: domain.ArticleShow(from.Show), 170 Show: domain.ArticleShow(from.Show),
165 } 171 }
166 return to, nil 172 return to, nil
@@ -173,6 +179,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* @@ -173,6 +179,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
173 CreatedAt: from.CreatedAt, 179 CreatedAt: from.CreatedAt,
174 UpdatedAt: from.UpdatedAt, 180 UpdatedAt: from.UpdatedAt,
175 DeletedAt: from.DeletedAt, 181 DeletedAt: from.DeletedAt,
  182 + IsDel: 0,
176 Version: from.Version, 183 Version: from.Version,
177 AuthorId: from.AuthorId, 184 AuthorId: from.AuthorId,
178 Author: from.Author, 185 Author: from.Author,
@@ -183,6 +190,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* @@ -183,6 +190,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
183 Location: from.Location, 190 Location: from.Location,
184 TargetUser: int(from.TargetUser), 191 TargetUser: int(from.TargetUser),
185 CountLove: from.CountLove, 192 CountLove: from.CountLove,
  193 + CountRead: from.CountRead,
186 CountComment: from.CountComment, 194 CountComment: from.CountComment,
187 Show: int(from.Show), 195 Show: int(from.Show),
188 } 196 }
@@ -125,10 +125,10 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti @@ -125,10 +125,10 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti
125 Order("id desc") 125 Order("id desc")
126 126
127 if v, ok := queryOptions["name"]; ok { 127 if v, ok := queryOptions["name"]; ok {
128 - tx.Where("id like ?", v) 128 + tx = tx.Where("name like ?", v)
129 } 129 }
130 if v, ok := queryOptions["group"]; ok { 130 if v, ok := queryOptions["group"]; ok {
131 - tx.Where("group like ?", v) 131 + tx = tx.Where("group like ?", v)
132 } 132 }
133 133
134 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 134 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
@@ -121,6 +121,9 @@ func (repository *MessageBusinessRepository) Find(ctx context.Context, conn tran @@ -121,6 +121,9 @@ func (repository *MessageBusinessRepository) Find(ctx context.Context, conn tran
121 ) 121 )
122 queryFunc := func() (interface{}, error) { 122 queryFunc := func() (interface{}, error) {
123 tx = tx.Model(&ms).Order("created_at desc") 123 tx = tx.Model(&ms).Order("created_at desc")
  124 + if v, ok := queryOptions["companyId"]; ok {
  125 + tx.Where("company_id = ?", v)
  126 + }
124 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 127 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
125 return dms, tx.Error 128 return dms, tx.Error
126 } 129 }
@@ -24,10 +24,21 @@ type Article struct { @@ -24,10 +24,21 @@ type Article struct {
24 TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 24 TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
25 CountLove int `json:"countLove"` // 点赞数量 25 CountLove int `json:"countLove"` // 点赞数量
26 CountComment int `json:"countComment"` // 评论数量 26 CountComment int `json:"countComment"` // 评论数量
27 - Show ArticleShow `json:"showState"` // 评论的展示状态(0显示、1不显示) 27 + CountRead int `json:"countRead"` // 浏览数量
  28 + Show ArticleShow `json:"show"` // 评论的展示状态(0显示、1不显示)
  29 + Tags []int64 `json:"tags"` // 定性标签
28 // ...more 30 // ...more
29 } 31 }
30 32
  33 +type ArticleRepository interface {
  34 + Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
  35 + Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
  36 + Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
  37 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
  38 + FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error)
  39 + Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error)
  40 +}
  41 +
31 type ArticleTarget int 42 type ArticleTarget int
32 43
33 const ( 44 const (
@@ -63,11 +74,24 @@ func (a ArticleShow) Named() string { @@ -63,11 +74,24 @@ func (a ArticleShow) Named() string {
63 return "" 74 return ""
64 } 75 }
65 76
66 -type ArticleRepository interface {  
67 - Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)  
68 - Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)  
69 - Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)  
70 - UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)  
71 - FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error)  
72 - Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Article, error) 77 +// 设置文章的备份数据
  78 +func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *ArticleBackup {
  79 + b := ArticleBackup{
  80 + Id: 0,
  81 + CompanyId: 0,
  82 + CreatedAt: 0,
  83 + UpdatedAt: 0,
  84 + DeletedAt: 0,
  85 + Version: 0,
  86 + Operator: operator,
  87 + Title: m.Title,
  88 + Section: section,
  89 + Images: m.Images,
  90 + Action: "",
  91 + TargetUser: m.TargetUser,
  92 + WhoRead: m.WhoRead,
  93 + WhoReview: m.WhoReview,
  94 + Tags: m.Tags,
  95 + }
  96 + return &b
73 } 97 }
@@ -22,7 +22,7 @@ type ArticleBackup struct { @@ -22,7 +22,7 @@ type ArticleBackup struct {
22 TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 22 TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
23 WhoRead []int64 `json:"whoRead"` // 谁可以看 23 WhoRead []int64 `json:"whoRead"` // 谁可以看
24 WhoReview []int64 `json:"whoReview"` // 评论人 24 WhoReview []int64 `json:"whoReview"` // 评论人
25 - Tags []int `json:"tags"` // 标签 25 + Tags []int64 `json:"tags"` // 标签
26 } 26 }
27 27
28 type ArticleBackupRepository interface { 28 type ArticleBackupRepository interface {
@@ -28,3 +28,10 @@ type ArticleSectionRepository interface { @@ -28,3 +28,10 @@ type ArticleSectionRepository interface {
28 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSection, error) 28 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSection, error)
29 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSection, error) 29 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSection, error)
30 } 30 }
  31 +
  32 +// 排序文章分段列表
  33 +type SortArticleSection []*ArticleSection
  34 +
  35 +func (a SortArticleSection) Len() int { return len(a) }
  36 +func (a SortArticleSection) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
  37 +func (a SortArticleSection) Less(i, j int) bool { return a[i].SortBy < a[j].SortBy }
@@ -7,27 +7,28 @@ import ( @@ -7,27 +7,28 @@ import (
7 7
8 type MessageBusiness struct { 8 type MessageBusiness struct {
9 Id int64 // 唯一标识 9 Id int64 // 唯一标识
10 - Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)  
11 - OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌) 10 + Type MsgBusinessType `json:"type"` // 分类 (1回复 2点赞 3被采纳)
  11 + OptType MsgBusinessOpt `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
12 CompanyId int64 `json:"companyId"` // 操作人公司ID 12 CompanyId int64 `json:"companyId"` // 操作人公司ID
13 UserId int64 `json:"userId"` // 操作人用户ID 13 UserId int64 `json:"userId"` // 操作人用户ID
14 RecipientId int64 `json:"recipientId"` // 接收人用户ID 14 RecipientId int64 `json:"recipientId"` // 接收人用户ID
15 ArticleId int64 `json:"articleId"` // 文章ID 15 ArticleId int64 `json:"articleId"` // 文章ID
16 CommentId int64 `json:"commentId"` // 评论ID 16 CommentId int64 `json:"commentId"` // 评论ID
17 - DiscussionId int64 `json:"discussionId"` // 圆桌ID  
18 - DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID  
19 Content string `json:"content"` // 消息内容 17 Content string `json:"content"` // 消息内容
20 CreatedAt int64 `json:",omitempty"` 18 CreatedAt int64 `json:",omitempty"`
21 UpdatedAt int64 `json:",omitempty"` 19 UpdatedAt int64 `json:",omitempty"`
22 DeletedAt int64 `json:",omitempty"` 20 DeletedAt int64 `json:",omitempty"`
23 Version int `json:",omitempty"` 21 Version int `json:",omitempty"`
  22 +
  23 + //DiscussionId int64 `json:"discussionId"` // 圆桌ID
  24 + //DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
24 } 25 }
25 26
26 type MsgBusinessType int 27 type MsgBusinessType int
27 type MsgBusinessOpt int 28 type MsgBusinessOpt int
28 29
29 const ( 30 const (
30 - MsgTypeReply MsgBusinessType = 1 // 消息分类-回复 31 + MsgTypeReply MsgBusinessType = 1 // 消息分类-评论
31 MsgTypeLike MsgBusinessType = 2 // 消息分类-点赞 32 MsgTypeLike MsgBusinessType = 2 // 消息分类-点赞
32 MsgTypeAccept MsgBusinessType = 3 // 消息分类-被采纳 33 MsgTypeAccept MsgBusinessType = 3 // 消息分类-被采纳
33 ) 34 )
@@ -32,6 +32,9 @@ type UserSimple struct { @@ -32,6 +32,9 @@ type UserSimple struct {
32 Id int64 `json:"id"` // 人员id 32 Id int64 `json:"id"` // 人员id
33 Name string `json:"name"` // 人员的名字 33 Name string `json:"name"` // 人员的名字
34 Avatar string `json:"avatar,omitempty"` // 人员头像URL 34 Avatar string `json:"avatar,omitempty"` // 人员头像URL
  35 + GroupId int64 `json:"groupId,omitempty"`
35 Group string `json:"group,omitempty"` // 人员的分组 36 Group string `json:"group,omitempty"` // 人员的分组
36 Position string `json:"position,omitempty"` // 职位 37 Position string `json:"position,omitempty"` // 职位
  38 + Company string `json:"company,omitempty"` // 公司
  39 + CompanyId int64 `json:"companyId"`
37 } 40 }