正在显示
36 个修改的文件
包含
2063 行增加
和
218 行删除
@@ -15,6 +15,22 @@ | @@ -15,6 +15,22 @@ | ||
15 | "application/json" | 15 | "application/json" |
16 | ], | 16 | ], |
17 | "paths": { | 17 | "paths": { |
18 | + "v1/clear": { | ||
19 | + "get": { | ||
20 | + "summary": "清理缓存", | ||
21 | + "operationId": "commonGetClearCache", | ||
22 | + "responses": { | ||
23 | + "200": { | ||
24 | + "description": "A successful response.", | ||
25 | + "schema": {} | ||
26 | + } | ||
27 | + }, | ||
28 | + "requestBody": {}, | ||
29 | + "tags": [ | ||
30 | + "common" | ||
31 | + ] | ||
32 | + } | ||
33 | + }, | ||
18 | "v1/common/sms/code": { | 34 | "v1/common/sms/code": { |
19 | "post": { | 35 | "post": { |
20 | "summary": "短信验证码", | 36 | "summary": "短信验证码", |
@@ -401,6 +417,34 @@ | @@ -401,6 +417,34 @@ | ||
401 | ] | 417 | ] |
402 | } | 418 | } |
403 | }, | 419 | }, |
420 | + "v1/mini/article_comment/list_reply": { | ||
421 | + "post": { | ||
422 | + "summary": "小程序展示评论对应的一级回复列表", | ||
423 | + "operationId": "MiniListReplyArticleComment", | ||
424 | + "responses": { | ||
425 | + "200": { | ||
426 | + "description": "A successful response.", | ||
427 | + "schema": { | ||
428 | + "$ref": "#/definitions/MiniListReplyArticleCommentResponse" | ||
429 | + } | ||
430 | + } | ||
431 | + }, | ||
432 | + "parameters": [ | ||
433 | + { | ||
434 | + "name": "body", | ||
435 | + "in": "body", | ||
436 | + "required": true, | ||
437 | + "schema": { | ||
438 | + "$ref": "#/definitions/MiniListReplyArticleCommentRequest" | ||
439 | + } | ||
440 | + } | ||
441 | + ], | ||
442 | + "requestBody": {}, | ||
443 | + "tags": [ | ||
444 | + "comment" | ||
445 | + ] | ||
446 | + } | ||
447 | + }, | ||
404 | "v1/mini/article_comment/top5": { | 448 | "v1/mini/article_comment/top5": { |
405 | "post": { | 449 | "post": { |
406 | "summary": "小程序展示文章的评论列表TOP5", | 450 | "summary": "小程序展示文章的评论列表TOP5", |
@@ -719,6 +763,118 @@ | @@ -719,6 +763,118 @@ | ||
719 | ] | 763 | ] |
720 | } | 764 | } |
721 | }, | 765 | }, |
766 | + "v1/mini/homepage/user_beliked": { | ||
767 | + "post": { | ||
768 | + "summary": "个人主页-获赞的列表", | ||
769 | + "operationId": "miniHomepageUserBeliked", | ||
770 | + "responses": { | ||
771 | + "200": { | ||
772 | + "description": "A successful response.", | ||
773 | + "schema": { | ||
774 | + "$ref": "#/definitions/MiniHomePageUserBeLikedResponse" | ||
775 | + } | ||
776 | + } | ||
777 | + }, | ||
778 | + "parameters": [ | ||
779 | + { | ||
780 | + "name": "body", | ||
781 | + "in": "body", | ||
782 | + "required": true, | ||
783 | + "schema": { | ||
784 | + "$ref": "#/definitions/MiniHomePageUserBeLikedRequest" | ||
785 | + } | ||
786 | + } | ||
787 | + ], | ||
788 | + "requestBody": {}, | ||
789 | + "tags": [ | ||
790 | + "user" | ||
791 | + ] | ||
792 | + } | ||
793 | + }, | ||
794 | + "v1/mini/homepage/user_follower": { | ||
795 | + "post": { | ||
796 | + "summary": "个人主页-关注我的人", | ||
797 | + "operationId": "miniHomepageUserFollower", | ||
798 | + "responses": { | ||
799 | + "200": { | ||
800 | + "description": "A successful response.", | ||
801 | + "schema": { | ||
802 | + "$ref": "#/definitions/MiniHomePageUserFollowerSearchResponse" | ||
803 | + } | ||
804 | + } | ||
805 | + }, | ||
806 | + "parameters": [ | ||
807 | + { | ||
808 | + "name": "body", | ||
809 | + "in": "body", | ||
810 | + "required": true, | ||
811 | + "schema": { | ||
812 | + "$ref": "#/definitions/MiniHomePageUserFollowerSearchRequest" | ||
813 | + } | ||
814 | + } | ||
815 | + ], | ||
816 | + "requestBody": {}, | ||
817 | + "tags": [ | ||
818 | + "user" | ||
819 | + ] | ||
820 | + } | ||
821 | + }, | ||
822 | + "v1/mini/homepage/user_info": { | ||
823 | + "post": { | ||
824 | + "summary": "个人主页用户信息", | ||
825 | + "operationId": "miniHomePageUserInfo", | ||
826 | + "responses": { | ||
827 | + "200": { | ||
828 | + "description": "A successful response.", | ||
829 | + "schema": { | ||
830 | + "$ref": "#/definitions/MiniHomePageUserInfoResponse" | ||
831 | + } | ||
832 | + } | ||
833 | + }, | ||
834 | + "parameters": [ | ||
835 | + { | ||
836 | + "name": "body", | ||
837 | + "in": "body", | ||
838 | + "required": true, | ||
839 | + "schema": { | ||
840 | + "$ref": "#/definitions/MiniHomePageUserInfoRequest" | ||
841 | + } | ||
842 | + } | ||
843 | + ], | ||
844 | + "requestBody": {}, | ||
845 | + "tags": [ | ||
846 | + "user" | ||
847 | + ] | ||
848 | + } | ||
849 | + }, | ||
850 | + "v1/mini/homepage/user_news": { | ||
851 | + "post": { | ||
852 | + "summary": "个人主页-用户发布的信息", | ||
853 | + "operationId": "miniHomepageUserNews", | ||
854 | + "responses": { | ||
855 | + "200": { | ||
856 | + "description": "A successful response.", | ||
857 | + "schema": { | ||
858 | + "$ref": "#/definitions/MiniHomepageUserNewsResposne" | ||
859 | + } | ||
860 | + } | ||
861 | + }, | ||
862 | + "parameters": [ | ||
863 | + { | ||
864 | + "name": "body", | ||
865 | + "in": "body", | ||
866 | + "required": true, | ||
867 | + "schema": { | ||
868 | + "$ref": "#/definitions/MiniHomepageUserNewsRequest" | ||
869 | + } | ||
870 | + } | ||
871 | + ], | ||
872 | + "requestBody": {}, | ||
873 | + "tags": [ | ||
874 | + "user" | ||
875 | + ] | ||
876 | + } | ||
877 | + }, | ||
722 | "v1/mini/message/comment": { | 878 | "v1/mini/message/comment": { |
723 | "post": { | 879 | "post": { |
724 | "summary": "评论消息", | 880 | "summary": "评论消息", |
@@ -803,6 +959,32 @@ | @@ -803,6 +959,32 @@ | ||
803 | ] | 959 | ] |
804 | } | 960 | } |
805 | }, | 961 | }, |
962 | + "v1/mini/qrcode": { | ||
963 | + "post": { | ||
964 | + "summary": "微信二维码", | ||
965 | + "operationId": "miniQrcodeInvite", | ||
966 | + "responses": { | ||
967 | + "200": { | ||
968 | + "description": "A successful response.", | ||
969 | + "schema": {} | ||
970 | + } | ||
971 | + }, | ||
972 | + "parameters": [ | ||
973 | + { | ||
974 | + "name": "body", | ||
975 | + "in": "body", | ||
976 | + "required": true, | ||
977 | + "schema": { | ||
978 | + "$ref": "#/definitions/MiniQrCodeRequest" | ||
979 | + } | ||
980 | + } | ||
981 | + ], | ||
982 | + "requestBody": {}, | ||
983 | + "tags": [ | ||
984 | + "common" | ||
985 | + ] | ||
986 | + } | ||
987 | + }, | ||
806 | "v1/mini/show/home_page": { | 988 | "v1/mini/show/home_page": { |
807 | "get": { | 989 | "get": { |
808 | "summary": "小程序首页数据展示", | 990 | "summary": "小程序首页数据展示", |
@@ -1121,6 +1303,34 @@ | @@ -1121,6 +1303,34 @@ | ||
1121 | ] | 1303 | ] |
1122 | } | 1304 | } |
1123 | }, | 1305 | }, |
1306 | + "v1/mini/user/info/edit": { | ||
1307 | + "post": { | ||
1308 | + "summary": "编辑用户信息", | ||
1309 | + "operationId": "miniEditUserInfo", | ||
1310 | + "responses": { | ||
1311 | + "200": { | ||
1312 | + "description": "A successful response.", | ||
1313 | + "schema": { | ||
1314 | + "$ref": "#/definitions/MiniEditUserInfoResponse" | ||
1315 | + } | ||
1316 | + } | ||
1317 | + }, | ||
1318 | + "parameters": [ | ||
1319 | + { | ||
1320 | + "name": "body", | ||
1321 | + "in": "body", | ||
1322 | + "required": true, | ||
1323 | + "schema": { | ||
1324 | + "$ref": "#/definitions/MiniEditUserInfoRequest" | ||
1325 | + } | ||
1326 | + } | ||
1327 | + ], | ||
1328 | + "requestBody": {}, | ||
1329 | + "tags": [ | ||
1330 | + "user" | ||
1331 | + ] | ||
1332 | + } | ||
1333 | + }, | ||
1124 | "v1/mini/user/login": { | 1334 | "v1/mini/user/login": { |
1125 | "post": { | 1335 | "post": { |
1126 | "summary": "用户登录", | 1336 | "summary": "用户登录", |
@@ -1149,9 +1359,65 @@ | @@ -1149,9 +1359,65 @@ | ||
1149 | ] | 1359 | ] |
1150 | } | 1360 | } |
1151 | }, | 1361 | }, |
1362 | + "v1/mini/user/my_following_news": { | ||
1363 | + "post": { | ||
1364 | + "summary": "我关注人发布的信息", | ||
1365 | + "operationId": "miniUserMyFollowingNews", | ||
1366 | + "responses": { | ||
1367 | + "200": { | ||
1368 | + "description": "A successful response.", | ||
1369 | + "schema": { | ||
1370 | + "$ref": "#/definitions/MiniUserNewsResposne" | ||
1371 | + } | ||
1372 | + } | ||
1373 | + }, | ||
1374 | + "parameters": [ | ||
1375 | + { | ||
1376 | + "name": "body", | ||
1377 | + "in": "body", | ||
1378 | + "required": true, | ||
1379 | + "schema": { | ||
1380 | + "$ref": "#/definitions/MiniUserNewsRequest" | ||
1381 | + } | ||
1382 | + } | ||
1383 | + ], | ||
1384 | + "requestBody": {}, | ||
1385 | + "tags": [ | ||
1386 | + "user" | ||
1387 | + ] | ||
1388 | + } | ||
1389 | + }, | ||
1390 | + "v1/mini/user/mybeliked": { | ||
1391 | + "post": { | ||
1392 | + "summary": "我被点赞-文章或评论列表", | ||
1393 | + "operationId": "miniMyBeLiked", | ||
1394 | + "responses": { | ||
1395 | + "200": { | ||
1396 | + "description": "A successful response.", | ||
1397 | + "schema": { | ||
1398 | + "$ref": "#/definitions/MiniBeLikedResponse" | ||
1399 | + } | ||
1400 | + } | ||
1401 | + }, | ||
1402 | + "parameters": [ | ||
1403 | + { | ||
1404 | + "name": "body", | ||
1405 | + "in": "body", | ||
1406 | + "required": true, | ||
1407 | + "schema": { | ||
1408 | + "$ref": "#/definitions/MiniBeLikedRequest" | ||
1409 | + } | ||
1410 | + } | ||
1411 | + ], | ||
1412 | + "requestBody": {}, | ||
1413 | + "tags": [ | ||
1414 | + "user" | ||
1415 | + ] | ||
1416 | + } | ||
1417 | + }, | ||
1152 | "v1/mini/user/mylike": { | 1418 | "v1/mini/user/mylike": { |
1153 | "post": { | 1419 | "post": { |
1154 | - "summary": "我点赞的文章或评论", | 1420 | + "summary": "我点赞的-文章或评论列表", |
1155 | "operationId": "miniMyLike", | 1421 | "operationId": "miniMyLike", |
1156 | "responses": { | 1422 | "responses": { |
1157 | "200": { | 1423 | "200": { |
@@ -1677,6 +1943,34 @@ | @@ -1677,6 +1943,34 @@ | ||
1677 | ] | 1943 | ] |
1678 | } | 1944 | } |
1679 | }, | 1945 | }, |
1946 | + "v1/system/article_comment/edit/love": { | ||
1947 | + "post": { | ||
1948 | + "summary": "编辑评论的运营点赞数", | ||
1949 | + "operationId": "SystemEditAticleCommentLove", | ||
1950 | + "responses": { | ||
1951 | + "200": { | ||
1952 | + "description": "A successful response.", | ||
1953 | + "schema": { | ||
1954 | + "$ref": "#/definitions/SystemEditCommentLoveResponse" | ||
1955 | + } | ||
1956 | + } | ||
1957 | + }, | ||
1958 | + "parameters": [ | ||
1959 | + { | ||
1960 | + "name": "body", | ||
1961 | + "in": "body", | ||
1962 | + "required": true, | ||
1963 | + "schema": { | ||
1964 | + "$ref": "#/definitions/SystemEditCommentLoveRequest" | ||
1965 | + } | ||
1966 | + } | ||
1967 | + ], | ||
1968 | + "requestBody": {}, | ||
1969 | + "tags": [ | ||
1970 | + "comment" | ||
1971 | + ] | ||
1972 | + } | ||
1973 | + }, | ||
1680 | "v1/system/article_comment/edit_show": { | 1974 | "v1/system/article_comment/edit_show": { |
1681 | "post": { | 1975 | "post": { |
1682 | "summary": "管理后台变更评论的显示状态", | 1976 | "summary": "管理后台变更评论的显示状态", |
@@ -2203,21 +2497,37 @@ | @@ -2203,21 +2497,37 @@ | ||
2203 | ] | 2497 | ] |
2204 | } | 2498 | } |
2205 | }, | 2499 | }, |
2206 | - "v1/system/role/search": { | ||
2207 | - "post": { | ||
2208 | - "summary": "角色列表搜索", | ||
2209 | - "operationId": "systemSearchRole", | 2500 | + "v1/system/role/auths": { |
2501 | + "get": { | ||
2502 | + "summary": "角色权限列表", | ||
2503 | + "operationId": "systemGetRoleAuths", | ||
2210 | "responses": { | 2504 | "responses": { |
2211 | "200": { | 2505 | "200": { |
2212 | "description": "A successful response.", | 2506 | "description": "A successful response.", |
2213 | - "schema": { | ||
2214 | - "$ref": "#/definitions/RoleSearchResponse" | ||
2215 | - } | 2507 | + "schema": {} |
2216 | } | 2508 | } |
2217 | }, | 2509 | }, |
2218 | - "parameters": [ | ||
2219 | - { | ||
2220 | - "name": "body", | 2510 | + "requestBody": {}, |
2511 | + "tags": [ | ||
2512 | + "role" | ||
2513 | + ] | ||
2514 | + } | ||
2515 | + }, | ||
2516 | + "v1/system/role/search": { | ||
2517 | + "post": { | ||
2518 | + "summary": "角色列表搜索", | ||
2519 | + "operationId": "systemSearchRole", | ||
2520 | + "responses": { | ||
2521 | + "200": { | ||
2522 | + "description": "A successful response.", | ||
2523 | + "schema": { | ||
2524 | + "$ref": "#/definitions/RoleSearchResponse" | ||
2525 | + } | ||
2526 | + } | ||
2527 | + }, | ||
2528 | + "parameters": [ | ||
2529 | + { | ||
2530 | + "name": "body", | ||
2221 | "in": "body", | 2531 | "in": "body", |
2222 | "required": true, | 2532 | "required": true, |
2223 | "schema": { | 2533 | "schema": { |
@@ -2661,6 +2971,10 @@ | @@ -2661,6 +2971,10 @@ | ||
2661 | }, | 2971 | }, |
2662 | "description": " 填写评论时@的人" | 2972 | "description": " 填写评论时@的人" |
2663 | }, | 2973 | }, |
2974 | + "matchUrl": { | ||
2975 | + "type": "object", | ||
2976 | + "description": " 评论内容中的url文本" | ||
2977 | + }, | ||
2664 | "createdAt": { | 2978 | "createdAt": { |
2665 | "type": "integer", | 2979 | "type": "integer", |
2666 | "format": "int64" | 2980 | "format": "int64" |
@@ -2668,7 +2982,7 @@ | @@ -2668,7 +2982,7 @@ | ||
2668 | "meLoveFlag": { | 2982 | "meLoveFlag": { |
2669 | "type": "integer", | 2983 | "type": "integer", |
2670 | "format": "int32", | 2984 | "format": "int32", |
2671 | - "description": "当前人员对评论的点赞标识 (0 没有点赞 1有点赞)" | 2985 | + "description": " 当前人员对评论的点赞标识 (0 没有点赞 1有点赞)" |
2672 | }, | 2986 | }, |
2673 | "content": { | 2987 | "content": { |
2674 | "type": "string", | 2988 | "type": "string", |
@@ -2691,6 +3005,7 @@ | @@ -2691,6 +3005,7 @@ | ||
2691 | "countUserLove", | 3005 | "countUserLove", |
2692 | "countAdminLove", | 3006 | "countAdminLove", |
2693 | "atWho", | 3007 | "atWho", |
3008 | + "matchUrl", | ||
2694 | "createdAt", | 3009 | "createdAt", |
2695 | "meLoveFlag", | 3010 | "meLoveFlag", |
2696 | "content" | 3011 | "content" |
@@ -2725,11 +3040,16 @@ | @@ -2725,11 +3040,16 @@ | ||
2725 | "format": "int32", | 3040 | "format": "int32", |
2726 | "description": "点赞数量" | 3041 | "description": "点赞数量" |
2727 | }, | 3042 | }, |
2728 | - "CountComment": { | 3043 | + "countComment": { |
2729 | "type": "integer", | 3044 | "type": "integer", |
2730 | "format": "int32", | 3045 | "format": "int32", |
2731 | "description": "评论数量" | 3046 | "description": "评论数量" |
2732 | }, | 3047 | }, |
3048 | + "countRead": { | ||
3049 | + "type": "integer", | ||
3050 | + "format": "int32", | ||
3051 | + "description": "浏览数量" | ||
3052 | + }, | ||
2733 | "show": { | 3053 | "show": { |
2734 | "type": "integer", | 3054 | "type": "integer", |
2735 | "format": "int32", | 3055 | "format": "int32", |
@@ -2743,7 +3063,8 @@ | @@ -2743,7 +3063,8 @@ | ||
2743 | "images", | 3063 | "images", |
2744 | "createdAt", | 3064 | "createdAt", |
2745 | "countLove", | 3065 | "countLove", |
2746 | - "CountComment", | 3066 | + "countComment", |
3067 | + "countRead", | ||
2747 | "show" | 3068 | "show" |
2748 | ] | 3069 | ] |
2749 | }, | 3070 | }, |
@@ -2811,6 +3132,11 @@ | @@ -2811,6 +3132,11 @@ | ||
2811 | "type": "integer", | 3132 | "type": "integer", |
2812 | "format": "int32", | 3133 | "format": "int32", |
2813 | "description": " 已读的标签数量" | 3134 | "description": " 已读的标签数量" |
3135 | + }, | ||
3136 | + "sortBy": { | ||
3137 | + "type": "integer", | ||
3138 | + "format": "int32", | ||
3139 | + "description": " 排序" | ||
2814 | } | 3140 | } |
2815 | }, | 3141 | }, |
2816 | "title": "ArticleTagCount", | 3142 | "title": "ArticleTagCount", |
@@ -2821,7 +3147,8 @@ | @@ -2821,7 +3147,8 @@ | ||
2821 | "tagName", | 3147 | "tagName", |
2822 | "tagRemark", | 3148 | "tagRemark", |
2823 | "totalArticle", | 3149 | "totalArticle", |
2824 | - "readArticle" | 3150 | + "readArticle", |
3151 | + "sortBy" | ||
2825 | ] | 3152 | ] |
2826 | }, | 3153 | }, |
2827 | "ArticleTagGroup": { | 3154 | "ArticleTagGroup": { |
@@ -2858,6 +3185,10 @@ | @@ -2858,6 +3185,10 @@ | ||
2858 | }, | 3185 | }, |
2859 | "image": { | 3186 | "image": { |
2860 | "type": "string" | 3187 | "type": "string" |
3188 | + }, | ||
3189 | + "sortBy": { | ||
3190 | + "type": "integer", | ||
3191 | + "format": "int32" | ||
2861 | } | 3192 | } |
2862 | }, | 3193 | }, |
2863 | "title": "ArticleTagItem", | 3194 | "title": "ArticleTagItem", |
@@ -2865,7 +3196,8 @@ | @@ -2865,7 +3196,8 @@ | ||
2865 | "id", | 3196 | "id", |
2866 | "category", | 3197 | "category", |
2867 | "name", | 3198 | "name", |
2868 | - "image" | 3199 | + "image", |
3200 | + "sortBy" | ||
2869 | ] | 3201 | ] |
2870 | }, | 3202 | }, |
2871 | "Auth": { | 3203 | "Auth": { |
@@ -2899,6 +3231,10 @@ | @@ -2899,6 +3231,10 @@ | ||
2899 | "type": "integer", | 3231 | "type": "integer", |
2900 | "format": "int64" | 3232 | "format": "int64" |
2901 | }, | 3233 | }, |
3234 | + "avatar": { | ||
3235 | + "type": "string", | ||
3236 | + "description": " 人员头像URL" | ||
3237 | + }, | ||
2902 | "name": { | 3238 | "name": { |
2903 | "type": "string" | 3239 | "type": "string" |
2904 | }, | 3240 | }, |
@@ -3268,7 +3604,7 @@ | @@ -3268,7 +3604,7 @@ | ||
3268 | "optType": { | 3604 | "optType": { |
3269 | "type": "integer", | 3605 | "type": "integer", |
3270 | "format": "int32", | 3606 | "format": "int32", |
3271 | - "description": " 操作类型(1针对文章、1针对评论、2针对圆桌)" | 3607 | + "description": " 操作类型(1针对文章或段落、2针对评论、3针对圆桌)" |
3272 | }, | 3608 | }, |
3273 | "companyId": { | 3609 | "companyId": { |
3274 | "type": "integer", | 3610 | "type": "integer", |
@@ -3290,25 +3626,6 @@ | @@ -3290,25 +3626,6 @@ | ||
3290 | "format": "int64", | 3626 | "format": "int64", |
3291 | "description": " 文章ID" | 3627 | "description": " 文章ID" |
3292 | }, | 3628 | }, |
3293 | - "commentId": { | ||
3294 | - "type": "integer", | ||
3295 | - "format": "int64", | ||
3296 | - "description": " 评论ID" | ||
3297 | - }, | ||
3298 | - "discussionId": { | ||
3299 | - "type": "integer", | ||
3300 | - "format": "int64", | ||
3301 | - "description": " 圆桌ID" | ||
3302 | - }, | ||
3303 | - "discussionOpinionId": { | ||
3304 | - "type": "integer", | ||
3305 | - "format": "int64", | ||
3306 | - "description": " 观点ID" | ||
3307 | - }, | ||
3308 | - "content": { | ||
3309 | - "type": "string", | ||
3310 | - "description": " 消息内容" | ||
3311 | - }, | ||
3312 | "createdAt": { | 3629 | "createdAt": { |
3313 | "type": "integer", | 3630 | "type": "integer", |
3314 | "format": "int64", | 3631 | "format": "int64", |
@@ -3324,7 +3641,11 @@ | @@ -3324,7 +3641,11 @@ | ||
3324 | }, | 3641 | }, |
3325 | "comment": { | 3642 | "comment": { |
3326 | "$ref": "#/definitions/SimpleComment", | 3643 | "$ref": "#/definitions/SimpleComment", |
3327 | - "description": " 评论(不一定是自己,可能是被人@到)" | 3644 | + "description": " 评论" |
3645 | + }, | ||
3646 | + "commentParent": { | ||
3647 | + "$ref": "#/definitions/SimpleComment", | ||
3648 | + "description": " 被回复的评论" | ||
3328 | } | 3649 | } |
3329 | }, | 3650 | }, |
3330 | "title": "MessageBusinessItem", | 3651 | "title": "MessageBusinessItem", |
@@ -3336,14 +3657,11 @@ | @@ -3336,14 +3657,11 @@ | ||
3336 | "userId", | 3657 | "userId", |
3337 | "recipientId", | 3658 | "recipientId", |
3338 | "articleId", | 3659 | "articleId", |
3339 | - "commentId", | ||
3340 | - "discussionId", | ||
3341 | - "discussionOpinionId", | ||
3342 | - "content", | ||
3343 | "createdAt", | 3660 | "createdAt", |
3344 | "user", | 3661 | "user", |
3345 | "article", | 3662 | "article", |
3346 | - "comment" | 3663 | + "comment", |
3664 | + "commentParent" | ||
3347 | ] | 3665 | ] |
3348 | }, | 3666 | }, |
3349 | "MessageBusinessResponse": { | 3667 | "MessageBusinessResponse": { |
@@ -3637,12 +3955,17 @@ | @@ -3637,12 +3955,17 @@ | ||
3637 | "location": { | 3955 | "location": { |
3638 | "$ref": "#/definitions/Location", | 3956 | "$ref": "#/definitions/Location", |
3639 | "description": "定位坐标" | 3957 | "description": "定位坐标" |
3958 | + }, | ||
3959 | + "matchUrl": { | ||
3960 | + "type": "object", | ||
3961 | + "description": " 匹配文章内容中的url文本" | ||
3640 | } | 3962 | } |
3641 | }, | 3963 | }, |
3642 | "title": "MiniArticleCreateRequest", | 3964 | "title": "MiniArticleCreateRequest", |
3643 | "required": [ | 3965 | "required": [ |
3644 | "title", | 3966 | "title", |
3645 | - "section" | 3967 | + "section", |
3968 | + "matchUrl" | ||
3646 | ] | 3969 | ] |
3647 | }, | 3970 | }, |
3648 | "MiniArticleCreateResponse": { | 3971 | "MiniArticleCreateResponse": { |
@@ -3712,6 +4035,10 @@ | @@ -3712,6 +4035,10 @@ | ||
3712 | "location": { | 4035 | "location": { |
3713 | "$ref": "#/definitions/Location", | 4036 | "$ref": "#/definitions/Location", |
3714 | "description": " 坐标" | 4037 | "description": " 坐标" |
4038 | + }, | ||
4039 | + "matchUrl": { | ||
4040 | + "type": "object", | ||
4041 | + "description": " 匹配文章内容中的url文本" | ||
3715 | } | 4042 | } |
3716 | }, | 4043 | }, |
3717 | "title": "MiniArticleDraftCreateRequest", | 4044 | "title": "MiniArticleDraftCreateRequest", |
@@ -3722,7 +4049,8 @@ | @@ -3722,7 +4049,8 @@ | ||
3722 | "images", | 4049 | "images", |
3723 | "whoRead", | 4050 | "whoRead", |
3724 | "whoReview", | 4051 | "whoReview", |
3725 | - "location" | 4052 | + "location", |
4053 | + "matchUrl" | ||
3726 | ] | 4054 | ] |
3727 | }, | 4055 | }, |
3728 | "MiniArticleDraftCreateResponse": { | 4056 | "MiniArticleDraftCreateResponse": { |
@@ -3846,6 +4174,9 @@ | @@ -3846,6 +4174,9 @@ | ||
3846 | "location": { | 4174 | "location": { |
3847 | "$ref": "#/definitions/Location", | 4175 | "$ref": "#/definitions/Location", |
3848 | "description": " 坐标" | 4176 | "description": " 坐标" |
4177 | + }, | ||
4178 | + "matchUrl": { | ||
4179 | + "type": "object" | ||
3849 | } | 4180 | } |
3850 | }, | 4181 | }, |
3851 | "title": "MiniArticleDraftGetMeResponse", | 4182 | "title": "MiniArticleDraftGetMeResponse", |
@@ -3857,7 +4188,8 @@ | @@ -3857,7 +4188,8 @@ | ||
3857 | "images", | 4188 | "images", |
3858 | "whoRead", | 4189 | "whoRead", |
3859 | "whoReview", | 4190 | "whoReview", |
3860 | - "location" | 4191 | + "location", |
4192 | + "matchUrl" | ||
3861 | ] | 4193 | ] |
3862 | }, | 4194 | }, |
3863 | "MiniArticleDraftItem": { | 4195 | "MiniArticleDraftItem": { |
@@ -3893,6 +4225,10 @@ | @@ -3893,6 +4225,10 @@ | ||
3893 | "createdAt": { | 4225 | "createdAt": { |
3894 | "type": "integer", | 4226 | "type": "integer", |
3895 | "format": "int64" | 4227 | "format": "int64" |
4228 | + }, | ||
4229 | + "matchUrl": { | ||
4230 | + "type": "object", | ||
4231 | + "description": "匹配内容中的url文本" | ||
3896 | } | 4232 | } |
3897 | }, | 4233 | }, |
3898 | "title": "MiniArticleDraftItem", | 4234 | "title": "MiniArticleDraftItem", |
@@ -3902,7 +4238,8 @@ | @@ -3902,7 +4238,8 @@ | ||
3902 | "section", | 4238 | "section", |
3903 | "title", | 4239 | "title", |
3904 | "images", | 4240 | "images", |
3905 | - "createdAt" | 4241 | + "createdAt", |
4242 | + "matchUrl" | ||
3906 | ] | 4243 | ] |
3907 | }, | 4244 | }, |
3908 | "MiniArticleDraftSearchMeRequest": { | 4245 | "MiniArticleDraftSearchMeRequest": { |
@@ -4011,6 +4348,10 @@ | @@ -4011,6 +4348,10 @@ | ||
4011 | "location": { | 4348 | "location": { |
4012 | "$ref": "#/definitions/Location", | 4349 | "$ref": "#/definitions/Location", |
4013 | "description": " 坐标" | 4350 | "description": " 坐标" |
4351 | + }, | ||
4352 | + "matchUrl": { | ||
4353 | + "type": "object", | ||
4354 | + "description": " 匹配文章内容中的url文本" | ||
4014 | } | 4355 | } |
4015 | }, | 4356 | }, |
4016 | "title": "MiniArticleDraftUpdateRequest", | 4357 | "title": "MiniArticleDraftUpdateRequest", |
@@ -4022,7 +4363,8 @@ | @@ -4022,7 +4363,8 @@ | ||
4022 | "images", | 4363 | "images", |
4023 | "whoRead", | 4364 | "whoRead", |
4024 | "whoReview", | 4365 | "whoReview", |
4025 | - "location" | 4366 | + "location", |
4367 | + "matchUrl" | ||
4026 | ] | 4368 | ] |
4027 | }, | 4369 | }, |
4028 | "MiniArticleDraftUpdateResponse": { | 4370 | "MiniArticleDraftUpdateResponse": { |
@@ -4102,6 +4444,13 @@ | @@ -4102,6 +4444,13 @@ | ||
4102 | }, | 4444 | }, |
4103 | "description": "图片" | 4445 | "description": "图片" |
4104 | }, | 4446 | }, |
4447 | + "videos": { | ||
4448 | + "type": "array", | ||
4449 | + "items": { | ||
4450 | + "$ref": "#/definitions/Video" | ||
4451 | + }, | ||
4452 | + "description": "视频" | ||
4453 | + }, | ||
4105 | "whoRead": { | 4454 | "whoRead": { |
4106 | "type": "array", | 4455 | "type": "array", |
4107 | "items": { | 4456 | "items": { |
@@ -4163,6 +4512,10 @@ | @@ -4163,6 +4512,10 @@ | ||
4163 | "type": "string" | 4512 | "type": "string" |
4164 | }, | 4513 | }, |
4165 | "description": " 文章的标签" | 4514 | "description": " 文章的标签" |
4515 | + }, | ||
4516 | + "matchUrl": { | ||
4517 | + "type": "object", | ||
4518 | + "description": " 匹配文章内容中的url文本" | ||
4166 | } | 4519 | } |
4167 | }, | 4520 | }, |
4168 | "title": "MiniArticleGetResponse", | 4521 | "title": "MiniArticleGetResponse", |
@@ -4174,6 +4527,7 @@ | @@ -4174,6 +4527,7 @@ | ||
4174 | "createdAt", | 4527 | "createdAt", |
4175 | "section", | 4528 | "section", |
4176 | "images", | 4529 | "images", |
4530 | + "videos", | ||
4177 | "whoRead", | 4531 | "whoRead", |
4178 | "whoReview", | 4532 | "whoReview", |
4179 | "location", | 4533 | "location", |
@@ -4184,7 +4538,8 @@ | @@ -4184,7 +4538,8 @@ | ||
4184 | "edit", | 4538 | "edit", |
4185 | "meLoveFlag", | 4539 | "meLoveFlag", |
4186 | "meFollowFlag", | 4540 | "meFollowFlag", |
4187 | - "tags" | 4541 | + "tags", |
4542 | + "matchUrl" | ||
4188 | ] | 4543 | ] |
4189 | }, | 4544 | }, |
4190 | "MiniArticleMarkItem": { | 4545 | "MiniArticleMarkItem": { |
@@ -4369,8 +4724,11 @@ | @@ -4369,8 +4724,11 @@ | ||
4369 | "description": " 文章id" | 4724 | "description": " 文章id" |
4370 | }, | 4725 | }, |
4371 | "tagId": { | 4726 | "tagId": { |
4727 | + "type": "array", | ||
4728 | + "items": { | ||
4372 | "type": "integer", | 4729 | "type": "integer", |
4373 | - "format": "int64", | 4730 | + "format": "int64" |
4731 | + }, | ||
4374 | "description": " 标签id" | 4732 | "description": " 标签id" |
4375 | } | 4733 | } |
4376 | }, | 4734 | }, |
@@ -4384,15 +4742,56 @@ | @@ -4384,15 +4742,56 @@ | ||
4384 | "type": "object", | 4742 | "type": "object", |
4385 | "properties": { | 4743 | "properties": { |
4386 | "id": { | 4744 | "id": { |
4745 | + "type": "array", | ||
4746 | + "items": { | ||
4387 | "type": "integer", | 4747 | "type": "integer", |
4388 | "format": "int64" | 4748 | "format": "int64" |
4389 | } | 4749 | } |
4750 | + } | ||
4390 | }, | 4751 | }, |
4391 | "title": "MiniArticleSetTagResponse", | 4752 | "title": "MiniArticleSetTagResponse", |
4392 | "required": [ | 4753 | "required": [ |
4393 | "id" | 4754 | "id" |
4394 | ] | 4755 | ] |
4395 | }, | 4756 | }, |
4757 | + "MiniBeLikedRequest": { | ||
4758 | + "type": "object", | ||
4759 | + "properties": { | ||
4760 | + "page": { | ||
4761 | + "type": "integer", | ||
4762 | + "format": "int32" | ||
4763 | + }, | ||
4764 | + "size": { | ||
4765 | + "type": "integer", | ||
4766 | + "format": "int32" | ||
4767 | + } | ||
4768 | + }, | ||
4769 | + "title": "MiniBeLikedRequest", | ||
4770 | + "required": [ | ||
4771 | + "page", | ||
4772 | + "size" | ||
4773 | + ] | ||
4774 | + }, | ||
4775 | + "MiniBeLikedResponse": { | ||
4776 | + "type": "object", | ||
4777 | + "properties": { | ||
4778 | + "list": { | ||
4779 | + "type": "array", | ||
4780 | + "items": { | ||
4781 | + "$ref": "#/definitions/MyBeLikedItem" | ||
4782 | + } | ||
4783 | + }, | ||
4784 | + "total": { | ||
4785 | + "type": "integer", | ||
4786 | + "format": "int64" | ||
4787 | + } | ||
4788 | + }, | ||
4789 | + "title": "MiniBeLikedResponse", | ||
4790 | + "required": [ | ||
4791 | + "list", | ||
4792 | + "total" | ||
4793 | + ] | ||
4794 | + }, | ||
4396 | "MiniCreateArticleCommentRequest": { | 4795 | "MiniCreateArticleCommentRequest": { |
4397 | "type": "object", | 4796 | "type": "object", |
4398 | "properties": { | 4797 | "properties": { |
@@ -4431,15 +4830,17 @@ | @@ -4431,15 +4830,17 @@ | ||
4431 | "$ref": "#/definitions/CommentAtWho" | 4830 | "$ref": "#/definitions/CommentAtWho" |
4432 | }, | 4831 | }, |
4433 | "description": " 填写评论时@的人" | 4832 | "description": " 填写评论时@的人" |
4833 | + }, | ||
4834 | + "matchUrl": { | ||
4835 | + "type": "object", | ||
4836 | + "description": " 评论内容中的url文本" | ||
4434 | } | 4837 | } |
4435 | }, | 4838 | }, |
4436 | "title": "MiniCreateArticleCommentRequest", | 4839 | "title": "MiniCreateArticleCommentRequest", |
4437 | "required": [ | 4840 | "required": [ |
4438 | "articleId", | 4841 | "articleId", |
4439 | "sectionId", | 4842 | "sectionId", |
4440 | - "pid", | ||
4441 | - "content", | ||
4442 | - "atWho" | 4843 | + "content" |
4443 | ] | 4844 | ] |
4444 | }, | 4845 | }, |
4445 | "MiniCreateArticleCommentResponse": { | 4846 | "MiniCreateArticleCommentResponse": { |
@@ -4511,6 +4912,10 @@ | @@ -4511,6 +4912,10 @@ | ||
4511 | }, | 4912 | }, |
4512 | "description": " 填写评论时@的人" | 4913 | "description": " 填写评论时@的人" |
4513 | }, | 4914 | }, |
4915 | + "matchUrl": { | ||
4916 | + "type": "object", | ||
4917 | + "description": " 评论内容中的url文本" | ||
4918 | + }, | ||
4514 | "createdAt": { | 4919 | "createdAt": { |
4515 | "type": "integer", | 4920 | "type": "integer", |
4516 | "format": "int64" | 4921 | "format": "int64" |
@@ -4532,6 +4937,7 @@ | @@ -4532,6 +4937,7 @@ | ||
4532 | "countUserLove", | 4937 | "countUserLove", |
4533 | "countAdminLove", | 4938 | "countAdminLove", |
4534 | "atWho", | 4939 | "atWho", |
4940 | + "matchUrl", | ||
4535 | "createdAt" | 4941 | "createdAt" |
4536 | ] | 4942 | ] |
4537 | }, | 4943 | }, |
@@ -4569,6 +4975,22 @@ | @@ -4569,6 +4975,22 @@ | ||
4569 | "id" | 4975 | "id" |
4570 | ] | 4976 | ] |
4571 | }, | 4977 | }, |
4978 | + "MiniEditUserInfoRequest": { | ||
4979 | + "type": "object", | ||
4980 | + "properties": { | ||
4981 | + "avatar": { | ||
4982 | + "$ref": "#/definitions/string" | ||
4983 | + } | ||
4984 | + }, | ||
4985 | + "title": "MiniEditUserInfoRequest", | ||
4986 | + "required": [ | ||
4987 | + "avatar" | ||
4988 | + ] | ||
4989 | + }, | ||
4990 | + "MiniEditUserInfoResponse": { | ||
4991 | + "type": "object", | ||
4992 | + "title": "MiniEditUserInfoResponse" | ||
4993 | + }, | ||
4572 | "MiniGetArticleCommentRequest": { | 4994 | "MiniGetArticleCommentRequest": { |
4573 | "type": "object", | 4995 | "type": "object", |
4574 | "properties": { | 4996 | "properties": { |
@@ -4625,26 +5047,278 @@ | @@ -4625,26 +5047,278 @@ | ||
4625 | "tags": { | 5047 | "tags": { |
4626 | "type": "array", | 5048 | "type": "array", |
4627 | "items": { | 5049 | "items": { |
4628 | - "$ref": "#/definitions/ArticleTagCount" | 5050 | + "$ref": "#/definitions/ArticleTagCount" |
5051 | + } | ||
5052 | + } | ||
5053 | + }, | ||
5054 | + "title": "MiniHomePageResponse", | ||
5055 | + "required": [ | ||
5056 | + "tagCategory", | ||
5057 | + "tags" | ||
5058 | + ] | ||
5059 | + }, | ||
5060 | + "MiniHomePageUserBeLikedRequest": { | ||
5061 | + "type": "object", | ||
5062 | + "properties": { | ||
5063 | + "userId": { | ||
5064 | + "type": "integer", | ||
5065 | + "format": "int32" | ||
5066 | + }, | ||
5067 | + "page": { | ||
5068 | + "type": "integer", | ||
5069 | + "format": "int32" | ||
5070 | + }, | ||
5071 | + "size": { | ||
5072 | + "type": "integer", | ||
5073 | + "format": "int32" | ||
5074 | + } | ||
5075 | + }, | ||
5076 | + "title": "MiniHomePageUserBeLikedRequest", | ||
5077 | + "required": [ | ||
5078 | + "userId", | ||
5079 | + "page", | ||
5080 | + "size" | ||
5081 | + ] | ||
5082 | + }, | ||
5083 | + "MiniHomePageUserBeLikedResponse": { | ||
5084 | + "type": "object", | ||
5085 | + "properties": { | ||
5086 | + "list": { | ||
5087 | + "type": "array", | ||
5088 | + "items": { | ||
5089 | + "$ref": "#/definitions/MyBeLikedItem" | ||
5090 | + } | ||
5091 | + }, | ||
5092 | + "total": { | ||
5093 | + "type": "integer", | ||
5094 | + "format": "int64" | ||
5095 | + } | ||
5096 | + }, | ||
5097 | + "title": "MiniHomePageUserBeLikedResponse", | ||
5098 | + "required": [ | ||
5099 | + "list", | ||
5100 | + "total" | ||
5101 | + ] | ||
5102 | + }, | ||
5103 | + "MiniHomePageUserFollowerSearchRequest": { | ||
5104 | + "type": "object", | ||
5105 | + "properties": { | ||
5106 | + "userId": { | ||
5107 | + "type": "integer", | ||
5108 | + "format": "int32" | ||
5109 | + }, | ||
5110 | + "page": { | ||
5111 | + "type": "integer", | ||
5112 | + "format": "int32" | ||
5113 | + }, | ||
5114 | + "size": { | ||
5115 | + "type": "integer", | ||
5116 | + "format": "int32" | ||
5117 | + } | ||
5118 | + }, | ||
5119 | + "title": "MiniHomePageUserFollowerSearchRequest", | ||
5120 | + "required": [ | ||
5121 | + "userId" | ||
5122 | + ] | ||
5123 | + }, | ||
5124 | + "MiniHomePageUserFollowerSearchResponse": { | ||
5125 | + "type": "object", | ||
5126 | + "properties": { | ||
5127 | + "users": { | ||
5128 | + "type": "array", | ||
5129 | + "items": { | ||
5130 | + "$ref": "#/definitions/UserFollowItem" | ||
5131 | + } | ||
5132 | + }, | ||
5133 | + "total": { | ||
5134 | + "type": "integer", | ||
5135 | + "format": "int64" | ||
5136 | + } | ||
5137 | + }, | ||
5138 | + "title": "MiniHomePageUserFollowerSearchResponse", | ||
5139 | + "required": [ | ||
5140 | + "users", | ||
5141 | + "total" | ||
5142 | + ] | ||
5143 | + }, | ||
5144 | + "MiniHomePageUserInfoRequest": { | ||
5145 | + "type": "object", | ||
5146 | + "properties": { | ||
5147 | + "userId": { | ||
5148 | + "type": "integer", | ||
5149 | + "format": "int64", | ||
5150 | + "description": " 用户ID" | ||
5151 | + } | ||
5152 | + }, | ||
5153 | + "title": "MiniHomePageUserInfoRequest", | ||
5154 | + "required": [ | ||
5155 | + "userId" | ||
5156 | + ] | ||
5157 | + }, | ||
5158 | + "MiniHomePageUserInfoResponse": { | ||
5159 | + "type": "object", | ||
5160 | + "properties": { | ||
5161 | + "user": { | ||
5162 | + "$ref": "#/definitions/UserItem", | ||
5163 | + "description": " 用户信息" | ||
5164 | + }, | ||
5165 | + "totalFollower": { | ||
5166 | + "type": "integer", | ||
5167 | + "format": "int32", | ||
5168 | + "description": " 关注他的人数" | ||
5169 | + }, | ||
5170 | + "totalBeLoved": { | ||
5171 | + "type": "integer", | ||
5172 | + "format": "int32", | ||
5173 | + "description": " 获赞数" | ||
5174 | + }, | ||
5175 | + "followed": { | ||
5176 | + "type": "boolean", | ||
5177 | + "format": "boolean", | ||
5178 | + "description": " 关注" | ||
5179 | + }, | ||
5180 | + "mutualFollowed": { | ||
5181 | + "type": "boolean", | ||
5182 | + "format": "boolean", | ||
5183 | + "description": " 互相关注标识" | ||
5184 | + } | ||
5185 | + }, | ||
5186 | + "title": "MiniHomePageUserInfoResponse", | ||
5187 | + "required": [ | ||
5188 | + "user", | ||
5189 | + "totalFollower", | ||
5190 | + "totalBeLoved", | ||
5191 | + "followed", | ||
5192 | + "mutualFollowed" | ||
5193 | + ] | ||
5194 | + }, | ||
5195 | + "MiniHomepageUserNewsRequest": { | ||
5196 | + "type": "object", | ||
5197 | + "properties": { | ||
5198 | + "authorId": { | ||
5199 | + "type": "integer", | ||
5200 | + "format": "int64", | ||
5201 | + "description": " 特定作者ID" | ||
5202 | + }, | ||
5203 | + "lastArticleId": { | ||
5204 | + "type": "integer", | ||
5205 | + "format": "int64", | ||
5206 | + "description": " 最后文章ID" | ||
5207 | + }, | ||
5208 | + "size": { | ||
5209 | + "type": "integer", | ||
5210 | + "format": "int32", | ||
5211 | + "description": " 数量" | ||
5212 | + }, | ||
5213 | + "orderByHotScore": { | ||
5214 | + "type": "string", | ||
5215 | + "default": "desc", | ||
5216 | + "description": " 热度排序 升序 asc 降序 desc" | ||
5217 | + }, | ||
5218 | + "keywords": { | ||
5219 | + "type": "string", | ||
5220 | + "description": " 关键字" | ||
5221 | + }, | ||
5222 | + "beginTime": { | ||
5223 | + "type": "integer", | ||
5224 | + "format": "int64", | ||
5225 | + "description": " 开始时间" | ||
5226 | + }, | ||
5227 | + "beginTime": { | ||
5228 | + "type": "integer", | ||
5229 | + "format": "int64", | ||
5230 | + "description": " 结束时间" | ||
5231 | + } | ||
5232 | + }, | ||
5233 | + "title": "MiniHomepageUserNewsRequest", | ||
5234 | + "required": [ | ||
5235 | + "authorId", | ||
5236 | + "size", | ||
5237 | + "orderByHotScore" | ||
5238 | + ] | ||
5239 | + }, | ||
5240 | + "MiniHomepageUserNewsResposne": { | ||
5241 | + "type": "object", | ||
5242 | + "properties": { | ||
5243 | + "list": { | ||
5244 | + "type": "array", | ||
5245 | + "items": { | ||
5246 | + "$ref": "#/definitions/UserNewsItem" | ||
5247 | + } | ||
5248 | + }, | ||
5249 | + "lastArticleId": { | ||
5250 | + "type": "integer", | ||
5251 | + "format": "int64", | ||
5252 | + "description": " 最后文章ID" | ||
5253 | + } | ||
5254 | + }, | ||
5255 | + "title": "MiniHomepageUserNewsResposne", | ||
5256 | + "required": [ | ||
5257 | + "list", | ||
5258 | + "lastArticleId" | ||
5259 | + ] | ||
5260 | + }, | ||
5261 | + "MiniListArticleCommentRequest": { | ||
5262 | + "type": "object", | ||
5263 | + "properties": { | ||
5264 | + "page": { | ||
5265 | + "type": "integer", | ||
5266 | + "format": "int32" | ||
5267 | + }, | ||
5268 | + "size": { | ||
5269 | + "type": "integer", | ||
5270 | + "format": "int32" | ||
5271 | + }, | ||
5272 | + "": { | ||
5273 | + "type": "integer", | ||
5274 | + "format": "int64" | ||
5275 | + }, | ||
5276 | + "": { | ||
5277 | + "type": "integer", | ||
5278 | + "format": "int64" | ||
5279 | + }, | ||
5280 | + "articleId": { | ||
5281 | + "type": "integer", | ||
5282 | + "format": "int64" | ||
5283 | + }, | ||
5284 | + "sectionId": { | ||
5285 | + "type": "integer", | ||
5286 | + "format": "int64" | ||
5287 | + } | ||
5288 | + }, | ||
5289 | + "title": "MiniListArticleCommentRequest", | ||
5290 | + "required": [ | ||
5291 | + "page", | ||
5292 | + "size", | ||
5293 | + "articleId" | ||
5294 | + ] | ||
5295 | + }, | ||
5296 | + "MiniListArticleCommentResponse": { | ||
5297 | + "type": "object", | ||
5298 | + "properties": { | ||
5299 | + "total": { | ||
5300 | + "type": "integer", | ||
5301 | + "format": "int64" | ||
5302 | + }, | ||
5303 | + "list": { | ||
5304 | + "type": "array", | ||
5305 | + "items": { | ||
5306 | + "$ref": "#/definitions/ArticleCommentAndReply" | ||
4629 | } | 5307 | } |
4630 | } | 5308 | } |
4631 | }, | 5309 | }, |
4632 | - "title": "MiniHomePageResponse", | 5310 | + "title": "MiniListArticleCommentResponse", |
4633 | "required": [ | 5311 | "required": [ |
4634 | - "tagCategory", | ||
4635 | - "tags" | 5312 | + "total", |
5313 | + "list" | ||
4636 | ] | 5314 | ] |
4637 | }, | 5315 | }, |
4638 | - "MiniListArticleCommentRequest": { | 5316 | + "MiniListReplyArticleCommentRequest": { |
4639 | "type": "object", | 5317 | "type": "object", |
4640 | "properties": { | 5318 | "properties": { |
4641 | - "page": { | ||
4642 | - "type": "integer", | ||
4643 | - "format": "int32" | ||
4644 | - }, | ||
4645 | - "size": { | 5319 | + "commentId": { |
4646 | "type": "integer", | 5320 | "type": "integer", |
4647 | - "format": "int32" | 5321 | + "format": "int64" |
4648 | }, | 5322 | }, |
4649 | "": { | 5323 | "": { |
4650 | "type": "integer", | 5324 | "type": "integer", |
@@ -4654,23 +5328,23 @@ | @@ -4654,23 +5328,23 @@ | ||
4654 | "type": "integer", | 5328 | "type": "integer", |
4655 | "format": "int64" | 5329 | "format": "int64" |
4656 | }, | 5330 | }, |
4657 | - "articleId": { | 5331 | + "page": { |
4658 | "type": "integer", | 5332 | "type": "integer", |
4659 | - "format": "int64" | 5333 | + "format": "int32" |
4660 | }, | 5334 | }, |
4661 | - "sectionId": { | 5335 | + "size": { |
4662 | "type": "integer", | 5336 | "type": "integer", |
4663 | - "format": "int64" | 5337 | + "format": "int32" |
4664 | } | 5338 | } |
4665 | }, | 5339 | }, |
4666 | - "title": "MiniListArticleCommentRequest", | 5340 | + "title": "MiniListReplyArticleCommentRequest", |
4667 | "required": [ | 5341 | "required": [ |
5342 | + "commentId", | ||
4668 | "page", | 5343 | "page", |
4669 | - "size", | ||
4670 | - "articleId" | 5344 | + "size" |
4671 | ] | 5345 | ] |
4672 | }, | 5346 | }, |
4673 | - "MiniListArticleCommentResponse": { | 5347 | + "MiniListReplyArticleCommentResponse": { |
4674 | "type": "object", | 5348 | "type": "object", |
4675 | "properties": { | 5349 | "properties": { |
4676 | "total": { | 5350 | "total": { |
@@ -4680,11 +5354,11 @@ | @@ -4680,11 +5354,11 @@ | ||
4680 | "list": { | 5354 | "list": { |
4681 | "type": "array", | 5355 | "type": "array", |
4682 | "items": { | 5356 | "items": { |
4683 | - "$ref": "#/definitions/ArticleCommentAndReply" | 5357 | + "$ref": "#/definitions/ArticleCommentItem" |
4684 | } | 5358 | } |
4685 | } | 5359 | } |
4686 | }, | 5360 | }, |
4687 | - "title": "MiniListArticleCommentResponse", | 5361 | + "title": "MiniListReplyArticleCommentResponse", |
4688 | "required": [ | 5362 | "required": [ |
4689 | "total", | 5363 | "total", |
4690 | "list" | 5364 | "list" |
@@ -4728,6 +5402,24 @@ | @@ -4728,6 +5402,24 @@ | ||
4728 | "total" | 5402 | "total" |
4729 | ] | 5403 | ] |
4730 | }, | 5404 | }, |
5405 | + "MiniQrCodeRequest": { | ||
5406 | + "type": "object", | ||
5407 | + "properties": { | ||
5408 | + "page": { | ||
5409 | + "type": "string", | ||
5410 | + "description": " 微信页面入口" | ||
5411 | + }, | ||
5412 | + "scene": { | ||
5413 | + "type": "string", | ||
5414 | + "description": " 参数" | ||
5415 | + } | ||
5416 | + }, | ||
5417 | + "title": "MiniQrCodeRequest", | ||
5418 | + "required": [ | ||
5419 | + "page", | ||
5420 | + "scene" | ||
5421 | + ] | ||
5422 | + }, | ||
4731 | "MiniSearchArticleItem": { | 5423 | "MiniSearchArticleItem": { |
4732 | "type": "object", | 5424 | "type": "object", |
4733 | "properties": { | 5425 | "properties": { |
@@ -4738,6 +5430,10 @@ | @@ -4738,6 +5430,10 @@ | ||
4738 | "title": { | 5430 | "title": { |
4739 | "type": "string" | 5431 | "type": "string" |
4740 | }, | 5432 | }, |
5433 | + "authorId": { | ||
5434 | + "type": "integer", | ||
5435 | + "format": "int64" | ||
5436 | + }, | ||
4741 | "author": { | 5437 | "author": { |
4742 | "type": "string", | 5438 | "type": "string", |
4743 | "description": " 发布人" | 5439 | "description": " 发布人" |
@@ -4766,6 +5462,7 @@ | @@ -4766,6 +5462,7 @@ | ||
4766 | "required": [ | 5462 | "required": [ |
4767 | "articleId", | 5463 | "articleId", |
4768 | "title", | 5464 | "title", |
5465 | + "authorId", | ||
4769 | "author", | 5466 | "author", |
4770 | "avatar", | 5467 | "avatar", |
4771 | "images", | 5468 | "images", |
@@ -5281,10 +5978,61 @@ | @@ -5281,10 +5978,61 @@ | ||
5281 | "type": "integer", | 5978 | "type": "integer", |
5282 | "format": "int64", | 5979 | "format": "int64", |
5283 | "description": " 按角色角色关联的用户" | 5980 | "description": " 按角色角色关联的用户" |
5981 | + }, | ||
5982 | + "keywords": { | ||
5983 | + "type": "string", | ||
5984 | + "description": " 按关键字搜索(名称)" | ||
5284 | } | 5985 | } |
5285 | }, | 5986 | }, |
5286 | "title": "MiniUsersListRequest" | 5987 | "title": "MiniUsersListRequest" |
5287 | }, | 5988 | }, |
5989 | + "MyBeLikedItem": { | ||
5990 | + "type": "object", | ||
5991 | + "properties": { | ||
5992 | + "userId": { | ||
5993 | + "type": "integer", | ||
5994 | + "format": "int64", | ||
5995 | + "description": " 点赞人id" | ||
5996 | + }, | ||
5997 | + "articleId": { | ||
5998 | + "type": "integer", | ||
5999 | + "format": "int64", | ||
6000 | + "description": " 文章id" | ||
6001 | + }, | ||
6002 | + "commentId": { | ||
6003 | + "type": "integer", | ||
6004 | + "format": "int64", | ||
6005 | + "description": " 评论id" | ||
6006 | + }, | ||
6007 | + "createdAt": { | ||
6008 | + "type": "integer", | ||
6009 | + "format": "int64", | ||
6010 | + "description": " 创建时间" | ||
6011 | + }, | ||
6012 | + "user": { | ||
6013 | + "$ref": "#/definitions/SimpleUser", | ||
6014 | + "description": " 点赞人" | ||
6015 | + }, | ||
6016 | + "article": { | ||
6017 | + "$ref": "#/definitions/SimpleArticle", | ||
6018 | + "description": " 文章" | ||
6019 | + }, | ||
6020 | + "comment": { | ||
6021 | + "$ref": "#/definitions/SimpleComment", | ||
6022 | + "description": " 评论" | ||
6023 | + } | ||
6024 | + }, | ||
6025 | + "title": "MyBeLikedItem", | ||
6026 | + "required": [ | ||
6027 | + "userId", | ||
6028 | + "articleId", | ||
6029 | + "commentId", | ||
6030 | + "createdAt", | ||
6031 | + "user", | ||
6032 | + "article", | ||
6033 | + "comment" | ||
6034 | + ] | ||
6035 | + }, | ||
5288 | "MyLikeItem": { | 6036 | "MyLikeItem": { |
5289 | "type": "object", | 6037 | "type": "object", |
5290 | "properties": { | 6038 | "properties": { |
@@ -5602,29 +6350,42 @@ | @@ -5602,29 +6350,42 @@ | ||
5602 | "type": "string", | 6350 | "type": "string", |
5603 | "description": " 评论内容" | 6351 | "description": " 评论内容" |
5604 | }, | 6352 | }, |
5605 | - "countLove": { | 6353 | + "show": { |
5606 | "type": "integer", | 6354 | "type": "integer", |
5607 | "format": "int32", | 6355 | "format": "int32", |
5608 | - "description": " 点赞数量" | 6356 | + "description": " 评论的展示状态(0显示、1不显示)" |
5609 | }, | 6357 | }, |
5610 | - "countComment": { | 6358 | + "atWho": { |
6359 | + "type": "array", | ||
6360 | + "items": { | ||
6361 | + "$ref": "#/definitions/CommentAtWho" | ||
6362 | + }, | ||
6363 | + "description": " 填写评论时@的人" | ||
6364 | + }, | ||
6365 | + "matchUrl": { | ||
6366 | + "type": "object", | ||
6367 | + "description": " 评论内容中的url文本" | ||
6368 | + }, | ||
6369 | + "countReply": { | ||
5611 | "type": "integer", | 6370 | "type": "integer", |
5612 | "format": "int32", | 6371 | "format": "int32", |
5613 | - "description": " 评论数量" | 6372 | + "description": " 用户回复数量" |
5614 | }, | 6373 | }, |
5615 | - "show": { | 6374 | + "countUserLove": { |
5616 | "type": "integer", | 6375 | "type": "integer", |
5617 | "format": "int32", | 6376 | "format": "int32", |
5618 | - "description": " 评论的展示状态(0显示、1不显示)" | 6377 | + "description": " 用户点赞数量" |
5619 | } | 6378 | } |
5620 | }, | 6379 | }, |
5621 | "title": "SimpleComment", | 6380 | "title": "SimpleComment", |
5622 | "required": [ | 6381 | "required": [ |
5623 | "id", | 6382 | "id", |
5624 | "content", | 6383 | "content", |
5625 | - "countLove", | ||
5626 | - "countComment", | ||
5627 | - "show" | 6384 | + "show", |
6385 | + "atWho", | ||
6386 | + "matchUrl", | ||
6387 | + "countReply", | ||
6388 | + "countUserLove" | ||
5628 | ] | 6389 | ] |
5629 | }, | 6390 | }, |
5630 | "SimpleUser": { | 6391 | "SimpleUser": { |
@@ -5744,6 +6505,17 @@ | @@ -5744,6 +6505,17 @@ | ||
5744 | "type": "string", | 6505 | "type": "string", |
5745 | "description": " 评论的内容" | 6506 | "description": " 评论的内容" |
5746 | }, | 6507 | }, |
6508 | + "atWho": { | ||
6509 | + "type": "array", | ||
6510 | + "items": { | ||
6511 | + "$ref": "#/definitions/CommentAtWho" | ||
6512 | + }, | ||
6513 | + "description": " 填写评论时@的人" | ||
6514 | + }, | ||
6515 | + "matchUrl": { | ||
6516 | + "type": "object", | ||
6517 | + "description": " 评论内容中的url文本" | ||
6518 | + }, | ||
5747 | "show": { | 6519 | "show": { |
5748 | "type": "integer", | 6520 | "type": "integer", |
5749 | "format": "int32", | 6521 | "format": "int32", |
@@ -5764,6 +6536,8 @@ | @@ -5764,6 +6536,8 @@ | ||
5764 | "countAdminLove", | 6536 | "countAdminLove", |
5765 | "createdAt", | 6537 | "createdAt", |
5766 | "content", | 6538 | "content", |
6539 | + "atWho", | ||
6540 | + "matchUrl", | ||
5767 | "show" | 6541 | "show" |
5768 | ] | 6542 | ] |
5769 | }, | 6543 | }, |
@@ -5843,7 +6617,8 @@ | @@ -5843,7 +6617,8 @@ | ||
5843 | "description": " 文章顶层ID" | 6617 | "description": " 文章顶层ID" |
5844 | }, | 6618 | }, |
5845 | "author": { | 6619 | "author": { |
5846 | - "type": "string", | 6620 | + "type": "integer", |
6621 | + "format": "int64", | ||
5847 | "description": " 用户" | 6622 | "description": " 用户" |
5848 | }, | 6623 | }, |
5849 | "show": { | 6624 | "show": { |
@@ -5943,6 +6718,12 @@ | @@ -5943,6 +6718,12 @@ | ||
5943 | }, | 6718 | }, |
5944 | "description": " 图片" | 6719 | "description": " 图片" |
5945 | }, | 6720 | }, |
6721 | + "video": { | ||
6722 | + "type": "array", | ||
6723 | + "items": { | ||
6724 | + "$ref": "#/definitions/Video" | ||
6725 | + } | ||
6726 | + }, | ||
5946 | "whoRead": { | 6727 | "whoRead": { |
5947 | "type": "array", | 6728 | "type": "array", |
5948 | "items": { | 6729 | "items": { |
@@ -5999,6 +6780,7 @@ | @@ -5999,6 +6780,7 @@ | ||
5999 | "createdAt", | 6780 | "createdAt", |
6000 | "section", | 6781 | "section", |
6001 | "images", | 6782 | "images", |
6783 | + "video", | ||
6002 | "whoRead", | 6784 | "whoRead", |
6003 | "whoReadInfo", | 6785 | "whoReadInfo", |
6004 | "whoReview", | 6786 | "whoReview", |
@@ -6066,6 +6848,13 @@ | @@ -6066,6 +6848,13 @@ | ||
6066 | }, | 6848 | }, |
6067 | "description": " 图片" | 6849 | "description": " 图片" |
6068 | }, | 6850 | }, |
6851 | + "videos": { | ||
6852 | + "type": "array", | ||
6853 | + "items": { | ||
6854 | + "$ref": "#/definitions/Video" | ||
6855 | + }, | ||
6856 | + "description": " 视频" | ||
6857 | + }, | ||
6069 | "whoRead": { | 6858 | "whoRead": { |
6070 | "type": "array", | 6859 | "type": "array", |
6071 | "items": { | 6860 | "items": { |
@@ -6142,6 +6931,7 @@ | @@ -6142,6 +6931,7 @@ | ||
6142 | "createdAt", | 6931 | "createdAt", |
6143 | "section", | 6932 | "section", |
6144 | "images", | 6933 | "images", |
6934 | + "videos", | ||
6145 | "whoRead", | 6935 | "whoRead", |
6146 | "whoReadInfo", | 6936 | "whoReadInfo", |
6147 | "whoReview", | 6937 | "whoReview", |
@@ -6296,6 +7086,11 @@ | @@ -6296,6 +7086,11 @@ | ||
6296 | "type": "string", | 7086 | "type": "string", |
6297 | "description": "标题" | 7087 | "description": "标题" |
6298 | }, | 7088 | }, |
7089 | + "authorId": { | ||
7090 | + "type": "integer", | ||
7091 | + "format": "int64", | ||
7092 | + "description": "发布人ID" | ||
7093 | + }, | ||
6299 | "author": { | 7094 | "author": { |
6300 | "type": "string", | 7095 | "type": "string", |
6301 | "description": "发布人" | 7096 | "description": "发布人" |
@@ -6317,7 +7112,7 @@ | @@ -6317,7 +7112,7 @@ | ||
6317 | "format": "int32", | 7112 | "format": "int32", |
6318 | "description": "点赞数量" | 7113 | "description": "点赞数量" |
6319 | }, | 7114 | }, |
6320 | - "CountComment": { | 7115 | + "countComment": { |
6321 | "type": "integer", | 7116 | "type": "integer", |
6322 | "format": "int32", | 7117 | "format": "int32", |
6323 | "description": "评论数量" | 7118 | "description": "评论数量" |
@@ -6344,11 +7139,12 @@ | @@ -6344,11 +7139,12 @@ | ||
6344 | "required": [ | 7139 | "required": [ |
6345 | "id", | 7140 | "id", |
6346 | "title", | 7141 | "title", |
7142 | + "authorId", | ||
6347 | "author", | 7143 | "author", |
6348 | "images", | 7144 | "images", |
6349 | "createdAt", | 7145 | "createdAt", |
6350 | "countLove", | 7146 | "countLove", |
6351 | - "CountComment", | 7147 | + "countComment", |
6352 | "show", | 7148 | "show", |
6353 | "tags", | 7149 | "tags", |
6354 | "targetUser" | 7150 | "targetUser" |
@@ -6420,7 +7216,8 @@ | @@ -6420,7 +7216,8 @@ | ||
6420 | "description": "标题" | 7216 | "description": "标题" |
6421 | }, | 7217 | }, |
6422 | "author": { | 7218 | "author": { |
6423 | - "type": "string", | 7219 | + "type": "integer", |
7220 | + "format": "int64", | ||
6424 | "description": "发布人" | 7221 | "description": "发布人" |
6425 | }, | 7222 | }, |
6426 | "beginTime": { | 7223 | "beginTime": { |
@@ -6512,6 +7309,13 @@ | @@ -6512,6 +7309,13 @@ | ||
6512 | }, | 7309 | }, |
6513 | "description": " 图片" | 7310 | "description": " 图片" |
6514 | }, | 7311 | }, |
7312 | + "video": { | ||
7313 | + "type": "array", | ||
7314 | + "items": { | ||
7315 | + "$ref": "#/definitions/Video" | ||
7316 | + }, | ||
7317 | + "description": " 视频" | ||
7318 | + }, | ||
6515 | "whoRead": { | 7319 | "whoRead": { |
6516 | "type": "array", | 7320 | "type": "array", |
6517 | "items": { | 7321 | "items": { |
@@ -6553,6 +7357,7 @@ | @@ -6553,6 +7357,7 @@ | ||
6553 | "section", | 7357 | "section", |
6554 | "title", | 7358 | "title", |
6555 | "images", | 7359 | "images", |
7360 | + "video", | ||
6556 | "whoRead", | 7361 | "whoRead", |
6557 | "whoReview", | 7362 | "whoReview", |
6558 | "targetUser", | 7363 | "targetUser", |
@@ -6593,6 +7398,13 @@ | @@ -6593,6 +7398,13 @@ | ||
6593 | "format": "int32", | 7398 | "format": "int32", |
6594 | "description": "点赞数量" | 7399 | "description": "点赞数量" |
6595 | }, | 7400 | }, |
7401 | + "video": { | ||
7402 | + "type": "array", | ||
7403 | + "items": { | ||
7404 | + "$ref": "#/definitions/Video" | ||
7405 | + }, | ||
7406 | + "description": " 视频" | ||
7407 | + }, | ||
6596 | "countComment": { | 7408 | "countComment": { |
6597 | "type": "integer", | 7409 | "type": "integer", |
6598 | "format": "int32", | 7410 | "format": "int32", |
@@ -6625,6 +7437,7 @@ | @@ -6625,6 +7437,7 @@ | ||
6625 | "images", | 7437 | "images", |
6626 | "createdAt", | 7438 | "createdAt", |
6627 | "countLove", | 7439 | "countLove", |
7440 | + "video", | ||
6628 | "countComment", | 7441 | "countComment", |
6629 | "show", | 7442 | "show", |
6630 | "tags", | 7443 | "tags", |
@@ -6712,6 +7525,40 @@ | @@ -6712,6 +7525,40 @@ | ||
6712 | "countAdminLove" | 7525 | "countAdminLove" |
6713 | ] | 7526 | ] |
6714 | }, | 7527 | }, |
7528 | + "SystemEditCommentLoveRequest": { | ||
7529 | + "type": "object", | ||
7530 | + "properties": { | ||
7531 | + "": { | ||
7532 | + "type": "integer", | ||
7533 | + "format": "int64" | ||
7534 | + }, | ||
7535 | + "paramList": { | ||
7536 | + "type": "array", | ||
7537 | + "items": { | ||
7538 | + "$ref": "#/definitions/SystemEditLove" | ||
7539 | + } | ||
7540 | + } | ||
7541 | + }, | ||
7542 | + "title": "SystemEditCommentLoveRequest", | ||
7543 | + "required": [ | ||
7544 | + "paramList" | ||
7545 | + ] | ||
7546 | + }, | ||
7547 | + "SystemEditCommentLoveResponse": { | ||
7548 | + "type": "object", | ||
7549 | + "properties": { | ||
7550 | + "paramList": { | ||
7551 | + "type": "array", | ||
7552 | + "items": { | ||
7553 | + "$ref": "#/definitions/SystemEditLove" | ||
7554 | + } | ||
7555 | + } | ||
7556 | + }, | ||
7557 | + "title": "SystemEditCommentLoveResponse", | ||
7558 | + "required": [ | ||
7559 | + "paramList" | ||
7560 | + ] | ||
7561 | + }, | ||
6715 | "SystemEditCommentRequest": { | 7562 | "SystemEditCommentRequest": { |
6716 | "type": "object", | 7563 | "type": "object", |
6717 | "properties": { | 7564 | "properties": { |
@@ -6728,6 +7575,9 @@ | @@ -6728,6 +7575,9 @@ | ||
6728 | "format": "int32", | 7575 | "format": "int32", |
6729 | "description": "[1 显示评论] [2: 隐藏评论]" | 7576 | "description": "[1 显示评论] [2: 隐藏评论]" |
6730 | }, | 7577 | }, |
7578 | + "content": { | ||
7579 | + "type": "string" | ||
7580 | + }, | ||
6731 | "countAdminLove": { | 7581 | "countAdminLove": { |
6732 | "type": "integer", | 7582 | "type": "integer", |
6733 | "format": "int32" | 7583 | "format": "int32" |
@@ -6794,6 +7644,23 @@ | @@ -6794,6 +7644,23 @@ | ||
6794 | "id" | 7644 | "id" |
6795 | ] | 7645 | ] |
6796 | }, | 7646 | }, |
7647 | + "SystemEditLove": { | ||
7648 | + "type": "object", | ||
7649 | + "properties": { | ||
7650 | + "id": { | ||
7651 | + "type": "integer", | ||
7652 | + "format": "int64" | ||
7653 | + }, | ||
7654 | + "countAdminLove": { | ||
7655 | + "type": "integer", | ||
7656 | + "format": "int32" | ||
7657 | + } | ||
7658 | + }, | ||
7659 | + "title": "SystemEditLove", | ||
7660 | + "required": [ | ||
7661 | + "id" | ||
7662 | + ] | ||
7663 | + }, | ||
6797 | "SystemGetCommentRequest": { | 7664 | "SystemGetCommentRequest": { |
6798 | "type": "object", | 7665 | "type": "object", |
6799 | "properties": { | 7666 | "properties": { |
@@ -6917,8 +7784,9 @@ | @@ -6917,8 +7784,9 @@ | ||
6917 | "format": "int64", | 7784 | "format": "int64", |
6918 | "description": " 评论的顶层ID" | 7785 | "description": " 评论的顶层ID" |
6919 | }, | 7786 | }, |
6920 | - "fromUser": { | ||
6921 | - "type": "string", | 7787 | + "fromUserId": { |
7788 | + "type": "integer", | ||
7789 | + "format": "int64", | ||
6922 | "description": " 用户" | 7790 | "description": " 用户" |
6923 | }, | 7791 | }, |
6924 | "show": { | 7792 | "show": { |
@@ -7430,6 +8298,11 @@ | @@ -7430,6 +8298,11 @@ | ||
7430 | }, | 8298 | }, |
7431 | "other": { | 8299 | "other": { |
7432 | "type": "string" | 8300 | "type": "string" |
8301 | + }, | ||
8302 | + "sortBy": { | ||
8303 | + "type": "integer", | ||
8304 | + "format": "int32", | ||
8305 | + "description": "排序" | ||
7433 | } | 8306 | } |
7434 | }, | 8307 | }, |
7435 | "title": "TagCreateRequest", | 8308 | "title": "TagCreateRequest", |
@@ -7510,6 +8383,11 @@ | @@ -7510,6 +8383,11 @@ | ||
7510 | }, | 8383 | }, |
7511 | "other": { | 8384 | "other": { |
7512 | "type": "string" | 8385 | "type": "string" |
8386 | + }, | ||
8387 | + "sortBy": { | ||
8388 | + "type": "integer", | ||
8389 | + "format": "int32", | ||
8390 | + "description": " 排序" | ||
7513 | } | 8391 | } |
7514 | }, | 8392 | }, |
7515 | "title": "TagEditRequest", | 8393 | "title": "TagEditRequest", |
@@ -7574,6 +8452,11 @@ | @@ -7574,6 +8452,11 @@ | ||
7574 | }, | 8452 | }, |
7575 | "other": { | 8453 | "other": { |
7576 | "type": "string" | 8454 | "type": "string" |
8455 | + }, | ||
8456 | + "sortBy": { | ||
8457 | + "type": "integer", | ||
8458 | + "format": "int32", | ||
8459 | + "description": " 排序" | ||
7577 | } | 8460 | } |
7578 | }, | 8461 | }, |
7579 | "title": "TagGetResponse", | 8462 | "title": "TagGetResponse", |
@@ -7611,6 +8494,11 @@ | @@ -7611,6 +8494,11 @@ | ||
7611 | "createdAt": { | 8494 | "createdAt": { |
7612 | "type": "integer", | 8495 | "type": "integer", |
7613 | "format": "int64" | 8496 | "format": "int64" |
8497 | + }, | ||
8498 | + "sortBy": { | ||
8499 | + "type": "integer", | ||
8500 | + "format": "int32", | ||
8501 | + "description": " 排序" | ||
7614 | } | 8502 | } |
7615 | }, | 8503 | }, |
7616 | "title": "TagItem", | 8504 | "title": "TagItem", |
@@ -7846,6 +8734,11 @@ | @@ -7846,6 +8734,11 @@ | ||
7846 | "$ref": "#/definitions/int", | 8734 | "$ref": "#/definitions/int", |
7847 | "description": " 审核状态 0:待审核 1:审核通过 2:拒绝" | 8735 | "description": " 审核状态 0:待审核 1:审核通过 2:拒绝" |
7848 | }, | 8736 | }, |
8737 | + "auditAt": { | ||
8738 | + "type": "integer", | ||
8739 | + "format": "int64", | ||
8740 | + "description": " 审核时间" | ||
8741 | + }, | ||
7849 | "followers": { | 8742 | "followers": { |
7850 | "type": "array", | 8743 | "type": "array", |
7851 | "items": { | 8744 | "items": { |
@@ -7889,6 +8782,7 @@ | @@ -7889,6 +8782,7 @@ | ||
7889 | "position", | 8782 | "position", |
7890 | "enable", | 8783 | "enable", |
7891 | "auditStatus", | 8784 | "auditStatus", |
8785 | + "auditAt", | ||
7892 | "followers", | 8786 | "followers", |
7893 | "following", | 8787 | "following", |
7894 | "departments", | 8788 | "departments", |
@@ -8027,22 +8921,58 @@ | @@ -8027,22 +8921,58 @@ | ||
8027 | "properties": { | 8921 | "properties": { |
8028 | "totalArticle": { | 8922 | "totalArticle": { |
8029 | "type": "integer", | 8923 | "type": "integer", |
8030 | - "format": "int32" | 8924 | + "format": "int32", |
8925 | + "description": " 累计发布文章" | ||
8031 | }, | 8926 | }, |
8032 | "totalComment": { | 8927 | "totalComment": { |
8033 | "type": "integer", | 8928 | "type": "integer", |
8034 | - "format": "int32" | 8929 | + "format": "int32", |
8930 | + "description": " 累计发布评论" | ||
8035 | }, | 8931 | }, |
8036 | "totalLoved": { | 8932 | "totalLoved": { |
8037 | "type": "integer", | 8933 | "type": "integer", |
8038 | - "format": "int32" | 8934 | + "format": "int32", |
8935 | + "description": " 累计赞别人" | ||
8936 | + }, | ||
8937 | + "totalBeLoved": { | ||
8938 | + "type": "integer", | ||
8939 | + "format": "int32", | ||
8940 | + "description": " 累计收到的赞" | ||
8039 | } | 8941 | } |
8040 | }, | 8942 | }, |
8041 | "title": "UserStatisticsResponse", | 8943 | "title": "UserStatisticsResponse", |
8042 | "required": [ | 8944 | "required": [ |
8043 | "totalArticle", | 8945 | "totalArticle", |
8044 | "totalComment", | 8946 | "totalComment", |
8045 | - "totalLoved" | 8947 | + "totalLoved", |
8948 | + "totalBeLoved" | ||
8949 | + ] | ||
8950 | + }, | ||
8951 | + "Video": { | ||
8952 | + "type": "object", | ||
8953 | + "properties": { | ||
8954 | + "url": { | ||
8955 | + "type": "string", | ||
8956 | + "description": "视频文件的地址" | ||
8957 | + }, | ||
8958 | + "cover": { | ||
8959 | + "type": "string", | ||
8960 | + "description": "封面" | ||
8961 | + }, | ||
8962 | + "width": { | ||
8963 | + "type": "integer", | ||
8964 | + "format": "int32", | ||
8965 | + "description": "封面图片宽" | ||
8966 | + }, | ||
8967 | + "height": { | ||
8968 | + "type": "integer", | ||
8969 | + "format": "int32", | ||
8970 | + "description": "封面图片长" | ||
8971 | + } | ||
8972 | + }, | ||
8973 | + "title": "Video", | ||
8974 | + "required": [ | ||
8975 | + "url" | ||
8046 | ] | 8976 | ] |
8047 | }, | 8977 | }, |
8048 | "WhichUserLikeArticle": { | 8978 | "WhichUserLikeArticle": { |
@@ -65,6 +65,9 @@ service Core { | @@ -65,6 +65,9 @@ service Core { | ||
65 | @handler MiniArticleBackupSearch | 65 | @handler MiniArticleBackupSearch |
66 | post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse) | 66 | post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse) |
67 | 67 | ||
68 | + @doc "小程序获取文章的编辑记录" | ||
69 | + @handler MiniGetArticleBackup | ||
70 | + get /article_backup/:id (MiniGetArticleBackupRequest) returns (MiniGetArticleBackupResponse) | ||
68 | 71 | ||
69 | @doc "小程序设置文章的定性标签" | 72 | @doc "小程序设置文章的定性标签" |
70 | @handler MiniArticleSetTag | 73 | @handler MiniArticleSetTag |
@@ -172,10 +172,36 @@ type ( | @@ -172,10 +172,36 @@ type ( | ||
172 | Title string `json:"title"` | 172 | Title string `json:"title"` |
173 | Content string `json:"content"` | 173 | Content string `json:"content"` |
174 | Images []string `json:"images"` | 174 | Images []string `json:"images"` |
175 | + Videos []Video `json:"videos"` | ||
176 | + ChangeField []string `json:"changeField"` | ||
175 | CreatedAt int64 `json:"createdAt"` | 177 | CreatedAt int64 `json:"createdAt"` |
176 | Location Location `json:"location"` | 178 | Location Location `json:"location"` |
179 | + Action string `json:"action"` | ||
180 | + Show int `json:"show"` | ||
177 | } | 181 | } |
178 | ) | 182 | ) |
183 | + | ||
184 | +type ( | ||
185 | + MiniGetArticleBackupRequest { | ||
186 | + BackupId int64 `path:"id"` | ||
187 | + CompanyId int64 `path:",optional"` // 服务端自动获取 | ||
188 | + } | ||
189 | + MiniGetArticleBackupResponse { | ||
190 | + Id int64 `json:"id"` | ||
191 | + Title string `json:"title"` | ||
192 | + Content string `json:"content"` | ||
193 | + Images []string `json:"images"` | ||
194 | + Videos []Video `json:"videos"` | ||
195 | + ChangeField []string `json:"changeField"` | ||
196 | + CreatedAt int64 `json:"createdAt"` | ||
197 | + Location Location `json:"location"` | ||
198 | + Action string `json:"action"` | ||
199 | + Show int `json:"show"` | ||
200 | + } | ||
201 | +) | ||
202 | + | ||
203 | + | ||
204 | + | ||
179 | // 标记人员浏览了那个文章 | 205 | // 标记人员浏览了那个文章 |
180 | type ( | 206 | type ( |
181 | MiniArticleMarkUserReadRequest { | 207 | MiniArticleMarkUserReadRequest { |
@@ -82,6 +82,19 @@ service Core { | @@ -82,6 +82,19 @@ service Core { | ||
82 | @doc "我被点赞-文章或评论列表" | 82 | @doc "我被点赞-文章或评论列表" |
83 | @handler miniMyBeLiked | 83 | @handler miniMyBeLiked |
84 | post /mini/user/mybeliked (MiniBeLikedRequest)returns (MiniBeLikedResponse) | 84 | post /mini/user/mybeliked (MiniBeLikedRequest)returns (MiniBeLikedResponse) |
85 | + | ||
86 | + @doc "个人主页用户信息" | ||
87 | + @handler miniHomePageUserInfo | ||
88 | + post /mini/homepage/user_info (MiniHomePageUserInfoRequest) returns (MiniHomePageUserInfoResponse) | ||
89 | + @doc "个人主页-关注我的人" | ||
90 | + @handler miniHomepageUserFollower | ||
91 | + post /mini/homepage/user_follower (MiniHomePageUserFollowerSearchRequest)returns(MiniHomePageUserFollowerSearchResponse) | ||
92 | + @doc "个人主页-获赞的列表" | ||
93 | + @handler miniHomepageUserBeLiked | ||
94 | + post /mini/homepage/user_beliked (MiniHomePageUserBeLikedRequest)returns(MiniHomePageUserBeLikedResponse) | ||
95 | + @doc "个人主页-用户发布的信息" | ||
96 | + @handler miniHomepageUserNews | ||
97 | + post /mini/homepage/user_news (MiniHomepageUserNewsRequest)returns(MiniHomepageUserNewsResposne) | ||
85 | } | 98 | } |
86 | 99 | ||
87 | type( | 100 | type( |
@@ -93,6 +106,58 @@ type( | @@ -93,6 +106,58 @@ type( | ||
93 | } | 106 | } |
94 | ) | 107 | ) |
95 | 108 | ||
109 | +// 个人主页 | ||
110 | +type( | ||
111 | + MiniHomePageUserInfoRequest { | ||
112 | + UserId int64 `json:"userId"` // 用户ID | ||
113 | + } | ||
114 | + MiniHomePageUserInfoResponse { | ||
115 | + User *UserItem `json:"user,omitempty"` // 用户信息 | ||
116 | + TotalFollower int `json:"totalFollower"` // 关注他的人数 | ||
117 | + TotalBeLoved int `json:"totalBeLoved"` // 获赞数 | ||
118 | + Followed bool `json:"followed"` // 关注 | ||
119 | + MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识 | ||
120 | + } | ||
121 | + | ||
122 | + MiniHomePageUserFollowerSearchRequest{ | ||
123 | + UserId int `json:"userId"` | ||
124 | + Page int `json:"page,optional"` | ||
125 | + Size int `json:"size,optional"` | ||
126 | + Name string `json:"name,optional"` | ||
127 | + } | ||
128 | + MiniHomePageUserFollowerSearchResponse{ | ||
129 | + List []*UserFollowItem `json:"users"` | ||
130 | + Total int64 `json:"total"` | ||
131 | + } | ||
132 | + | ||
133 | + MiniHomePageUserBeLikedRequest{ | ||
134 | + UserId int `json:"userId"` | ||
135 | + Page int `json:"page"` | ||
136 | + Size int `json:"size"` | ||
137 | + } | ||
138 | + MiniHomePageUserBeLikedResponse { | ||
139 | + List []MyBeLikedItem `json:"list"` | ||
140 | + Total int64 `json:"total"` | ||
141 | + } | ||
142 | + | ||
143 | + MiniHomepageUserNewsRequest{ | ||
144 | + AuthorId int64 `json:"authorId"` // 特定作者ID | ||
145 | + LastArticleId int64 `json:"lastArticleId,optional"`// 最后文章ID | ||
146 | + Size int `json:"size"` // 数量 | ||
147 | + //OrderByHotScore string `json:"orderByHotScore,options=asc|desc,optional,default=desc"` // 热度排序 升序 asc 降序 desc | ||
148 | + OrderByKey string `json:"orderByKey,options=HotScore|All|Time,optional,default=desc"` // 按规则排序 (热度:HotScore All:时间排序 Time:时间排序) | ||
149 | + OrderByValue string `json:"orderByValue,options=asc||desc,optional"` // 排序值 升序 asc 降序 desc | ||
150 | + Keywords string `json:"keywords,optional"` // 关键字 | ||
151 | + BeginTime int64 `json:"beginTime,optional"`// 开始时间 | ||
152 | + EndTime int64 `json:"endTime,optional"`// 结束时间 | ||
153 | + } | ||
154 | + MiniHomepageUserNewsResposne{ | ||
155 | + List []UserNewsItem `json:"list"` | ||
156 | + LastArticleId int64 `json:"lastArticleId"`// 最后文章ID | ||
157 | + Total int64 `json:"total"` | ||
158 | + } | ||
159 | +) | ||
160 | + | ||
96 | type( | 161 | type( |
97 | MiniUserLoginRequest { | 162 | MiniUserLoginRequest { |
98 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login | 163 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login |
@@ -143,6 +208,7 @@ type( | @@ -143,6 +208,7 @@ type( | ||
143 | MiniUsersListRequest{ | 208 | MiniUsersListRequest{ |
144 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) | 209 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) |
145 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 | 210 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 |
211 | + Keywords string `json:"keywords,optional"` // 按关键字搜索(名称) | ||
146 | } | 212 | } |
147 | MiniUserNewsRequest{ | 213 | MiniUserNewsRequest{ |
148 | AuthorId int64 `json:"authorId,optional"` // 特定作者ID | 214 | AuthorId int64 `json:"authorId,optional"` // 特定作者ID |
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/result" | ||
11 | +) | ||
12 | + | ||
13 | +func MiniGetArticleBackupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.MiniGetArticleBackupRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + result.HttpResult(r, w, nil, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewMiniGetArticleBackupLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.MiniGetArticleBackup(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
@@ -319,6 +319,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -319,6 +319,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
319 | Path: "/mini/user/mybeliked", | 319 | Path: "/mini/user/mybeliked", |
320 | Handler: user.MiniMyBeLikedHandler(serverCtx), | 320 | Handler: user.MiniMyBeLikedHandler(serverCtx), |
321 | }, | 321 | }, |
322 | + { | ||
323 | + Method: http.MethodPost, | ||
324 | + Path: "/mini/homepage/user_info", | ||
325 | + Handler: user.MiniHomePageUserInfoHandler(serverCtx), | ||
326 | + }, | ||
327 | + { | ||
328 | + Method: http.MethodPost, | ||
329 | + Path: "/mini/homepage/user_follower", | ||
330 | + Handler: user.MiniHomepageUserFollowerHandler(serverCtx), | ||
331 | + }, | ||
332 | + { | ||
333 | + Method: http.MethodPost, | ||
334 | + Path: "/mini/homepage/user_beliked", | ||
335 | + Handler: user.MiniHomepageUserBeLikedHandler(serverCtx), | ||
336 | + }, | ||
337 | + { | ||
338 | + Method: http.MethodPost, | ||
339 | + Path: "/mini/homepage/user_news", | ||
340 | + Handler: user.MiniHomepageUserNewsHandler(serverCtx), | ||
341 | + }, | ||
322 | }..., | 342 | }..., |
323 | ), | 343 | ), |
324 | rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | 344 | rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), |
@@ -509,6 +529,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -509,6 +529,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
509 | Handler: article.MiniArticleBackupSearchHandler(serverCtx), | 529 | Handler: article.MiniArticleBackupSearchHandler(serverCtx), |
510 | }, | 530 | }, |
511 | { | 531 | { |
532 | + Method: http.MethodGet, | ||
533 | + Path: "/article_backup/:id", | ||
534 | + Handler: article.MiniGetArticleBackupHandler(serverCtx), | ||
535 | + }, | ||
536 | + { | ||
512 | Method: http.MethodPost, | 537 | Method: http.MethodPost, |
513 | Path: "/article/set_tag", | 538 | Path: "/article/set_tag", |
514 | Handler: article.MiniArticleSetTagHandler(serverCtx), | 539 | Handler: article.MiniArticleSetTagHandler(serverCtx), |
1 | package user | 1 | package user |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
4 | "net/http" | 5 | "net/http" |
5 | 6 | ||
6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
@@ -19,10 +20,6 @@ func MiniEditUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -19,10 +20,6 @@ func MiniEditUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
19 | 20 | ||
20 | l := user.NewMiniEditUserInfoLogic(r.Context(), svcCtx) | 21 | l := user.NewMiniEditUserInfoLogic(r.Context(), svcCtx) |
21 | resp, err := l.MiniEditUserInfo(&req) | 22 | resp, err := l.MiniEditUserInfo(&req) |
22 | - if err != nil { | ||
23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
24 | - } else { | ||
25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
27 | } | 24 | } |
28 | } | 25 | } |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
5 | + "net/http" | ||
6 | + | ||
7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
11 | +) | ||
12 | + | ||
13 | +func MiniHomePageUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.MiniHomePageUserInfoRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := user.NewMiniHomePageUserInfoLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.MiniHomePageUserInfo(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
5 | + "net/http" | ||
6 | + | ||
7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
11 | +) | ||
12 | + | ||
13 | +func MiniHomepageUserBeLikedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.MiniHomePageUserBeLikedRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := user.NewMiniHomepageUserBeLikedLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.MiniHomepageUserBeLiked(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
5 | + "net/http" | ||
6 | + | ||
7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
11 | +) | ||
12 | + | ||
13 | +func MiniHomepageUserFollowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.MiniHomePageUserFollowerSearchRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := user.NewMiniHomepageUserFollowerLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.MiniHomepageUserFollower(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
5 | + "net/http" | ||
6 | + | ||
7 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
11 | +) | ||
12 | + | ||
13 | +func MiniHomepageUserNewsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.MiniHomepageUserNewsRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := user.NewMiniHomepageUserNewsLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.MiniHomepageUserNews(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
@@ -51,17 +51,31 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | @@ -51,17 +51,31 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | ||
51 | for _, val2 := range backupList[i].Images { | 51 | for _, val2 := range backupList[i].Images { |
52 | images = append(images, val2.Url) | 52 | images = append(images, val2.Url) |
53 | } | 53 | } |
54 | + | ||
55 | + videos := []types.Video{} | ||
56 | + for _, val2 := range backupList[i].Videos { | ||
57 | + videos = append(videos, types.Video{ | ||
58 | + Url: val2.Url, | ||
59 | + Cover: val2.Cover, | ||
60 | + Width: val2.Width, | ||
61 | + Height: val2.Height, | ||
62 | + }) | ||
63 | + } | ||
54 | resp.List[i] = types.MiniArticleBackupItem{ | 64 | resp.List[i] = types.MiniArticleBackupItem{ |
55 | Id: backupList[i].Id, | 65 | Id: backupList[i].Id, |
56 | Title: backupList[i].Title, | 66 | Title: backupList[i].Title, |
57 | Content: content.String(), | 67 | Content: content.String(), |
58 | Images: images, | 68 | Images: images, |
69 | + Videos: videos, | ||
59 | CreatedAt: backupList[i].CreatedAt, | 70 | CreatedAt: backupList[i].CreatedAt, |
60 | Location: types.Location{ | 71 | Location: types.Location{ |
61 | Longitude: backupList[i].Location.Longitude, | 72 | Longitude: backupList[i].Location.Longitude, |
62 | Latitude: backupList[i].Location.Latitude, | 73 | Latitude: backupList[i].Location.Latitude, |
63 | Descript: backupList[i].Location.Descript, | 74 | Descript: backupList[i].Location.Descript, |
64 | }, | 75 | }, |
76 | + ChangeField: backupList[i].ChangeField, | ||
77 | + Action: backupList[i].Action, | ||
78 | + Show: int(backupList[i].Show), | ||
65 | } | 79 | } |
66 | } | 80 | } |
67 | return resp, nil | 81 | return resp, nil |
@@ -127,7 +127,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -127,7 +127,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
127 | } | 127 | } |
128 | 128 | ||
129 | //切分文章分段 | 129 | //切分文章分段 |
130 | - sectionList := []domain.ArticleSection{} | 130 | + sectionList := []*domain.ArticleSection{} |
131 | newStr := "" | 131 | newStr := "" |
132 | for i := range req.Section { | 132 | for i := range req.Section { |
133 | strList := strings.Split(req.Section[i], "\n") | 133 | strList := strings.Split(req.Section[i], "\n") |
@@ -141,7 +141,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -141,7 +141,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
141 | SortBy: len(sectionList), | 141 | SortBy: len(sectionList), |
142 | TotalComment: 0, | 142 | TotalComment: 0, |
143 | } | 143 | } |
144 | - sectionList = append(sectionList, newSection) | 144 | + sectionList = append(sectionList, &newSection) |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
@@ -185,11 +185,19 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -185,11 +185,19 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
185 | 185 | ||
186 | for i := range sectionList { | 186 | for i := range sectionList { |
187 | sectionList[i].ArticleId = newArticle.Id | 187 | sectionList[i].ArticleId = newArticle.Id |
188 | - _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, §ionList[i]) | 188 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, sectionList[i]) |
189 | if err != nil { | 189 | if err != nil { |
190 | return xerr.NewErrMsgErr("创建文章内容失败", err) | 190 | return xerr.NewErrMsgErr("创建文章内容失败", err) |
191 | } | 191 | } |
192 | } | 192 | } |
193 | + | ||
194 | + // 生成 备份数据 | ||
195 | + var backupData domain.ArticleBackup | ||
196 | + backupData.MakeBackup(articleAuthor, newArticle, sectionList, "原始版本") | ||
197 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(l.ctx, conn, &backupData) | ||
198 | + if err != nil { | ||
199 | + return xerr.NewErrMsgErr("创建文章失败", err) | ||
200 | + } | ||
193 | return nil | 201 | return nil |
194 | }, true) | 202 | }, true) |
195 | if err != nil { | 203 | if err != nil { |
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/pkg/xerr" | ||
10 | + | ||
11 | + "github.com/zeromicro/go-zero/core/logx" | ||
12 | +) | ||
13 | + | ||
14 | +type MiniGetArticleBackupLogic struct { | ||
15 | + logx.Logger | ||
16 | + ctx context.Context | ||
17 | + svcCtx *svc.ServiceContext | ||
18 | +} | ||
19 | + | ||
20 | +func NewMiniGetArticleBackupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniGetArticleBackupLogic { | ||
21 | + return &MiniGetArticleBackupLogic{ | ||
22 | + Logger: logx.WithContext(ctx), | ||
23 | + ctx: ctx, | ||
24 | + svcCtx: svcCtx, | ||
25 | + } | ||
26 | +} | ||
27 | + | ||
28 | +func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArticleBackupRequest) (resp *types.MiniGetArticleBackupResponse, err error) { | ||
29 | + var conn = l.svcCtx.DefaultDBConn() | ||
30 | + | ||
31 | + backupInfo, err := l.svcCtx.ArticleBackupRepository.FindOne(l.ctx, conn, req.BackupId) | ||
32 | + if err != nil { | ||
33 | + return &types.MiniGetArticleBackupResponse{}, xerr.NewErrMsgErr("获取编辑记录失败", err) | ||
34 | + } | ||
35 | + | ||
36 | + content := strings.Builder{} | ||
37 | + for _, val2 := range backupInfo.Section { | ||
38 | + content.WriteString(val2.Content) | ||
39 | + } | ||
40 | + images := []string{} | ||
41 | + for _, val2 := range backupInfo.Images { | ||
42 | + images = append(images, val2.Url) | ||
43 | + } | ||
44 | + | ||
45 | + videos := []types.Video{} | ||
46 | + for _, val2 := range backupInfo.Videos { | ||
47 | + videos = append(videos, types.Video{ | ||
48 | + Url: val2.Url, | ||
49 | + Cover: val2.Cover, | ||
50 | + Width: val2.Width, | ||
51 | + Height: val2.Height, | ||
52 | + }) | ||
53 | + } | ||
54 | + | ||
55 | + resp = &types.MiniGetArticleBackupResponse{ | ||
56 | + Id: backupInfo.Id, | ||
57 | + Title: backupInfo.Title, | ||
58 | + Content: content.String(), | ||
59 | + Images: images, | ||
60 | + Videos: videos, | ||
61 | + CreatedAt: backupInfo.CreatedAt, | ||
62 | + Location: types.Location{ | ||
63 | + Longitude: backupInfo.Location.Longitude, | ||
64 | + Latitude: backupInfo.Location.Latitude, | ||
65 | + Descript: backupInfo.Location.Descript, | ||
66 | + }, | ||
67 | + ChangeField: backupInfo.ChangeField, | ||
68 | + Action: backupInfo.Action, | ||
69 | + Show: int(backupInfo.Show), | ||
70 | + } | ||
71 | + | ||
72 | + return | ||
73 | +} |
@@ -110,8 +110,8 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -110,8 +110,8 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
110 | 110 | ||
111 | follow, _ := l.svcCtx.UserFollowRepository.FindOneUserFollowing(l.ctx, conn, int64(req.UserId), articleInfo.AuthorId) | 111 | follow, _ := l.svcCtx.UserFollowRepository.FindOneUserFollowing(l.ctx, conn, int64(req.UserId), articleInfo.AuthorId) |
112 | 112 | ||
113 | - queryOption = domain.NewQueryOptions().WithFindOnly().WithOffsetLimit(1, 1).WithKV("articleId", articleInfo.Id) | ||
114 | - _, backupList, _ := l.svcCtx.ArticleBackupRepository.Find(l.ctx, conn, queryOption) | 113 | + queryOption = domain.NewQueryOptions().WithCountOnly().WithOffsetLimit(1, 1).WithKV("articleId", articleInfo.Id) |
114 | + backupCount, _, _ := l.svcCtx.ArticleBackupRepository.Find(l.ctx, conn, queryOption) | ||
115 | 115 | ||
116 | sortBy := domain.SortArticleSection(sectionList) | 116 | sortBy := domain.SortArticleSection(sectionList) |
117 | sort.Sort(sortBy) | 117 | sort.Sort(sortBy) |
@@ -157,7 +157,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -157,7 +157,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
157 | MatchUrl: map[string]string{}, | 157 | MatchUrl: map[string]string{}, |
158 | Videos: []types.Video{}, | 158 | Videos: []types.Video{}, |
159 | } | 159 | } |
160 | - if len(backupList) > 0 { | 160 | + if backupCount > 1 { |
161 | resp.Edit = 1 | 161 | resp.Edit = 1 |
162 | } | 162 | } |
163 | if author != nil { | 163 | if author != nil { |
@@ -32,7 +32,7 @@ func NewSystemArticleRestoreLogic(ctx context.Context, svcCtx *svc.ServiceContex | @@ -32,7 +32,7 @@ func NewSystemArticleRestoreLogic(ctx context.Context, svcCtx *svc.ServiceContex | ||
32 | 32 | ||
33 | func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticleRestoreRequest) (resp *types.SystemArticleRestoreResponse, err error) { | 33 | func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticleRestoreRequest) (resp *types.SystemArticleRestoreResponse, err error) { |
34 | var conn = l.svcCtx.DefaultDBConn() | 34 | var conn = l.svcCtx.DefaultDBConn() |
35 | - backup, err := l.svcCtx.ArticleBackupRepository.FindOne(l.ctx, conn, req.Id) | 35 | + oldBackup, err := l.svcCtx.ArticleBackupRepository.FindOne(l.ctx, conn, req.Id) |
36 | if err != nil { | 36 | if err != nil { |
37 | return nil, xerr.NewErrMsgErr("获取编辑历史记录失败", err) | 37 | return nil, xerr.NewErrMsgErr("获取编辑历史记录失败", err) |
38 | } | 38 | } |
@@ -42,7 +42,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | @@ -42,7 +42,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | ||
42 | if err != nil { | 42 | if err != nil { |
43 | return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | 43 | return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) |
44 | } | 44 | } |
45 | - article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, backup.ArticleId) | 45 | + article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, oldBackup.ArticleId) |
46 | if err != nil { | 46 | if err != nil { |
47 | return nil, xerr.NewErrMsgErr("获取文章失败", err) | 47 | return nil, xerr.NewErrMsgErr("获取文章失败", err) |
48 | } | 48 | } |
@@ -50,24 +50,26 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | @@ -50,24 +50,26 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | ||
50 | if err != nil { | 50 | if err != nil { |
51 | return nil, xerr.NewErrMsgErr("获取文章段落内容失败", err) | 51 | return nil, xerr.NewErrMsgErr("获取文章段落内容失败", err) |
52 | } | 52 | } |
53 | + | ||
53 | // 备份数据 | 54 | // 备份数据 |
54 | - newBackUp := article.MakeBackup(domain.UserSimple{ | 55 | + var newBackUp domain.ArticleBackup |
56 | + newBackUp.MakeBackup(domain.UserSimple{ | ||
55 | Id: userToken.UserId, | 57 | Id: userToken.UserId, |
56 | Name: userMe.User.NickName, | 58 | Name: userMe.User.NickName, |
57 | Avatar: userMe.User.Avatar, | 59 | Avatar: userMe.User.Avatar, |
58 | CompanyId: userToken.CompanyId, | 60 | CompanyId: userToken.CompanyId, |
59 | Company: userMe.CurrentCompany.Name, | 61 | Company: userMe.CurrentCompany.Name, |
60 | - }, sectionList) | ||
61 | - newBackUp.Action = "恢复" | 62 | + }, article, sectionList, "恢复") |
63 | + _ = newBackUp.CheckChangeField(oldBackup) | ||
62 | 64 | ||
63 | article.Version = article.Version + 1 | 65 | article.Version = article.Version + 1 |
64 | - article.Images = backup.Images | ||
65 | - article.Videos = backup.Videos | ||
66 | - article.Title = backup.Title | ||
67 | - article.MatchUrl = backup.MatchUrl | ||
68 | - articleSections := make([]domain.ArticleSection, 0) | ||
69 | - lo.ForEach(backup.Section, func(item domain.ArticleSection, index int) { | ||
70 | - articleSections = append(articleSections, domain.ArticleSection{ | 66 | + article.Images = oldBackup.Images |
67 | + article.Videos = oldBackup.Videos | ||
68 | + article.Title = oldBackup.Title | ||
69 | + article.MatchUrl = oldBackup.MatchUrl | ||
70 | + articleSections := make([]*domain.ArticleSection, 0) | ||
71 | + lo.ForEach(oldBackup.Section, func(item domain.ArticleSection, index int) { | ||
72 | + articleSections = append(articleSections, &domain.ArticleSection{ | ||
71 | Id: item.Id, | 73 | Id: item.Id, |
72 | CompanyId: item.CompanyId, | 74 | CompanyId: item.CompanyId, |
73 | Version: article.Version, | 75 | Version: article.Version, |
@@ -98,7 +100,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | @@ -98,7 +100,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | ||
98 | return xerr.NewErrMsgErr("恢复文章版本失败", err) | 100 | return xerr.NewErrMsgErr("恢复文章版本失败", err) |
99 | } | 101 | } |
100 | } else { | 102 | } else { |
101 | - _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, &item) | 103 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, item) |
102 | if err != nil { | 104 | if err != nil { |
103 | return xerr.NewErrMsgErr("恢复文章版本失败", err) | 105 | return xerr.NewErrMsgErr("恢复文章版本失败", err) |
104 | } | 106 | } |
@@ -106,13 +108,14 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | @@ -106,13 +108,14 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl | ||
106 | updateSectionIds = append(updateSectionIds, item.Id) | 108 | updateSectionIds = append(updateSectionIds, item.Id) |
107 | } | 109 | } |
108 | if len(updateSectionIds) > 0 { | 110 | if len(updateSectionIds) > 0 { |
109 | - err = l.svcCtx.ArticleSectionRepository.DeleteBy(ctx, c, domain.NewQueryOptions().WithKV("articleId", article.Id).WithKV("notIds", updateSectionIds)) | 111 | + queryOption := domain.NewQueryOptions().WithKV("articleId", article.Id).WithKV("notIds", updateSectionIds) |
112 | + err = l.svcCtx.ArticleSectionRepository.DeleteBy(ctx, c, queryOption) | ||
110 | if err != nil { | 113 | if err != nil { |
111 | return xerr.NewErrMsgErr("保存文章内容失败", err) | 114 | return xerr.NewErrMsgErr("保存文章内容失败", err) |
112 | } | 115 | } |
113 | } | 116 | } |
114 | 117 | ||
115 | - _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, newBackUp) | 118 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, &newBackUp) |
116 | if err != nil { | 119 | if err != nil { |
117 | return xerr.NewErrMsgErr("恢复文章版本失败", err) | 120 | return xerr.NewErrMsgErr("恢复文章版本失败", err) |
118 | } | 121 | } |
@@ -57,24 +57,26 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -57,24 +57,26 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
57 | if err != nil { | 57 | if err != nil { |
58 | return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | 58 | return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) |
59 | } | 59 | } |
60 | + operator := domain.UserSimple{ | ||
61 | + Id: userToken.UserId, | ||
62 | + Name: userMe.User.NickName, | ||
63 | + Avatar: userMe.User.Avatar, | ||
64 | + CompanyId: userToken.CompanyId, | ||
65 | + Company: userMe.CurrentCompany.Name, | ||
66 | + } | ||
60 | // 文章数据 | 67 | // 文章数据 |
61 | article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, l.conn, req.Id) | 68 | article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, l.conn, req.Id) |
62 | if err != nil { | 69 | if err != nil { |
63 | return nil, xerr.NewErrMsgErr("帖子不存在", err) | 70 | return nil, xerr.NewErrMsgErr("帖子不存在", err) |
64 | } | 71 | } |
65 | - _, sectionList, err := l.svcCtx.ArticleSectionRepository.Find(l.ctx, l.conn, map[string]interface{}{"articleId": article.Id}) | 72 | + // |
73 | + queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("articleId", req.Id) | ||
74 | + _, sectionList, err := l.svcCtx.ArticleSectionRepository.Find(l.ctx, l.conn, queryOption) | ||
66 | if err != nil { | 75 | if err != nil { |
67 | - return nil, xerr.NewErrMsgErr("获取文章段落内容失败", err) | 76 | + return nil, xerr.NewErrMsgErr("帖子不存在", err) |
68 | } | 77 | } |
69 | - //备份数据 | ||
70 | - backup := article.MakeBackup(domain.UserSimple{ | ||
71 | - Id: userToken.UserId, | ||
72 | - Name: userMe.User.NickName, | ||
73 | - Avatar: userMe.User.Avatar, | ||
74 | - CompanyId: userToken.CompanyId, | ||
75 | - Company: userMe.CurrentCompany.Name, | ||
76 | - }, sectionList) | ||
77 | - backup.Action = "编辑" | 78 | + var oldBackup domain.ArticleBackup |
79 | + oldBackup.MakeBackup(operator, article, sectionList, "编辑") | ||
78 | 80 | ||
79 | // 获取图片的尺寸大小 | 81 | // 获取图片的尺寸大小 |
80 | images, err := l.getImages(req) | 82 | images, err := l.getImages(req) |
@@ -126,6 +128,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -126,6 +128,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
126 | } | 128 | } |
127 | //文章内容 | 129 | //文章内容 |
128 | updateSectionIds := []int64{} | 130 | updateSectionIds := []int64{} |
131 | + updateSection := []*domain.ArticleSection{} | ||
129 | for _, item := range articleSections { | 132 | for _, item := range articleSections { |
130 | if item.Id > 0 { | 133 | if item.Id > 0 { |
131 | section, err := l.svcCtx.ArticleSectionRepository.FindOne(ctx, c, item.Id) | 134 | section, err := l.svcCtx.ArticleSectionRepository.FindOne(ctx, c, item.Id) |
@@ -142,23 +145,30 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -142,23 +145,30 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
142 | return xerr.NewErrMsgErr("保存文章段落内容失败", err) | 145 | return xerr.NewErrMsgErr("保存文章段落内容失败", err) |
143 | } | 146 | } |
144 | } else { | 147 | } else { |
145 | - _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, &item) | 148 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, item) |
146 | if err != nil { | 149 | if err != nil { |
147 | return xerr.NewErrMsgErr("保存文章段落内容失败", err) | 150 | return xerr.NewErrMsgErr("保存文章段落内容失败", err) |
148 | } | 151 | } |
149 | } | 152 | } |
150 | updateSectionIds = append(updateSectionIds, item.Id) | 153 | updateSectionIds = append(updateSectionIds, item.Id) |
154 | + updateSection = append(updateSection, item) | ||
151 | } | 155 | } |
152 | if len(updateSectionIds) > 0 { | 156 | if len(updateSectionIds) > 0 { |
153 | - err = l.svcCtx.ArticleSectionRepository.DeleteBy(ctx, c, domain.NewQueryOptions().WithKV("articleId", article.Id).WithKV("notIds", updateSectionIds)) | 157 | + queryOption := domain.NewQueryOptions().WithKV("articleId", article.Id).WithKV("notIds", updateSectionIds) |
158 | + err = l.svcCtx.ArticleSectionRepository.DeleteBy(ctx, c, queryOption) | ||
154 | if err != nil { | 159 | if err != nil { |
155 | return xerr.NewErrMsgErr("保存文章内容失败", err) | 160 | return xerr.NewErrMsgErr("保存文章内容失败", err) |
156 | } | 161 | } |
157 | } | 162 | } |
158 | - _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, backup) | 163 | + var backup domain.ArticleBackup |
164 | + backup.MakeBackup(operator, article, updateSection, "编辑") | ||
165 | + | ||
166 | + if ok := backup.CheckChangeField(&oldBackup); ok { | ||
167 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(ctx, c, &backup) | ||
159 | if err != nil { | 168 | if err != nil { |
160 | return xerr.NewErrMsgErr("保存文章内容失败", err) | 169 | return xerr.NewErrMsgErr("保存文章内容失败", err) |
161 | } | 170 | } |
171 | + } | ||
162 | //文章定性 | 172 | //文章定性 |
163 | err = l.setTags(c, article) | 173 | err = l.setTags(c, article) |
164 | if err != nil { | 174 | if err != nil { |
@@ -307,8 +317,8 @@ func (l *SystemUpdateArticleLogic) getVideos(req *types.SystemArticleUpdateReque | @@ -307,8 +317,8 @@ func (l *SystemUpdateArticleLogic) getVideos(req *types.SystemArticleUpdateReque | ||
307 | return videos, nil | 317 | return videos, nil |
308 | } | 318 | } |
309 | 319 | ||
310 | -func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateRequest, article *domain.Article) []domain.ArticleSection { | ||
311 | - articleSections := make([]domain.ArticleSection, 0) | 320 | +func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateRequest, article *domain.Article) []*domain.ArticleSection { |
321 | + articleSections := make([]*domain.ArticleSection, 0) | ||
312 | sortBy := 1 | 322 | sortBy := 1 |
313 | lo.ForEach(req.Section, func(item types.ArticleSection, index int) { | 323 | lo.ForEach(req.Section, func(item types.ArticleSection, index int) { |
314 | strList := strings.Split(item.Content, "\n") | 324 | strList := strings.Split(item.Content, "\n") |
@@ -326,7 +336,7 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | @@ -326,7 +336,7 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | ||
326 | if key == 0 { | 336 | if key == 0 { |
327 | section.Id = item.Id | 337 | section.Id = item.Id |
328 | } | 338 | } |
329 | - articleSections = append(articleSections, section) | 339 | + articleSections = append(articleSections, §ion) |
330 | sortBy++ | 340 | sortBy++ |
331 | } | 341 | } |
332 | }) | 342 | }) |
@@ -52,13 +52,6 @@ func (l *MiniDeleteArticleCommentLogic) MiniDeleteArticleComment(req *types.Mini | @@ -52,13 +52,6 @@ func (l *MiniDeleteArticleCommentLogic) MiniDeleteArticleComment(req *types.Mini | ||
52 | if err != nil { | 52 | if err != nil { |
53 | return err | 53 | return err |
54 | } | 54 | } |
55 | - // 减少上级评论的回复数量 | ||
56 | - // if commentInfo.Pid != 0 { | ||
57 | - // err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid) | ||
58 | - // if err != nil { | ||
59 | - // return err | ||
60 | - // } | ||
61 | - // } | ||
62 | // 减少最顶层的评论回复计数 | 55 | // 减少最顶层的评论回复计数 |
63 | // if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId { | 56 | // if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId { |
64 | if commentInfo.TopId != 0 { | 57 | if commentInfo.TopId != 0 { |
@@ -80,15 +80,6 @@ func (l *SystemEditAticleCommentShowLogic) disableShow(commentId int64, companyI | @@ -80,15 +80,6 @@ func (l *SystemEditAticleCommentShowLogic) disableShow(commentId int64, companyI | ||
80 | if err != nil { | 80 | if err != nil { |
81 | return err | 81 | return err |
82 | } | 82 | } |
83 | - // 减少上级评论的回复数量 | ||
84 | - // if commentInfo.Pid != 0 { | ||
85 | - // err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid) | ||
86 | - // if err != nil { | ||
87 | - // return err | ||
88 | - // } | ||
89 | - // } | ||
90 | - // 减少最顶层的评论回复计数 | ||
91 | - // if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId { | ||
92 | if commentInfo.TopId != 0 { | 83 | if commentInfo.TopId != 0 { |
93 | err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.TopId) | 84 | err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.TopId) |
94 | if err != nil { | 85 | if err != nil { |
@@ -157,15 +148,8 @@ func (l *SystemEditAticleCommentShowLogic) enableShow(commentId int64, companyId | @@ -157,15 +148,8 @@ func (l *SystemEditAticleCommentShowLogic) enableShow(commentId int64, companyId | ||
157 | if err != nil { | 148 | if err != nil { |
158 | return err | 149 | return err |
159 | } | 150 | } |
160 | - // 增加上级评论的回复数量 | ||
161 | - // if commetInfo.Pid != 0 { | ||
162 | - // err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, commetInfo.Pid) | ||
163 | - // if err != nil { | ||
164 | - // return err | ||
165 | - // } | ||
166 | - // } | 151 | + |
167 | // 增加最顶层的评论回复计数 | 152 | // 增加最顶层的评论回复计数 |
168 | - // if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId { | ||
169 | if commetInfo.TopId != 0 { | 153 | if commetInfo.TopId != 0 { |
170 | err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, commetInfo.TopId) | 154 | err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, commetInfo.TopId) |
171 | if err != nil { | 155 | if err != nil { |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "github.com/samber/lo" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
9 | + | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
12 | + | ||
13 | + "github.com/zeromicro/go-zero/core/logx" | ||
14 | +) | ||
15 | + | ||
16 | +type MiniHomePageUserInfoLogic struct { | ||
17 | + logx.Logger | ||
18 | + ctx context.Context | ||
19 | + svcCtx *svc.ServiceContext | ||
20 | +} | ||
21 | + | ||
22 | +func NewMiniHomePageUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniHomePageUserInfoLogic { | ||
23 | + return &MiniHomePageUserInfoLogic{ | ||
24 | + Logger: logx.WithContext(ctx), | ||
25 | + ctx: ctx, | ||
26 | + svcCtx: svcCtx, | ||
27 | + } | ||
28 | +} | ||
29 | + | ||
30 | +func (l *MiniHomePageUserInfoLogic) MiniHomePageUserInfo(req *types.MiniHomePageUserInfoRequest) (resp *types.MiniHomePageUserInfoResponse, err error) { | ||
31 | + var ( | ||
32 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
33 | + user *domain.User | ||
34 | + conn = l.svcCtx.DefaultDBConn() | ||
35 | + companyMap = make(map[int64]*domain.Company) | ||
36 | + currentUser *domain.User | ||
37 | + ) | ||
38 | + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.UserId); err != nil { | ||
39 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
40 | + } | ||
41 | + if currentUser, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | ||
42 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
43 | + } | ||
44 | + if user.CompanyId != currentUser.CompanyId { | ||
45 | + return nil, xerr.NewErrMsgErr("无查看权限", err) | ||
46 | + } | ||
47 | + resp = &types.MiniHomePageUserInfoResponse{ | ||
48 | + User: &types.UserItem{ | ||
49 | + Id: user.Id, | ||
50 | + Name: user.Name, | ||
51 | + Avatar: lo.ToPtr(user.Avatar), | ||
52 | + Position: user.Position, | ||
53 | + AuditStatus: lo.ToPtr(user.AuditStatus), | ||
54 | + Enable: user.Enable, | ||
55 | + }, | ||
56 | + TotalFollower: len(user.Follower), | ||
57 | + Followed: currentUser.IsFollowed(user.Id), | ||
58 | + MutualFollowed: currentUser.IsFriend(user.Id), | ||
59 | + } | ||
60 | + if company, _ := domain.LazyLoad(companyMap, l.ctx, conn, user.CompanyId, l.svcCtx.CompanyRepository.FindOne); company != nil { | ||
61 | + resp.User.CompanyName = company.Name | ||
62 | + resp.User.CompanyCode = company.Code | ||
63 | + resp.User.CompanyLogo = lo.ToPtr(company.Logo) | ||
64 | + } | ||
65 | + | ||
66 | + var total int64 | ||
67 | + total, _, _ = l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.IndexCompanyId(0)().WithCountOnly().MustWithKV("toUserId", user.Id)) | ||
68 | + resp.TotalBeLoved = int(total) | ||
69 | + | ||
70 | + return | ||
71 | +} |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "github.com/samber/lo" | ||
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 | + | ||
10 | + "github.com/zeromicro/go-zero/core/logx" | ||
11 | +) | ||
12 | + | ||
13 | +type MiniHomepageUserBeLikedLogic struct { | ||
14 | + logx.Logger | ||
15 | + ctx context.Context | ||
16 | + svcCtx *svc.ServiceContext | ||
17 | +} | ||
18 | + | ||
19 | +func NewMiniHomepageUserBeLikedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniHomepageUserBeLikedLogic { | ||
20 | + return &MiniHomepageUserBeLikedLogic{ | ||
21 | + Logger: logx.WithContext(ctx), | ||
22 | + ctx: ctx, | ||
23 | + svcCtx: svcCtx, | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +func (l *MiniHomepageUserBeLikedLogic) MiniHomepageUserBeLiked(req *types.MiniHomePageUserBeLikedRequest) (resp *types.MiniHomePageUserBeLikedResponse, err error) { | ||
28 | + var conn = l.svcCtx.DefaultDBConn() | ||
29 | + | ||
30 | + total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions(). | ||
31 | + WithOffsetLimit(req.Page, req.Size). | ||
32 | + //WithKV("companyId", userToken.CompanyId). 不存在字段 | ||
33 | + WithKV("toUserId", req.UserId)) | ||
34 | + if err != nil { | ||
35 | + return nil, err | ||
36 | + } | ||
37 | + | ||
38 | + resp = &types.MiniHomePageUserBeLikedResponse{} | ||
39 | + resp.Total = total | ||
40 | + resp.List = make([]types.MyBeLikedItem, 0) | ||
41 | + if total == 0 || len(list) == 0 { | ||
42 | + return resp, nil | ||
43 | + } | ||
44 | + | ||
45 | + var companyMap = make(map[int64]*domain.Company) | ||
46 | + var userMap = make(map[int64]*domain.User) | ||
47 | + var articleMap = make(map[int64]*domain.Article) | ||
48 | + var commentMap = make(map[int64]*domain.ArticleComment) | ||
49 | + | ||
50 | + lo.ForEach(list, func(item *domain.UserLoveFlag, index int) { | ||
51 | + var ( | ||
52 | + company *domain.Company | ||
53 | + user *domain.User | ||
54 | + article *domain.Article | ||
55 | + comment *domain.ArticleComment | ||
56 | + ) | ||
57 | + user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.UserId, l.svcCtx.UserRepository.FindOne) | ||
58 | + if user != nil { | ||
59 | + company, _ = domain.LazyLoad(companyMap, l.ctx, conn, user.CompanyId, l.svcCtx.CompanyRepository.FindOne) | ||
60 | + } | ||
61 | + article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne) | ||
62 | + // 点赞评论 | ||
63 | + if item.CommentId != 0 { | ||
64 | + comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) | ||
65 | + } | ||
66 | + itemBeLiked := NewItemSimple(item, company, user, article, comment) | ||
67 | + // 无权限的隐藏 | ||
68 | + resp.List = append(resp.List, itemBeLiked) | ||
69 | + }) | ||
70 | + | ||
71 | + return resp, nil | ||
72 | +} |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
8 | + | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
11 | + | ||
12 | + "github.com/zeromicro/go-zero/core/logx" | ||
13 | +) | ||
14 | + | ||
15 | +type MiniHomepageUserFollowerLogic struct { | ||
16 | + logx.Logger | ||
17 | + ctx context.Context | ||
18 | + svcCtx *svc.ServiceContext | ||
19 | +} | ||
20 | + | ||
21 | +func NewMiniHomepageUserFollowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniHomepageUserFollowerLogic { | ||
22 | + return &MiniHomepageUserFollowerLogic{ | ||
23 | + Logger: logx.WithContext(ctx), | ||
24 | + ctx: ctx, | ||
25 | + svcCtx: svcCtx, | ||
26 | + } | ||
27 | +} | ||
28 | + | ||
29 | +func (l *MiniHomepageUserFollowerLogic) MiniHomepageUserFollower(req *types.MiniHomePageUserFollowerSearchRequest) (resp *types.MiniHomePageUserFollowerSearchResponse, err error) { | ||
30 | + var ( | ||
31 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
32 | + user *domain.User | ||
33 | + conn = l.svcCtx.DefaultDBConn() | ||
34 | + currentUser *domain.User | ||
35 | + ) | ||
36 | + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, int64(req.UserId)); err != nil { | ||
37 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
38 | + } | ||
39 | + if currentUser, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | ||
40 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
41 | + } | ||
42 | + if user.CompanyId != currentUser.CompanyId { | ||
43 | + return nil, xerr.NewErrMsgErr("无查看权限", err) | ||
44 | + } | ||
45 | + resp = &types.MiniHomePageUserFollowerSearchResponse{} | ||
46 | + resp.Total, resp.List = follower(l.ctx, l.svcCtx, user, req.Page, req.Size, req.Name) | ||
47 | + return | ||
48 | +} |
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "github.com/samber/lo" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
9 | + | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
12 | + | ||
13 | + "github.com/zeromicro/go-zero/core/logx" | ||
14 | +) | ||
15 | + | ||
16 | +type MiniHomepageUserNewsLogic struct { | ||
17 | + logx.Logger | ||
18 | + ctx context.Context | ||
19 | + svcCtx *svc.ServiceContext | ||
20 | +} | ||
21 | + | ||
22 | +func NewMiniHomepageUserNewsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniHomepageUserNewsLogic { | ||
23 | + return &MiniHomepageUserNewsLogic{ | ||
24 | + Logger: logx.WithContext(ctx), | ||
25 | + ctx: ctx, | ||
26 | + svcCtx: svcCtx, | ||
27 | + } | ||
28 | +} | ||
29 | + | ||
30 | +func (l *MiniHomepageUserNewsLogic) MiniHomepageUserNews(req *types.MiniHomepageUserNewsRequest) (resp *types.MiniHomepageUserNewsResposne, err error) { | ||
31 | + var ( | ||
32 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
33 | + user *domain.User | ||
34 | + conn = l.svcCtx.DefaultDBConn() | ||
35 | + currentUser *domain.User | ||
36 | + articles []*domain.Article | ||
37 | + readArticles = make([]*domain.UserReadArticle, 0) | ||
38 | + userMap = make(map[int64]*domain.User) | ||
39 | + ) | ||
40 | + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.AuthorId); err != nil { | ||
41 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
42 | + } | ||
43 | + if currentUser, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | ||
44 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
45 | + } | ||
46 | + if user.CompanyId != currentUser.CompanyId { | ||
47 | + return nil, xerr.NewErrMsgErr("无查看权限", err) | ||
48 | + } | ||
49 | + | ||
50 | + queryOptions := domain.IndexCompanyId(userToken.CompanyId)(). | ||
51 | + WithKV("beginTime", req.BeginTime). | ||
52 | + WithKV("endTime", req.EndTime). | ||
53 | + WithKV("keywords", req.Keywords) | ||
54 | + if len(req.OrderByKey) > 0 && len(req.OrderByValue) > 0 { | ||
55 | + switch req.OrderByKey { | ||
56 | + case "HotScore": | ||
57 | + queryOptions.WithKV("orderByHotScore", req.OrderByValue) | ||
58 | + case "All": | ||
59 | + queryOptions.WithKV("orderByAll", req.OrderByValue) | ||
60 | + case "Time": | ||
61 | + queryOptions.WithKV("orderByAll", req.OrderByValue) | ||
62 | + } | ||
63 | + } | ||
64 | + var users = []int64{req.AuthorId} | ||
65 | + if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, currentUser.Id, req.LastArticleId, req.Size, queryOptions.Copy().WithFindOnly()); err != nil { | ||
66 | + return nil, xerr.NewErrMsgErr("获取快讯异常", err) | ||
67 | + } | ||
68 | + var total int64 | ||
69 | + if total, _, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, currentUser.Id, 0, 1, queryOptions.Copy().WithCountOnly()); err != nil { | ||
70 | + return nil, xerr.NewErrMsgErr("获取快讯异常", err) | ||
71 | + } | ||
72 | + resp = &types.MiniHomepageUserNewsResposne{ | ||
73 | + List: make([]types.UserNewsItem, 0), | ||
74 | + Total: total, | ||
75 | + } | ||
76 | + articleIds := domain.Values(articles, func(item *domain.Article) int64 { | ||
77 | + return item.Id | ||
78 | + }) | ||
79 | + if len(articleIds) > 0 { | ||
80 | + resp.LastArticleId = articleIds[len(articleIds)-1] | ||
81 | + _, readArticles, _ = l.svcCtx.UserReadArticleRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().WithFindOnly().WithKV("articleIds", articleIds)) | ||
82 | + } | ||
83 | + readArticlesMap := lo.KeyBy(readArticles, func(item *domain.UserReadArticle) int64 { | ||
84 | + return item.ArticleId | ||
85 | + }) | ||
86 | + lo.ForEach(articles, func(item *domain.Article, index int) { | ||
87 | + newsItem := types.UserNewsItem{ | ||
88 | + NewsId: item.Id, | ||
89 | + Type: "article", | ||
90 | + Title: item.Title, | ||
91 | + Summary: item.Summary, | ||
92 | + Time: item.CreatedAt, | ||
93 | + Images: make([]string, 0), | ||
94 | + ReadFlag: false, | ||
95 | + } | ||
96 | + if author, _ := domain.LazyLoad(userMap, l.ctx, conn, item.AuthorId, l.svcCtx.UserRepository.FindOne); author != nil { | ||
97 | + newsItem.Author = types.UserItem{ | ||
98 | + Id: author.Id, | ||
99 | + Name: author.Name, | ||
100 | + Avatar: lo.ToPtr(author.Avatar), | ||
101 | + } | ||
102 | + } | ||
103 | + for _, img := range item.Images { | ||
104 | + newsItem.Images = append(newsItem.Images, img.Url) | ||
105 | + } | ||
106 | + if _, ok := readArticlesMap[item.Id]; ok { | ||
107 | + newsItem.ReadFlag = true | ||
108 | + } | ||
109 | + resp.List = append(resp.List, newsItem) | ||
110 | + }) | ||
111 | + return | ||
112 | +} |
@@ -67,13 +67,13 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp | @@ -67,13 +67,13 @@ func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp | ||
67 | comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) | 67 | comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne) |
68 | } | 68 | } |
69 | 69 | ||
70 | - resp.List = append(resp.List, l.NewItemSimple(item, company, user, article, comment)) | 70 | + resp.List = append(resp.List, NewItemSimple(item, company, user, article, comment)) |
71 | }) | 71 | }) |
72 | 72 | ||
73 | return resp, nil | 73 | return resp, nil |
74 | } | 74 | } |
75 | 75 | ||
76 | -func (l *MiniMyBeLikedLogic) NewItemSimple(love *domain.UserLoveFlag, company *domain.Company, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyBeLikedItem { | 76 | +func NewItemSimple(love *domain.UserLoveFlag, company *domain.Company, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyBeLikedItem { |
77 | item := types.MyBeLikedItem{ | 77 | item := types.MyBeLikedItem{ |
78 | UserId: love.UserId, | 78 | UserId: love.UserId, |
79 | ArticleId: love.ArticleId, | 79 | ArticleId: love.ArticleId, |
@@ -33,52 +33,58 @@ func (l *MiniUserFollowerLogic) MiniUserFollower(req *types.MiniUserFollowedSear | @@ -33,52 +33,58 @@ func (l *MiniUserFollowerLogic) MiniUserFollower(req *types.MiniUserFollowedSear | ||
33 | conn = l.svcCtx.DefaultDBConn() | 33 | conn = l.svcCtx.DefaultDBConn() |
34 | user *domain.User | 34 | user *domain.User |
35 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) | 35 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) |
36 | - companyMap = make(map[int64]*domain.Company) | ||
37 | ) | 36 | ) |
38 | if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | 37 | if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { |
39 | return nil, xerr.NewErrMsgErr("用户不存在", err) | 38 | return nil, xerr.NewErrMsgErr("用户不存在", err) |
40 | } | 39 | } |
40 | + resp = &types.MiniUserFollowedSearchResponse{ | ||
41 | + Total: 0, | ||
42 | + List: make([]*types.UserFollowItem, 0), | ||
43 | + } | ||
44 | + resp.Total, resp.List = follower(l.ctx, l.svcCtx, user, req.Page, req.Size, req.Name) | ||
45 | + return | ||
46 | +} | ||
47 | + | ||
48 | +func follower(ctx context.Context, svcCtx *svc.ServiceContext, user *domain.User, page, size int, name string) (total int64, list []*types.UserFollowItem) { | ||
41 | var ( | 49 | var ( |
42 | users = user.Follower | 50 | users = user.Follower |
43 | - total = int64(len(users)) | ||
44 | - offset, limit = domain.OffsetLimit(req.Page, req.Size) | 51 | + offset, limit = domain.OffsetLimit(page, size) |
52 | + conn = svcCtx.DefaultDBConn() | ||
53 | + companyMap = make(map[int64]*domain.Company) | ||
45 | ) | 54 | ) |
55 | + total = int64(len(users)) | ||
46 | users = lo.Slice(users, offset, offset+limit) | 56 | users = lo.Slice(users, offset, offset+limit) |
47 | - resp = &types.MiniUserFollowedSearchResponse{ | ||
48 | - Total: total, | ||
49 | - List: make([]*types.UserFollowItem, 0), | ||
50 | - } | 57 | + list = make([]*types.UserFollowItem, 0) |
51 | for { | 58 | for { |
52 | if offset > len(user.Follower) { | 59 | if offset > len(user.Follower) { |
53 | break | 60 | break |
54 | } | 61 | } |
55 | users = lo.Slice(users, offset, offset+limit) | 62 | users = lo.Slice(users, offset, offset+limit) |
56 | lo.ForEach(users, func(item int64, index int) { | 63 | lo.ForEach(users, func(item int64, index int) { |
57 | - if foundUser, _ := l.svcCtx.UserRepository.FindOne(l.ctx, conn, item); foundUser != nil { | ||
58 | - if len(req.Name) > 0 && !strings.Contains(foundUser.Name, req.Name) { | 64 | + if foundUser, _ := svcCtx.UserRepository.FindOne(ctx, conn, item); foundUser != nil { |
65 | + if len(name) > 0 && !strings.Contains(foundUser.Name, name) { | ||
59 | return | 66 | return |
60 | } | 67 | } |
61 | var companyName = "" | 68 | var companyName = "" |
62 | - if company, _ := domain.LazyLoad(companyMap, l.ctx, conn, foundUser.CompanyId, l.svcCtx.CompanyRepository.FindOne); company != nil { | 69 | + if company, _ := domain.LazyLoad(companyMap, ctx, conn, foundUser.CompanyId, svcCtx.CompanyRepository.FindOne); company != nil { |
63 | companyName = company.Name | 70 | companyName = company.Name |
64 | } | 71 | } |
65 | - resp.List = append(resp.List, &types.UserFollowItem{ | 72 | + list = append(list, &types.UserFollowItem{ |
66 | Id: foundUser.Id, | 73 | Id: foundUser.Id, |
67 | Name: foundUser.Name, | 74 | Name: foundUser.Name, |
68 | CompanyName: companyName, | 75 | CompanyName: companyName, |
69 | Avatar: foundUser.Avatar, | 76 | Avatar: foundUser.Avatar, |
70 | Position: foundUser.Position, | 77 | Position: foundUser.Position, |
71 | Followed: true, | 78 | Followed: true, |
72 | - MutualFollowed: lo.Contains(user.Following, item), | 79 | + MutualFollowed: user.IsFriend(item), |
73 | }) | 80 | }) |
74 | } | 81 | } |
75 | }) | 82 | }) |
76 | - if len(resp.List) >= limit { | 83 | + if len(list) >= limit { |
77 | break | 84 | break |
78 | } | 85 | } |
79 | - req.Page += 1 | ||
80 | - offset, limit = domain.OffsetLimit(req.Page, req.Size) | 86 | + page += 1 |
87 | + offset, limit = domain.OffsetLimit(page, size) | ||
81 | } | 88 | } |
82 | - | ||
83 | return | 89 | return |
84 | } | 90 | } |
@@ -45,7 +45,7 @@ func (l *MiniUserMyFollowingNewsLogic) MiniUserMyFollowingNews(req *types.MiniUs | @@ -45,7 +45,7 @@ func (l *MiniUserMyFollowingNewsLogic) MiniUserMyFollowingNews(req *types.MiniUs | ||
45 | if req.AuthorId > 0 { | 45 | if req.AuthorId > 0 { |
46 | users = []int64{req.AuthorId} | 46 | users = []int64{req.AuthorId} |
47 | } | 47 | } |
48 | - if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, user.Id, req.LastArticleId, req.Size); err != nil { | 48 | + if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, user.Id, req.LastArticleId, req.Size, domain.NewQueryOptions().WithFindOnly()); err != nil { |
49 | return nil, xerr.NewErrMsgErr("获取快讯异常", err) | 49 | return nil, xerr.NewErrMsgErr("获取快讯异常", err) |
50 | } | 50 | } |
51 | resp = &types.MiniUserNewsResposne{ | 51 | resp = &types.MiniUserNewsResposne{ |
@@ -43,7 +43,7 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) | @@ -43,7 +43,7 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) | ||
43 | onlyUsers = article.WhoRead | 43 | onlyUsers = article.WhoRead |
44 | } | 44 | } |
45 | } | 45 | } |
46 | - if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().WithFindOnly()); err != nil { | 46 | + if _, users, err = l.svcCtx.UserRepository.FindDepartmentUsers(l.ctx, conn, userToken.CompanyId, domain.NewQueryOptions().WithKV("name", req.Keywords).WithFindOnly()); err != nil { |
47 | return nil, xerr.NewErrMsgErr("用户列表获取失败", err) | 47 | return nil, xerr.NewErrMsgErr("用户列表获取失败", err) |
48 | } | 48 | } |
49 | if len(onlyUsers) > 0 { | 49 | if len(onlyUsers) > 0 { |
@@ -63,6 +63,8 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) | @@ -63,6 +63,8 @@ func (l *MiniAtUsersListLogic) MiniAtUsersList(req *types.MiniUsersListRequest) | ||
63 | Id: item.Id, | 63 | Id: item.Id, |
64 | Name: item.Name, | 64 | Name: item.Name, |
65 | PinYinName: item.PinYinName, | 65 | PinYinName: item.PinYinName, |
66 | + Avatar: item.Avatar, | ||
67 | + Position: item.Position, | ||
66 | }) | 68 | }) |
67 | }) | 69 | }) |
68 | return map[string]interface{}{ | 70 | return map[string]interface{}{ |
@@ -449,6 +449,58 @@ type MiniEditUserInfoRequest struct { | @@ -449,6 +449,58 @@ type MiniEditUserInfoRequest struct { | ||
449 | type MiniEditUserInfoResponse struct { | 449 | type MiniEditUserInfoResponse struct { |
450 | } | 450 | } |
451 | 451 | ||
452 | +type MiniHomePageUserInfoRequest struct { | ||
453 | + UserId int64 `json:"userId"` // 用户ID | ||
454 | +} | ||
455 | + | ||
456 | +type MiniHomePageUserInfoResponse struct { | ||
457 | + User *UserItem `json:"user,omitempty"` // 用户信息 | ||
458 | + TotalFollower int `json:"totalFollower"` // 关注他的人数 | ||
459 | + TotalBeLoved int `json:"totalBeLoved"` // 获赞数 | ||
460 | + Followed bool `json:"followed"` // 关注 | ||
461 | + MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识 | ||
462 | +} | ||
463 | + | ||
464 | +type MiniHomePageUserFollowerSearchRequest struct { | ||
465 | + UserId int `json:"userId"` | ||
466 | + Page int `json:"page,optional"` | ||
467 | + Size int `json:"size,optional"` | ||
468 | + Name string `json:"name,optional"` | ||
469 | +} | ||
470 | + | ||
471 | +type MiniHomePageUserFollowerSearchResponse struct { | ||
472 | + List []*UserFollowItem `json:"users"` | ||
473 | + Total int64 `json:"total"` | ||
474 | +} | ||
475 | + | ||
476 | +type MiniHomePageUserBeLikedRequest struct { | ||
477 | + UserId int `json:"userId"` | ||
478 | + Page int `json:"page"` | ||
479 | + Size int `json:"size"` | ||
480 | +} | ||
481 | + | ||
482 | +type MiniHomePageUserBeLikedResponse struct { | ||
483 | + List []MyBeLikedItem `json:"list"` | ||
484 | + Total int64 `json:"total"` | ||
485 | +} | ||
486 | + | ||
487 | +type MiniHomepageUserNewsRequest struct { | ||
488 | + AuthorId int64 `json:"authorId"` // 特定作者ID | ||
489 | + LastArticleId int64 `json:"lastArticleId,optional"` // 最后文章ID | ||
490 | + Size int `json:"size"` // 数量 | ||
491 | + OrderByKey string `json:"orderByKey,options=HotScore|All|Time,optional,default=desc"` // 按规则排序 (热度:HotScore All:时间排序 Time:时间排序) | ||
492 | + OrderByValue string `json:"orderByValue,options=asc||desc,optional"` // 排序值 升序 asc 降序 desc | ||
493 | + Keywords string `json:"keywords,optional"` // 关键字 | ||
494 | + BeginTime int64 `json:"beginTime,optional"` // 开始时间 | ||
495 | + EndTime int64 `json:"endTime,optional"` // 结束时间 | ||
496 | +} | ||
497 | + | ||
498 | +type MiniHomepageUserNewsResposne struct { | ||
499 | + List []UserNewsItem `json:"list"` | ||
500 | + LastArticleId int64 `json:"lastArticleId"` // 最后文章ID | ||
501 | + Total int64 `json:"total"` | ||
502 | +} | ||
503 | + | ||
452 | type MiniUserLoginRequest struct { | 504 | type MiniUserLoginRequest struct { |
453 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login | 505 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login |
454 | WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 | 506 | WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 |
@@ -505,6 +557,7 @@ type MiniUserDepartmentUsersResponse struct { | @@ -505,6 +557,7 @@ type MiniUserDepartmentUsersResponse struct { | ||
505 | type MiniUsersListRequest struct { | 557 | type MiniUsersListRequest struct { |
506 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) | 558 | ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户) |
507 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 | 559 | RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户 |
560 | + Keywords string `json:"keywords,optional"` // 按关键字搜索(名称) | ||
508 | } | 561 | } |
509 | 562 | ||
510 | type MiniUserNewsRequest struct { | 563 | type MiniUserNewsRequest struct { |
@@ -980,8 +1033,30 @@ type MiniArticleBackupItem struct { | @@ -980,8 +1033,30 @@ type MiniArticleBackupItem struct { | ||
980 | Title string `json:"title"` | 1033 | Title string `json:"title"` |
981 | Content string `json:"content"` | 1034 | Content string `json:"content"` |
982 | Images []string `json:"images"` | 1035 | Images []string `json:"images"` |
1036 | + Videos []Video `json:"videos"` | ||
1037 | + ChangeField []string `json:"changeField"` | ||
1038 | + CreatedAt int64 `json:"createdAt"` | ||
1039 | + Location Location `json:"location"` | ||
1040 | + Action string `json:"action"` | ||
1041 | + Show int `json:"show"` | ||
1042 | +} | ||
1043 | + | ||
1044 | +type MiniGetArticleBackupRequest struct { | ||
1045 | + BackupId int64 `path:"id"` | ||
1046 | + CompanyId int64 `path:",optional"` // 服务端自动获取 | ||
1047 | +} | ||
1048 | + | ||
1049 | +type MiniGetArticleBackupResponse struct { | ||
1050 | + Id int64 `json:"id"` | ||
1051 | + Title string `json:"title"` | ||
1052 | + Content string `json:"content"` | ||
1053 | + Images []string `json:"images"` | ||
1054 | + Videos []Video `json:"videos"` | ||
1055 | + ChangeField []string `json:"changeField"` | ||
983 | CreatedAt int64 `json:"createdAt"` | 1056 | CreatedAt int64 `json:"createdAt"` |
984 | Location Location `json:"location"` | 1057 | Location Location `json:"location"` |
1058 | + Action string `json:"action"` | ||
1059 | + Show int `json:"show"` | ||
985 | } | 1060 | } |
986 | 1061 | ||
987 | type MiniArticleMarkUserReadRequest struct { | 1062 | type MiniArticleMarkUserReadRequest struct { |
@@ -23,6 +23,7 @@ type ArticleBackup struct { | @@ -23,6 +23,7 @@ type ArticleBackup struct { | ||
23 | Section []domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容 | 23 | Section []domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容 |
24 | Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片 | 24 | Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片 |
25 | Videos []domain.Video `gorm:"type:jsonb;serializer:json"` // 视频 | 25 | Videos []domain.Video `gorm:"type:jsonb;serializer:json"` // 视频 |
26 | + ChangeField []string `gorm:"type:jsonb;serializer:json"` // | ||
26 | Action string // 操作 | 27 | Action string // 操作 |
27 | WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 | 28 | WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 |
28 | WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 | 29 | WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 |
@@ -30,6 +31,7 @@ type ArticleBackup struct { | @@ -30,6 +31,7 @@ type ArticleBackup struct { | ||
30 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 | 31 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 |
31 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 | 32 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 |
32 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | 33 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 |
34 | + Show int | ||
33 | } | 35 | } |
34 | 36 | ||
35 | func (m *ArticleBackup) TableName() string { | 37 | func (m *ArticleBackup) TableName() string { |
@@ -175,7 +175,9 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | @@ -175,7 +175,9 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | ||
175 | WhoReview: from.WhoReview, | 175 | WhoReview: from.WhoReview, |
176 | Tags: from.Tags, | 176 | Tags: from.Tags, |
177 | MatchUrl: from.MatchUrl, | 177 | MatchUrl: from.MatchUrl, |
178 | + ChangeField: from.ChangeField, | ||
178 | Videos: from.Videos, | 179 | Videos: from.Videos, |
180 | + Show: domain.ArticleShow(from.Show), | ||
179 | } | 181 | } |
180 | // err := copier.Copy(to, from) | 182 | // err := copier.Copy(to, from) |
181 | return to, nil | 183 | return to, nil |
@@ -203,6 +205,8 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | @@ -203,6 +205,8 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | ||
203 | TargetUser: int(from.TargetUser), | 205 | TargetUser: int(from.TargetUser), |
204 | MatchUrl: from.MatchUrl, | 206 | MatchUrl: from.MatchUrl, |
205 | Videos: from.Videos, | 207 | Videos: from.Videos, |
208 | + ChangeField: from.ChangeField, | ||
209 | + Show: int(from.Show), | ||
206 | } | 210 | } |
207 | // err := copier.Copy(to, from) | 211 | // err := copier.Copy(to, from) |
208 | return to, nil | 212 | return to, nil |
@@ -207,7 +207,7 @@ func (repository *ArticleRepository) FindLatestAccessibleArticle(ctx context.Con | @@ -207,7 +207,7 @@ func (repository *ArticleRepository) FindLatestAccessibleArticle(ctx context.Con | ||
207 | 207 | ||
208 | // FindAuthorsLatestArticle 作者最新的文章 | 208 | // FindAuthorsLatestArticle 作者最新的文章 |
209 | func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Context, conn transaction.Conn, | 209 | func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Context, conn transaction.Conn, |
210 | - companyId int64, authors []int64, whoRead int64, lastId int64, limit int) (int64, []*domain.Article, error) { | 210 | + companyId int64, authors []int64, whoRead int64, lastId int64, limit int, queryOptions map[string]interface{}) (int64, []*domain.Article, error) { |
211 | var ( | 211 | var ( |
212 | tx = conn.DB() | 212 | tx = conn.DB() |
213 | ms []*models.Article | 213 | ms []*models.Article |
@@ -223,11 +223,26 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex | @@ -223,11 +223,26 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex | ||
223 | if lastId > 0 { | 223 | if lastId > 0 { |
224 | tx.Where("id < ?", lastId) | 224 | tx.Where("id < ?", lastId) |
225 | } | 225 | } |
226 | + if v, ok := queryOptions["beginTime"]; ok { | ||
227 | + tx.Where("created_at >= ?", v) | ||
228 | + } | ||
229 | + if v, ok := queryOptions["endTime"]; ok { | ||
230 | + tx.Where("created_at < ?", v) | ||
231 | + } | ||
232 | + if v, ok := queryOptions["keywords"]; ok { | ||
233 | + tx.Where("title like ?", fmt.Sprintf("%%%v%%", v)) | ||
234 | + } | ||
235 | + if v, ok := queryOptions["orderByHotScore"]; ok { | ||
236 | + tx.Order(fmt.Sprintf("(count_comment+count_love) %v", v)) | ||
237 | + } else if v, ok := queryOptions["orderByAll"]; ok { | ||
238 | + tx.Order(fmt.Sprintf("id %v", v)) | ||
239 | + } else { | ||
226 | tx.Order("id desc") | 240 | tx.Order("id desc") |
241 | + } | ||
227 | if limit > 0 { | 242 | if limit > 0 { |
228 | tx.Limit(limit) | 243 | tx.Limit(limit) |
229 | } | 244 | } |
230 | - if total, tx = transaction.PaginationAndCount(ctx, tx, domain.NewQueryOptions().WithFindOnly(), &ms); tx.Error != nil { | 245 | + if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
231 | return dms, tx.Error | 246 | return dms, tx.Error |
232 | } | 247 | } |
233 | return dms, nil | 248 | return dms, nil |
@@ -158,6 +158,45 @@ func (repository *UserLoveFlagRepository) Find(ctx context.Context, conn transac | @@ -158,6 +158,45 @@ func (repository *UserLoveFlagRepository) Find(ctx context.Context, conn transac | ||
158 | return total, dms, nil | 158 | return total, dms, nil |
159 | } | 159 | } |
160 | 160 | ||
161 | +//func (repository *UserLoveFlagRepository) FindByUserVisible(ctx context.Context, conn transaction.Conn,companyId, toUserId int64,currentUserId, queryOptions map[string]interface{}) (int64, []*domain.UserLoveFlag, error) { | ||
162 | +// var ( | ||
163 | +// tx = conn.DB() | ||
164 | +// ms []*models.UserLoveFlag | ||
165 | +// dms = make([]*domain.UserLoveFlag, 0) | ||
166 | +// total int64 | ||
167 | +// ) | ||
168 | +// queryFunc := func() (interface{}, error) { | ||
169 | +// tx = tx.Model(&ms).Order("id desc") | ||
170 | +// if v, ok := queryOptions["companyId"]; ok { | ||
171 | +// tx = tx.Where("company_id=?", v) | ||
172 | +// } | ||
173 | +// tx = tx.Where("article_id in (SELECT id FROM \"article\" WHERE company_id=? AND author_id in (?) AND (author_id = ? or target_user=0 or who_read @>'[?]') AND show = 1 AND \"article\".\"is_del\" = 0)", companyId,toUserId) | ||
174 | +// if v, ok := queryOptions["toUserId"]; ok { | ||
175 | +// tx = tx.Where("to_user_id=?", v) | ||
176 | +// } | ||
177 | +// if v, ok := queryOptions["commentIdList"]; ok { | ||
178 | +// tx = tx.Where("comment_id in (?)", v) | ||
179 | +// } | ||
180 | +// if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | ||
181 | +// return dms, tx.Error | ||
182 | +// } | ||
183 | +// return dms, nil | ||
184 | +// } | ||
185 | +// | ||
186 | +// if _, err := repository.Query(queryFunc); err != nil { | ||
187 | +// return 0, nil, err | ||
188 | +// } | ||
189 | +// | ||
190 | +// for _, item := range ms { | ||
191 | +// if dm, err := repository.ModelToDomainModel(item); err != nil { | ||
192 | +// return 0, dms, err | ||
193 | +// } else { | ||
194 | +// dms = append(dms, dm) | ||
195 | +// } | ||
196 | +// } | ||
197 | +// return total, dms, nil | ||
198 | +//} | ||
199 | + | ||
161 | func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLoveFlag) (*domain.UserLoveFlag, error) { | 200 | func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLoveFlag) (*domain.UserLoveFlag, error) { |
162 | to := &domain.UserLoveFlag{ | 201 | to := &domain.UserLoveFlag{ |
163 | Id: from.Id, | 202 | Id: from.Id, |
@@ -226,6 +226,9 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn | @@ -226,6 +226,9 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn | ||
226 | tx.Where("company_id = ?", companyId) | 226 | tx.Where("company_id = ?", companyId) |
227 | tx.Where("audit_status in (?)", domain.UserAuditStatusPassed) | 227 | tx.Where("audit_status in (?)", domain.UserAuditStatusPassed) |
228 | tx.Where("enable = ?", domain.UserEnable) | 228 | tx.Where("enable = ?", domain.UserEnable) |
229 | + if v, ok := queryOptions["name"]; ok { | ||
230 | + tx.Where("name like ?", fmt.Sprintf("%%%v%%", v)) | ||
231 | + } | ||
229 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 232 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
230 | return dms, tx.Error | 233 | return dms, tx.Error |
231 | } | 234 | } |
@@ -43,7 +43,7 @@ type ArticleRepository interface { | @@ -43,7 +43,7 @@ type ArticleRepository interface { | ||
43 | Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error) | 43 | Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error) |
44 | FindAuthorsLatestFirstArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) | 44 | FindAuthorsLatestFirstArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) |
45 | FindAuthorsLatestFirstUnreadArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) | 45 | FindAuthorsLatestFirstUnreadArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) |
46 | - FindAuthorsLatestArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, lastId int64, limit int) (int64, []*Article, error) | 46 | + FindAuthorsLatestArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, lastId int64, limit int, queryOptions map[string]interface{}) (int64, []*Article, error) |
47 | FindLatestAccessibleArticle(ctx context.Context, conn transaction.Conn, companyId int64, whoRead int64, lastId int64, limit int) (int64, []*Article, error) | 47 | FindLatestAccessibleArticle(ctx context.Context, conn transaction.Conn, companyId int64, whoRead int64, lastId int64, limit int) (int64, []*Article, error) |
48 | IncreaseCountLove(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //点赞数量变动 | 48 | IncreaseCountLove(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //点赞数量变动 |
49 | IncreaseCountComment(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //评论数量变动 | 49 | IncreaseCountComment(ctx context.Context, conn transaction.Conn, incr int, articleId int64) error //评论数量变动 |
@@ -95,42 +95,7 @@ func (a ArticleShow) Named() string { | @@ -95,42 +95,7 @@ func (a ArticleShow) Named() string { | ||
95 | return "" | 95 | return "" |
96 | } | 96 | } |
97 | 97 | ||
98 | -// 设置文章的备份数据 | ||
99 | -func (m *Article) MakeBackup(operator UserSimple, section []*ArticleSection) *ArticleBackup { | ||
100 | - sectionBackup := make([]ArticleSection, len(section)) | ||
101 | - for i := range section { | ||
102 | - sectionBackup[i] = *section[i] | ||
103 | - } | ||
104 | - b := ArticleBackup{ | ||
105 | - Id: 0, | ||
106 | - CompanyId: m.CompanyId, | ||
107 | - CreatedAt: 0, | ||
108 | - UpdatedAt: 0, | ||
109 | - DeletedAt: 0, | ||
110 | - Version: m.Version, | ||
111 | - Operator: operator, | ||
112 | - ArticleId: m.Id, | ||
113 | - Title: m.Title, | ||
114 | - Section: sectionBackup, | ||
115 | - Images: make([]Image, len(m.Images)), | ||
116 | - Videos: make([]Video, len(m.Videos)), | ||
117 | - Action: "", | ||
118 | - TargetUser: m.TargetUser, | ||
119 | - WhoRead: m.WhoRead, | ||
120 | - WhoReview: m.WhoReview, | ||
121 | - Tags: m.Tags, | ||
122 | - MatchUrl: map[string]string{}, | ||
123 | - Location: m.Location, | ||
124 | - } | ||
125 | - copy(b.Videos, m.Videos) | ||
126 | - copy(b.Images, m.Images) | ||
127 | - for k, v := range m.MatchUrl { | ||
128 | - b.MatchUrl[k] = v | ||
129 | - } | ||
130 | - return &b | ||
131 | -} | ||
132 | - | ||
133 | -func (m *Article) SetSummary(sectionList []ArticleSection) { | 98 | +func (m *Article) SetSummary(sectionList []*ArticleSection) { |
134 | if len(sectionList) == 0 { | 99 | if len(sectionList) == 0 { |
135 | return | 100 | return |
136 | } | 101 | } |
@@ -156,3 +121,27 @@ func (m *Article) SetSummary(sectionList []ArticleSection) { | @@ -156,3 +121,27 @@ func (m *Article) SetSummary(sectionList []ArticleSection) { | ||
156 | } | 121 | } |
157 | m.Summary = content[0:stringIndex] | 122 | m.Summary = content[0:stringIndex] |
158 | } | 123 | } |
124 | + | ||
125 | +func (m *Article) WhoCanRead(userId int64) bool { | ||
126 | + if len(m.WhoRead) == 0 { | ||
127 | + return true | ||
128 | + } | ||
129 | + for _, val := range m.WhoRead { | ||
130 | + if userId == val { | ||
131 | + return true | ||
132 | + } | ||
133 | + } | ||
134 | + return false | ||
135 | +} | ||
136 | + | ||
137 | +func (m *Article) WhoCanReview(userId int64) bool { | ||
138 | + if len(m.WhoReview) == 0 { | ||
139 | + return true | ||
140 | + } | ||
141 | + for _, val := range m.WhoReview { | ||
142 | + if userId == val { | ||
143 | + return true | ||
144 | + } | ||
145 | + } | ||
146 | + return false | ||
147 | +} |
1 | package domain | 1 | package domain |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "bytes" | ||
4 | "context" | 5 | "context" |
6 | + "encoding/json" | ||
7 | + "fmt" | ||
8 | + "sort" | ||
5 | 9 | ||
6 | "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/db/transaction" |
7 | ) | 11 | ) |
@@ -21,12 +25,15 @@ type ArticleBackup struct { | @@ -21,12 +25,15 @@ type ArticleBackup struct { | ||
21 | Images []Image `json:"images"` // 图片 | 25 | Images []Image `json:"images"` // 图片 |
22 | Videos []Video `json:"videos"` // 视频 | 26 | Videos []Video `json:"videos"` // 视频 |
23 | Action string `json:"action"` // 操作 | 27 | Action string `json:"action"` // 操作 |
28 | + // 新的备份内容相对与旧的文章信息哪些内容发生了变更,可选值[WhoRead] 修改了分发对象, [WhoReview] 修改了评论范围,[Section] 修改了内容 | ||
29 | + ChangeField []string `json:"changeField"` | ||
24 | TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 | 30 | TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 |
25 | Location Location `json:"location"` // 定位坐标 | 31 | Location Location `json:"location"` // 定位坐标 |
26 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 32 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
27 | WhoReview []int64 `json:"whoReview"` // 评论人 | 33 | WhoReview []int64 `json:"whoReview"` // 评论人 |
28 | Tags []int64 `json:"tags"` // 标签 | 34 | Tags []int64 `json:"tags"` // 标签 |
29 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 35 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
36 | + Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) | ||
30 | } | 37 | } |
31 | 38 | ||
32 | type ArticleBackupRepository interface { | 39 | type ArticleBackupRepository interface { |
@@ -37,3 +44,137 @@ type ArticleBackupRepository interface { | @@ -37,3 +44,137 @@ type ArticleBackupRepository interface { | ||
37 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleBackup, error) | 44 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleBackup, error) |
38 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleBackup, error) | 45 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleBackup, error) |
39 | } | 46 | } |
47 | + | ||
48 | +// 检查新的备份内容相对与旧的文章信息哪些内容发生了变更 | ||
49 | +// 记录ArticleBackup中数据发生变更的的字段名 | ||
50 | +func (bk *ArticleBackup) CheckChangeField(oldBackup *ArticleBackup) bool { | ||
51 | + bk.ChangeField = make([]string, 0) | ||
52 | + //比较 WhoRead | ||
53 | + { | ||
54 | + whoReadChanged := false | ||
55 | + sort.Slice(bk.WhoRead, func(i, j int) bool { | ||
56 | + return bk.WhoRead[i] < bk.WhoRead[j] | ||
57 | + }) | ||
58 | + sort.Slice(oldBackup.WhoRead, func(i, j int) bool { | ||
59 | + return oldBackup.WhoRead[i] < oldBackup.WhoRead[j] | ||
60 | + }) | ||
61 | + | ||
62 | + if len(bk.WhoRead) != len(oldBackup.WhoRead) { | ||
63 | + whoReadChanged = true | ||
64 | + } else { | ||
65 | + for i := range bk.WhoRead { | ||
66 | + if bk.WhoRead[i] != oldBackup.WhoRead[i] { | ||
67 | + whoReadChanged = true | ||
68 | + } | ||
69 | + } | ||
70 | + } | ||
71 | + if whoReadChanged { | ||
72 | + bk.ChangeField = append(bk.ChangeField, "WhoRead") | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
76 | + //比较 whoReview | ||
77 | + { | ||
78 | + whoReviewChanged := false | ||
79 | + sort.Slice(bk.WhoReview, func(i, j int) bool { | ||
80 | + return bk.WhoReview[i] < bk.WhoReview[j] | ||
81 | + }) | ||
82 | + sort.Slice(oldBackup.WhoReview, func(i, j int) bool { | ||
83 | + return oldBackup.WhoReview[i] < oldBackup.WhoReview[j] | ||
84 | + }) | ||
85 | + | ||
86 | + if len(bk.WhoReview) != len(oldBackup.WhoReview) { | ||
87 | + whoReviewChanged = true | ||
88 | + } else { | ||
89 | + for i := range bk.WhoReview { | ||
90 | + if bk.WhoReview[i] != oldBackup.WhoReview[i] { | ||
91 | + whoReviewChanged = true | ||
92 | + } | ||
93 | + } | ||
94 | + } | ||
95 | + if whoReviewChanged { | ||
96 | + bk.ChangeField = append(bk.ChangeField, "WhoReview") | ||
97 | + } | ||
98 | + } | ||
99 | + //比较段落内容+图片+视频 是否发生变更 | ||
100 | + { | ||
101 | + sectionChanged := false | ||
102 | + newSectionData := map[string]string{ | ||
103 | + "title": bk.Title, | ||
104 | + } | ||
105 | + | ||
106 | + oldSectionData := map[string]string{ | ||
107 | + "title": oldBackup.Title, | ||
108 | + } | ||
109 | + | ||
110 | + for _, val := range bk.Section { | ||
111 | + mkey := fmt.Sprintf("section-%d", val.SortBy) | ||
112 | + newSectionData[mkey] = val.Content | ||
113 | + } | ||
114 | + for _, val := range bk.Images { | ||
115 | + newSectionData[val.Url] = "" | ||
116 | + } | ||
117 | + for _, val := range bk.Videos { | ||
118 | + newSectionData[val.Url] = "" | ||
119 | + } | ||
120 | + | ||
121 | + for _, val := range oldBackup.Section { | ||
122 | + mKey := fmt.Sprintf("section-%d", val.SortBy) | ||
123 | + oldSectionData[mKey] = val.Content | ||
124 | + } | ||
125 | + for _, val := range oldBackup.Images { | ||
126 | + oldSectionData[val.Url] = "" | ||
127 | + } | ||
128 | + for _, val := range oldBackup.Videos { | ||
129 | + oldSectionData[val.Url] = "" | ||
130 | + } | ||
131 | + newSectionJson, _ := json.Marshal(newSectionData) | ||
132 | + oldSectionJson, _ := json.Marshal(oldSectionData) | ||
133 | + if ok := bytes.Equal(newSectionJson, oldSectionJson); !ok { | ||
134 | + sectionChanged = true | ||
135 | + } | ||
136 | + if sectionChanged { | ||
137 | + bk.ChangeField = append(bk.ChangeField, "Section") | ||
138 | + } | ||
139 | + } | ||
140 | + return len(bk.ChangeField) > 0 | ||
141 | +} | ||
142 | + | ||
143 | +// 创建备份信息 | ||
144 | +func (bk *ArticleBackup) MakeBackup(operator UserSimple, article *Article, section []*ArticleSection, action string) { | ||
145 | + sectionBackup := make([]ArticleSection, len(section)) | ||
146 | + for i := range section { | ||
147 | + sectionBackup[i] = *section[i] | ||
148 | + } | ||
149 | + b := ArticleBackup{ | ||
150 | + Id: 0, | ||
151 | + CompanyId: article.CompanyId, | ||
152 | + CreatedAt: 0, | ||
153 | + UpdatedAt: 0, | ||
154 | + DeletedAt: 0, | ||
155 | + Version: article.Version, | ||
156 | + Operator: operator, | ||
157 | + ArticleId: article.Id, | ||
158 | + Title: article.Title, | ||
159 | + Section: sectionBackup, | ||
160 | + Images: make([]Image, len(article.Images)), | ||
161 | + Videos: make([]Video, len(article.Videos)), | ||
162 | + Action: action, | ||
163 | + TargetUser: article.TargetUser, | ||
164 | + WhoRead: article.WhoRead, | ||
165 | + WhoReview: article.WhoReview, | ||
166 | + Tags: article.Tags, | ||
167 | + MatchUrl: map[string]string{}, | ||
168 | + Show: article.Show, | ||
169 | + Location: article.Location, | ||
170 | + } | ||
171 | + if action == "原始版本" { | ||
172 | + b.ChangeField = append(b.ChangeField, "Section") | ||
173 | + } | ||
174 | + copy(b.Videos, article.Videos) | ||
175 | + copy(b.Images, article.Images) | ||
176 | + for k, v := range article.MatchUrl { | ||
177 | + b.MatchUrl[k] = v | ||
178 | + } | ||
179 | + *bk = b | ||
180 | +} |
@@ -136,6 +136,15 @@ func (m *User) WithName(name string) *User { | @@ -136,6 +136,15 @@ func (m *User) WithName(name string) *User { | ||
136 | return m | 136 | return m |
137 | } | 137 | } |
138 | 138 | ||
139 | +func (m *User) IsFollowed(userId int64) bool { | ||
140 | + return lo.Contains(m.Following, userId) | ||
141 | +} | ||
142 | + | ||
143 | +// IsFriend 如果是好友,为互相关注 | ||
144 | +func (m *User) IsFriend(userId int64) bool { | ||
145 | + return lo.Contains(m.Following, userId) && lo.Contains(m.Follower, userId) | ||
146 | +} | ||
147 | + | ||
139 | type ( | 148 | type ( |
140 | LoginCreator interface { | 149 | LoginCreator interface { |
141 | WechatLogin(r WechatLoginRequest) (*LoginInfo, error) | 150 | WechatLogin(r WechatLoginRequest) (*LoginInfo, error) |
-
请 注册 或 登录 后发表评论