正在显示
66 个修改的文件
包含
3846 行增加
和
101 行删除
| @@ -11,3 +11,5 @@ import "core/article.api" | @@ -11,3 +11,5 @@ import "core/article.api" | ||
| 11 | import "core/role.api" | 11 | import "core/role.api" |
| 12 | import "core/department.api" | 12 | import "core/department.api" |
| 13 | import "core/article_category.api" | 13 | import "core/article_category.api" |
| 14 | +import "core/article_security.api" | ||
| 15 | +import "core/article_template.api" |
| @@ -789,6 +789,184 @@ | @@ -789,6 +789,184 @@ | ||
| 789 | ] | 789 | ] |
| 790 | } | 790 | } |
| 791 | }, | 791 | }, |
| 792 | + "v1/mini/article_template": { | ||
| 793 | + "post": { | ||
| 794 | + "summary": "模板管理-保存", | ||
| 795 | + "operationId": "miniArticleTemplateSave", | ||
| 796 | + "responses": { | ||
| 797 | + "200": { | ||
| 798 | + "description": "A successful response.", | ||
| 799 | + "schema": { | ||
| 800 | + "$ref": "#/definitions/ArticleTemplateSaveResponse" | ||
| 801 | + } | ||
| 802 | + } | ||
| 803 | + }, | ||
| 804 | + "parameters": [ | ||
| 805 | + { | ||
| 806 | + "name": "body", | ||
| 807 | + "in": "body", | ||
| 808 | + "required": true, | ||
| 809 | + "schema": { | ||
| 810 | + "$ref": "#/definitions/ArticleTemplateSaveRequest" | ||
| 811 | + } | ||
| 812 | + } | ||
| 813 | + ], | ||
| 814 | + "requestBody": {}, | ||
| 815 | + "tags": [ | ||
| 816 | + "template" | ||
| 817 | + ] | ||
| 818 | + } | ||
| 819 | + }, | ||
| 820 | + "v1/mini/article_template/search": { | ||
| 821 | + "post": { | ||
| 822 | + "summary": "模板搜索", | ||
| 823 | + "operationId": "miniArticleTemplateSearch", | ||
| 824 | + "responses": { | ||
| 825 | + "200": { | ||
| 826 | + "description": "A successful response.", | ||
| 827 | + "schema": { | ||
| 828 | + "$ref": "#/definitions/ArticleTemplateSearchResponse" | ||
| 829 | + } | ||
| 830 | + } | ||
| 831 | + }, | ||
| 832 | + "parameters": [ | ||
| 833 | + { | ||
| 834 | + "name": "body", | ||
| 835 | + "in": "body", | ||
| 836 | + "required": true, | ||
| 837 | + "schema": { | ||
| 838 | + "$ref": "#/definitions/ArticleTemplateSearchRequest" | ||
| 839 | + } | ||
| 840 | + } | ||
| 841 | + ], | ||
| 842 | + "requestBody": {}, | ||
| 843 | + "tags": [ | ||
| 844 | + "template" | ||
| 845 | + ] | ||
| 846 | + } | ||
| 847 | + }, | ||
| 848 | + "v1/mini/article_template/search-mine": { | ||
| 849 | + "post": { | ||
| 850 | + "summary": "我的模板搜索", | ||
| 851 | + "operationId": "miniArticleTemplateSearchMine", | ||
| 852 | + "responses": { | ||
| 853 | + "200": { | ||
| 854 | + "description": "A successful response.", | ||
| 855 | + "schema": { | ||
| 856 | + "$ref": "#/definitions/ArticleTemplateSearchResponse" | ||
| 857 | + } | ||
| 858 | + } | ||
| 859 | + }, | ||
| 860 | + "parameters": [ | ||
| 861 | + { | ||
| 862 | + "name": "body", | ||
| 863 | + "in": "body", | ||
| 864 | + "required": true, | ||
| 865 | + "schema": { | ||
| 866 | + "$ref": "#/definitions/ArticleTemplateSearchRequest" | ||
| 867 | + } | ||
| 868 | + } | ||
| 869 | + ], | ||
| 870 | + "requestBody": {}, | ||
| 871 | + "tags": [ | ||
| 872 | + "template" | ||
| 873 | + ] | ||
| 874 | + } | ||
| 875 | + }, | ||
| 876 | + "v1/mini/article_template/{id}": { | ||
| 877 | + "delete": { | ||
| 878 | + "summary": "模板管理-删除", | ||
| 879 | + "operationId": "miniArticleTemplateDelete", | ||
| 880 | + "responses": { | ||
| 881 | + "200": { | ||
| 882 | + "description": "A successful response.", | ||
| 883 | + "schema": { | ||
| 884 | + "$ref": "#/definitions/ArticleTemplateDeleteResponse" | ||
| 885 | + } | ||
| 886 | + } | ||
| 887 | + }, | ||
| 888 | + "parameters": [ | ||
| 889 | + { | ||
| 890 | + "name": "id", | ||
| 891 | + "in": "path", | ||
| 892 | + "required": true, | ||
| 893 | + "type": "string" | ||
| 894 | + }, | ||
| 895 | + { | ||
| 896 | + "name": "body", | ||
| 897 | + "in": "body", | ||
| 898 | + "required": true, | ||
| 899 | + "schema": { | ||
| 900 | + "$ref": "#/definitions/ArticleTemplateDeleteRequest" | ||
| 901 | + } | ||
| 902 | + } | ||
| 903 | + ], | ||
| 904 | + "requestBody": {}, | ||
| 905 | + "tags": [ | ||
| 906 | + "template" | ||
| 907 | + ] | ||
| 908 | + }, | ||
| 909 | + "put": { | ||
| 910 | + "summary": "模板管理-更新", | ||
| 911 | + "operationId": "miniArticleTemplateUpdate", | ||
| 912 | + "responses": { | ||
| 913 | + "200": { | ||
| 914 | + "description": "A successful response.", | ||
| 915 | + "schema": { | ||
| 916 | + "$ref": "#/definitions/ArticleTemplateUpdateResponse" | ||
| 917 | + } | ||
| 918 | + } | ||
| 919 | + }, | ||
| 920 | + "parameters": [ | ||
| 921 | + { | ||
| 922 | + "name": "id", | ||
| 923 | + "in": "path", | ||
| 924 | + "required": true, | ||
| 925 | + "type": "string" | ||
| 926 | + }, | ||
| 927 | + { | ||
| 928 | + "name": "body", | ||
| 929 | + "in": "body", | ||
| 930 | + "required": true, | ||
| 931 | + "schema": { | ||
| 932 | + "$ref": "#/definitions/ArticleTemplateUpdateRequest" | ||
| 933 | + } | ||
| 934 | + } | ||
| 935 | + ], | ||
| 936 | + "requestBody": {}, | ||
| 937 | + "tags": [ | ||
| 938 | + "template" | ||
| 939 | + ] | ||
| 940 | + } | ||
| 941 | + }, | ||
| 942 | + "v1/mini/article_template_class/search": { | ||
| 943 | + "post": { | ||
| 944 | + "summary": "模板分类搜索", | ||
| 945 | + "operationId": "miniArticleTemplateClassSearch", | ||
| 946 | + "responses": { | ||
| 947 | + "200": { | ||
| 948 | + "description": "A successful response.", | ||
| 949 | + "schema": { | ||
| 950 | + "$ref": "#/definitions/ArticleTemplateClassSearchResponse" | ||
| 951 | + } | ||
| 952 | + } | ||
| 953 | + }, | ||
| 954 | + "parameters": [ | ||
| 955 | + { | ||
| 956 | + "name": "body", | ||
| 957 | + "in": "body", | ||
| 958 | + "required": true, | ||
| 959 | + "schema": { | ||
| 960 | + "$ref": "#/definitions/ArticleTemplateClassSearchRequest" | ||
| 961 | + } | ||
| 962 | + } | ||
| 963 | + ], | ||
| 964 | + "requestBody": {}, | ||
| 965 | + "tags": [ | ||
| 966 | + "template" | ||
| 967 | + ] | ||
| 968 | + } | ||
| 969 | + }, | ||
| 792 | "v1/mini/company/search": { | 970 | "v1/mini/company/search": { |
| 793 | "post": { | 971 | "post": { |
| 794 | "summary": "公司搜索(公开的)", | 972 | "summary": "公司搜索(公开的)", |
| @@ -1013,6 +1191,64 @@ | @@ -1013,6 +1191,64 @@ | ||
| 1013 | ] | 1191 | ] |
| 1014 | } | 1192 | } |
| 1015 | }, | 1193 | }, |
| 1194 | + "v1/mini/message/subscribe/add": { | ||
| 1195 | + "post": { | ||
| 1196 | + "summary": "增加订阅消息次数", | ||
| 1197 | + "operationId": "miniMessageSubscribeAdd", | ||
| 1198 | + "responses": { | ||
| 1199 | + "200": { | ||
| 1200 | + "description": "A successful response.", | ||
| 1201 | + "schema": { | ||
| 1202 | + "$ref": "#/definitions/MessageSubscribeAddResponse" | ||
| 1203 | + } | ||
| 1204 | + } | ||
| 1205 | + }, | ||
| 1206 | + "parameters": [ | ||
| 1207 | + { | ||
| 1208 | + "name": "body", | ||
| 1209 | + "description": " 增加消息订阅次数", | ||
| 1210 | + "in": "body", | ||
| 1211 | + "required": true, | ||
| 1212 | + "schema": { | ||
| 1213 | + "$ref": "#/definitions/MessageSubscribeAddRequest" | ||
| 1214 | + } | ||
| 1215 | + } | ||
| 1216 | + ], | ||
| 1217 | + "requestBody": {}, | ||
| 1218 | + "tags": [ | ||
| 1219 | + "message" | ||
| 1220 | + ] | ||
| 1221 | + } | ||
| 1222 | + }, | ||
| 1223 | + "v1/mini/message/subscribe/list": { | ||
| 1224 | + "post": { | ||
| 1225 | + "summary": "获取订阅消息次数", | ||
| 1226 | + "operationId": "miniMessageSubscribeList", | ||
| 1227 | + "responses": { | ||
| 1228 | + "200": { | ||
| 1229 | + "description": "A successful response.", | ||
| 1230 | + "schema": { | ||
| 1231 | + "$ref": "#/definitions/MessageSubscribeListResponse" | ||
| 1232 | + } | ||
| 1233 | + } | ||
| 1234 | + }, | ||
| 1235 | + "parameters": [ | ||
| 1236 | + { | ||
| 1237 | + "name": "body", | ||
| 1238 | + "description": "订阅消息次数详情", | ||
| 1239 | + "in": "body", | ||
| 1240 | + "required": true, | ||
| 1241 | + "schema": { | ||
| 1242 | + "$ref": "#/definitions/MessageSubscribeListRequest" | ||
| 1243 | + } | ||
| 1244 | + } | ||
| 1245 | + ], | ||
| 1246 | + "requestBody": {}, | ||
| 1247 | + "tags": [ | ||
| 1248 | + "message" | ||
| 1249 | + ] | ||
| 1250 | + } | ||
| 1251 | + }, | ||
| 1016 | "v1/mini/message/system": { | 1252 | "v1/mini/message/system": { |
| 1017 | "post": { | 1253 | "post": { |
| 1018 | "summary": "系统消息", | 1254 | "summary": "系统消息", |
| @@ -1661,6 +1897,52 @@ | @@ -1661,6 +1897,52 @@ | ||
| 1661 | ] | 1897 | ] |
| 1662 | } | 1898 | } |
| 1663 | }, | 1899 | }, |
| 1900 | + "v1/mini/wechat/bind": { | ||
| 1901 | + "post": { | ||
| 1902 | + "summary": "绑定微信", | ||
| 1903 | + "operationId": "miniWechatBind", | ||
| 1904 | + "responses": { | ||
| 1905 | + "200": { | ||
| 1906 | + "description": "A successful response.", | ||
| 1907 | + "schema": { | ||
| 1908 | + "$ref": "#/definitions/MiniWechatBindResponse" | ||
| 1909 | + } | ||
| 1910 | + } | ||
| 1911 | + }, | ||
| 1912 | + "parameters": [ | ||
| 1913 | + { | ||
| 1914 | + "name": "body", | ||
| 1915 | + "in": "body", | ||
| 1916 | + "required": true, | ||
| 1917 | + "schema": { | ||
| 1918 | + "$ref": "#/definitions/MiniWechatBindRequest" | ||
| 1919 | + } | ||
| 1920 | + } | ||
| 1921 | + ], | ||
| 1922 | + "requestBody": {}, | ||
| 1923 | + "tags": [ | ||
| 1924 | + "user" | ||
| 1925 | + ] | ||
| 1926 | + } | ||
| 1927 | + }, | ||
| 1928 | + "v1/mini/wechat/info": { | ||
| 1929 | + "get": { | ||
| 1930 | + "summary": "检测是否绑定微信", | ||
| 1931 | + "operationId": "miniWechatInfo", | ||
| 1932 | + "responses": { | ||
| 1933 | + "200": { | ||
| 1934 | + "description": "A successful response.", | ||
| 1935 | + "schema": { | ||
| 1936 | + "$ref": "#/definitions/MiniWechatInfoResponse" | ||
| 1937 | + } | ||
| 1938 | + } | ||
| 1939 | + }, | ||
| 1940 | + "requestBody": {}, | ||
| 1941 | + "tags": [ | ||
| 1942 | + "user" | ||
| 1943 | + ] | ||
| 1944 | + } | ||
| 1945 | + }, | ||
| 1664 | "v1/system/account": { | 1946 | "v1/system/account": { |
| 1665 | "post": { | 1947 | "post": { |
| 1666 | "summary": "系统新增账号", | 1948 | "summary": "系统新增账号", |
| @@ -2623,41 +2905,44 @@ | @@ -2623,41 +2905,44 @@ | ||
| 2623 | ] | 2905 | ] |
| 2624 | } | 2906 | } |
| 2625 | }, | 2907 | }, |
| 2626 | - "v1/system/article_tag": { | 2908 | + "v1/system/article_security/audit": { |
| 2627 | "post": { | 2909 | "post": { |
| 2628 | - "summary": "后台创建文章标签", | ||
| 2629 | - "operationId": "CreateTag", | 2910 | + "summary": "内容安全-审核", |
| 2911 | + "operationId": "articleSecurityAudit", | ||
| 2630 | "responses": { | 2912 | "responses": { |
| 2631 | "200": { | 2913 | "200": { |
| 2632 | "description": "A successful response.", | 2914 | "description": "A successful response.", |
| 2633 | "schema": { | 2915 | "schema": { |
| 2634 | - "$ref": "#/definitions/TagCreateResponse" | 2916 | + "$ref": "#/definitions/ArticleSecurityAuditResponse" |
| 2635 | } | 2917 | } |
| 2636 | } | 2918 | } |
| 2637 | }, | 2919 | }, |
| 2638 | "parameters": [ | 2920 | "parameters": [ |
| 2639 | { | 2921 | { |
| 2640 | "name": "body", | 2922 | "name": "body", |
| 2923 | + "description": " ArticleSecuritySaveRequest struct{, ArticleSecurity ArticleSecurityItem `json:\"article_security\"`, }, ArticleSecuritySaveResponse struct{},, ArticleSecurityDeleteRequest struct{, Id int64 `path:\"id\"`, }, ArticleSecurityDeleteResponse struct{},, ArticleSecurityUpdateRequest struct{, Id int64 `path:\"id\"`, ArticleSecurity ArticleSecurityItem `json:\"article_security\"`, }, ArticleSecurityUpdateResponse struct{}", | ||
| 2641 | "in": "body", | 2924 | "in": "body", |
| 2642 | "required": true, | 2925 | "required": true, |
| 2643 | "schema": { | 2926 | "schema": { |
| 2644 | - "$ref": "#/definitions/TagCreateRequest" | 2927 | + "$ref": "#/definitions/ArticleSecurityAuditRequest" |
| 2645 | } | 2928 | } |
| 2646 | } | 2929 | } |
| 2647 | ], | 2930 | ], |
| 2648 | "requestBody": {}, | 2931 | "requestBody": {}, |
| 2649 | "tags": [ | 2932 | "tags": [ |
| 2650 | - "tags" | 2933 | + "secuirty" |
| 2651 | ] | 2934 | ] |
| 2935 | + } | ||
| 2652 | }, | 2936 | }, |
| 2653 | - "put": { | ||
| 2654 | - "summary": "后台编辑文章标签", | ||
| 2655 | - "operationId": "EditTag", | 2937 | + "v1/system/article_security/search": { |
| 2938 | + "post": { | ||
| 2939 | + "summary": "内容安全-搜索", | ||
| 2940 | + "operationId": "articleSecuritySearch", | ||
| 2656 | "responses": { | 2941 | "responses": { |
| 2657 | "200": { | 2942 | "200": { |
| 2658 | "description": "A successful response.", | 2943 | "description": "A successful response.", |
| 2659 | "schema": { | 2944 | "schema": { |
| 2660 | - "$ref": "#/definitions/TagEditResponse" | 2945 | + "$ref": "#/definitions/ArticleSecuritySearchResponse" |
| 2661 | } | 2946 | } |
| 2662 | } | 2947 | } |
| 2663 | }, | 2948 | }, |
| @@ -2667,37 +2952,117 @@ | @@ -2667,37 +2952,117 @@ | ||
| 2667 | "in": "body", | 2952 | "in": "body", |
| 2668 | "required": true, | 2953 | "required": true, |
| 2669 | "schema": { | 2954 | "schema": { |
| 2670 | - "$ref": "#/definitions/TagEditRequest" | 2955 | + "$ref": "#/definitions/ArticleSecuritySearchRequest" |
| 2671 | } | 2956 | } |
| 2672 | } | 2957 | } |
| 2673 | ], | 2958 | ], |
| 2674 | "requestBody": {}, | 2959 | "requestBody": {}, |
| 2675 | "tags": [ | 2960 | "tags": [ |
| 2676 | - "tags" | 2961 | + "secuirty" |
| 2677 | ] | 2962 | ] |
| 2678 | } | 2963 | } |
| 2679 | }, | 2964 | }, |
| 2680 | - "v1/system/article_tag/options": { | 2965 | + "v1/system/article_security/{id}": { |
| 2681 | "get": { | 2966 | "get": { |
| 2682 | - "summary": "后台标签下拉列表", | ||
| 2683 | - "operationId": "Options", | 2967 | + "summary": "详情", |
| 2968 | + "operationId": "articleSecurityGet", | ||
| 2684 | "responses": { | 2969 | "responses": { |
| 2685 | "200": { | 2970 | "200": { |
| 2686 | "description": "A successful response.", | 2971 | "description": "A successful response.", |
| 2687 | "schema": { | 2972 | "schema": { |
| 2688 | - "$ref": "#/definitions/TagOptionsResponse" | 2973 | + "$ref": "#/definitions/ArticleSecurityGetResponse" |
| 2689 | } | 2974 | } |
| 2690 | } | 2975 | } |
| 2691 | }, | 2976 | }, |
| 2977 | + "parameters": [ | ||
| 2978 | + { | ||
| 2979 | + "name": "id", | ||
| 2980 | + "in": "path", | ||
| 2981 | + "required": true, | ||
| 2982 | + "type": "string" | ||
| 2983 | + } | ||
| 2984 | + ], | ||
| 2692 | "requestBody": {}, | 2985 | "requestBody": {}, |
| 2693 | "tags": [ | 2986 | "tags": [ |
| 2694 | - "tags" | 2987 | + "secuirty" |
| 2695 | ] | 2988 | ] |
| 2696 | } | 2989 | } |
| 2697 | }, | 2990 | }, |
| 2698 | - "v1/system/article_tag/search": { | 2991 | + "v1/system/article_tag": { |
| 2699 | "post": { | 2992 | "post": { |
| 2700 | - "summary": "后台搜索标签", | 2993 | + "summary": "后台创建文章标签", |
| 2994 | + "operationId": "CreateTag", | ||
| 2995 | + "responses": { | ||
| 2996 | + "200": { | ||
| 2997 | + "description": "A successful response.", | ||
| 2998 | + "schema": { | ||
| 2999 | + "$ref": "#/definitions/TagCreateResponse" | ||
| 3000 | + } | ||
| 3001 | + } | ||
| 3002 | + }, | ||
| 3003 | + "parameters": [ | ||
| 3004 | + { | ||
| 3005 | + "name": "body", | ||
| 3006 | + "in": "body", | ||
| 3007 | + "required": true, | ||
| 3008 | + "schema": { | ||
| 3009 | + "$ref": "#/definitions/TagCreateRequest" | ||
| 3010 | + } | ||
| 3011 | + } | ||
| 3012 | + ], | ||
| 3013 | + "requestBody": {}, | ||
| 3014 | + "tags": [ | ||
| 3015 | + "tags" | ||
| 3016 | + ] | ||
| 3017 | + }, | ||
| 3018 | + "put": { | ||
| 3019 | + "summary": "后台编辑文章标签", | ||
| 3020 | + "operationId": "EditTag", | ||
| 3021 | + "responses": { | ||
| 3022 | + "200": { | ||
| 3023 | + "description": "A successful response.", | ||
| 3024 | + "schema": { | ||
| 3025 | + "$ref": "#/definitions/TagEditResponse" | ||
| 3026 | + } | ||
| 3027 | + } | ||
| 3028 | + }, | ||
| 3029 | + "parameters": [ | ||
| 3030 | + { | ||
| 3031 | + "name": "body", | ||
| 3032 | + "in": "body", | ||
| 3033 | + "required": true, | ||
| 3034 | + "schema": { | ||
| 3035 | + "$ref": "#/definitions/TagEditRequest" | ||
| 3036 | + } | ||
| 3037 | + } | ||
| 3038 | + ], | ||
| 3039 | + "requestBody": {}, | ||
| 3040 | + "tags": [ | ||
| 3041 | + "tags" | ||
| 3042 | + ] | ||
| 3043 | + } | ||
| 3044 | + }, | ||
| 3045 | + "v1/system/article_tag/options": { | ||
| 3046 | + "get": { | ||
| 3047 | + "summary": "后台标签下拉列表", | ||
| 3048 | + "operationId": "Options", | ||
| 3049 | + "responses": { | ||
| 3050 | + "200": { | ||
| 3051 | + "description": "A successful response.", | ||
| 3052 | + "schema": { | ||
| 3053 | + "$ref": "#/definitions/TagOptionsResponse" | ||
| 3054 | + } | ||
| 3055 | + } | ||
| 3056 | + }, | ||
| 3057 | + "requestBody": {}, | ||
| 3058 | + "tags": [ | ||
| 3059 | + "tags" | ||
| 3060 | + ] | ||
| 3061 | + } | ||
| 3062 | + }, | ||
| 3063 | + "v1/system/article_tag/search": { | ||
| 3064 | + "post": { | ||
| 3065 | + "summary": "后台搜索标签", | ||
| 2701 | "operationId": "SearchTag", | 3066 | "operationId": "SearchTag", |
| 2702 | "responses": { | 3067 | "responses": { |
| 2703 | "200": { | 3068 | "200": { |
| @@ -2781,6 +3146,208 @@ | @@ -2781,6 +3146,208 @@ | ||
| 2781 | ] | 3146 | ] |
| 2782 | } | 3147 | } |
| 2783 | }, | 3148 | }, |
| 3149 | + "v1/system/article_template": { | ||
| 3150 | + "post": { | ||
| 3151 | + "summary": "模板管理-保存", | ||
| 3152 | + "operationId": "systemArticleTemplateSave", | ||
| 3153 | + "responses": { | ||
| 3154 | + "200": { | ||
| 3155 | + "description": "A successful response.", | ||
| 3156 | + "schema": { | ||
| 3157 | + "$ref": "#/definitions/ArticleTemplateSaveResponse" | ||
| 3158 | + } | ||
| 3159 | + } | ||
| 3160 | + }, | ||
| 3161 | + "parameters": [ | ||
| 3162 | + { | ||
| 3163 | + "name": "body", | ||
| 3164 | + "in": "body", | ||
| 3165 | + "required": true, | ||
| 3166 | + "schema": { | ||
| 3167 | + "$ref": "#/definitions/ArticleTemplateSaveRequest" | ||
| 3168 | + } | ||
| 3169 | + } | ||
| 3170 | + ], | ||
| 3171 | + "requestBody": {}, | ||
| 3172 | + "tags": [ | ||
| 3173 | + "template" | ||
| 3174 | + ] | ||
| 3175 | + } | ||
| 3176 | + }, | ||
| 3177 | + "v1/system/article_template/batch_delete": { | ||
| 3178 | + "delete": { | ||
| 3179 | + "summary": "模板管理-批量删除", | ||
| 3180 | + "operationId": "systemArticleTemplateBatchDelete", | ||
| 3181 | + "responses": { | ||
| 3182 | + "200": { | ||
| 3183 | + "description": "A successful response.", | ||
| 3184 | + "schema": { | ||
| 3185 | + "$ref": "#/definitions/ArticleTemplateBatchResponse" | ||
| 3186 | + } | ||
| 3187 | + } | ||
| 3188 | + }, | ||
| 3189 | + "parameters": [ | ||
| 3190 | + { | ||
| 3191 | + "name": "body", | ||
| 3192 | + "in": "body", | ||
| 3193 | + "required": true, | ||
| 3194 | + "schema": { | ||
| 3195 | + "$ref": "#/definitions/ArticleTemplateBatchDeleteRequest" | ||
| 3196 | + } | ||
| 3197 | + } | ||
| 3198 | + ], | ||
| 3199 | + "requestBody": {}, | ||
| 3200 | + "tags": [ | ||
| 3201 | + "template" | ||
| 3202 | + ] | ||
| 3203 | + } | ||
| 3204 | + }, | ||
| 3205 | + "v1/system/article_template/search": { | ||
| 3206 | + "post": { | ||
| 3207 | + "summary": "模板管理-搜索", | ||
| 3208 | + "operationId": "systemArticleTemplateSearch", | ||
| 3209 | + "responses": { | ||
| 3210 | + "200": { | ||
| 3211 | + "description": "A successful response.", | ||
| 3212 | + "schema": { | ||
| 3213 | + "$ref": "#/definitions/ArticleTemplateSearchResponse" | ||
| 3214 | + } | ||
| 3215 | + } | ||
| 3216 | + }, | ||
| 3217 | + "parameters": [ | ||
| 3218 | + { | ||
| 3219 | + "name": "body", | ||
| 3220 | + "in": "body", | ||
| 3221 | + "required": true, | ||
| 3222 | + "schema": { | ||
| 3223 | + "$ref": "#/definitions/ArticleTemplateSearchRequest" | ||
| 3224 | + } | ||
| 3225 | + } | ||
| 3226 | + ], | ||
| 3227 | + "requestBody": {}, | ||
| 3228 | + "tags": [ | ||
| 3229 | + "template" | ||
| 3230 | + ] | ||
| 3231 | + } | ||
| 3232 | + }, | ||
| 3233 | + "v1/system/article_template/{id}": { | ||
| 3234 | + "get": { | ||
| 3235 | + "summary": "模板管理-详情", | ||
| 3236 | + "operationId": "systemArticleTemplateGet", | ||
| 3237 | + "responses": { | ||
| 3238 | + "200": { | ||
| 3239 | + "description": "A successful response.", | ||
| 3240 | + "schema": { | ||
| 3241 | + "$ref": "#/definitions/ArticleTemplateGetResponse" | ||
| 3242 | + } | ||
| 3243 | + } | ||
| 3244 | + }, | ||
| 3245 | + "parameters": [ | ||
| 3246 | + { | ||
| 3247 | + "name": "id", | ||
| 3248 | + "in": "path", | ||
| 3249 | + "required": true, | ||
| 3250 | + "type": "string" | ||
| 3251 | + } | ||
| 3252 | + ], | ||
| 3253 | + "requestBody": {}, | ||
| 3254 | + "tags": [ | ||
| 3255 | + "template" | ||
| 3256 | + ] | ||
| 3257 | + }, | ||
| 3258 | + "delete": { | ||
| 3259 | + "summary": "模板管理-删除", | ||
| 3260 | + "operationId": "systemArticleTemplateDelete", | ||
| 3261 | + "responses": { | ||
| 3262 | + "200": { | ||
| 3263 | + "description": "A successful response.", | ||
| 3264 | + "schema": { | ||
| 3265 | + "$ref": "#/definitions/ArticleTemplateDeleteResponse" | ||
| 3266 | + } | ||
| 3267 | + } | ||
| 3268 | + }, | ||
| 3269 | + "parameters": [ | ||
| 3270 | + { | ||
| 3271 | + "name": "id", | ||
| 3272 | + "in": "path", | ||
| 3273 | + "required": true, | ||
| 3274 | + "type": "string" | ||
| 3275 | + }, | ||
| 3276 | + { | ||
| 3277 | + "name": "body", | ||
| 3278 | + "in": "body", | ||
| 3279 | + "required": true, | ||
| 3280 | + "schema": { | ||
| 3281 | + "$ref": "#/definitions/ArticleTemplateDeleteRequest" | ||
| 3282 | + } | ||
| 3283 | + } | ||
| 3284 | + ], | ||
| 3285 | + "requestBody": {}, | ||
| 3286 | + "tags": [ | ||
| 3287 | + "template" | ||
| 3288 | + ] | ||
| 3289 | + }, | ||
| 3290 | + "put": { | ||
| 3291 | + "summary": "模板管理-更新", | ||
| 3292 | + "operationId": "systemArticleTemplateUpdate", | ||
| 3293 | + "responses": { | ||
| 3294 | + "200": { | ||
| 3295 | + "description": "A successful response.", | ||
| 3296 | + "schema": { | ||
| 3297 | + "$ref": "#/definitions/ArticleTemplateUpdateResponse" | ||
| 3298 | + } | ||
| 3299 | + } | ||
| 3300 | + }, | ||
| 3301 | + "parameters": [ | ||
| 3302 | + { | ||
| 3303 | + "name": "id", | ||
| 3304 | + "in": "path", | ||
| 3305 | + "required": true, | ||
| 3306 | + "type": "string" | ||
| 3307 | + }, | ||
| 3308 | + { | ||
| 3309 | + "name": "body", | ||
| 3310 | + "in": "body", | ||
| 3311 | + "required": true, | ||
| 3312 | + "schema": { | ||
| 3313 | + "$ref": "#/definitions/ArticleTemplateUpdateRequest" | ||
| 3314 | + } | ||
| 3315 | + } | ||
| 3316 | + ], | ||
| 3317 | + "requestBody": {}, | ||
| 3318 | + "tags": [ | ||
| 3319 | + "template" | ||
| 3320 | + ] | ||
| 3321 | + } | ||
| 3322 | + }, | ||
| 3323 | + "v1/system/article_template_class/search": { | ||
| 3324 | + "post": { | ||
| 3325 | + "summary": "模板管理-分类搜索", | ||
| 3326 | + "operationId": "systemArticleTemplateClassSearch", | ||
| 3327 | + "responses": { | ||
| 3328 | + "200": { | ||
| 3329 | + "description": "A successful response.", | ||
| 3330 | + "schema": { | ||
| 3331 | + "$ref": "#/definitions/ArticleTemplateClassSearchResponse" | ||
| 3332 | + } | ||
| 3333 | + } | ||
| 3334 | + }, | ||
| 3335 | + "parameters": [ | ||
| 3336 | + { | ||
| 3337 | + "name": "body", | ||
| 3338 | + "in": "body", | ||
| 3339 | + "required": true, | ||
| 3340 | + "schema": { | ||
| 3341 | + "$ref": "#/definitions/ArticleTemplateClassSearchRequest" | ||
| 3342 | + } | ||
| 3343 | + } | ||
| 3344 | + ], | ||
| 3345 | + "requestBody": {}, | ||
| 3346 | + "tags": [ | ||
| 3347 | + "template" | ||
| 3348 | + ] | ||
| 3349 | + } | ||
| 3350 | + }, | ||
| 2784 | "v1/system/company/positions/search": { | 3351 | "v1/system/company/positions/search": { |
| 2785 | "post": { | 3352 | "post": { |
| 2786 | "summary": "公司职位搜索", | 3353 | "summary": "公司职位搜索", |
| @@ -3765,6 +4332,16 @@ | @@ -3765,6 +4332,16 @@ | ||
| 3765 | "format": "int64" | 4332 | "format": "int64" |
| 3766 | }, | 4333 | }, |
| 3767 | "description": "谁可查看" | 4334 | "description": "谁可查看" |
| 4335 | + }, | ||
| 4336 | + "isDel": { | ||
| 4337 | + "type": "integer", | ||
| 4338 | + "format": "int32", | ||
| 4339 | + "description": "是否删除 1-删除 0-否" | ||
| 4340 | + }, | ||
| 4341 | + "deletedType": { | ||
| 4342 | + "type": "integer", | ||
| 4343 | + "format": "int32", | ||
| 4344 | + "description": "类型 1-运营删除 2-用户删除" | ||
| 3768 | } | 4345 | } |
| 3769 | }, | 4346 | }, |
| 3770 | "title": "ArticleSearchMe", | 4347 | "title": "ArticleSearchMe", |
| @@ -3778,7 +4355,9 @@ | @@ -3778,7 +4355,9 @@ | ||
| 3778 | "countRead", | 4355 | "countRead", |
| 3779 | "show", | 4356 | "show", |
| 3780 | "targetUser", | 4357 | "targetUser", |
| 3781 | - "whoRead" | 4358 | + "whoRead", |
| 4359 | + "isDel", | ||
| 4360 | + "deletedType" | ||
| 3782 | ] | 4361 | ] |
| 3783 | }, | 4362 | }, |
| 3784 | "ArticleSection": { | 4363 | "ArticleSection": { |
| @@ -3812,19 +4391,213 @@ | @@ -3812,19 +4391,213 @@ | ||
| 3812 | "totalComment" | 4391 | "totalComment" |
| 3813 | ] | 4392 | ] |
| 3814 | }, | 4393 | }, |
| 3815 | - "ArticleTagCount": { | 4394 | + "ArticleSecurityAuditRequest": { |
| 3816 | "type": "object", | 4395 | "type": "object", |
| 3817 | "properties": { | 4396 | "properties": { |
| 3818 | - "tagCategory": { | ||
| 3819 | - "type": "string", | ||
| 3820 | - "description": " 标签分组" | ||
| 3821 | - }, | ||
| 3822 | - "tagId": { | 4397 | + "id": { |
| 3823 | "type": "integer", | 4398 | "type": "integer", |
| 3824 | "format": "int64", | 4399 | "format": "int64", |
| 3825 | - "description": " 标签id" | 4400 | + "description": "id" |
| 3826 | }, | 4401 | }, |
| 3827 | - "tagImage": { | 4402 | + "status": { |
| 4403 | + "type": "integer", | ||
| 4404 | + "format": "int32", | ||
| 4405 | + "description": " 1:成功 0:失败" | ||
| 4406 | + } | ||
| 4407 | + }, | ||
| 4408 | + "title": "ArticleSecurityAuditRequest", | ||
| 4409 | + "required": [ | ||
| 4410 | + "id", | ||
| 4411 | + "status" | ||
| 4412 | + ] | ||
| 4413 | + }, | ||
| 4414 | + "ArticleSecurityAuditResponse": { | ||
| 4415 | + "type": "object", | ||
| 4416 | + "title": "ArticleSecurityAuditResponse" | ||
| 4417 | + }, | ||
| 4418 | + "ArticleSecurityGetRequest": { | ||
| 4419 | + "type": "object", | ||
| 4420 | + "properties": { | ||
| 4421 | + "id": { | ||
| 4422 | + "type": "integer", | ||
| 4423 | + "format": "int64" | ||
| 4424 | + } | ||
| 4425 | + }, | ||
| 4426 | + "title": "ArticleSecurityGetRequest", | ||
| 4427 | + "required": [ | ||
| 4428 | + "id" | ||
| 4429 | + ] | ||
| 4430 | + }, | ||
| 4431 | + "ArticleSecurityGetResponse": { | ||
| 4432 | + "type": "object", | ||
| 4433 | + "properties": { | ||
| 4434 | + "item": { | ||
| 4435 | + "$ref": "#/definitions/ArticleSecurityItem" | ||
| 4436 | + } | ||
| 4437 | + }, | ||
| 4438 | + "title": "ArticleSecurityGetResponse", | ||
| 4439 | + "required": [ | ||
| 4440 | + "item" | ||
| 4441 | + ] | ||
| 4442 | + }, | ||
| 4443 | + "ArticleSecurityItem": { | ||
| 4444 | + "type": "object", | ||
| 4445 | + "properties": { | ||
| 4446 | + "id": { | ||
| 4447 | + "type": "integer", | ||
| 4448 | + "format": "int64", | ||
| 4449 | + "description": " 唯一标识" | ||
| 4450 | + }, | ||
| 4451 | + "contentKeyWords": { | ||
| 4452 | + "type": "string", | ||
| 4453 | + "description": " 内容关键字" | ||
| 4454 | + }, | ||
| 4455 | + "content": { | ||
| 4456 | + "$ref": "#/definitions/ContentDetailItem", | ||
| 4457 | + "description": " 内容详情" | ||
| 4458 | + }, | ||
| 4459 | + "label": { | ||
| 4460 | + "type": "string", | ||
| 4461 | + "description": " 风控标签" | ||
| 4462 | + }, | ||
| 4463 | + "prob": { | ||
| 4464 | + "type": "integer", | ||
| 4465 | + "format": "int32", | ||
| 4466 | + "description": " 分值" | ||
| 4467 | + }, | ||
| 4468 | + "suggest": { | ||
| 4469 | + "type": "string", | ||
| 4470 | + "description": " 建议 通过、风险、人工审核" | ||
| 4471 | + }, | ||
| 4472 | + "author": { | ||
| 4473 | + "type": "string", | ||
| 4474 | + "description": " 发布人" | ||
| 4475 | + }, | ||
| 4476 | + "releaseAt": { | ||
| 4477 | + "type": "integer", | ||
| 4478 | + "format": "int64", | ||
| 4479 | + "description": " 发布时间" | ||
| 4480 | + }, | ||
| 4481 | + "reviewStatus": { | ||
| 4482 | + "type": "integer", | ||
| 4483 | + "format": "int32", | ||
| 4484 | + "description": " 审核结果 1:待审核 2:通过 3:拒绝" | ||
| 4485 | + }, | ||
| 4486 | + "reviewer": { | ||
| 4487 | + "type": "string", | ||
| 4488 | + "description": " 审核人" | ||
| 4489 | + }, | ||
| 4490 | + "reviewAt": { | ||
| 4491 | + "type": "integer", | ||
| 4492 | + "format": "int64", | ||
| 4493 | + "description": " 审核时间(人工处置时间)" | ||
| 4494 | + }, | ||
| 4495 | + "checkList": { | ||
| 4496 | + "type": "array", | ||
| 4497 | + "items": { | ||
| 4498 | + "$ref": "#/definitions/CheckDetailItem" | ||
| 4499 | + }, | ||
| 4500 | + "description": " 检查列表" | ||
| 4501 | + } | ||
| 4502 | + }, | ||
| 4503 | + "title": "ArticleSecurityItem", | ||
| 4504 | + "required": [ | ||
| 4505 | + "id", | ||
| 4506 | + "contentKeyWords", | ||
| 4507 | + "content", | ||
| 4508 | + "label", | ||
| 4509 | + "prob", | ||
| 4510 | + "suggest", | ||
| 4511 | + "author", | ||
| 4512 | + "releaseAt", | ||
| 4513 | + "reviewStatus", | ||
| 4514 | + "reviewer", | ||
| 4515 | + "reviewAt", | ||
| 4516 | + "checkList" | ||
| 4517 | + ] | ||
| 4518 | + }, | ||
| 4519 | + "ArticleSecuritySearchRequest": { | ||
| 4520 | + "type": "object", | ||
| 4521 | + "properties": { | ||
| 4522 | + "page": { | ||
| 4523 | + "type": "integer", | ||
| 4524 | + "format": "int32" | ||
| 4525 | + }, | ||
| 4526 | + "size": { | ||
| 4527 | + "type": "integer", | ||
| 4528 | + "format": "int32" | ||
| 4529 | + }, | ||
| 4530 | + "reviewStatus": { | ||
| 4531 | + "type": "integer", | ||
| 4532 | + "format": "int32", | ||
| 4533 | + "description": " 审核结果 1:待审核 2:通过 3:拒绝" | ||
| 4534 | + }, | ||
| 4535 | + "suggest": { | ||
| 4536 | + "type": "string", | ||
| 4537 | + "description": " 建议 通过、风险、人工审核" | ||
| 4538 | + }, | ||
| 4539 | + "contentType": { | ||
| 4540 | + "type": "integer", | ||
| 4541 | + "format": "int32", | ||
| 4542 | + "description": " 内容类型 (1:文章 2:评论)" | ||
| 4543 | + }, | ||
| 4544 | + "authorName": { | ||
| 4545 | + "type": "string", | ||
| 4546 | + "description": " 作者名称" | ||
| 4547 | + }, | ||
| 4548 | + "beginTime": { | ||
| 4549 | + "type": "integer", | ||
| 4550 | + "format": "int64", | ||
| 4551 | + "description": " 开始时间" | ||
| 4552 | + }, | ||
| 4553 | + "endTime": { | ||
| 4554 | + "type": "integer", | ||
| 4555 | + "format": "int64", | ||
| 4556 | + "description": " 结束时间" | ||
| 4557 | + } | ||
| 4558 | + }, | ||
| 4559 | + "title": "ArticleSecuritySearchRequest", | ||
| 4560 | + "required": [ | ||
| 4561 | + "suggest", | ||
| 4562 | + "contentType", | ||
| 4563 | + "authorName", | ||
| 4564 | + "beginTime", | ||
| 4565 | + "endTime" | ||
| 4566 | + ] | ||
| 4567 | + }, | ||
| 4568 | + "ArticleSecuritySearchResponse": { | ||
| 4569 | + "type": "object", | ||
| 4570 | + "properties": { | ||
| 4571 | + "list": { | ||
| 4572 | + "type": "array", | ||
| 4573 | + "items": { | ||
| 4574 | + "$ref": "#/definitions/ArticleSecurityItem" | ||
| 4575 | + } | ||
| 4576 | + }, | ||
| 4577 | + "total": { | ||
| 4578 | + "type": "integer", | ||
| 4579 | + "format": "int64" | ||
| 4580 | + } | ||
| 4581 | + }, | ||
| 4582 | + "title": "ArticleSecuritySearchResponse", | ||
| 4583 | + "required": [ | ||
| 4584 | + "list", | ||
| 4585 | + "total" | ||
| 4586 | + ] | ||
| 4587 | + }, | ||
| 4588 | + "ArticleTagCount": { | ||
| 4589 | + "type": "object", | ||
| 4590 | + "properties": { | ||
| 4591 | + "tagCategory": { | ||
| 4592 | + "type": "string", | ||
| 4593 | + "description": " 标签分组" | ||
| 4594 | + }, | ||
| 4595 | + "tagId": { | ||
| 4596 | + "type": "integer", | ||
| 4597 | + "format": "int64", | ||
| 4598 | + "description": " 标签id" | ||
| 4599 | + }, | ||
| 4600 | + "tagImage": { | ||
| 3828 | "type": "string", | 4601 | "type": "string", |
| 3829 | "description": " 对应的图标" | 4602 | "description": " 对应的图标" |
| 3830 | }, | 4603 | }, |
| @@ -3877,42 +4650,328 @@ | @@ -3877,42 +4650,328 @@ | ||
| 3877 | } | 4650 | } |
| 3878 | } | 4651 | } |
| 3879 | }, | 4652 | }, |
| 3880 | - "title": "ArticleTagGroup", | 4653 | + "title": "ArticleTagGroup", |
| 4654 | + "required": [ | ||
| 4655 | + "category", | ||
| 4656 | + "tags" | ||
| 4657 | + ] | ||
| 4658 | + }, | ||
| 4659 | + "ArticleTagItem": { | ||
| 4660 | + "type": "object", | ||
| 4661 | + "properties": { | ||
| 4662 | + "id": { | ||
| 4663 | + "type": "integer", | ||
| 4664 | + "format": "int64" | ||
| 4665 | + }, | ||
| 4666 | + "category": { | ||
| 4667 | + "type": "string" | ||
| 4668 | + }, | ||
| 4669 | + "name": { | ||
| 4670 | + "type": "string" | ||
| 4671 | + }, | ||
| 4672 | + "image": { | ||
| 4673 | + "type": "string" | ||
| 4674 | + }, | ||
| 4675 | + "sortBy": { | ||
| 4676 | + "type": "integer", | ||
| 4677 | + "format": "int32" | ||
| 4678 | + } | ||
| 4679 | + }, | ||
| 4680 | + "title": "ArticleTagItem", | ||
| 4681 | + "required": [ | ||
| 4682 | + "id", | ||
| 4683 | + "category", | ||
| 4684 | + "name", | ||
| 4685 | + "image", | ||
| 4686 | + "sortBy" | ||
| 4687 | + ] | ||
| 4688 | + }, | ||
| 4689 | + "ArticleTemplateBatchDeleteRequest": { | ||
| 4690 | + "type": "object", | ||
| 4691 | + "properties": { | ||
| 4692 | + "ids": { | ||
| 4693 | + "type": "array", | ||
| 4694 | + "items": { | ||
| 4695 | + "type": "integer", | ||
| 4696 | + "format": "int64" | ||
| 4697 | + } | ||
| 4698 | + } | ||
| 4699 | + }, | ||
| 4700 | + "title": "ArticleTemplateBatchDeleteRequest", | ||
| 4701 | + "required": [ | ||
| 4702 | + "ids" | ||
| 4703 | + ] | ||
| 4704 | + }, | ||
| 4705 | + "ArticleTemplateBatchResponse": { | ||
| 4706 | + "type": "object", | ||
| 4707 | + "title": "ArticleTemplateBatchResponse" | ||
| 4708 | + }, | ||
| 4709 | + "ArticleTemplateClassItem": { | ||
| 4710 | + "type": "object", | ||
| 4711 | + "properties": { | ||
| 4712 | + "name": { | ||
| 4713 | + "type": "string", | ||
| 4714 | + "description": " 名称" | ||
| 4715 | + } | ||
| 4716 | + }, | ||
| 4717 | + "title": "ArticleTemplateClassItem", | ||
| 4718 | + "required": [ | ||
| 4719 | + "name" | ||
| 4720 | + ] | ||
| 4721 | + }, | ||
| 4722 | + "ArticleTemplateClassSearchRequest": { | ||
| 4723 | + "type": "object", | ||
| 4724 | + "properties": { | ||
| 4725 | + "page": { | ||
| 4726 | + "type": "integer", | ||
| 4727 | + "format": "int32" | ||
| 4728 | + }, | ||
| 4729 | + "size": { | ||
| 4730 | + "type": "integer", | ||
| 4731 | + "format": "int32" | ||
| 4732 | + }, | ||
| 4733 | + "name": { | ||
| 4734 | + "type": "string", | ||
| 4735 | + "description": " 模板名称" | ||
| 4736 | + } | ||
| 4737 | + }, | ||
| 4738 | + "title": "ArticleTemplateClassSearchRequest" | ||
| 4739 | + }, | ||
| 4740 | + "ArticleTemplateClassSearchResponse": { | ||
| 4741 | + "type": "object", | ||
| 4742 | + "properties": { | ||
| 4743 | + "list": { | ||
| 4744 | + "type": "array", | ||
| 4745 | + "items": { | ||
| 4746 | + "$ref": "#/definitions/ArticleTemplateClassItem" | ||
| 4747 | + } | ||
| 4748 | + }, | ||
| 4749 | + "total": { | ||
| 4750 | + "type": "integer", | ||
| 4751 | + "format": "int64" | ||
| 4752 | + } | ||
| 4753 | + }, | ||
| 4754 | + "title": "ArticleTemplateClassSearchResponse", | ||
| 4755 | + "required": [ | ||
| 4756 | + "list", | ||
| 4757 | + "total" | ||
| 4758 | + ] | ||
| 4759 | + }, | ||
| 4760 | + "ArticleTemplateDeleteRequest": { | ||
| 4761 | + "type": "object", | ||
| 4762 | + "properties": { | ||
| 4763 | + "id": { | ||
| 4764 | + "type": "integer", | ||
| 4765 | + "format": "int64" | ||
| 4766 | + } | ||
| 4767 | + }, | ||
| 4768 | + "title": "ArticleTemplateDeleteRequest", | ||
| 4769 | + "required": [ | ||
| 4770 | + "id" | ||
| 4771 | + ] | ||
| 4772 | + }, | ||
| 4773 | + "ArticleTemplateDeleteResponse": { | ||
| 4774 | + "type": "object", | ||
| 4775 | + "title": "ArticleTemplateDeleteResponse" | ||
| 4776 | + }, | ||
| 4777 | + "ArticleTemplateGetRequest": { | ||
| 4778 | + "type": "object", | ||
| 4779 | + "properties": { | ||
| 4780 | + "id": { | ||
| 4781 | + "type": "integer", | ||
| 4782 | + "format": "int64" | ||
| 4783 | + } | ||
| 4784 | + }, | ||
| 4785 | + "title": "ArticleTemplateGetRequest", | ||
| 4786 | + "required": [ | ||
| 4787 | + "id" | ||
| 4788 | + ] | ||
| 4789 | + }, | ||
| 4790 | + "ArticleTemplateGetResponse": { | ||
| 4791 | + "type": "object", | ||
| 4792 | + "properties": { | ||
| 4793 | + "item": { | ||
| 4794 | + "$ref": "#/definitions/ArticleTemplateItem" | ||
| 4795 | + } | ||
| 4796 | + }, | ||
| 4797 | + "title": "ArticleTemplateGetResponse", | ||
| 4798 | + "required": [ | ||
| 4799 | + "item" | ||
| 4800 | + ] | ||
| 4801 | + }, | ||
| 4802 | + "ArticleTemplateItem": { | ||
| 4803 | + "type": "object", | ||
| 4804 | + "properties": { | ||
| 4805 | + "id": { | ||
| 4806 | + "type": "integer", | ||
| 4807 | + "format": "int64", | ||
| 4808 | + "description": " 唯一标识" | ||
| 4809 | + }, | ||
| 4810 | + "name": { | ||
| 4811 | + "type": "string", | ||
| 4812 | + "description": " 模板名称" | ||
| 4813 | + }, | ||
| 4814 | + "templateClass": { | ||
| 4815 | + "type": "string", | ||
| 4816 | + "description": " 模板分类" | ||
| 4817 | + }, | ||
| 4818 | + "paragraphs": { | ||
| 4819 | + "type": "array", | ||
| 4820 | + "items": { | ||
| 4821 | + "$ref": "#/definitions/Paragraph" | ||
| 4822 | + }, | ||
| 4823 | + "description": " 段落列表" | ||
| 4824 | + }, | ||
| 4825 | + "icon": { | ||
| 4826 | + "type": "string", | ||
| 4827 | + "description": " 图标地址" | ||
| 4828 | + }, | ||
| 4829 | + "targetWhoRead": { | ||
| 4830 | + "type": "integer", | ||
| 4831 | + "format": "int32", | ||
| 4832 | + "description": " 分发方式 0 分发给所有人 1 分发给指定的人" | ||
| 4833 | + }, | ||
| 4834 | + "targetWhoReview": { | ||
| 4835 | + "type": "integer", | ||
| 4836 | + "format": "int32", | ||
| 4837 | + "description": " 分发方式 0 分发给所有人 1 分发给指定的人" | ||
| 4838 | + }, | ||
| 4839 | + "whoRead": { | ||
| 4840 | + "type": "array", | ||
| 4841 | + "items": { | ||
| 4842 | + "type": "integer", | ||
| 4843 | + "format": "int64" | ||
| 4844 | + }, | ||
| 4845 | + "description": " 谁可以看" | ||
| 4846 | + }, | ||
| 4847 | + "whoReview": { | ||
| 4848 | + "type": "array", | ||
| 4849 | + "items": { | ||
| 4850 | + "type": "integer", | ||
| 4851 | + "format": "int64" | ||
| 4852 | + }, | ||
| 4853 | + "description": " 查看、评论人" | ||
| 4854 | + }, | ||
| 4855 | + "whoReadInfo": { | ||
| 4856 | + "type": "array", | ||
| 4857 | + "items": { | ||
| 4858 | + "$ref": "#/definitions/TargetUser" | ||
| 4859 | + }, | ||
| 4860 | + "description": " 谁可查看" | ||
| 4861 | + }, | ||
| 4862 | + "whoReviewInfo": { | ||
| 4863 | + "type": "array", | ||
| 4864 | + "items": { | ||
| 4865 | + "$ref": "#/definitions/TargetUser" | ||
| 4866 | + }, | ||
| 4867 | + "description": " 谁可评论" | ||
| 4868 | + }, | ||
| 4869 | + "": { | ||
| 4870 | + "type": "string", | ||
| 4871 | + "description": " 操作人" | ||
| 4872 | + }, | ||
| 4873 | + "": { | ||
| 4874 | + "type": "integer", | ||
| 4875 | + "format": "int64", | ||
| 4876 | + "description": " 更新时间戳" | ||
| 4877 | + } | ||
| 4878 | + }, | ||
| 4879 | + "title": "ArticleTemplateItem", | ||
| 4880 | + "required": [ | ||
| 4881 | + "name", | ||
| 4882 | + "templateClass", | ||
| 4883 | + "paragraphs", | ||
| 4884 | + "" | ||
| 4885 | + ] | ||
| 4886 | + }, | ||
| 4887 | + "ArticleTemplateSaveRequest": { | ||
| 4888 | + "type": "object", | ||
| 4889 | + "properties": { | ||
| 4890 | + "AccessToken": { | ||
| 4891 | + "type": "string", | ||
| 4892 | + "description": " 授权token" | ||
| 4893 | + }, | ||
| 4894 | + "item": { | ||
| 4895 | + "$ref": "#/definitions/ArticleTemplateItem" | ||
| 4896 | + } | ||
| 4897 | + }, | ||
| 4898 | + "title": "ArticleTemplateSaveRequest", | ||
| 4899 | + "required": [ | ||
| 4900 | + "x-mmm-accesstoken", | ||
| 4901 | + "item" | ||
| 4902 | + ] | ||
| 4903 | + }, | ||
| 4904 | + "ArticleTemplateSaveResponse": { | ||
| 4905 | + "type": "object", | ||
| 4906 | + "title": "ArticleTemplateSaveResponse" | ||
| 4907 | + }, | ||
| 4908 | + "ArticleTemplateSearchRequest": { | ||
| 4909 | + "type": "object", | ||
| 4910 | + "properties": { | ||
| 4911 | + "page": { | ||
| 4912 | + "type": "integer", | ||
| 4913 | + "format": "int32" | ||
| 4914 | + }, | ||
| 4915 | + "size": { | ||
| 4916 | + "type": "integer", | ||
| 4917 | + "format": "int32" | ||
| 4918 | + }, | ||
| 4919 | + "name": { | ||
| 4920 | + "type": "string", | ||
| 4921 | + "description": " 模板名称" | ||
| 4922 | + }, | ||
| 4923 | + "templateClass": { | ||
| 4924 | + "type": "string", | ||
| 4925 | + "description": " 模板分类" | ||
| 4926 | + }, | ||
| 4927 | + "target": { | ||
| 4928 | + "$ref": "#/definitions/int", | ||
| 4929 | + "description": " 目标 0 全员 1 指定人" | ||
| 4930 | + } | ||
| 4931 | + }, | ||
| 4932 | + "title": "ArticleTemplateSearchRequest" | ||
| 4933 | + }, | ||
| 4934 | + "ArticleTemplateSearchResponse": { | ||
| 4935 | + "type": "object", | ||
| 4936 | + "properties": { | ||
| 4937 | + "list": { | ||
| 4938 | + "type": "array", | ||
| 4939 | + "items": { | ||
| 4940 | + "$ref": "#/definitions/ArticleTemplateItem" | ||
| 4941 | + } | ||
| 4942 | + }, | ||
| 4943 | + "total": { | ||
| 4944 | + "type": "integer", | ||
| 4945 | + "format": "int64" | ||
| 4946 | + } | ||
| 4947 | + }, | ||
| 4948 | + "title": "ArticleTemplateSearchResponse", | ||
| 3881 | "required": [ | 4949 | "required": [ |
| 3882 | - "category", | ||
| 3883 | - "tags" | 4950 | + "list", |
| 4951 | + "total" | ||
| 3884 | ] | 4952 | ] |
| 3885 | }, | 4953 | }, |
| 3886 | - "ArticleTagItem": { | 4954 | + "ArticleTemplateUpdateRequest": { |
| 3887 | "type": "object", | 4955 | "type": "object", |
| 3888 | "properties": { | 4956 | "properties": { |
| 3889 | "id": { | 4957 | "id": { |
| 3890 | "type": "integer", | 4958 | "type": "integer", |
| 3891 | "format": "int64" | 4959 | "format": "int64" |
| 3892 | }, | 4960 | }, |
| 3893 | - "category": { | ||
| 3894 | - "type": "string" | ||
| 3895 | - }, | ||
| 3896 | - "name": { | ||
| 3897 | - "type": "string" | ||
| 3898 | - }, | ||
| 3899 | - "image": { | ||
| 3900 | - "type": "string" | ||
| 3901 | - }, | ||
| 3902 | - "sortBy": { | ||
| 3903 | - "type": "integer", | ||
| 3904 | - "format": "int32" | 4961 | + "item": { |
| 4962 | + "$ref": "#/definitions/ArticleTemplateItem" | ||
| 3905 | } | 4963 | } |
| 3906 | }, | 4964 | }, |
| 3907 | - "title": "ArticleTagItem", | 4965 | + "title": "ArticleTemplateUpdateRequest", |
| 3908 | "required": [ | 4966 | "required": [ |
| 3909 | "id", | 4967 | "id", |
| 3910 | - "category", | ||
| 3911 | - "name", | ||
| 3912 | - "image", | ||
| 3913 | - "sortBy" | 4968 | + "item" |
| 3914 | ] | 4969 | ] |
| 3915 | }, | 4970 | }, |
| 4971 | + "ArticleTemplateUpdateResponse": { | ||
| 4972 | + "type": "object", | ||
| 4973 | + "title": "ArticleTemplateUpdateResponse" | ||
| 4974 | + }, | ||
| 3916 | "Auth": { | 4975 | "Auth": { |
| 3917 | "type": "object", | 4976 | "type": "object", |
| 3918 | "properties": { | 4977 | "properties": { |
| @@ -3967,12 +5026,18 @@ | @@ -3967,12 +5026,18 @@ | ||
| 3967 | "label": { | 5026 | "label": { |
| 3968 | "type": "string", | 5027 | "type": "string", |
| 3969 | "description": " 分组名称" | 5028 | "description": " 分组名称" |
| 5029 | + }, | ||
| 5030 | + "enable": { | ||
| 5031 | + "type": "integer", | ||
| 5032 | + "format": "int32", | ||
| 5033 | + "description": " 启用状态 1:启用" | ||
| 3970 | } | 5034 | } |
| 3971 | }, | 5035 | }, |
| 3972 | "title": "CategoryOptions", | 5036 | "title": "CategoryOptions", |
| 3973 | "required": [ | 5037 | "required": [ |
| 3974 | "value", | 5038 | "value", |
| 3975 | - "label" | 5039 | + "label", |
| 5040 | + "enable" | ||
| 3976 | ] | 5041 | ] |
| 3977 | }, | 5042 | }, |
| 3978 | "CategoryOptionsRequest": { | 5043 | "CategoryOptionsRequest": { |
| @@ -4001,6 +5066,29 @@ | @@ -4001,6 +5066,29 @@ | ||
| 4001 | "options" | 5066 | "options" |
| 4002 | ] | 5067 | ] |
| 4003 | }, | 5068 | }, |
| 5069 | + "CheckDetailItem": { | ||
| 5070 | + "type": "object", | ||
| 5071 | + "properties": { | ||
| 5072 | + "label": { | ||
| 5073 | + "type": "string", | ||
| 5074 | + "description": " 命中标签" | ||
| 5075 | + }, | ||
| 5076 | + "prob": { | ||
| 5077 | + "$ref": "#/definitions/uint", | ||
| 5078 | + "description": " 置信度。0-100,越高代表越有可能属于当前返回的标签(label)" | ||
| 5079 | + }, | ||
| 5080 | + "suggest": { | ||
| 5081 | + "type": "string", | ||
| 5082 | + "description": " 建议" | ||
| 5083 | + } | ||
| 5084 | + }, | ||
| 5085 | + "title": "CheckDetailItem", | ||
| 5086 | + "required": [ | ||
| 5087 | + "label", | ||
| 5088 | + "prob", | ||
| 5089 | + "suggest" | ||
| 5090 | + ] | ||
| 5091 | + }, | ||
| 4004 | "CommentAtWho": { | 5092 | "CommentAtWho": { |
| 4005 | "type": "object", | 5093 | "type": "object", |
| 4006 | "properties": { | 5094 | "properties": { |
| @@ -4200,6 +5288,31 @@ | @@ -4200,6 +5288,31 @@ | ||
| 4200 | "type": "object", | 5288 | "type": "object", |
| 4201 | "title": "CompanyVisibleSwitchResponse" | 5289 | "title": "CompanyVisibleSwitchResponse" |
| 4202 | }, | 5290 | }, |
| 5291 | + "ContentDetailItem": { | ||
| 5292 | + "type": "object", | ||
| 5293 | + "properties": { | ||
| 5294 | + "id": { | ||
| 5295 | + "type": "integer", | ||
| 5296 | + "format": "int64", | ||
| 5297 | + "description": " 内容ID" | ||
| 5298 | + }, | ||
| 5299 | + "type": { | ||
| 5300 | + "type": "integer", | ||
| 5301 | + "format": "int32", | ||
| 5302 | + "description": " 内容类型 (1:文章 2:评论)" | ||
| 5303 | + }, | ||
| 5304 | + "text": { | ||
| 5305 | + "type": "string", | ||
| 5306 | + "description": " 内容文本" | ||
| 5307 | + } | ||
| 5308 | + }, | ||
| 5309 | + "title": "ContentDetailItem", | ||
| 5310 | + "required": [ | ||
| 5311 | + "id", | ||
| 5312 | + "type", | ||
| 5313 | + "text" | ||
| 5314 | + ] | ||
| 5315 | + }, | ||
| 4203 | "Department": { | 5316 | "Department": { |
| 4204 | "type": "object", | 5317 | "type": "object", |
| 4205 | "properties": { | 5318 | "properties": { |
| @@ -4229,6 +5342,11 @@ | @@ -4229,6 +5342,11 @@ | ||
| 4229 | "format": "int64" | 5342 | "format": "int64" |
| 4230 | }, | 5343 | }, |
| 4231 | "description": " 部门下的用户" | 5344 | "description": " 部门下的用户" |
| 5345 | + }, | ||
| 5346 | + "totalUser": { | ||
| 5347 | + "type": "integer", | ||
| 5348 | + "format": "int32", | ||
| 5349 | + "description": " 累计用户" | ||
| 4232 | } | 5350 | } |
| 4233 | }, | 5351 | }, |
| 4234 | "title": "Department", | 5352 | "title": "Department", |
| @@ -4237,7 +5355,8 @@ | @@ -4237,7 +5355,8 @@ | ||
| 4237 | "companyId", | 5355 | "companyId", |
| 4238 | "parentId", | 5356 | "parentId", |
| 4239 | "name", | 5357 | "name", |
| 4240 | - "userIds" | 5358 | + "userIds", |
| 5359 | + "totalUser" | ||
| 4241 | ] | 5360 | ] |
| 4242 | }, | 5361 | }, |
| 4243 | "DepartmentAddRequest": { | 5362 | "DepartmentAddRequest": { |
| @@ -4297,6 +5416,16 @@ | @@ -4297,6 +5416,16 @@ | ||
| 4297 | "size": { | 5416 | "size": { |
| 4298 | "type": "integer", | 5417 | "type": "integer", |
| 4299 | "format": "int32" | 5418 | "format": "int32" |
| 5419 | + }, | ||
| 5420 | + "includeRootCompany": { | ||
| 5421 | + "type": "boolean", | ||
| 5422 | + "format": "boolean", | ||
| 5423 | + "description": " 包含公司(把公司当作部门作为顶级节点 部门ID:0)" | ||
| 5424 | + }, | ||
| 5425 | + "includeDefaultDepartment": { | ||
| 5426 | + "type": "boolean", | ||
| 5427 | + "format": "boolean", | ||
| 5428 | + "description": " 包含默认分组" | ||
| 4300 | } | 5429 | } |
| 4301 | }, | 5430 | }, |
| 4302 | "title": "DepartmentListRequest", | 5431 | "title": "DepartmentListRequest", |
| @@ -4497,6 +5626,89 @@ | @@ -4497,6 +5626,89 @@ | ||
| 4497 | "size" | 5626 | "size" |
| 4498 | ] | 5627 | ] |
| 4499 | }, | 5628 | }, |
| 5629 | + "MessageSubscribeAddRequest": { | ||
| 5630 | + "type": "object", | ||
| 5631 | + "properties": { | ||
| 5632 | + "types": { | ||
| 5633 | + "type": "array", | ||
| 5634 | + "items": { | ||
| 5635 | + "type": "integer", | ||
| 5636 | + "format": "int32" | ||
| 5637 | + }, | ||
| 5638 | + "description": " 订阅消息类型" | ||
| 5639 | + } | ||
| 5640 | + }, | ||
| 5641 | + "title": "MessageSubscribeAddRequest", | ||
| 5642 | + "required": [ | ||
| 5643 | + "types" | ||
| 5644 | + ] | ||
| 5645 | + }, | ||
| 5646 | + "MessageSubscribeAddResponse": { | ||
| 5647 | + "type": "object", | ||
| 5648 | + "properties": { | ||
| 5649 | + "items": { | ||
| 5650 | + "type": "array", | ||
| 5651 | + "items": { | ||
| 5652 | + "$ref": "#/definitions/MessageSubscribeItem" | ||
| 5653 | + } | ||
| 5654 | + } | ||
| 5655 | + }, | ||
| 5656 | + "title": "MessageSubscribeAddResponse", | ||
| 5657 | + "required": [ | ||
| 5658 | + "items" | ||
| 5659 | + ] | ||
| 5660 | + }, | ||
| 5661 | + "MessageSubscribeItem": { | ||
| 5662 | + "type": "object", | ||
| 5663 | + "properties": { | ||
| 5664 | + "type": { | ||
| 5665 | + "type": "integer", | ||
| 5666 | + "format": "int32", | ||
| 5667 | + "description": " 订阅消息类型" | ||
| 5668 | + }, | ||
| 5669 | + "count": { | ||
| 5670 | + "type": "integer", | ||
| 5671 | + "format": "int32", | ||
| 5672 | + "description": " 订阅次数" | ||
| 5673 | + }, | ||
| 5674 | + "userId": { | ||
| 5675 | + "type": "integer", | ||
| 5676 | + "format": "int64", | ||
| 5677 | + "description": " 用户ID" | ||
| 5678 | + }, | ||
| 5679 | + "companyId": { | ||
| 5680 | + "type": "integer", | ||
| 5681 | + "format": "int64", | ||
| 5682 | + "description": " 公司ID" | ||
| 5683 | + } | ||
| 5684 | + }, | ||
| 5685 | + "title": "MessageSubscribeItem", | ||
| 5686 | + "required": [ | ||
| 5687 | + "type", | ||
| 5688 | + "count", | ||
| 5689 | + "userId", | ||
| 5690 | + "companyId" | ||
| 5691 | + ] | ||
| 5692 | + }, | ||
| 5693 | + "MessageSubscribeListRequest": { | ||
| 5694 | + "type": "object", | ||
| 5695 | + "title": "MessageSubscribeListRequest" | ||
| 5696 | + }, | ||
| 5697 | + "MessageSubscribeListResponse": { | ||
| 5698 | + "type": "object", | ||
| 5699 | + "properties": { | ||
| 5700 | + "items": { | ||
| 5701 | + "type": "array", | ||
| 5702 | + "items": { | ||
| 5703 | + "$ref": "#/definitions/MessageSubscribeItem" | ||
| 5704 | + } | ||
| 5705 | + } | ||
| 5706 | + }, | ||
| 5707 | + "title": "MessageSubscribeListResponse", | ||
| 5708 | + "required": [ | ||
| 5709 | + "items" | ||
| 5710 | + ] | ||
| 5711 | + }, | ||
| 4500 | "MessageSystemItem": { | 5712 | "MessageSystemItem": { |
| 4501 | "type": "object", | 5713 | "type": "object", |
| 4502 | "properties": { | 5714 | "properties": { |
| @@ -6975,10 +8187,89 @@ | @@ -6975,10 +8187,89 @@ | ||
| 6975 | "keywords": { | 8187 | "keywords": { |
| 6976 | "type": "string", | 8188 | "type": "string", |
| 6977 | "description": " 按关键字搜索(名称)" | 8189 | "description": " 按关键字搜索(名称)" |
| 8190 | + }, | ||
| 8191 | + "departmentId": { | ||
| 8192 | + "$ref": "#/definitions/int64", | ||
| 8193 | + "description": " 按部门过滤" | ||
| 6978 | } | 8194 | } |
| 6979 | }, | 8195 | }, |
| 6980 | "title": "MiniUsersListRequest" | 8196 | "title": "MiniUsersListRequest" |
| 6981 | }, | 8197 | }, |
| 8198 | + "MiniWechatBindRequest": { | ||
| 8199 | + "type": "object", | ||
| 8200 | + "properties": { | ||
| 8201 | + "wechatAuthcode": { | ||
| 8202 | + "type": "string", | ||
| 8203 | + "description": " 微信登录 授权码" | ||
| 8204 | + }, | ||
| 8205 | + "wechatEncryptedData": { | ||
| 8206 | + "type": "string", | ||
| 8207 | + "description": " 微信登录 加密数据" | ||
| 8208 | + }, | ||
| 8209 | + "wechatIV": { | ||
| 8210 | + "type": "string", | ||
| 8211 | + "description": " 微信登录 加密算法初始向量" | ||
| 8212 | + } | ||
| 8213 | + }, | ||
| 8214 | + "title": "MiniWechatBindRequest", | ||
| 8215 | + "required": [ | ||
| 8216 | + "wechatAuthcode", | ||
| 8217 | + "wechatEncryptedData", | ||
| 8218 | + "wechatIV" | ||
| 8219 | + ] | ||
| 8220 | + }, | ||
| 8221 | + "MiniWechatBindResponse": { | ||
| 8222 | + "type": "object", | ||
| 8223 | + "properties": { | ||
| 8224 | + "bind": { | ||
| 8225 | + "type": "boolean", | ||
| 8226 | + "format": "boolean", | ||
| 8227 | + "description": " 绑定结果 true-已绑定 false-未绑定" | ||
| 8228 | + }, | ||
| 8229 | + "openId": { | ||
| 8230 | + "type": "string", | ||
| 8231 | + "description": " 绑定的微信openId" | ||
| 8232 | + }, | ||
| 8233 | + "phone": { | ||
| 8234 | + "type": "string", | ||
| 8235 | + "description": " 绑定手机号" | ||
| 8236 | + } | ||
| 8237 | + }, | ||
| 8238 | + "title": "MiniWechatBindResponse", | ||
| 8239 | + "required": [ | ||
| 8240 | + "bind", | ||
| 8241 | + "openId", | ||
| 8242 | + "phone" | ||
| 8243 | + ] | ||
| 8244 | + }, | ||
| 8245 | + "MiniWechatInfoRequest": { | ||
| 8246 | + "type": "object", | ||
| 8247 | + "title": "MiniWechatInfoRequest" | ||
| 8248 | + }, | ||
| 8249 | + "MiniWechatInfoResponse": { | ||
| 8250 | + "type": "object", | ||
| 8251 | + "properties": { | ||
| 8252 | + "bind": { | ||
| 8253 | + "type": "boolean", | ||
| 8254 | + "format": "boolean", | ||
| 8255 | + "description": " 绑定结果 true-已绑定 false-未绑定" | ||
| 8256 | + }, | ||
| 8257 | + "openId": { | ||
| 8258 | + "type": "string", | ||
| 8259 | + "description": " 绑定的微信openId" | ||
| 8260 | + }, | ||
| 8261 | + "phone": { | ||
| 8262 | + "type": "string", | ||
| 8263 | + "description": " 绑定手机号" | ||
| 8264 | + } | ||
| 8265 | + }, | ||
| 8266 | + "title": "MiniWechatInfoResponse", | ||
| 8267 | + "required": [ | ||
| 8268 | + "bind", | ||
| 8269 | + "openId", | ||
| 8270 | + "phone" | ||
| 8271 | + ] | ||
| 8272 | + }, | ||
| 6982 | "MyBeLikedItem": { | 8273 | "MyBeLikedItem": { |
| 6983 | "type": "object", | 8274 | "type": "object", |
| 6984 | "properties": { | 8275 | "properties": { |
| @@ -7092,6 +8383,49 @@ | @@ -7092,6 +8383,49 @@ | ||
| 7092 | "name" | 8383 | "name" |
| 7093 | ] | 8384 | ] |
| 7094 | }, | 8385 | }, |
| 8386 | + "Paragraph": { | ||
| 8387 | + "type": "object", | ||
| 8388 | + "properties": { | ||
| 8389 | + "id": { | ||
| 8390 | + "type": "string", | ||
| 8391 | + "description": " 唯一标识" | ||
| 8392 | + }, | ||
| 8393 | + "title": { | ||
| 8394 | + "type": "string", | ||
| 8395 | + "description": " 标题" | ||
| 8396 | + }, | ||
| 8397 | + "prompt": { | ||
| 8398 | + "type": "string", | ||
| 8399 | + "description": " 文本提示" | ||
| 8400 | + }, | ||
| 8401 | + "required": { | ||
| 8402 | + "type": "boolean", | ||
| 8403 | + "format": "boolean", | ||
| 8404 | + "description": " 必填" | ||
| 8405 | + }, | ||
| 8406 | + "type": { | ||
| 8407 | + "type": "integer", | ||
| 8408 | + "format": "int32", | ||
| 8409 | + "description": " 段落类型 1:文本 2:图片" | ||
| 8410 | + }, | ||
| 8411 | + "text": { | ||
| 8412 | + "type": "string", | ||
| 8413 | + "description": " 文本内容" | ||
| 8414 | + }, | ||
| 8415 | + "images": { | ||
| 8416 | + "type": "array", | ||
| 8417 | + "items": { | ||
| 8418 | + "type": "string" | ||
| 8419 | + }, | ||
| 8420 | + "description": " 图片地址列表" | ||
| 8421 | + } | ||
| 8422 | + }, | ||
| 8423 | + "title": "Paragraph", | ||
| 8424 | + "required": [ | ||
| 8425 | + "text", | ||
| 8426 | + "images" | ||
| 8427 | + ] | ||
| 8428 | + }, | ||
| 7095 | "Position": { | 8429 | "Position": { |
| 7096 | "type": "object", | 8430 | "type": "object", |
| 7097 | "properties": { | 8431 | "properties": { |
| @@ -7828,11 +9162,16 @@ | @@ -7828,11 +9162,16 @@ | ||
| 7828 | "type": "integer", | 9162 | "type": "integer", |
| 7829 | "format": "int64", | 9163 | "format": "int64", |
| 7830 | "description": "id" | 9164 | "description": "id" |
| 9165 | + }, | ||
| 9166 | + "AccessToken": { | ||
| 9167 | + "type": "string", | ||
| 9168 | + "description": " 授权token" | ||
| 7831 | } | 9169 | } |
| 7832 | }, | 9170 | }, |
| 7833 | "title": "SystemArticleDeleteRequest", | 9171 | "title": "SystemArticleDeleteRequest", |
| 7834 | "required": [ | 9172 | "required": [ |
| 7835 | - "id" | 9173 | + "id", |
| 9174 | + "x-mmm-accesstoken" | ||
| 7836 | ] | 9175 | ] |
| 7837 | }, | 9176 | }, |
| 7838 | "SystemArticleDeleteResponse": { | 9177 | "SystemArticleDeleteResponse": { |
| @@ -7866,11 +9205,16 @@ | @@ -7866,11 +9205,16 @@ | ||
| 7866 | "type": "integer", | 9205 | "type": "integer", |
| 7867 | "format": "int64", | 9206 | "format": "int64", |
| 7868 | "description": "ID" | 9207 | "description": "ID" |
| 9208 | + }, | ||
| 9209 | + "AccessToken": { | ||
| 9210 | + "type": "string", | ||
| 9211 | + "description": " 授权token" | ||
| 7869 | } | 9212 | } |
| 7870 | }, | 9213 | }, |
| 7871 | "title": "SystemArticleDeletedRestoreRequest", | 9214 | "title": "SystemArticleDeletedRestoreRequest", |
| 7872 | "required": [ | 9215 | "required": [ |
| 7873 | - "id" | 9216 | + "id", |
| 9217 | + "x-mmm-accesstoken" | ||
| 7874 | ] | 9218 | ] |
| 7875 | }, | 9219 | }, |
| 7876 | "SystemArticleDeletedRestoreResponse": { | 9220 | "SystemArticleDeletedRestoreResponse": { |
| @@ -10180,6 +11524,10 @@ | @@ -10180,6 +11524,10 @@ | ||
| 10180 | }, | 11524 | }, |
| 10181 | "code": { | 11525 | "code": { |
| 10182 | "type": "string" | 11526 | "type": "string" |
| 11527 | + }, | ||
| 11528 | + "companyVisible": { | ||
| 11529 | + "type": "boolean", | ||
| 11530 | + "format": "boolean" | ||
| 10183 | } | 11531 | } |
| 10184 | }, | 11532 | }, |
| 10185 | "title": "SystemUserInfoResponse", | 11533 | "title": "SystemUserInfoResponse", |
| @@ -10189,7 +11537,8 @@ | @@ -10189,7 +11537,8 @@ | ||
| 10189 | "avatar", | 11537 | "avatar", |
| 10190 | "companyId", | 11538 | "companyId", |
| 10191 | "companyName", | 11539 | "companyName", |
| 10192 | - "code" | 11540 | + "code", |
| 11541 | + "companyVisible" | ||
| 10193 | ] | 11542 | ] |
| 10194 | }, | 11543 | }, |
| 10195 | "SystemUserSearchRequest": { | 11544 | "SystemUserSearchRequest": { |
| @@ -10221,8 +11570,7 @@ | @@ -10221,8 +11570,7 @@ | ||
| 10221 | "description": " 启用状态 1:启用 2:禁用" | 11570 | "description": " 启用状态 1:启用 2:禁用" |
| 10222 | }, | 11571 | }, |
| 10223 | "departmentId": { | 11572 | "departmentId": { |
| 10224 | - "type": "integer", | ||
| 10225 | - "format": "int64", | 11573 | + "$ref": "#/definitions/int64", |
| 10226 | "description": " 所属部门" | 11574 | "description": " 所属部门" |
| 10227 | } | 11575 | } |
| 10228 | }, | 11576 | }, |
| @@ -10666,6 +12014,23 @@ | @@ -10666,6 +12014,23 @@ | ||
| 10666 | "options" | 12014 | "options" |
| 10667 | ] | 12015 | ] |
| 10668 | }, | 12016 | }, |
| 12017 | + "TargetUser": { | ||
| 12018 | + "type": "object", | ||
| 12019 | + "properties": { | ||
| 12020 | + "id": { | ||
| 12021 | + "type": "integer", | ||
| 12022 | + "format": "int64" | ||
| 12023 | + }, | ||
| 12024 | + "name": { | ||
| 12025 | + "type": "string" | ||
| 12026 | + } | ||
| 12027 | + }, | ||
| 12028 | + "title": "TargetUser", | ||
| 12029 | + "required": [ | ||
| 12030 | + "id", | ||
| 12031 | + "name" | ||
| 12032 | + ] | ||
| 12033 | + }, | ||
| 10669 | "UserFollowItem": { | 12034 | "UserFollowItem": { |
| 10670 | "type": "object", | 12035 | "type": "object", |
| 10671 | "properties": { | 12036 | "properties": { |
| 1 | +@server( | ||
| 2 | + prefix: v1/system | ||
| 3 | + group: secuirty | ||
| 4 | + middleware: LoginStatusCheck,LogRequest | ||
| 5 | + jwt: SystemAuth | ||
| 6 | +) | ||
| 7 | +service Core { | ||
| 8 | + @doc "内容安全-搜索" | ||
| 9 | + @handler articleSecuritySearch | ||
| 10 | + post /article_security/search (ArticleSecuritySearchRequest) returns (ArticleSecuritySearchResponse) | ||
| 11 | + @doc "详情" | ||
| 12 | + @handler articleSecurityGet | ||
| 13 | + get /article_security/:id (ArticleSecurityGetRequest) returns (ArticleSecurityGetResponse) | ||
| 14 | + @doc "内容安全-审核" | ||
| 15 | + @handler articleSecurityAudit | ||
| 16 | + post /article_security/audit (ArticleSecurityAuditRequest) returns (ArticleSecurityAuditResponse) | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +type ( | ||
| 20 | + ArticleSecurityGetRequest { | ||
| 21 | + Id int64 `path:"id"` | ||
| 22 | + } | ||
| 23 | + ArticleSecurityGetResponse struct{ | ||
| 24 | + ArticleSecurity ArticleSecurityItem `json:"item"` | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +// ArticleSecuritySaveRequest struct{ | ||
| 28 | +// ArticleSecurity ArticleSecurityItem `json:"article_security"` | ||
| 29 | +// } | ||
| 30 | +// ArticleSecuritySaveResponse struct{} | ||
| 31 | +// | ||
| 32 | +// ArticleSecurityDeleteRequest struct{ | ||
| 33 | +// Id int64 `path:"id"` | ||
| 34 | +// } | ||
| 35 | +// ArticleSecurityDeleteResponse struct{} | ||
| 36 | +// | ||
| 37 | +// ArticleSecurityUpdateRequest struct{ | ||
| 38 | +// Id int64 `path:"id"` | ||
| 39 | +// ArticleSecurity ArticleSecurityItem `json:"article_security"` | ||
| 40 | +// } | ||
| 41 | +// ArticleSecurityUpdateResponse struct{} | ||
| 42 | + ArticleSecurityAuditRequest struct{ | ||
| 43 | + Id int64 `json:"id"` //id | ||
| 44 | + Status int `json:"status"` // 1:成功 0:失败 | ||
| 45 | + } | ||
| 46 | + ArticleSecurityAuditResponse struct{ | ||
| 47 | + | ||
| 48 | + } | ||
| 49 | + ArticleSecuritySearchRequest struct{ | ||
| 50 | + Page int `json:"page,optional"` | ||
| 51 | + Size int `json:"size,optional"` | ||
| 52 | + ReviewStatus int `json:"reviewStatus,optional"` // 审核结果 1:待审核 2:通过 3:拒绝 | ||
| 53 | + Suggest string `json:"suggest"` // 建议 通过、风险、人工审核 | ||
| 54 | + ContentType int `json:"contentType"` // 内容类型 (1:文章 2:评论) | ||
| 55 | + AuthorName string `json:"authorName"` // 作者名称 | ||
| 56 | + BeginTime int64 `json:"beginTime"` // 开始时间 | ||
| 57 | + EndTime int64 `json:"endTime"` // 结束时间 | ||
| 58 | + } | ||
| 59 | + ArticleSecuritySearchResponse{ | ||
| 60 | + List []ArticleSecurityItem `json:"list"` | ||
| 61 | + Total int64 `json:"total"` | ||
| 62 | + } | ||
| 63 | + ArticleSecurityItem struct{ | ||
| 64 | + Id int64 `json:"id"` // 唯一标识 | ||
| 65 | + ContentKeyWords string `json:"contentKeyWords"` // 内容关键字 | ||
| 66 | + Content ContentDetailItem `json:"content"` // 内容详情 | ||
| 67 | + Label string `json:"label"` // 风控标签 | ||
| 68 | + Prob int `json:"prob"` // 分值 | ||
| 69 | + Suggest string `json:"suggest"` // 建议 通过、风险、人工审核 | ||
| 70 | + Author string `json:"author"` // 发布人 | ||
| 71 | + ReleaseAt int64 `json:"releaseAt"` // 发布时间 | ||
| 72 | + ReviewStatus int `json:"reviewStatus"` // 审核结果 1:待审核 2:通过 3:拒绝 | ||
| 73 | + | ||
| 74 | + Reviewer string `json:"reviewer"` // 审核人 | ||
| 75 | + ReviewAt int64 `json:"reviewAt"` // 审核时间(人工处置时间) | ||
| 76 | + CheckList []CheckDetailItem `json:"checkList"` // 检查列表 | ||
| 77 | + } | ||
| 78 | + CheckDetailItem struct{ | ||
| 79 | + Label string `json:"label"` // 命中标签 | ||
| 80 | + Prob uint `json:"prob"` // 置信度。0-100,越高代表越有可能属于当前返回的标签(label) | ||
| 81 | + Suggest string `json:"suggest"` // 建议 | ||
| 82 | + } | ||
| 83 | + ContentDetailItem struct{ | ||
| 84 | + Id int64 `json:"id"` // 内容ID | ||
| 85 | + Type int `json:"type"` // 内容类型 (1:文章 2:评论) | ||
| 86 | + Text string `json:"text"` // 内容文本 | ||
| 87 | + } | ||
| 88 | +) |
| 1 | +@server( | ||
| 2 | + prefix: v1/system | ||
| 3 | + group: template | ||
| 4 | + middleware: LoginStatusCheck,LogRequest | ||
| 5 | + jwt: SystemAuth | ||
| 6 | +) | ||
| 7 | +service Core { | ||
| 8 | + @doc "模板管理-详情" | ||
| 9 | + @handler systemArticleTemplateGet | ||
| 10 | + get /article_template/:id (ArticleTemplateGetRequest) returns (ArticleTemplateGetResponse) | ||
| 11 | + @doc "模板管理-保存" | ||
| 12 | + @handler systemArticleTemplateSave | ||
| 13 | + post /article_template (ArticleTemplateSaveRequest) returns (ArticleTemplateSaveResponse) | ||
| 14 | + @doc "模板管理-删除" | ||
| 15 | + @handler systemArticleTemplateDelete | ||
| 16 | + delete /article_template/:id (ArticleTemplateDeleteRequest) returns (ArticleTemplateDeleteResponse) | ||
| 17 | + @doc "模板管理-批量删除" | ||
| 18 | + @handler systemArticleTemplateBatchDelete | ||
| 19 | + delete /article_template/batch_delete (ArticleTemplateBatchDeleteRequest) returns (ArticleTemplateBatchResponse) | ||
| 20 | + @doc "模板管理-更新" | ||
| 21 | + @handler systemArticleTemplateUpdate | ||
| 22 | + put /article_template/:id (ArticleTemplateUpdateRequest) returns (ArticleTemplateUpdateResponse) | ||
| 23 | + @doc "模板管理-搜索" | ||
| 24 | + @handler systemArticleTemplateSearch | ||
| 25 | + post /article_template/search (ArticleTemplateSearchRequest) returns (ArticleTemplateSearchResponse) | ||
| 26 | + @doc "模板管理-分类搜索" | ||
| 27 | + @handler systemArticleTemplateClassSearch | ||
| 28 | + post /article_template_class/search (ArticleTemplateClassSearchRequest) returns (ArticleTemplateClassSearchResponse) | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +@server( | ||
| 32 | + prefix: v1/mini | ||
| 33 | + group: template | ||
| 34 | + middleware: LogRequest | ||
| 35 | + jwt: MiniAuth | ||
| 36 | +) | ||
| 37 | +service Core { | ||
| 38 | + @doc "模板搜索" | ||
| 39 | + @handler miniArticleTemplateSearch | ||
| 40 | + post /article_template/search (ArticleTemplateSearchRequest) returns (ArticleTemplateSearchResponse) | ||
| 41 | + @doc "我的模板搜索" | ||
| 42 | + @handler miniArticleTemplateSearchMine | ||
| 43 | + post /article_template/search-mine (ArticleTemplateSearchRequest) returns (ArticleTemplateSearchResponse) | ||
| 44 | + @doc "模板分类搜索" | ||
| 45 | + @handler miniArticleTemplateClassSearch | ||
| 46 | + post /article_template_class/search (ArticleTemplateClassSearchRequest) returns (ArticleTemplateClassSearchResponse) | ||
| 47 | + @doc "模板管理-保存" | ||
| 48 | + @handler miniArticleTemplateSave | ||
| 49 | + post /article_template (ArticleTemplateSaveRequest) returns (ArticleTemplateSaveResponse) | ||
| 50 | + @doc "模板管理-删除" | ||
| 51 | + @handler miniArticleTemplateDelete | ||
| 52 | + delete /article_template/:id (ArticleTemplateDeleteRequest) returns (ArticleTemplateDeleteResponse) | ||
| 53 | + @doc "模板管理-更新" | ||
| 54 | + @handler miniArticleTemplateUpdate | ||
| 55 | + put /article_template/:id (ArticleTemplateUpdateRequest) returns (ArticleTemplateUpdateResponse) | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +type ( | ||
| 59 | + ArticleTemplateGetRequest { | ||
| 60 | + Id int64 `path:"id"` | ||
| 61 | + } | ||
| 62 | + ArticleTemplateGetResponse struct{ | ||
| 63 | + ArticleTemplate ArticleTemplateItem `json:"item"` | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + ArticleTemplateSaveRequest struct{ | ||
| 67 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
| 68 | + ArticleTemplate ArticleTemplateItem `json:"item"` | ||
| 69 | + BelongTo int `json:"belongTo,optional,default=2"` // 模板属于: 1:企业 、2:个人 | ||
| 70 | + } | ||
| 71 | + ArticleTemplateSaveResponse struct{} | ||
| 72 | + | ||
| 73 | + ArticleTemplateDeleteRequest struct{ | ||
| 74 | + Id int64 `path:"id"` | ||
| 75 | + } | ||
| 76 | + ArticleTemplateDeleteResponse struct{} | ||
| 77 | + | ||
| 78 | + ArticleTemplateBatchDeleteRequest struct{ | ||
| 79 | + Ids []int64 `json:"ids"` | ||
| 80 | + } | ||
| 81 | + ArticleTemplateBatchResponse struct{ | ||
| 82 | + | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + ArticleTemplateUpdateRequest struct{ | ||
| 86 | + Id int64 `path:"id"` | ||
| 87 | + ArticleTemplate ArticleTemplateItem `json:"item"` | ||
| 88 | + } | ||
| 89 | + ArticleTemplateUpdateResponse struct{} | ||
| 90 | + | ||
| 91 | + ArticleTemplateSearchRequest struct{ | ||
| 92 | + Page int `json:"page,optional"` | ||
| 93 | + Size int `json:"size,optional"` | ||
| 94 | + Name string `json:"name,optional"` // 模板名称 | ||
| 95 | + TemplateClass string `json:"templateClass,optional"` // 模板分类 | ||
| 96 | + Target *int `json:"target,optional"` // 目标 0 全员 1 指定人 | ||
| 97 | + TargetUser string `json:"targetUser,optional"` // 目标用户 | ||
| 98 | +// BelongTos []int `json:"belongTos,optional"` // 归属 | ||
| 99 | + CompanyId int64 `json:",optional"` // 属于企业时有值 | ||
| 100 | + UserId int64 `json:",optional"` // 属于个人时有值 | ||
| 101 | + } | ||
| 102 | + ArticleTemplateSearchResponse{ | ||
| 103 | + List []ArticleTemplateItem `json:"list"` | ||
| 104 | + Total int64 `json:"total"` | ||
| 105 | + } | ||
| 106 | + ArticleTemplateClassSearchRequest struct{ | ||
| 107 | + Page int `json:"page,optional"` | ||
| 108 | + Size int `json:"size,optional"` | ||
| 109 | + Name string `json:"name,optional"` // 模板名称 | ||
| 110 | + CompanyId int64 `json:",optional"` // 属于企业时有值 | ||
| 111 | + UserId int64 `json:",optional"` // 属于个人时有值 | ||
| 112 | + } | ||
| 113 | + ArticleTemplateClassSearchResponse{ | ||
| 114 | + List []ArticleTemplateClassItem `json:"list"` | ||
| 115 | + Total int64 `json:"total"` | ||
| 116 | + } | ||
| 117 | + ArticleTemplateClassItem struct{ | ||
| 118 | + Name string `json:"name"` // 名称 | ||
| 119 | + } | ||
| 120 | + ArticleTemplateItem struct{ | ||
| 121 | + Id int64 `json:"id,optional"` // 唯一标识 | ||
| 122 | + //CompanyId int64 `json:",optional"` // 属于企业时有值 | ||
| 123 | + //UserId int64 `json:",optional"` // 属于个人时有值 | ||
| 124 | + //BelongTo int `json:"belongTo,optional"` // 模板属于: 1:企业 、2:个人 | ||
| 125 | + Name string `json:"name"` // 模板名称 | ||
| 126 | + Description string `json:"description,optional"` // 描述 | ||
| 127 | + TemplateClass string `json:"templateClass"` // 模板分类 | ||
| 128 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落列表 | ||
| 129 | + Icon string `json:"icon,optional"` // 图标地址 | ||
| 130 | + TargetWhoRead int `json:"targetWhoRead,optional"` // 分发方式 0 分发给所有人 1 分发给指定的人 | ||
| 131 | + TargetWhoReview int `json:"targetWhoReview,optional"` // 分发方式 0 分发给所有人 1 分发给指定的人 | ||
| 132 | + WhoRead []int64 `json:"whoRead,optional"` // 谁可以看 | ||
| 133 | + WhoReview []int64 `json:"whoReview,optional"` // 查看、评论人 | ||
| 134 | + WhoReadInfo []TargetUser `json:"whoReadInfo,optional"` // 谁可查看 | ||
| 135 | + WhoReviewInfo []TargetUser `json:"whoReviewInfo,optional"` // 谁可评论 | ||
| 136 | + Operator string `json:"operator,omitempty,optional"` // 操作人 | ||
| 137 | + UpdatedAt int64 `json:"updatedAt,omitempty,optional"` // 更新时间戳 | ||
| 138 | + } | ||
| 139 | + Paragraph struct { | ||
| 140 | + ID string `json:"id,optional"` // 唯一标识 | ||
| 141 | + Title string `json:"title,optional"` // 标题 | ||
| 142 | + Prompt string `json:"prompt,optional"` // 文本提示 | ||
| 143 | + Required bool `json:"required,optional"` // 必填 | ||
| 144 | + Type int `json:"type,optional"` // 段落类型 1:文本 2:图片 | ||
| 145 | + | ||
| 146 | + Text string `json:"text,optional,omitempty"` // 文本内容 | ||
| 147 | + Images []string `json:"images,optional,omitempty"` // 图片地址列表 | ||
| 148 | + } | ||
| 149 | + TargetUser struct{ | ||
| 150 | + Id int64 `json:"id"` | ||
| 151 | + Name string `json:"name"` | ||
| 152 | + } | ||
| 153 | +) |
| @@ -34,13 +34,15 @@ type Operator { | @@ -34,13 +34,15 @@ type Operator { | ||
| 34 | type ( | 34 | type ( |
| 35 | MiniArticleCreateRequest { | 35 | MiniArticleCreateRequest { |
| 36 | Title string `json:"title"` //标题 | 36 | Title string `json:"title"` //标题 |
| 37 | - Section []string `json:"section"` //文章的文本内容 | 37 | + Section []string `json:"section,optional"` //文章的文本内容 |
| 38 | AuthorId int64 `json:"authorId,optional"` //发布人id | 38 | AuthorId int64 `json:"authorId,optional"` //发布人id |
| 39 | Images []string `json:"images,optional"` //图片 | 39 | Images []string `json:"images,optional"` //图片 |
| 40 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 40 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
| 41 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 41 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
| 42 | Location Location `json:"location,optional"` //定位坐标 | 42 | Location Location `json:"location,optional"` //定位坐标 |
| 43 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 43 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
| 44 | + | ||
| 45 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 44 | } | 46 | } |
| 45 | MiniArticleCreateResponse { | 47 | MiniArticleCreateResponse { |
| 46 | Id int64 `json:"id"` | 48 | Id int64 `json:"id"` |
| @@ -75,12 +77,16 @@ type ( | @@ -75,12 +77,16 @@ type ( | ||
| 75 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 77 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
| 76 | Tags []string `json:"tags"` // 文章的标签 | 78 | Tags []string `json:"tags"` // 文章的标签 |
| 77 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 79 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
| 80 | + Cover string `json:"cover"` //封面 | ||
| 78 | } | 81 | } |
| 79 | ArticleSection { | 82 | ArticleSection { |
| 80 | Id int64 `json:"id"` //段落id | 83 | Id int64 `json:"id"` //段落id |
| 81 | - Content string `json:"content"` // 文本内容 | 84 | + Content string `json:"content,optional"` // 文本内容 |
| 82 | SortBy int `json:"sortBy"` // 排序 | 85 | SortBy int `json:"sortBy"` // 排序 |
| 83 | TotalComment int `json:"totalComment"` // 评论的数量 | 86 | TotalComment int `json:"totalComment"` // 评论的数量 |
| 87 | + Images []string `json:"images,optional"` // 照片列表 | ||
| 88 | + ParagraphType int `json:"paragraphType"` // 段落类型 0:无样式 1:模板文本 2:模板图片 | ||
| 89 | + ParagraphTemplate Paragraph `json:"paragraphTemplate"` // 段落模板 | ||
| 84 | } | 90 | } |
| 85 | ) | 91 | ) |
| 86 | 92 | ||
| @@ -111,6 +117,7 @@ type ( | @@ -111,6 +117,7 @@ type ( | ||
| 111 | WhoRead []int64 `json:"whoRead"` //谁可查看 | 117 | WhoRead []int64 `json:"whoRead"` //谁可查看 |
| 112 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 | 118 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 |
| 113 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | 119 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 |
| 120 | + Cover string `json:"cover"` //封面 | ||
| 114 | } | 121 | } |
| 115 | 122 | ||
| 116 | SystemArticleSearchMeRequest { | 123 | SystemArticleSearchMeRequest { |
| @@ -211,6 +218,7 @@ type ( | @@ -211,6 +218,7 @@ type ( | ||
| 211 | Location Location `json:"location"` | 218 | Location Location `json:"location"` |
| 212 | Action string `json:"action"` | 219 | Action string `json:"action"` |
| 213 | Show int `json:"show"` | 220 | Show int `json:"show"` |
| 221 | + Cover string `json:"cover"` //封面 | ||
| 214 | } | 222 | } |
| 215 | ) | 223 | ) |
| 216 | 224 | ||
| @@ -230,6 +238,7 @@ type ( | @@ -230,6 +238,7 @@ type ( | ||
| 230 | Location Location `json:"location"` | 238 | Location Location `json:"location"` |
| 231 | Action string `json:"action"` | 239 | Action string `json:"action"` |
| 232 | Show int `json:"show"` | 240 | Show int `json:"show"` |
| 241 | + Cover string `json:"cover"` //封面 | ||
| 233 | } | 242 | } |
| 234 | ) | 243 | ) |
| 235 | 244 | ||
| @@ -253,14 +262,16 @@ type ( | @@ -253,14 +262,16 @@ type ( | ||
| 253 | MiniArticleDraftCreateRequest { | 262 | MiniArticleDraftCreateRequest { |
| 254 | CompanyId int64 `json:",optional"` | 263 | CompanyId int64 `json:",optional"` |
| 255 | AuthorId int64 `json:",optional"` // 发布人 | 264 | AuthorId int64 `json:",optional"` // 发布人 |
| 256 | - Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | ||
| 257 | - Section []string `json:"section"` // 填写的内容 | 265 | + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 5、演绎式 3、归纳式 10、其他业务类型模板 |
| 266 | + Section []string `json:"section,optional"` // 填写的内容 | ||
| 258 | Title string `json:"title"` // 标题 | 267 | Title string `json:"title"` // 标题 |
| 259 | Images []string `json:"images"` // 图片 | 268 | Images []string `json:"images"` // 图片 |
| 260 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 269 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| 261 | WhoReview []int64 `json:"whoReview"` // 评论人 | 270 | WhoReview []int64 `json:"whoReview"` // 评论人 |
| 262 | Location Location `json:"location"` // 坐标 | 271 | Location Location `json:"location"` // 坐标 |
| 263 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 272 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
| 273 | + | ||
| 274 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 264 | } | 275 | } |
| 265 | 276 | ||
| 266 | MiniArticleDraftCreateResponse { | 277 | MiniArticleDraftCreateResponse { |
| @@ -275,13 +286,15 @@ type ( | @@ -275,13 +286,15 @@ type ( | ||
| 275 | CompanyId int64 `json:",optional"` | 286 | CompanyId int64 `json:",optional"` |
| 276 | AuthorId int64 `json:",optional"` // 发布人 | 287 | AuthorId int64 `json:",optional"` // 发布人 |
| 277 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | 288 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 |
| 278 | - Section []string `json:"section"` // 填写的内容 | 289 | + Section []string `json:"section,optional"` // 填写的内容 |
| 279 | Title string `json:"title"` // 标题 | 290 | Title string `json:"title"` // 标题 |
| 280 | Images []string `json:"images"` // 图片 | 291 | Images []string `json:"images"` // 图片 |
| 281 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 292 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| 282 | WhoReview []int64 `json:"whoReview"` // 评论人 | 293 | WhoReview []int64 `json:"whoReview"` // 评论人 |
| 283 | Location Location `json:"location"` // 坐标 | 294 | Location Location `json:"location"` // 坐标 |
| 284 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 295 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
| 296 | + | ||
| 297 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 285 | } | 298 | } |
| 286 | 299 | ||
| 287 | MiniArticleDraftUpdateResponse { | 300 | MiniArticleDraftUpdateResponse { |
| @@ -305,11 +318,13 @@ type ( | @@ -305,11 +318,13 @@ type ( | ||
| 305 | MiniArticleDraftItem { | 318 | MiniArticleDraftItem { |
| 306 | Id int64 `json:"id"` | 319 | Id int64 `json:"id"` |
| 307 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | 320 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 |
| 308 | - Section []string `json:"section"` // 填写的内容 | 321 | + Section []string `json:"section,optional"` // 填写的内容 |
| 309 | Title string `json:"title"` // 标题 | 322 | Title string `json:"title"` // 标题 |
| 310 | Images []string `json:"images"` // 图片 | 323 | Images []string `json:"images"` // 图片 |
| 311 | CreatedAt int64 `json:"createdAt"`// | 324 | CreatedAt int64 `json:"createdAt"`// |
| 312 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | 325 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 |
| 326 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 327 | + Cover string `json:"cover"` //封面 | ||
| 313 | } | 328 | } |
| 314 | ) | 329 | ) |
| 315 | 330 | ||
| @@ -331,6 +346,8 @@ type ( | @@ -331,6 +346,8 @@ type ( | ||
| 331 | WhoReview []int64 `json:"whoReview"` // 评论人 | 346 | WhoReview []int64 `json:"whoReview"` // 评论人 |
| 332 | Location Location `json:"location"` // 坐标 | 347 | Location Location `json:"location"` // 坐标 |
| 333 | MatchUrl map[string]string `json:"matchUrl"` // | 348 | MatchUrl map[string]string `json:"matchUrl"` // |
| 349 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 350 | + Cover string `json:"cover"` //封面 | ||
| 334 | } | 351 | } |
| 335 | ) | 352 | ) |
| 336 | 353 | ||
| @@ -436,6 +453,7 @@ type ( | @@ -436,6 +453,7 @@ type ( | ||
| 436 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 453 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
| 437 | Tags []ArticleTagItem `json:"tags"` //标签 | 454 | Tags []ArticleTagItem `json:"tags"` //标签 |
| 438 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 455 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
| 456 | + Cover string `json:"cover"` //封面 | ||
| 439 | } | 457 | } |
| 440 | ) | 458 | ) |
| 441 | 459 | ||
| @@ -462,6 +480,7 @@ type ( | @@ -462,6 +480,7 @@ type ( | ||
| 462 | Title string `json:"title"` //标题 | 480 | Title string `json:"title"` //标题 |
| 463 | AuthorId int64 `json:"authorId"` //发布人ID | 481 | AuthorId int64 `json:"authorId"` //发布人ID |
| 464 | Author string `json:"author"` //发布人 | 482 | Author string `json:"author"` //发布人 |
| 483 | + Cover string `json:"cover"` //封面 | ||
| 465 | Images []string `json:"images"` //图片 | 484 | Images []string `json:"images"` //图片 |
| 466 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 485 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
| 467 | UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 | 486 | UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 |
| @@ -481,9 +500,9 @@ type ( | @@ -481,9 +500,9 @@ type ( | ||
| 481 | Id int64 `json:"id"` | 500 | Id int64 `json:"id"` |
| 482 | CompanyId int64 `json:"companyId,optional"` | 501 | CompanyId int64 `json:"companyId,optional"` |
| 483 | Template int `json:"template,optional"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | 502 | Template int `json:"template,optional"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 |
| 484 | - Section []ArticleSection `json:"section"` // 填写的内容 | 503 | + Section []ArticleSection `json:"section,optional"` // 填写的内容 |
| 485 | Title string `json:"title"` // 标题 | 504 | Title string `json:"title"` // 标题 |
| 486 | - Images []string `json:"images"` // 图片 | 505 | + Images []string `json:"images,optional"` // 图片 |
| 487 | Videos []Video `json:"video"` // 视频 | 506 | Videos []Video `json:"video"` // 视频 |
| 488 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 507 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| 489 | WhoReview []int64 `json:"whoReview"` // 评论人 | 508 | WhoReview []int64 `json:"whoReview"` // 评论人 |
| @@ -519,6 +538,8 @@ type ( | @@ -519,6 +538,8 @@ type ( | ||
| 519 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 538 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 520 | ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID | 539 | ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID |
| 521 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 540 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
| 541 | + | ||
| 542 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 522 | } | 543 | } |
| 523 | SystemArticleCreateResponse { | 544 | SystemArticleCreateResponse { |
| 524 | Id int64 `json:"id"` //id | 545 | Id int64 `json:"id"` //id |
| @@ -588,6 +609,7 @@ type ( | @@ -588,6 +609,7 @@ type ( | ||
| 588 | Location Location `json:"location"` // 定位坐标 | 609 | Location Location `json:"location"` // 定位坐标 |
| 589 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 610 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
| 590 | Tags []int64 `json:"tags"` // 标签 | 611 | Tags []int64 `json:"tags"` // 标签 |
| 612 | + Cover string `json:"cover"` //封面 | ||
| 591 | } | 613 | } |
| 592 | ) | 614 | ) |
| 593 | // 管理后台文章恢复 | 615 | // 管理后台文章恢复 |
| @@ -653,6 +675,7 @@ type ( | @@ -653,6 +675,7 @@ type ( | ||
| 653 | Images []string `json:"images"` | 675 | Images []string `json:"images"` |
| 654 | CreatedAt int64 `json:"createdAt"` | 676 | CreatedAt int64 `json:"createdAt"` |
| 655 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 677 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
| 678 | + Cover string `json:"cover"` //封面 | ||
| 656 | } | 679 | } |
| 657 | ) | 680 | ) |
| 658 | 681 | ||
| @@ -670,6 +693,7 @@ type ( | @@ -670,6 +693,7 @@ type ( | ||
| 670 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 693 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 671 | Tags []int64 `json:"tags"` // 标签 | 694 | Tags []int64 `json:"tags"` // 标签 |
| 672 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 695 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
| 696 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 673 | } | 697 | } |
| 674 | SystemArticleDraftCreateResponse { | 698 | SystemArticleDraftCreateResponse { |
| 675 | Id int64 `json:"id"` //ID | 699 | Id int64 `json:"id"` //ID |
| @@ -701,6 +725,7 @@ type ( | @@ -701,6 +725,7 @@ type ( | ||
| 701 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 725 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 702 | Tags []int64 `json:"tags"` // 标签 | 726 | Tags []int64 `json:"tags"` // 标签 |
| 703 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 727 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
| 728 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 704 | } | 729 | } |
| 705 | SystemArticleDraftUpdateResponse { | 730 | SystemArticleDraftUpdateResponse { |
| 706 | Id int64 `json:"id"` //ID | 731 | Id int64 `json:"id"` //ID |
| @@ -740,6 +765,7 @@ type ( | @@ -740,6 +765,7 @@ type ( | ||
| 740 | AuthorId int64 `json:"authorId"` //发布人id | 765 | AuthorId int64 `json:"authorId"` //发布人id |
| 741 | Author string `json:"author"` //发布人 | 766 | Author string `json:"author"` //发布人 |
| 742 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 | 767 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 |
| 768 | + Cover string `json:"cover"` //封面 | ||
| 743 | } | 769 | } |
| 744 | ) | 770 | ) |
| 745 | 771 | ||
| @@ -783,6 +809,8 @@ type ( | @@ -783,6 +809,8 @@ type ( | ||
| 783 | WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | 809 | WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 |
| 784 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 810 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 785 | Tags []int64 `json:"tags"` // 标签 | 811 | Tags []int64 `json:"tags"` // 标签 |
| 812 | + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | ||
| 813 | + Cover string `json:"cover"` //封面 | ||
| 786 | } | 814 | } |
| 787 | ) | 815 | ) |
| 788 | 816 |
| @@ -236,6 +236,7 @@ type( | @@ -236,6 +236,7 @@ type( | ||
| 236 | ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读 | 236 | ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读 |
| 237 | Images []string `json:"images"` // 图片列表 | 237 | Images []string `json:"images"` // 图片列表 |
| 238 | Author UserItem `json:"author"` // 作者 | 238 | Author UserItem `json:"author"` // 作者 |
| 239 | + Cover string `json:"cover"` //封面 | ||
| 239 | } | 240 | } |
| 240 | MiniUserFollowedSearchRequest{ | 241 | MiniUserFollowedSearchRequest{ |
| 241 | Page int `json:"page,optional"` | 242 | Page int `json:"page,optional"` |
| @@ -7,6 +7,7 @@ Timeout: 30000 | @@ -7,6 +7,7 @@ Timeout: 30000 | ||
| 7 | # CertFile: ./key/fjmaimaimai.com_bundle.crt | 7 | # CertFile: ./key/fjmaimaimai.com_bundle.crt |
| 8 | # KeyFile: ./key/fjmaimaimai.com.key | 8 | # KeyFile: ./key/fjmaimaimai.com.key |
| 9 | LogRequest: true # 记录详细请求日志 | 9 | LogRequest: true # 记录详细请求日志 |
| 10 | +ContentSecurityCheck: true # 内容安全检查(调用微信接口) | ||
| 10 | 11 | ||
| 11 | Log: | 12 | Log: |
| 12 | Mode: file | 13 | Mode: file |
| @@ -17,6 +17,7 @@ type Config struct { | @@ -17,6 +17,7 @@ type Config struct { | ||
| 17 | ApiAuth ApiService | 17 | ApiAuth ApiService |
| 18 | DebugSmsCode string `json:",optional,default=999512"` | 18 | DebugSmsCode string `json:",optional,default=999512"` |
| 19 | LogRequest bool `json:",optional,default=true"` | 19 | LogRequest bool `json:",optional,default=true"` |
| 20 | + ContentSecurityCheck bool `json:",optional,default=false"` | ||
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | type ApiService struct { | 23 | type ApiService struct { |
| @@ -11,7 +11,9 @@ import ( | @@ -11,7 +11,9 @@ import ( | ||
| 11 | department "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/department" | 11 | department "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/department" |
| 12 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" | 12 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" |
| 13 | role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role" | 13 | role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role" |
| 14 | + secuirty "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/secuirty" | ||
| 14 | tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags" | 15 | tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags" |
| 16 | + template "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/template" | ||
| 15 | user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user" | 17 | user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user" |
| 16 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 18 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
| 17 | 19 | ||
| @@ -809,4 +811,114 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -809,4 +811,114 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 809 | }, | 811 | }, |
| 810 | rest.WithPrefix("/v1/system"), | 812 | rest.WithPrefix("/v1/system"), |
| 811 | ) | 813 | ) |
| 814 | + | ||
| 815 | + server.AddRoutes( | ||
| 816 | + rest.WithMiddlewares( | ||
| 817 | + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest}, | ||
| 818 | + []rest.Route{ | ||
| 819 | + { | ||
| 820 | + Method: http.MethodPost, | ||
| 821 | + Path: "/article_security/search", | ||
| 822 | + Handler: secuirty.ArticleSecuritySearchHandler(serverCtx), | ||
| 823 | + }, | ||
| 824 | + { | ||
| 825 | + Method: http.MethodGet, | ||
| 826 | + Path: "/article_security/:id", | ||
| 827 | + Handler: secuirty.ArticleSecurityGetHandler(serverCtx), | ||
| 828 | + }, | ||
| 829 | + { | ||
| 830 | + Method: http.MethodPost, | ||
| 831 | + Path: "/article_security/audit", | ||
| 832 | + Handler: secuirty.ArticleSecurityAuditHandler(serverCtx), | ||
| 833 | + }, | ||
| 834 | + }..., | ||
| 835 | + ), | ||
| 836 | + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | ||
| 837 | + rest.WithPrefix("/v1/system"), | ||
| 838 | + ) | ||
| 839 | + | ||
| 840 | + server.AddRoutes( | ||
| 841 | + rest.WithMiddlewares( | ||
| 842 | + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest}, | ||
| 843 | + []rest.Route{ | ||
| 844 | + { | ||
| 845 | + Method: http.MethodGet, | ||
| 846 | + Path: "/article_template/:id", | ||
| 847 | + Handler: template.SystemArticleTemplateGetHandler(serverCtx), | ||
| 848 | + }, | ||
| 849 | + { | ||
| 850 | + Method: http.MethodPost, | ||
| 851 | + Path: "/article_template", | ||
| 852 | + Handler: template.SystemArticleTemplateSaveHandler(serverCtx), | ||
| 853 | + }, | ||
| 854 | + { | ||
| 855 | + Method: http.MethodDelete, | ||
| 856 | + Path: "/article_template/:id", | ||
| 857 | + Handler: template.SystemArticleTemplateDeleteHandler(serverCtx), | ||
| 858 | + }, | ||
| 859 | + { | ||
| 860 | + Method: http.MethodDelete, | ||
| 861 | + Path: "/article_template/batch_delete", | ||
| 862 | + Handler: template.SystemArticleTemplateBatchDeleteHandler(serverCtx), | ||
| 863 | + }, | ||
| 864 | + { | ||
| 865 | + Method: http.MethodPut, | ||
| 866 | + Path: "/article_template/:id", | ||
| 867 | + Handler: template.SystemArticleTemplateUpdateHandler(serverCtx), | ||
| 868 | + }, | ||
| 869 | + { | ||
| 870 | + Method: http.MethodPost, | ||
| 871 | + Path: "/article_template/search", | ||
| 872 | + Handler: template.SystemArticleTemplateSearchHandler(serverCtx), | ||
| 873 | + }, | ||
| 874 | + { | ||
| 875 | + Method: http.MethodPost, | ||
| 876 | + Path: "/article_template_class/search", | ||
| 877 | + Handler: template.SystemArticleTemplateClassSearchHandler(serverCtx), | ||
| 878 | + }, | ||
| 879 | + }..., | ||
| 880 | + ), | ||
| 881 | + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | ||
| 882 | + rest.WithPrefix("/v1/system"), | ||
| 883 | + ) | ||
| 884 | + | ||
| 885 | + server.AddRoutes( | ||
| 886 | + rest.WithMiddlewares( | ||
| 887 | + []rest.Middleware{serverCtx.LogRequest}, | ||
| 888 | + []rest.Route{ | ||
| 889 | + { | ||
| 890 | + Method: http.MethodPost, | ||
| 891 | + Path: "/article_template/search", | ||
| 892 | + Handler: template.MiniArticleTemplateSearchHandler(serverCtx), | ||
| 893 | + }, | ||
| 894 | + { | ||
| 895 | + Method: http.MethodPost, | ||
| 896 | + Path: "/article_template/search-mine", | ||
| 897 | + Handler: template.MiniArticleTemplateSearchMineHandler(serverCtx), | ||
| 898 | + }, | ||
| 899 | + { | ||
| 900 | + Method: http.MethodPost, | ||
| 901 | + Path: "/article_template_class/search", | ||
| 902 | + Handler: template.MiniArticleTemplateClassSearchHandler(serverCtx), | ||
| 903 | + }, | ||
| 904 | + { | ||
| 905 | + Method: http.MethodPost, | ||
| 906 | + Path: "/article_template", | ||
| 907 | + Handler: template.MiniArticleTemplateSaveHandler(serverCtx), | ||
| 908 | + }, | ||
| 909 | + { | ||
| 910 | + Method: http.MethodDelete, | ||
| 911 | + Path: "/article_template/:id", | ||
| 912 | + Handler: template.MiniArticleTemplateDeleteHandler(serverCtx), | ||
| 913 | + }, | ||
| 914 | + { | ||
| 915 | + Method: http.MethodPut, | ||
| 916 | + Path: "/article_template/:id", | ||
| 917 | + Handler: template.MiniArticleTemplateUpdateHandler(serverCtx), | ||
| 918 | + }, | ||
| 919 | + }..., | ||
| 920 | + ), | ||
| 921 | + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | ||
| 922 | + rest.WithPrefix("/v1/mini"), | ||
| 923 | + ) | ||
| 812 | } | 924 | } |
| 1 | +package secuirty | ||
| 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/secuirty" | ||
| 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 ArticleSecurityAuditHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleSecurityAuditRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := secuirty.NewArticleSecurityAuditLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.ArticleSecurityAudit(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package secuirty | ||
| 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/secuirty" | ||
| 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 ArticleSecurityGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleSecurityGetRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := secuirty.NewArticleSecurityGetLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.ArticleSecurityGet(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package secuirty | ||
| 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/secuirty" | ||
| 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 ArticleSecuritySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleSecuritySearchRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := secuirty.NewArticleSecuritySearchLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.ArticleSecuritySearch(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 MiniArticleTemplateClassSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateClassSearchRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewMiniArticleTemplateClassSearchLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.MiniArticleTemplateClassSearch(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 MiniArticleTemplateDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateDeleteRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewMiniArticleTemplateDeleteLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.MiniArticleTemplateDelete(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 MiniArticleTemplateSaveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateSaveRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewMiniArticleTemplateSaveLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.MiniArticleTemplateSave(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 MiniArticleTemplateSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateSearchRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewMiniArticleTemplateSearchLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.MiniArticleTemplateSearch(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 MiniArticleTemplateSearchMineHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateSearchRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewMiniArticleTemplateSearchMineLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.MiniArticleTemplateSearchMine(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 MiniArticleTemplateUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateUpdateRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewMiniArticleTemplateUpdateLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.MiniArticleTemplateUpdate(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
cmd/discuss/api/internal/handler/template/system_article_template_batch_delete_handler.go
0 → 100644
| 1 | +package template | ||
| 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/template" | ||
| 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 SystemArticleTemplateBatchDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateBatchDeleteRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewSystemArticleTemplateBatchDeleteLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SystemArticleTemplateBatchDelete(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
cmd/discuss/api/internal/handler/template/system_article_template_class_search_handler.go
0 → 100644
| 1 | +package template | ||
| 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/template" | ||
| 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 SystemArticleTemplateClassSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateClassSearchRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewSystemArticleTemplateClassSearchLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SystemArticleTemplateClassSearch(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 SystemArticleTemplateDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateDeleteRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewSystemArticleTemplateDeleteLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SystemArticleTemplateDelete(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 SystemArticleTemplateGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateGetRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewSystemArticleTemplateGetLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SystemArticleTemplateGet(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 SystemArticleTemplateSaveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateSaveRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewSystemArticleTemplateSaveLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SystemArticleTemplateSave(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 6 | + "net/http" | ||
| 7 | + | ||
| 8 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/template" | ||
| 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 | + | ||
| 14 | +func SystemArticleTemplateSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 15 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 16 | + var req types.ArticleTemplateSearchRequest | ||
| 17 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 18 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 19 | + return | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + l := template.NewSystemArticleTemplateSearchLogic(r.Context(), svcCtx) | ||
| 23 | + userToken := contextdata.GetUserTokenFromCtx(r.Context()) | ||
| 24 | + req.CompanyId = userToken.CompanyId | ||
| 25 | + resp, err := l.SystemArticleTemplateSearch(&req) | ||
| 26 | + result.HttpResult(r, w, resp, err) | ||
| 27 | + } | ||
| 28 | +} |
| 1 | +package template | ||
| 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/template" | ||
| 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 SystemArticleTemplateUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 15 | + var req types.ArticleTemplateUpdateRequest | ||
| 16 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 18 | + return | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + l := template.NewSystemArticleTemplateUpdateLogic(r.Context(), svcCtx) | ||
| 22 | + resp, err := l.SystemArticleTemplateUpdate(&req) | ||
| 23 | + result.HttpResult(r, w, resp, err) | ||
| 24 | + } | ||
| 25 | +} |
| @@ -65,7 +65,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | @@ -65,7 +65,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | ||
| 65 | Id: backupList[i].Id, | 65 | Id: backupList[i].Id, |
| 66 | Title: "", | 66 | Title: "", |
| 67 | Content: "", | 67 | Content: "", |
| 68 | - Images: []string{}, | 68 | + Images: backupList[i].GetImages(), |
| 69 | Videos: []types.Video{}, | 69 | Videos: []types.Video{}, |
| 70 | CreatedAt: backupList[i].CreatedAt, | 70 | CreatedAt: backupList[i].CreatedAt, |
| 71 | Location: types.Location{ | 71 | Location: types.Location{ |
| @@ -76,6 +76,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | @@ -76,6 +76,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | ||
| 76 | ChangeField: backupList[i].ChangeField, | 76 | ChangeField: backupList[i].ChangeField, |
| 77 | Action: backupList[i].Action, | 77 | Action: backupList[i].Action, |
| 78 | Show: int(backupList[i].Show), | 78 | Show: int(backupList[i].Show), |
| 79 | + Cover: backupList[i].GetCover(), | ||
| 79 | } | 80 | } |
| 80 | //根据修改的内容替换展示内容 | 81 | //根据修改的内容替换展示内容 |
| 81 | changeFiled := []string{} | 82 | changeFiled := []string{} |
| @@ -52,14 +52,10 @@ func (l *MiniArticleSearchMeLogic) MiniArticleSearchMe(req *types.MiniArticleSea | @@ -52,14 +52,10 @@ func (l *MiniArticleSearchMeLogic) MiniArticleSearchMe(req *types.MiniArticleSea | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | func NewArticle(article *domain.Article) types.ArticleSearchMe { | 54 | func NewArticle(article *domain.Article) types.ArticleSearchMe { |
| 55 | - images := []string{} | ||
| 56 | - for _, val2 := range article.Images { | ||
| 57 | - images = append(images, val2.Url) | ||
| 58 | - } | ||
| 59 | articleSearchMe := types.ArticleSearchMe{ | 55 | articleSearchMe := types.ArticleSearchMe{ |
| 60 | Id: article.Id, | 56 | Id: article.Id, |
| 61 | Title: article.Title, | 57 | Title: article.Title, |
| 62 | - Images: images, | 58 | + Images: article.GetImages(), |
| 63 | CreatedAt: article.CreatedAt, | 59 | CreatedAt: article.CreatedAt, |
| 64 | CountLove: article.CountLove, | 60 | CountLove: article.CountLove, |
| 65 | CountComment: article.CountComment, | 61 | CountComment: article.CountComment, |
| @@ -69,6 +65,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe { | @@ -69,6 +65,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe { | ||
| 69 | WhoRead: article.WhoRead, | 65 | WhoRead: article.WhoRead, |
| 70 | IsDel: article.IsDel, | 66 | IsDel: article.IsDel, |
| 71 | DeletedType: article.DeletedType, | 67 | DeletedType: article.DeletedType, |
| 68 | + Cover: article.GetCover(), | ||
| 72 | } | 69 | } |
| 73 | return articleSearchMe | 70 | return articleSearchMe |
| 74 | } | 71 | } |
| @@ -54,6 +54,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | @@ -54,6 +54,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | ||
| 54 | Descript: req.Location.Descript, | 54 | Descript: req.Location.Descript, |
| 55 | }, | 55 | }, |
| 56 | MatchUrl: map[string]string{}, | 56 | MatchUrl: map[string]string{}, |
| 57 | + Section: NewArticleSectionFromParagraphs(req.Paragraphs, req.CompanyId, 0), | ||
| 57 | } | 58 | } |
| 58 | for _, val := range req.Images { | 59 | for _, val := range req.Images { |
| 59 | newDraft.Images = append(newDraft.Images, domain.Image{ | 60 | newDraft.Images = append(newDraft.Images, domain.Image{ |
| @@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" |
| 6 | "strconv" | 7 | "strconv" |
| 7 | "strings" | 8 | "strings" |
| @@ -128,6 +129,202 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -128,6 +129,202 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
| 128 | } | 129 | } |
| 129 | 130 | ||
| 130 | //切分文章分段 | 131 | //切分文章分段 |
| 132 | + sectionList := NewArticleSectionFromParagraphs(req.Paragraphs, author.CompanyId, 0) | ||
| 133 | + //newStr := "" | ||
| 134 | + //for _, paragraph := range req.Paragraphs { | ||
| 135 | + // strList := []string{paragraph.Text} | ||
| 136 | + // // 无模板样式的 | ||
| 137 | + // if paragraph.Type == 0 { | ||
| 138 | + // strList = strings.Split(paragraph.Text, "\n") | ||
| 139 | + // } | ||
| 140 | + // for i2 := range strList { | ||
| 141 | + // newStr = template.HTMLEscapeString(strList[i2]) | ||
| 142 | + // newSection := domain.ArticleSection{ | ||
| 143 | + // Id: 0, | ||
| 144 | + // CompanyId: author.CompanyId, | ||
| 145 | + // ArticleId: 0, | ||
| 146 | + // Content: newStr, | ||
| 147 | + // SortBy: len(sectionList), | ||
| 148 | + // TotalComment: 0, | ||
| 149 | + // | ||
| 150 | + // Images: paragraph.Images, | ||
| 151 | + // ParagraphType: paragraph.Type, | ||
| 152 | + // ParagraphTemplate: core.NewDomainParagraph(paragraph), | ||
| 153 | + // } | ||
| 154 | + // sectionList = append(sectionList, &newSection) | ||
| 155 | + // } | ||
| 156 | + //} | ||
| 157 | + | ||
| 158 | + newArticle := &domain.Article{ | ||
| 159 | + Id: 0, | ||
| 160 | + CompanyId: author.CompanyId, | ||
| 161 | + AuthorId: author.Id, | ||
| 162 | + Author: articleAuthor, | ||
| 163 | + Title: req.Title, | ||
| 164 | + Images: images, | ||
| 165 | + WhoRead: whoRead, | ||
| 166 | + WhoReview: whoReview, | ||
| 167 | + Location: domain.Location{ | ||
| 168 | + Longitude: req.Location.Longitude, | ||
| 169 | + Latitude: req.Location.Latitude, | ||
| 170 | + Descript: req.Location.Descript, | ||
| 171 | + }, | ||
| 172 | + TargetUser: domain.ArticleTargetAll, | ||
| 173 | + CountLove: 0, | ||
| 174 | + CountComment: 0, | ||
| 175 | + CountRead: 0, | ||
| 176 | + Show: domain.ArticleShowEnable, | ||
| 177 | + Tags: []int64{}, | ||
| 178 | + MatchUrl: map[string]string{}, | ||
| 179 | + Videos: []domain.Video{}, | ||
| 180 | + } | ||
| 181 | + if len(whoRead) > 0 { | ||
| 182 | + newArticle.TargetUser = domain.ArticleTargetLimit | ||
| 183 | + } | ||
| 184 | + for k, v := range req.MatchUrl { | ||
| 185 | + newArticle.MatchUrl[k] = v | ||
| 186 | + } | ||
| 187 | + //设置内容概要 | ||
| 188 | + newArticle.SetSummary(sectionList) | ||
| 189 | + | ||
| 190 | + err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | ||
| 191 | + newArticle, err = l.svcCtx.ArticleRepository.Insert(ctx, c, newArticle) | ||
| 192 | + if err != nil { | ||
| 193 | + return xerr.NewErrMsgErr("创建文章失败", err) | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + for i := range sectionList { | ||
| 197 | + sectionList[i].ArticleId = newArticle.Id | ||
| 198 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, c, sectionList[i]) | ||
| 199 | + if err != nil { | ||
| 200 | + return xerr.NewErrMsgErr("创建文章内容失败", err) | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + // 生成 备份数据 | ||
| 205 | + var backupData domain.ArticleBackup | ||
| 206 | + backupData.MakeBackup(articleAuthor, newArticle, sectionList, "原始版本") | ||
| 207 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(l.ctx, conn, &backupData) | ||
| 208 | + if err != nil { | ||
| 209 | + return xerr.NewErrMsgErr("创建文章失败", err) | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + //发送订阅消息 | ||
| 213 | + err = message.NewMiniSubscribeLogic(l.ctx, l.svcCtx).FollowArticle(conn, newArticle) | ||
| 214 | + if err != nil { | ||
| 215 | + return xerr.NewErrMsgErr("创建文章失败", err) | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + // 内容安全检查 | ||
| 219 | + if err = core.ContentSecurityCheck(l.ctx, l.svcCtx, c, author, core.NewContentFromArticle(newArticle, sectionList)); err != nil { | ||
| 220 | + return err | ||
| 221 | + } | ||
| 222 | + return nil | ||
| 223 | + }, true) | ||
| 224 | + if err != nil { | ||
| 225 | + return nil, xerr.NewErrMsgErr("创建文章失败", err) | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + resp = &types.MiniArticleCreateResponse{ | ||
| 229 | + Id: newArticle.Id, | ||
| 230 | + } | ||
| 231 | + return | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +func (l *MiniCreateArticleLogic) MiniCreateArticleBak(req *types.MiniArticleCreateRequest) (resp *types.MiniArticleCreateResponse, err error) { | ||
| 235 | + var conn = l.svcCtx.DefaultDBConn() | ||
| 236 | + err = l.validateTextLimit(req) | ||
| 237 | + if err != nil { | ||
| 238 | + return nil, err | ||
| 239 | + } | ||
| 240 | + // 检查发布人 | ||
| 241 | + author, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.AuthorId) | ||
| 242 | + if err != nil { | ||
| 243 | + return nil, xerr.NewErrMsgErr("创建文章内容失败", err) | ||
| 244 | + } | ||
| 245 | + companyInfo, err := l.svcCtx.CompanyRepository.FindOne(l.ctx, conn, author.CompanyId) | ||
| 246 | + if err != nil { | ||
| 247 | + return nil, xerr.NewErrMsgErr("创建文章内容失败", err) | ||
| 248 | + } | ||
| 249 | + articleAuthor := domain.UserSimple{ | ||
| 250 | + Id: author.Id, | ||
| 251 | + Name: author.Name, | ||
| 252 | + Avatar: author.Avatar, | ||
| 253 | + Position: author.Position, | ||
| 254 | + Company: companyInfo.Name, | ||
| 255 | + CompanyId: author.CompanyId, | ||
| 256 | + } | ||
| 257 | + if len(req.Images) > 9 { | ||
| 258 | + return nil, xerr.NewErrMsg("图片数量最多9张") | ||
| 259 | + } | ||
| 260 | + //获取图片的尺寸大小 | ||
| 261 | + images := []domain.Image{} | ||
| 262 | + for _, val := range req.Images { | ||
| 263 | + fInfo, _ := oss.GetImageInfo(val) | ||
| 264 | + w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
| 265 | + h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | ||
| 266 | + images = append(images, domain.Image{ | ||
| 267 | + Url: val, | ||
| 268 | + Width: w, | ||
| 269 | + Height: h, | ||
| 270 | + }) | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + //检查文章可被哪些人查看 | ||
| 274 | + whoRead := []int64{} | ||
| 275 | + if len(req.WhoRead) > 0 { | ||
| 276 | + whoRead = lo.Uniq(req.WhoRead) | ||
| 277 | + var u *domain.User | ||
| 278 | + for _, val := range whoRead { | ||
| 279 | + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val) | ||
| 280 | + if err != nil { | ||
| 281 | + return nil, xerr.NewErrMsgErr("文章可查看人设置错误", err) | ||
| 282 | + } | ||
| 283 | + if u.CompanyId != author.CompanyId { | ||
| 284 | + return nil, xerr.NewErrMsg("文章可查看人设置错误") | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + //检查文章可被哪些人评论 | ||
| 289 | + whoReview := []int64{} | ||
| 290 | + if len(req.WhoReview) > 0 { | ||
| 291 | + whoReview = lo.Uniq(req.WhoReview) | ||
| 292 | + } | ||
| 293 | + //有指定可查看人的情况 | ||
| 294 | + if len(whoRead) > 0 { | ||
| 295 | + if len(whoReview) > 0 { | ||
| 296 | + // 检查 whoRead 是否 完全包含 whoReview | ||
| 297 | + ok := lo.Every(whoRead, whoReview) | ||
| 298 | + if !ok { | ||
| 299 | + return nil, xerr.NewErrMsg("文章可评论人设置错误") | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + if len(whoReview) == 0 { | ||
| 303 | + //有指定可查看人 ,但未指定可评论人 | ||
| 304 | + return nil, xerr.NewErrMsg("文章可评论人设置错误") | ||
| 305 | + } | ||
| 306 | + } | ||
| 307 | + //没有指定可查看人的情况 | ||
| 308 | + if len(whoRead) == 0 { | ||
| 309 | + if len(whoReview) > 0 { | ||
| 310 | + // 未指定可查看人(全员可看),有指定可评论人, | ||
| 311 | + var u *domain.User | ||
| 312 | + for _, val := range whoReview { | ||
| 313 | + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val) | ||
| 314 | + if err != nil { | ||
| 315 | + return nil, xerr.NewErrMsgErr("文章可评论人设置错误", err) | ||
| 316 | + } | ||
| 317 | + if u.CompanyId != author.CompanyId { | ||
| 318 | + return nil, xerr.NewErrMsg("文章可评论人设置错误") | ||
| 319 | + } | ||
| 320 | + } | ||
| 321 | + } | ||
| 322 | + // if len(whoReview) == 0 { | ||
| 323 | + // 未指定可查看人(全员可看),未指定可评论人 ,忽略判断 | ||
| 324 | + // } | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + //切分文章分段 | ||
| 131 | sectionList := []*domain.ArticleSection{} | 328 | sectionList := []*domain.ArticleSection{} |
| 132 | newStr := "" | 329 | newStr := "" |
| 133 | for i := range req.Section { | 330 | for i := range req.Section { |
| @@ -205,6 +402,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -205,6 +402,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
| 205 | if err != nil { | 402 | if err != nil { |
| 206 | return xerr.NewErrMsgErr("创建文章失败", err) | 403 | return xerr.NewErrMsgErr("创建文章失败", err) |
| 207 | } | 404 | } |
| 405 | + | ||
| 406 | + // 内容安全检查 | ||
| 407 | + if err = core.ContentSecurityCheck(l.ctx, l.svcCtx, c, author, core.NewContentFromArticle(newArticle, sectionList)); err != nil { | ||
| 408 | + return err | ||
| 409 | + } | ||
| 208 | return nil | 410 | return nil |
| 209 | }, true) | 411 | }, true) |
| 210 | if err != nil { | 412 | if err != nil { |
| @@ -228,10 +430,12 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR | @@ -228,10 +430,12 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR | ||
| 228 | for i := range req.Section { | 430 | for i := range req.Section { |
| 229 | num := utf8.RuneCountInString(req.Section[i]) | 431 | num := utf8.RuneCountInString(req.Section[i]) |
| 230 | wordNum += num | 432 | wordNum += num |
| 433 | + if num > 1000 { | ||
| 434 | + return xerr.NewErrMsg("内容最多只能输入1000字") | ||
| 435 | + } | ||
| 231 | } | 436 | } |
| 232 | if wordNum > 1000 { | 437 | if wordNum > 1000 { |
| 233 | - return xerr.NewErrMsg("内容最多只能输入1000字") | 438 | + //return xerr.NewErrMsg("内容最多只能输入1000字") |
| 234 | } | 439 | } |
| 235 | - | ||
| 236 | return nil | 440 | return nil |
| 237 | } | 441 | } |
| @@ -67,6 +67,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic | @@ -67,6 +67,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic | ||
| 67 | ChangeField: backupInfo.ChangeField, | 67 | ChangeField: backupInfo.ChangeField, |
| 68 | Action: backupInfo.Action, | 68 | Action: backupInfo.Action, |
| 69 | Show: int(backupInfo.Show), | 69 | Show: int(backupInfo.Show), |
| 70 | + Cover: backupInfo.GetCover(), | ||
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | return | 73 | return |
| @@ -2,6 +2,9 @@ package article | @@ -2,6 +2,9 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "github.com/samber/lo" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 5 | 8 | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 9 | "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" | 10 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| @@ -37,10 +40,25 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | @@ -37,10 +40,25 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | ||
| 37 | return nil, xerr.NewErrMsg("获取草稿失败") | 40 | return nil, xerr.NewErrMsg("获取草稿失败") |
| 38 | } | 41 | } |
| 39 | } | 42 | } |
| 43 | + | ||
| 44 | + var paragraphs = make([]types.Paragraph, 0) | ||
| 45 | + lo.ForEach(draftInfo.Section, func(p *domain.ArticleSection, index int) { | ||
| 46 | + paragraphTemplate := core.NewTypesParagraph(p.ParagraphTemplate) | ||
| 47 | + paragraphTemplate.Images = p.Images | ||
| 48 | + paragraphTemplate.Text = p.Content | ||
| 49 | + paragraphs = append(paragraphs, paragraphTemplate) | ||
| 50 | + }) | ||
| 51 | + | ||
| 52 | + if len(paragraphs) == 0 && len(draftInfo.Content) > 0 { | ||
| 53 | + lo.ForEach(draftInfo.Content, func(item string, index int) { | ||
| 54 | + paragraphs = append(paragraphs, core.NewNoneTypesParagraph(item)) | ||
| 55 | + }) | ||
| 56 | + } | ||
| 57 | + | ||
| 40 | resp = &types.MiniArticleDraftGetMeResponse{ | 58 | resp = &types.MiniArticleDraftGetMeResponse{ |
| 41 | Id: draftInfo.Id, | 59 | Id: draftInfo.Id, |
| 42 | Template: draftInfo.Template, | 60 | Template: draftInfo.Template, |
| 43 | - Section: draftInfo.Content, | 61 | + //Section: draftInfo.Content, |
| 44 | Title: draftInfo.Title, | 62 | Title: draftInfo.Title, |
| 45 | Images: []string{}, | 63 | Images: []string{}, |
| 46 | WhoRead: draftInfo.WhoRead, | 64 | WhoRead: draftInfo.WhoRead, |
| @@ -51,6 +69,8 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | @@ -51,6 +69,8 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | ||
| 51 | Descript: draftInfo.Location.Descript, | 69 | Descript: draftInfo.Location.Descript, |
| 52 | }, | 70 | }, |
| 53 | MatchUrl: map[string]string{}, | 71 | MatchUrl: map[string]string{}, |
| 72 | + Paragraphs: paragraphs, | ||
| 73 | + Cover: draftInfo.GetCover(), | ||
| 54 | } | 74 | } |
| 55 | for k, v := range draftInfo.MatchUrl { | 75 | for k, v := range draftInfo.MatchUrl { |
| 56 | resp.MatchUrl[k] = v | 76 | resp.MatchUrl[k] = v |
| @@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | "sort" | 6 | "sort" |
| 6 | 7 | ||
| 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/svc" |
| @@ -101,11 +102,18 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -101,11 +102,18 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
| 101 | articleSection := []types.ArticleSection{} | 102 | articleSection := []types.ArticleSection{} |
| 102 | 103 | ||
| 103 | for _, val := range sortBy { | 104 | for _, val := range sortBy { |
| 105 | + | ||
| 106 | + paragraphTemplate := core.NewTypesParagraph(val.ParagraphTemplate) | ||
| 107 | + paragraphTemplate.Images = val.Images | ||
| 108 | + paragraphTemplate.Text = val.Content | ||
| 104 | articleSection = append(articleSection, types.ArticleSection{ | 109 | articleSection = append(articleSection, types.ArticleSection{ |
| 105 | Id: val.Id, | 110 | Id: val.Id, |
| 106 | Content: val.Content, | 111 | Content: val.Content, |
| 107 | SortBy: val.SortBy, | 112 | SortBy: val.SortBy, |
| 108 | TotalComment: val.TotalComment, | 113 | TotalComment: val.TotalComment, |
| 114 | + Images: val.Images, | ||
| 115 | + ParagraphTemplate: core.NewTypesParagraph(val.ParagraphTemplate), | ||
| 116 | + ParagraphType: val.ParagraphType, | ||
| 109 | }) | 117 | }) |
| 110 | } | 118 | } |
| 111 | resp = &types.MiniArticleGetResponse{ | 119 | resp = &types.MiniArticleGetResponse{ |
| @@ -139,6 +147,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -139,6 +147,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
| 139 | Tags: tags, | 147 | Tags: tags, |
| 140 | MatchUrl: map[string]string{}, | 148 | MatchUrl: map[string]string{}, |
| 141 | Videos: []types.Video{}, | 149 | Videos: []types.Video{}, |
| 150 | + Cover: articleInfo.GetCover(), | ||
| 142 | } | 151 | } |
| 143 | if backupCount > 1 { | 152 | if backupCount > 1 { |
| 144 | resp.Edit = 1 | 153 | resp.Edit = 1 |
| @@ -2,6 +2,8 @@ package article | @@ -2,6 +2,8 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "github.com/samber/lo" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | 7 | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| @@ -45,6 +47,21 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | @@ -45,6 +47,21 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | ||
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | for i := range draftList { | 49 | for i := range draftList { |
| 50 | + draftInfo := draftList[i] | ||
| 51 | + var paragraphs = make([]types.Paragraph, 0) | ||
| 52 | + lo.ForEach(draftInfo.Section, func(p *domain.ArticleSection, index int) { | ||
| 53 | + item := core.NewTypesParagraph(p.ParagraphTemplate) | ||
| 54 | + item.Text = p.Content | ||
| 55 | + item.Images = p.Images | ||
| 56 | + paragraphs = append(paragraphs, item) | ||
| 57 | + }) | ||
| 58 | + | ||
| 59 | + if len(paragraphs) == 0 && len(draftInfo.Content) > 0 { | ||
| 60 | + lo.ForEach(draftInfo.Content, func(item string, index int) { | ||
| 61 | + paragraphs = append(paragraphs, core.NewNoneTypesParagraph(item)) | ||
| 62 | + }) | ||
| 63 | + } | ||
| 64 | + | ||
| 48 | images := []string{} | 65 | images := []string{} |
| 49 | for _, val := range draftList[i].Images { | 66 | for _, val := range draftList[i].Images { |
| 50 | images = append(images, val.Url) | 67 | images = append(images, val.Url) |
| @@ -52,11 +69,13 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | @@ -52,11 +69,13 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | ||
| 52 | resp.List[i] = types.MiniArticleDraftItem{ | 69 | resp.List[i] = types.MiniArticleDraftItem{ |
| 53 | Id: draftList[i].Id, | 70 | Id: draftList[i].Id, |
| 54 | Template: draftList[i].Template, | 71 | Template: draftList[i].Template, |
| 55 | - Section: draftList[i].Content, | 72 | + //Section: draftList[i].Content, |
| 56 | Title: draftList[i].Title, | 73 | Title: draftList[i].Title, |
| 57 | - Images: images, | 74 | + Images: draftList[i].GetImages(), |
| 58 | CreatedAt: draftList[i].CreatedAt, | 75 | CreatedAt: draftList[i].CreatedAt, |
| 59 | MatchUrl: draftList[i].MatchUrl, | 76 | MatchUrl: draftList[i].MatchUrl, |
| 77 | + Paragraphs: paragraphs, | ||
| 78 | + Cover: draftList[i].GetCover(), | ||
| 60 | } | 79 | } |
| 61 | } | 80 | } |
| 62 | return resp, nil | 81 | return resp, nil |
| @@ -73,17 +73,15 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch | @@ -73,17 +73,15 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch | ||
| 73 | AuthorId: val.AuthorId, | 73 | AuthorId: val.AuthorId, |
| 74 | Author: author.Name, | 74 | Author: author.Name, |
| 75 | Avatar: author.Avatar, | 75 | Avatar: author.Avatar, |
| 76 | - Images: []string{}, | 76 | + Images: val.GetImages(), |
| 77 | CreatedAt: val.CreatedAt, | 77 | CreatedAt: val.CreatedAt, |
| 78 | MeReadFlag: 0, | 78 | MeReadFlag: 0, |
| 79 | + Cover: val.GetCover(), | ||
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | if _, ok := readFlag[val.Id]; ok { | 82 | if _, ok := readFlag[val.Id]; ok { |
| 82 | item.MeReadFlag = 1 | 83 | item.MeReadFlag = 1 |
| 83 | } | 84 | } |
| 84 | - for _, img := range val.Images { | ||
| 85 | - item.Images = append(item.Images, img.Url) | ||
| 86 | - } | ||
| 87 | resp.List[i] = item | 85 | resp.List[i] = item |
| 88 | } | 86 | } |
| 89 | 87 |
| @@ -62,6 +62,7 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti | @@ -62,6 +62,7 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti | ||
| 62 | for k, v := range req.MatchUrl { | 62 | for k, v := range req.MatchUrl { |
| 63 | draftInfo.MatchUrl[k] = v | 63 | draftInfo.MatchUrl[k] = v |
| 64 | } | 64 | } |
| 65 | + draftInfo.Section = NewArticleSectionFromParagraphs(req.Paragraphs, req.CompanyId, 0) | ||
| 65 | _, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo) | 66 | _, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo) |
| 66 | if err != nil { | 67 | if err != nil { |
| 67 | return nil, xerr.NewErrMsgErr("更新草稿失败", err) | 68 | return nil, xerr.NewErrMsgErr("更新草稿失败", err) |
| @@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | 6 | ||
| 6 | "github.com/samber/lo" | 7 | "github.com/samber/lo" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| @@ -53,6 +54,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | @@ -53,6 +54,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | ||
| 53 | TargetUser: int(backup.TargetUser), | 54 | TargetUser: int(backup.TargetUser), |
| 54 | Tags: backup.Tags, | 55 | Tags: backup.Tags, |
| 55 | Videos: make([]types.Video, 0), | 56 | Videos: make([]types.Video, 0), |
| 57 | + Cover: backup.GetCover(), | ||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | //文章段落内容 | 60 | //文章段落内容 |
| @@ -62,6 +64,9 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | @@ -62,6 +64,9 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | ||
| 62 | Content: item.Content, | 64 | Content: item.Content, |
| 63 | SortBy: item.SortBy, | 65 | SortBy: item.SortBy, |
| 64 | TotalComment: item.TotalComment, | 66 | TotalComment: item.TotalComment, |
| 67 | + Images: item.Images, | ||
| 68 | + ParagraphTemplate: core.NewTypesParagraph(item.ParagraphTemplate), | ||
| 69 | + ParagraphType: item.ParagraphType, | ||
| 65 | }) | 70 | }) |
| 66 | }) | 71 | }) |
| 67 | //图片 | 72 | //图片 |
| @@ -75,6 +75,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst | @@ -75,6 +75,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst | ||
| 75 | Name: userMe.User.NickName, | 75 | Name: userMe.User.NickName, |
| 76 | }, | 76 | }, |
| 77 | Tags: req.Tags, | 77 | Tags: req.Tags, |
| 78 | + Section: NewArticleSectionFromParagraphs(req.Paragraphs, companyInfo.Id, 0), | ||
| 78 | } | 79 | } |
| 79 | err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { | 80 | err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { |
| 80 | _, err := l.svcCtx.ArticleDraftOperationRepository.Insert(ctx, conn, articleDraft) | 81 | _, err := l.svcCtx.ArticleDraftOperationRepository.Insert(ctx, conn, articleDraft) |
| @@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
| 4 | "context" | 4 | "context" |
| 5 | "github.com/pkg/errors" | 5 | "github.com/pkg/errors" |
| 6 | "github.com/samber/lo" | 6 | "github.com/samber/lo" |
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
| 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| @@ -11,6 +12,7 @@ import ( | @@ -11,6 +12,7 @@ import ( | ||
| 11 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | 12 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" |
| 12 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" | 13 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" |
| 13 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | 14 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" |
| 15 | + "html/template" | ||
| 14 | "strconv" | 16 | "strconv" |
| 15 | "strings" | 17 | "strings" |
| 16 | "unicode/utf8" | 18 | "unicode/utf8" |
| @@ -115,7 +117,7 @@ func (l *SystemCreateArticleLogic) SystemCreateArticle(req *types.SystemArticleC | @@ -115,7 +117,7 @@ func (l *SystemCreateArticleLogic) SystemCreateArticle(req *types.SystemArticleC | ||
| 115 | } | 117 | } |
| 116 | article.WhoRead = whoRead | 118 | article.WhoRead = whoRead |
| 117 | article.WhoReview = whoReview | 119 | article.WhoReview = whoReview |
| 118 | - sections := l.getSections(req, article) | 120 | + sections := NewArticleSectionFromParagraphs(req.Paragraphs, author.CompanyId, 0) //l.getSections(req, article) |
| 119 | //设置内容摘要 | 121 | //设置内容摘要 |
| 120 | article.SetSummary(sections) | 122 | article.SetSummary(sections) |
| 121 | //草稿ID | 123 | //草稿ID |
| @@ -186,9 +188,9 @@ func (l *SystemCreateArticleLogic) validate(req *types.SystemArticleCreateReques | @@ -186,9 +188,9 @@ func (l *SystemCreateArticleLogic) validate(req *types.SystemArticleCreateReques | ||
| 186 | return errors.New("标题最多只能输入64字") | 188 | return errors.New("标题最多只能输入64字") |
| 187 | } | 189 | } |
| 188 | //文章内容 | 190 | //文章内容 |
| 189 | - if utf8.RuneCountInString(req.Content) > 1000 { | ||
| 190 | - return errors.New("内容最多只能输入1000字") | ||
| 191 | - } | 191 | + //if utf8.RuneCountInString(req.Content) > 1000 { |
| 192 | + // return errors.New("内容最多只能输入1000字") | ||
| 193 | + //} | ||
| 192 | //图片 | 194 | //图片 |
| 193 | if len(req.Images) > 9 { | 195 | if len(req.Images) > 9 { |
| 194 | return errors.New("图片数量最多9张") | 196 | return errors.New("图片数量最多9张") |
| @@ -296,18 +298,56 @@ func (l *SystemCreateArticleLogic) validateWhoReview(whoRead []int64, whoReview | @@ -296,18 +298,56 @@ func (l *SystemCreateArticleLogic) validateWhoReview(whoRead []int64, whoReview | ||
| 296 | func (l *SystemCreateArticleLogic) getSections(req *types.SystemArticleCreateRequest, article *domain.Article) []*domain.ArticleSection { | 298 | func (l *SystemCreateArticleLogic) getSections(req *types.SystemArticleCreateRequest, article *domain.Article) []*domain.ArticleSection { |
| 297 | articleSections := make([]*domain.ArticleSection, 0) | 299 | articleSections := make([]*domain.ArticleSection, 0) |
| 298 | sortBy := 1 | 300 | sortBy := 1 |
| 299 | - sections := strings.Split(req.Content, "\n") | ||
| 300 | - lo.ForEach(sections, func(item string, index int) { | 301 | + lo.ForEach(req.Paragraphs, func(paragraph types.Paragraph, index int) { |
| 301 | //去除空 | 302 | //去除空 |
| 302 | - item = strings.TrimSpace(item) | ||
| 303 | - if item != "" { | 303 | + strList := []string{paragraph.Text} |
| 304 | + // 无模板样式的 | ||
| 305 | + if paragraph.Type == 0 { | ||
| 306 | + strList = strings.Split(paragraph.Text, "\n") | ||
| 307 | + } | ||
| 308 | + for i2 := range strList { | ||
| 309 | + newStr := template.HTMLEscapeString(strList[i2]) | ||
| 304 | section := domain.ArticleSection{ | 310 | section := domain.ArticleSection{ |
| 305 | CompanyId: article.CompanyId, | 311 | CompanyId: article.CompanyId, |
| 306 | Version: article.Version, | 312 | Version: article.Version, |
| 307 | ArticleId: article.Id, | 313 | ArticleId: article.Id, |
| 308 | - Content: item, | 314 | + Content: newStr, |
| 315 | + SortBy: sortBy, | ||
| 316 | + | ||
| 317 | + Images: paragraph.Images, | ||
| 318 | + ParagraphType: paragraph.Type, | ||
| 319 | + ParagraphTemplate: core.NewDomainParagraph(paragraph), | ||
| 320 | + } | ||
| 321 | + articleSections = append(articleSections, §ion) | ||
| 322 | + sortBy++ | ||
| 323 | + } | ||
| 324 | + }) | ||
| 325 | + return articleSections | ||
| 326 | +} | ||
| 327 | + | ||
| 328 | +func NewArticleSectionFromParagraphs(paragraphs []types.Paragraph, companyId int64, articleId int64) []*domain.ArticleSection { | ||
| 329 | + articleSections := make([]*domain.ArticleSection, 0) | ||
| 330 | + sortBy := 1 | ||
| 331 | + lo.ForEach(paragraphs, func(paragraph types.Paragraph, index int) { | ||
| 332 | + //去除空 | ||
| 333 | + strList := []string{paragraph.Text} | ||
| 334 | + // 无模板样式的 | ||
| 335 | + if paragraph.Type == 0 { | ||
| 336 | + strList = strings.Split(paragraph.Text, "\n") | ||
| 337 | + } | ||
| 338 | + for i2 := range strList { | ||
| 339 | + newStr := template.HTMLEscapeString(strList[i2]) | ||
| 340 | + section := domain.ArticleSection{ | ||
| 341 | + CompanyId: companyId, | ||
| 342 | + ArticleId: articleId, | ||
| 343 | + Content: newStr, | ||
| 309 | SortBy: sortBy, | 344 | SortBy: sortBy, |
| 345 | + | ||
| 346 | + Images: paragraph.Images, | ||
| 347 | + ParagraphType: paragraph.Type, | ||
| 348 | + ParagraphTemplate: core.NewDomainParagraph(paragraph), | ||
| 310 | } | 349 | } |
| 350 | + section.Images = paragraph.Images | ||
| 311 | articleSections = append(articleSections, §ion) | 351 | articleSections = append(articleSections, §ion) |
| 312 | sortBy++ | 352 | sortBy++ |
| 313 | } | 353 | } |
| @@ -3,6 +3,7 @@ package article | @@ -3,6 +3,7 @@ package article | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | "github.com/samber/lo" | 5 | "github.com/samber/lo" |
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" |
| @@ -57,6 +58,15 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | @@ -57,6 +58,15 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | ||
| 57 | Height: video.Height, | 58 | Height: video.Height, |
| 58 | }) | 59 | }) |
| 59 | }) | 60 | }) |
| 61 | + | ||
| 62 | + var paragraphs = make([]types.Paragraph, 0) | ||
| 63 | + lo.ForEach(articleDraft.Section, func(p *domain.ArticleSection, index int) { | ||
| 64 | + paragraphs = append(paragraphs, core.NewTypesParagraph(p.ParagraphTemplate)) | ||
| 65 | + }) | ||
| 66 | + | ||
| 67 | + if len(paragraphs) == 0 && len(articleDraft.Content) > 0 { | ||
| 68 | + paragraphs = append(paragraphs, core.NewNoneTypesParagraph(articleDraft.Content)) | ||
| 69 | + } | ||
| 60 | resp = &types.SystemArticleDraftGetResponse{ | 70 | resp = &types.SystemArticleDraftGetResponse{ |
| 61 | Id: articleDraft.Id, | 71 | Id: articleDraft.Id, |
| 62 | Title: articleDraft.Title, | 72 | Title: articleDraft.Title, |
| @@ -71,6 +81,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | @@ -71,6 +81,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | ||
| 71 | WhoReviewInfo: make([]types.UserShowName, 0), | 81 | WhoReviewInfo: make([]types.UserShowName, 0), |
| 72 | MatchUrl: articleDraft.MatchUrl, | 82 | MatchUrl: articleDraft.MatchUrl, |
| 73 | Tags: articleDraft.Tags, | 83 | Tags: articleDraft.Tags, |
| 84 | + Cover: articleDraft.GetCover(), | ||
| 74 | } | 85 | } |
| 75 | userIds := lo.Union(resp.WhoRead, resp.WhoReview) | 86 | userIds := lo.Union(resp.WhoRead, resp.WhoReview) |
| 76 | if len(userIds) > 0 { | 87 | if len(userIds) > 0 { |
| @@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | 6 | ||
| 6 | "github.com/samber/lo" | 7 | "github.com/samber/lo" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| @@ -67,6 +68,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | @@ -67,6 +68,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | ||
| 67 | Tags: make([]types.ArticleTagItem, 0), | 68 | Tags: make([]types.ArticleTagItem, 0), |
| 68 | TargetUser: int(article.TargetUser), | 69 | TargetUser: int(article.TargetUser), |
| 69 | Videos: make([]types.Video, 0), | 70 | Videos: make([]types.Video, 0), |
| 71 | + Cover: article.GetCover(), | ||
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | for _, val := range article.Videos { | 74 | for _, val := range article.Videos { |
| @@ -102,8 +104,12 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | @@ -102,8 +104,12 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | ||
| 102 | Content: item.Content, | 104 | Content: item.Content, |
| 103 | SortBy: item.SortBy, | 105 | SortBy: item.SortBy, |
| 104 | TotalComment: item.TotalComment, | 106 | TotalComment: item.TotalComment, |
| 107 | + Images: item.Images, | ||
| 108 | + ParagraphTemplate: core.NewTypesParagraph(item.ParagraphTemplate), | ||
| 109 | + ParagraphType: item.ParagraphType, | ||
| 105 | }) | 110 | }) |
| 106 | }) | 111 | }) |
| 112 | + resp.Cover = article.GetCoverWithSections(articleSections) | ||
| 107 | userIds := lo.Union(resp.WhoRead, resp.WhoReview) | 113 | userIds := lo.Union(resp.WhoRead, resp.WhoReview) |
| 108 | if len(userIds) > 0 { | 114 | if len(userIds) > 0 { |
| 109 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithKV("ids", userIds)) | 115 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithKV("ids", userIds)) |
| @@ -67,11 +67,12 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst | @@ -67,11 +67,12 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst | ||
| 67 | resp.List = append(resp.List, types.SystemArticleDraftSearch{ | 67 | resp.List = append(resp.List, types.SystemArticleDraftSearch{ |
| 68 | Id: item.Id, | 68 | Id: item.Id, |
| 69 | Title: item.Title, | 69 | Title: item.Title, |
| 70 | - Images: images, | 70 | + Images: item.GetImages(), |
| 71 | Operator: item.Operator.Name, | 71 | Operator: item.Operator.Name, |
| 72 | AuthorId: item.AuthorId, | 72 | AuthorId: item.AuthorId, |
| 73 | Author: author, | 73 | Author: author, |
| 74 | UpdatedAt: item.UpdatedAt, | 74 | UpdatedAt: item.UpdatedAt, |
| 75 | + Cover: item.GetCover(), | ||
| 75 | }) | 76 | }) |
| 76 | }) | 77 | }) |
| 77 | return | 78 | return |
| @@ -54,11 +54,6 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -54,11 +54,6 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 54 | //获取标签 | 54 | //获取标签 |
| 55 | _, tags, _ := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, domain.NewQueryOptions()) | 55 | _, tags, _ := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, domain.NewQueryOptions()) |
| 56 | lo.ForEach(articles, func(item *domain.Article, index int) { | 56 | lo.ForEach(articles, func(item *domain.Article, index int) { |
| 57 | - //图片 | ||
| 58 | - images := make([]string, 0) | ||
| 59 | - lo.ForEach(item.Images, func(img domain.Image, n int) { | ||
| 60 | - images = append(images, img.Url) | ||
| 61 | - }) | ||
| 62 | //发布人 | 57 | //发布人 |
| 63 | author := item.Author.Name | 58 | author := item.Author.Name |
| 64 | for _, user := range users { | 59 | for _, user := range users { |
| @@ -80,7 +75,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -80,7 +75,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 80 | Title: item.Title, | 75 | Title: item.Title, |
| 81 | AuthorId: item.AuthorId, | 76 | AuthorId: item.AuthorId, |
| 82 | Author: author, | 77 | Author: author, |
| 83 | - Images: images, | 78 | + Images: item.GetImages(), |
| 84 | CreatedAt: item.CreatedAt, | 79 | CreatedAt: item.CreatedAt, |
| 85 | UpdatedAt: item.UpdatedAt, | 80 | UpdatedAt: item.UpdatedAt, |
| 86 | CountLove: item.CountLove, | 81 | CountLove: item.CountLove, |
| @@ -93,6 +88,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -93,6 +88,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 93 | Id: item.Operator.Id, | 88 | Id: item.Operator.Id, |
| 94 | Name: item.Operator.Name, | 89 | Name: item.Operator.Name, |
| 95 | }, | 90 | }, |
| 91 | + Cover: item.GetCover(), | ||
| 96 | }) | 92 | }) |
| 97 | }) | 93 | }) |
| 98 | return | 94 | return |
| @@ -68,6 +68,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst | @@ -68,6 +68,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst | ||
| 68 | Id: userToken.UserId, | 68 | Id: userToken.UserId, |
| 69 | Name: userMe.User.NickName, | 69 | Name: userMe.User.NickName, |
| 70 | } | 70 | } |
| 71 | + articleDraft.Section = NewArticleSectionFromParagraphs(req.Paragraphs, articleDraft.CompanyId, 0) | ||
| 71 | err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { | 72 | err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { |
| 72 | _, err := l.svcCtx.ArticleDraftOperationRepository.Update(ctx, conn, articleDraft) | 73 | _, err := l.svcCtx.ArticleDraftOperationRepository.Update(ctx, conn, articleDraft) |
| 73 | if err != nil { | 74 | if err != nil { |
| @@ -2,6 +2,7 @@ package article | @@ -2,6 +2,7 @@ package article | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | "strconv" | 6 | "strconv" |
| 6 | "unicode/utf8" | 7 | "unicode/utf8" |
| 7 | 8 | ||
| @@ -139,6 +140,9 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -139,6 +140,9 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
| 139 | section.ArticleId = item.ArticleId | 140 | section.ArticleId = item.ArticleId |
| 140 | section.Version = item.Version | 141 | section.Version = item.Version |
| 141 | section.SortBy = item.SortBy | 142 | section.SortBy = item.SortBy |
| 143 | + section.Images = item.Images | ||
| 144 | + section.ParagraphType = item.ParagraphType | ||
| 145 | + section.ParagraphTemplate = item.ParagraphTemplate | ||
| 142 | section.CompanyId = item.CompanyId | 146 | section.CompanyId = item.CompanyId |
| 143 | _, err = l.svcCtx.ArticleSectionRepository.Update(ctx, c, section) | 147 | _, err = l.svcCtx.ArticleSectionRepository.Update(ctx, c, section) |
| 144 | if err != nil { | 148 | if err != nil { |
| @@ -196,10 +200,13 @@ func (l *SystemUpdateArticleLogic) validateTextLimit(req *types.SystemArticleUpd | @@ -196,10 +200,13 @@ func (l *SystemUpdateArticleLogic) validateTextLimit(req *types.SystemArticleUpd | ||
| 196 | wordNum := 0 | 200 | wordNum := 0 |
| 197 | for i := range req.Section { | 201 | for i := range req.Section { |
| 198 | num := utf8.RuneCountInString(req.Section[i].Content) | 202 | num := utf8.RuneCountInString(req.Section[i].Content) |
| 203 | + if num > 1000 { | ||
| 204 | + return xerr.NewErrMsg("内容最多只能输入1000字") | ||
| 205 | + } | ||
| 199 | wordNum += num | 206 | wordNum += num |
| 200 | } | 207 | } |
| 201 | if wordNum > 1000 { | 208 | if wordNum > 1000 { |
| 202 | - return xerr.NewErrMsg("内容最多只能输入1000字") | 209 | + //return xerr.NewErrMsg("内容最多只能输入1000字") |
| 203 | } | 210 | } |
| 204 | return nil | 211 | return nil |
| 205 | } | 212 | } |
| @@ -323,7 +330,7 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | @@ -323,7 +330,7 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | ||
| 323 | lo.ForEach(req.Section, func(item types.ArticleSection, index int) { | 330 | lo.ForEach(req.Section, func(item types.ArticleSection, index int) { |
| 324 | strList := strings.Split(item.Content, "\n") | 331 | strList := strings.Split(item.Content, "\n") |
| 325 | for key, value := range strList { | 332 | for key, value := range strList { |
| 326 | - if value == "" { | 333 | + if value == "" && item.ParagraphType == domain.ParagraphTypeNone { |
| 327 | continue | 334 | continue |
| 328 | } | 335 | } |
| 329 | section := domain.ArticleSection{ | 336 | section := domain.ArticleSection{ |
| @@ -332,6 +339,9 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | @@ -332,6 +339,9 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | ||
| 332 | ArticleId: article.Id, | 339 | ArticleId: article.Id, |
| 333 | Content: value, | 340 | Content: value, |
| 334 | SortBy: sortBy, | 341 | SortBy: sortBy, |
| 342 | + Images: item.Images, | ||
| 343 | + ParagraphType: item.ParagraphType, | ||
| 344 | + ParagraphTemplate: core.NewDomainParagraph(item.ParagraphTemplate), | ||
| 335 | } | 345 | } |
| 336 | if key == 0 { | 346 | if key == 0 { |
| 337 | section.Id = item.Id | 347 | section.Id = item.Id |
| @@ -2,6 +2,7 @@ package comment | @@ -2,6 +2,7 @@ package comment | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 5 | 6 | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" |
| 7 | 8 | ||
| @@ -211,6 +212,11 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | @@ -211,6 +212,11 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | ||
| 211 | if err != nil { | 212 | if err != nil { |
| 212 | return err | 213 | return err |
| 213 | } | 214 | } |
| 215 | + | ||
| 216 | + // 内容安全检查 | ||
| 217 | + if err = core.ContentSecurityCheck(l.ctx, l.svcCtx, conn, fromUser, core.NewContentFromComment(&newComment)); err != nil { | ||
| 218 | + return err | ||
| 219 | + } | ||
| 214 | return nil | 220 | return nil |
| 215 | }, true) | 221 | }, true) |
| 216 | 222 |
| 1 | +package core | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "bytes" | ||
| 5 | + "context" | ||
| 6 | + "fmt" | ||
| 7 | + "github.com/silenceper/wechat/v2/miniprogram/security" | ||
| 8 | + "github.com/zeromicro/go-zero/core/executors" | ||
| 9 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 12 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 13 | + "time" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +func ContentSecurityCheck(ctx context.Context, svcCtx *svc.ServiceContext, conn transaction.Conn, toUser *domain.User, content ContentBody) error { | ||
| 17 | + if !svcCtx.Config.ContentSecurityCheck { | ||
| 18 | + return nil | ||
| 19 | + } | ||
| 20 | + var ( | ||
| 21 | + scene security.MsgScene | ||
| 22 | + ) | ||
| 23 | + if content.Type == 1 { | ||
| 24 | + scene = security.MsgSceneSocialLog | ||
| 25 | + } else { | ||
| 26 | + scene = security.MsgSceneComment | ||
| 27 | + } | ||
| 28 | + var ( | ||
| 29 | + resp domain.MsgCheckDetail | ||
| 30 | + userWechat *domain.UserWechat | ||
| 31 | + ) | ||
| 32 | + if userWechat, _ = svcCtx.UserWechatRepository.FindOneByPhone(ctx, conn, toUser.Phone); userWechat == nil { | ||
| 33 | + logx.Debug(fmt.Sprintf("用户%s(%s)未绑定微信,无法进行内容检查", toUser.Name, toUser.Phone)) | ||
| 34 | + return nil | ||
| 35 | + } | ||
| 36 | + respTmp, err := svcCtx.MiniProgram.GetSecurity().MsgCheck(&security.MsgCheckRequest{ | ||
| 37 | + OpenID: userWechat.OpenId, | ||
| 38 | + Scene: scene, | ||
| 39 | + Content: content.Content, | ||
| 40 | + }) | ||
| 41 | + if err != nil { | ||
| 42 | + logx.Error(err) | ||
| 43 | + return nil | ||
| 44 | + } | ||
| 45 | + resp = domain.MsgCheckDetail(respTmp) | ||
| 46 | + var ( | ||
| 47 | + keyWords = make([]string, 0) | ||
| 48 | + prob int | ||
| 49 | + ) | ||
| 50 | + for i := range resp.Detail { | ||
| 51 | + item := resp.Detail[i] | ||
| 52 | + if prob == 0 { | ||
| 53 | + prob = int(item.Prob) | ||
| 54 | + } | ||
| 55 | + if item.Keyword == "" { | ||
| 56 | + continue | ||
| 57 | + } | ||
| 58 | + keyWords = append(keyWords, item.Keyword) | ||
| 59 | + } | ||
| 60 | + dm := &domain.ArticleSecurity{ | ||
| 61 | + CompanyId: toUser.CompanyId, | ||
| 62 | + ContentKeyWords: keyWords, | ||
| 63 | + ContentType: content.Type, | ||
| 64 | + ContentId: content.Id, | ||
| 65 | + AuthorId: content.AuthorId, | ||
| 66 | + AuthorName: toUser.Name, | ||
| 67 | + Reviewer: 0, | ||
| 68 | + ReviewStatus: domain.ReviewStatusWait, | ||
| 69 | + Label: resp.Result.Label.String(), | ||
| 70 | + Prob: prob, | ||
| 71 | + Suggest: string(resp.Result.Suggest), | ||
| 72 | + Detail: resp, | ||
| 73 | + AutoReviewAt: time.Now().Unix(), | ||
| 74 | + AutoReviewErrorCode: fmt.Sprintf("%d", resp.ErrCode), | ||
| 75 | + } | ||
| 76 | + if resp.Result.Suggest == security.CheckSuggestPass { | ||
| 77 | + dm.ReviewStatus = domain.ReviewStatusPass | ||
| 78 | + } | ||
| 79 | + if len(dm.ContentKeyWords) == 0 { | ||
| 80 | + dm.ContentKeyWords = append(dm.ContentKeyWords, content.Summary) | ||
| 81 | + } | ||
| 82 | + // 延迟任务(认定为风险的、人工审核),帖子或评论先隐藏,状态改为非法 | ||
| 83 | + if resp.Result.Suggest == security.CheckSuggestRisky { // || resp.Result.Suggest == security.CheckSuggestReview | ||
| 84 | + executors.NewDelayExecutor(func() { | ||
| 85 | + HandlerSecurityContent(ctx, svcCtx, svcCtx.DefaultDBConn(), content, dm.ReviewStatus) | ||
| 86 | + }, time.Second*5).Trigger() | ||
| 87 | + } | ||
| 88 | + if dm, err = svcCtx.ArticleSecurityRepository.Insert(ctx, conn, dm); err != nil { | ||
| 89 | + logx.Error(err) | ||
| 90 | + return nil | ||
| 91 | + } | ||
| 92 | + return nil | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, conn transaction.Conn, c ContentBody, status int) error { | ||
| 96 | + if !svcCtx.Config.ContentSecurityCheck { | ||
| 97 | + return nil | ||
| 98 | + } | ||
| 99 | + var ( | ||
| 100 | + article *domain.Article | ||
| 101 | + comment *domain.ArticleComment | ||
| 102 | + err error | ||
| 103 | + show = int(domain.ArticleShowIllegal) | ||
| 104 | + ) | ||
| 105 | + if status == domain.ReviewStatusPass { | ||
| 106 | + show = int(domain.ArticleShowEnable) | ||
| 107 | + } | ||
| 108 | + mnl := NewMessageNoticeLogic(ctx, svcCtx) | ||
| 109 | + if c.Type == domain.TypeArticle { | ||
| 110 | + if article, err = svcCtx.ArticleRepository.FindOne(ctx, conn, c.Id); err != nil { | ||
| 111 | + return fmt.Errorf("文章不存在") | ||
| 112 | + } | ||
| 113 | + article.Show = domain.ArticleShow(show) | ||
| 114 | + if _, err = svcCtx.ArticleRepository.UpdateWithVersion(ctx, conn, article); err != nil { | ||
| 115 | + return err | ||
| 116 | + } | ||
| 117 | + if show == int(domain.ArticleShowIllegal) { | ||
| 118 | + mnl.ArticleIllegal(conn, article.CompanyId, article.AuthorId, time.Unix(article.CreatedAt, 0).Format("2006-01-02 15:04"), article.Title) | ||
| 119 | + } | ||
| 120 | + } else if c.Type == domain.TypeComment { | ||
| 121 | + if comment, err = svcCtx.ArticleCommentRepository.FindOne(ctx, conn, c.Id); err != nil { | ||
| 122 | + return fmt.Errorf("评论不存在") | ||
| 123 | + } | ||
| 124 | + comment.Show = domain.CommentShow(show) | ||
| 125 | + if _, err = svcCtx.ArticleCommentRepository.UpdateWithVersion(ctx, conn, comment); err != nil { | ||
| 126 | + return err | ||
| 127 | + } | ||
| 128 | + if show == int(domain.CommentShowIllegal) { | ||
| 129 | + mnl.ArticleIllegal(conn, comment.CompanyId, comment.FromUserId, time.Unix(comment.CreatedAt, 0).Format("2006-01-02 15:04"), comment.Content) | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + return nil | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +type ContentBody struct { | ||
| 136 | + Id int64 | ||
| 137 | + Type int | ||
| 138 | + Content string | ||
| 139 | + AuthorId int64 | ||
| 140 | + Summary string | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +func NewContentFromComment(c *domain.ArticleComment) ContentBody { | ||
| 144 | + return ContentBody{ | ||
| 145 | + Id: c.Id, | ||
| 146 | + Type: domain.TypeComment, | ||
| 147 | + Content: c.Content, | ||
| 148 | + AuthorId: c.FromUserId, | ||
| 149 | + Summary: c.Content, | ||
| 150 | + } | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +func NewContentFromArticle(c *domain.Article, sections []*domain.ArticleSection) ContentBody { | ||
| 154 | + content := bytes.NewBuffer(nil) | ||
| 155 | + for _, sec := range sections { | ||
| 156 | + content.WriteString(sec.Content) | ||
| 157 | + } | ||
| 158 | + return ContentBody{ | ||
| 159 | + Id: c.Id, | ||
| 160 | + Type: domain.TypeArticle, | ||
| 161 | + Content: content.String(), | ||
| 162 | + AuthorId: c.AuthorId, | ||
| 163 | + Summary: c.Summary, | ||
| 164 | + } | ||
| 165 | +} |
| 1 | +package core | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "fmt" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +type MessageNotice struct { | ||
| 12 | + ctx context.Context | ||
| 13 | + svcCtx *svc.ServiceContext | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +func NewMessageNoticeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MessageNotice { | ||
| 17 | + return &MessageNotice{ | ||
| 18 | + ctx: ctx, | ||
| 19 | + svcCtx: svcCtx, | ||
| 20 | + } | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (l *MessageNotice) ArticleIllegal(conn transaction.Conn, companyId, at int64, createdTime, title string) (err error) { | ||
| 24 | + return l.createMessage(conn, companyId, at, domain.MsgTypeIllegal, "文本内容违规", fmt.Sprintf("你于%v发布的帖子[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +// CommentIllegal 评论违规 | ||
| 28 | +func (l *MessageNotice) CommentIllegal(conn transaction.Conn, at int64, companyId int64, createdTime, title string) (err error) { | ||
| 29 | + return l.createMessage(conn, companyId, at, domain.MsgTypeIllegal, "文本内容违规", fmt.Sprintf("你于%v发布的评论[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +func (l *MessageNotice) createMessage(conn transaction.Conn, companyId, at int64, msgType domain.MsgSystemType, title string, content string) (err error) { | ||
| 33 | + var msg = &domain.MessageSystem{ | ||
| 34 | + Type: msgType, | ||
| 35 | + CompanyId: companyId, | ||
| 36 | + RecipientId: at, | ||
| 37 | + Title: title, | ||
| 38 | + Content: content, | ||
| 39 | + } | ||
| 40 | + msg, err = l.svcCtx.MessageSystemRepository.Insert(l.ctx, conn, msg) | ||
| 41 | + return err | ||
| 42 | +} |
| 1 | +package core | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "github.com/google/uuid" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +func NewDomainParagraph(item types.Paragraph) domain.Paragraph { | ||
| 10 | + id := item.ID | ||
| 11 | + if item.ID == "" { | ||
| 12 | + idGen, _ := uuid.NewUUID() | ||
| 13 | + id = idGen.String() | ||
| 14 | + } | ||
| 15 | + return domain.Paragraph{ | ||
| 16 | + ID: id, | ||
| 17 | + Title: item.Title, | ||
| 18 | + Prompt: item.Prompt, | ||
| 19 | + Required: item.Required, | ||
| 20 | + Type: item.Type, | ||
| 21 | + } | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +func NewTypesParagraph(item domain.Paragraph) types.Paragraph { | ||
| 25 | + return types.Paragraph{ | ||
| 26 | + ID: item.ID, | ||
| 27 | + Title: item.Title, | ||
| 28 | + Prompt: item.Prompt, | ||
| 29 | + Required: item.Required, | ||
| 30 | + Type: item.Type, | ||
| 31 | + } | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +func NewNoneTypesParagraph(item string) types.Paragraph { | ||
| 35 | + return types.Paragraph{ | ||
| 36 | + ID: "", | ||
| 37 | + Title: "", | ||
| 38 | + Prompt: "", | ||
| 39 | + Required: false, | ||
| 40 | + Type: 0, | ||
| 41 | + Text: item, | ||
| 42 | + } | ||
| 43 | +} |
| @@ -62,6 +62,11 @@ func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at in | @@ -62,6 +62,11 @@ func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at in | ||
| 62 | return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "帖子已删除", fmt.Sprintf("你于%v发布的帖子[%v]已被删除,如有疑问,请联系运营管理员了解详情。", createdTime, title)) | 62 | return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "帖子已删除", fmt.Sprintf("你于%v发布的帖子[%v]已被删除,如有疑问,请联系运营管理员了解详情。", createdTime, title)) |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | +// ArticleIllegal 帖子违规 | ||
| 66 | +func (l *MiniSystemLogic) ArticleIllegal(conn transaction.Conn, companyId, at int64, createdTime, title string) (err error) { | ||
| 67 | + return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "文本内容违规", fmt.Sprintf("你于%v发布的帖子[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
| 68 | +} | ||
| 69 | + | ||
| 65 | //// ArticleAuth 文章权限变更 | 70 | //// ArticleAuth 文章权限变更 |
| 66 | //func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) { | 71 | //func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) { |
| 67 | // return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item)) | 72 | // return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item)) |
| @@ -92,6 +97,11 @@ func (l *MiniSystemLogic) AbnormalCommentHidden(conn transaction.Conn, companyId | @@ -92,6 +97,11 @@ func (l *MiniSystemLogic) AbnormalCommentHidden(conn transaction.Conn, companyId | ||
| 92 | return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "评论被隐藏", fmt.Sprintf("您的评论[%s]已被隐藏,如有疑问,请联系运营管理员了解详情。", item)) | 97 | return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "评论被隐藏", fmt.Sprintf("您的评论[%s]已被隐藏,如有疑问,请联系运营管理员了解详情。", item)) |
| 93 | } | 98 | } |
| 94 | 99 | ||
| 100 | +// CommentIllegal 评论违规 | ||
| 101 | +func (l *MiniSystemLogic) CommentIllegal(conn transaction.Conn, at int64, companyId int64, createdTime, title string) (err error) { | ||
| 102 | + return l.createMessage(conn, companyId, at, domain.MsgTypeIllegal, "文本内容违规", fmt.Sprintf("你于%v发布的评论[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
| 103 | +} | ||
| 104 | + | ||
| 95 | func (l *MiniSystemLogic) createMessage(conn transaction.Conn, companyId, at int64, msgType domain.MsgSystemType, title string, content string) (err error) { | 105 | func (l *MiniSystemLogic) createMessage(conn transaction.Conn, companyId, at int64, msgType domain.MsgSystemType, title string, content string) (err error) { |
| 96 | var msg = &domain.MessageSystem{ | 106 | var msg = &domain.MessageSystem{ |
| 97 | Type: msgType, | 107 | Type: msgType, |
| 1 | +package secuirty | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
| 9 | + "time" | ||
| 10 | + | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 12 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 13 | + | ||
| 14 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 15 | +) | ||
| 16 | + | ||
| 17 | +type ArticleSecurityAuditLogic struct { | ||
| 18 | + logx.Logger | ||
| 19 | + ctx context.Context | ||
| 20 | + svcCtx *svc.ServiceContext | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func NewArticleSecurityAuditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ArticleSecurityAuditLogic { | ||
| 24 | + return &ArticleSecurityAuditLogic{ | ||
| 25 | + Logger: logx.WithContext(ctx), | ||
| 26 | + ctx: ctx, | ||
| 27 | + svcCtx: svcCtx, | ||
| 28 | + } | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +func (l *ArticleSecurityAuditLogic) ArticleSecurityAudit(req *types.ArticleSecurityAuditRequest) (resp *types.ArticleSecurityAuditResponse, err error) { | ||
| 32 | + var ( | ||
| 33 | + conn = l.svcCtx.DefaultDBConn() | ||
| 34 | + dm *domain.ArticleSecurity | ||
| 35 | + ) | ||
| 36 | + if dm, err = l.svcCtx.ArticleSecurityRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 37 | + return nil, xerr.NewErrMsgErr("不存在", err) | ||
| 38 | + } | ||
| 39 | + // 不可编辑判断 | ||
| 40 | + //if dm.ReviewStatus != domain.ReviewStatusWait { | ||
| 41 | + // return nil, xerr.NewErrMsgErr("内容已审核", err) | ||
| 42 | + //} | ||
| 43 | + // 赋值 | ||
| 44 | + if req.Status == 1 { | ||
| 45 | + dm.ReviewStatus = domain.ReviewStatusPass | ||
| 46 | + } else { | ||
| 47 | + dm.ReviewStatus = domain.ReviewStatusFail | ||
| 48 | + } | ||
| 49 | + dm.ReviewAt = time.Now().Unix() | ||
| 50 | + // 更新 | ||
| 51 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 52 | + dm, err = l.svcCtx.ArticleSecurityRepository.UpdateWithVersion(l.ctx, conn, dm) | ||
| 53 | + if err != nil { | ||
| 54 | + return err | ||
| 55 | + } | ||
| 56 | + if err = core.HandlerSecurityContent(l.ctx, l.svcCtx, conn, core.ContentBody{Id: dm.ContentId, Type: dm.ContentType}, dm.ReviewStatus); err != nil { | ||
| 57 | + return err | ||
| 58 | + } | ||
| 59 | + // 更新文章/评论可见 | ||
| 60 | + return err | ||
| 61 | + }, true); err != nil { | ||
| 62 | + return nil, xerr.NewErrMsg("更新失败") | ||
| 63 | + } | ||
| 64 | + resp = &types.ArticleSecurityAuditResponse{} | ||
| 65 | + return | ||
| 66 | +} |
| 1 | +package secuirty | ||
| 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/xerr" | ||
| 7 | + | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 10 | + | ||
| 11 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +type ArticleSecurityGetLogic struct { | ||
| 15 | + logx.Logger | ||
| 16 | + ctx context.Context | ||
| 17 | + svcCtx *svc.ServiceContext | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func NewArticleSecurityGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ArticleSecurityGetLogic { | ||
| 21 | + return &ArticleSecurityGetLogic{ | ||
| 22 | + Logger: logx.WithContext(ctx), | ||
| 23 | + ctx: ctx, | ||
| 24 | + svcCtx: svcCtx, | ||
| 25 | + } | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +func (l *ArticleSecurityGetLogic) ArticleSecurityGet(req *types.ArticleSecurityGetRequest) (resp *types.ArticleSecurityGetResponse, err error) { | ||
| 29 | + var ( | ||
| 30 | + conn = l.svcCtx.DefaultDBConn() | ||
| 31 | + dm *domain.ArticleSecurity | ||
| 32 | + reviewer *domain.User | ||
| 33 | + article *domain.Article | ||
| 34 | + comment *domain.ArticleComment | ||
| 35 | + ) | ||
| 36 | + // 货号唯一 | ||
| 37 | + if dm, err = l.svcCtx.ArticleSecurityRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 38 | + return nil, xerr.NewErrMsgErr("不存在", err) | ||
| 39 | + } | ||
| 40 | + if dm.Reviewer > 0 { | ||
| 41 | + if reviewer, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, dm.Reviewer); err != nil { | ||
| 42 | + return nil, err | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + resp = &types.ArticleSecurityGetResponse{ | ||
| 46 | + ArticleSecurity: NewTypesArticleSecurity(dm, reviewer), | ||
| 47 | + } | ||
| 48 | + if dm.ContentType == domain.TypeArticle { | ||
| 49 | + if article, _ = l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, dm.ContentId); article != nil { | ||
| 50 | + resp.ArticleSecurity.Content.Text = article.Summary | ||
| 51 | + } | ||
| 52 | + } else if dm.ContentType == domain.TypeComment { | ||
| 53 | + if comment, _ = l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, dm.ContentId); comment != nil { | ||
| 54 | + resp.ArticleSecurity.Content.Text = comment.Content | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + return | ||
| 58 | +} |
| 1 | +package secuirty | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
| 9 | + "strings" | ||
| 10 | + | ||
| 11 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +type ArticleSecuritySearchLogic struct { | ||
| 15 | + logx.Logger | ||
| 16 | + ctx context.Context | ||
| 17 | + svcCtx *svc.ServiceContext | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func NewArticleSecuritySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ArticleSecuritySearchLogic { | ||
| 21 | + return &ArticleSecuritySearchLogic{ | ||
| 22 | + Logger: logx.WithContext(ctx), | ||
| 23 | + ctx: ctx, | ||
| 24 | + svcCtx: svcCtx, | ||
| 25 | + } | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +func (l *ArticleSecuritySearchLogic) ArticleSecuritySearch(req *types.ArticleSecuritySearchRequest) (resp *types.ArticleSecuritySearchResponse, err error) { | ||
| 29 | + var ( | ||
| 30 | + conn = l.svcCtx.DefaultDBConn() | ||
| 31 | + dms []*domain.ArticleSecurity | ||
| 32 | + total int64 | ||
| 33 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 34 | + ) | ||
| 35 | + | ||
| 36 | + queryOptions := domain.IndexCompanyId(userToken.CompanyId)().WithOffsetLimit(req.Page, req.Size). | ||
| 37 | + WithKV("reviewStatus", req.ReviewStatus). | ||
| 38 | + WithKV("suggest", req.Suggest). | ||
| 39 | + WithKV("contentType", req.ContentType). | ||
| 40 | + WithKV("authorName", req.AuthorName). | ||
| 41 | + WithKV("beginTime", req.BeginTime). | ||
| 42 | + WithKV("endTime", req.EndTime) | ||
| 43 | + | ||
| 44 | + total, dms, err = l.svcCtx.ArticleSecurityRepository.Find(l.ctx, conn, queryOptions) | ||
| 45 | + list := make([]types.ArticleSecurityItem, 0) | ||
| 46 | + for i := range dms { | ||
| 47 | + list = append(list, NewTypesArticleSecurity(dms[i], nil)) | ||
| 48 | + } | ||
| 49 | + resp = &types.ArticleSecuritySearchResponse{ | ||
| 50 | + List: list, | ||
| 51 | + Total: total, | ||
| 52 | + } | ||
| 53 | + return | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +func NewDomainArticleSecurity(item types.ArticleSecurityItem) *domain.ArticleSecurity { | ||
| 57 | + return &domain.ArticleSecurity{} | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +func NewTypesArticleSecurity(item *domain.ArticleSecurity, reviewer *domain.User) types.ArticleSecurityItem { | ||
| 61 | + result := types.ArticleSecurityItem{ | ||
| 62 | + Id: item.Id, | ||
| 63 | + Content: types.ContentDetailItem{ | ||
| 64 | + Id: item.ContentId, | ||
| 65 | + Type: item.ContentType, | ||
| 66 | + }, | ||
| 67 | + ContentKeyWords: strings.Join(item.ContentKeyWords, ","), | ||
| 68 | + Label: item.Label, | ||
| 69 | + Prob: item.Prob, | ||
| 70 | + Suggest: describeSuggest(item.Suggest), | ||
| 71 | + Author: item.AuthorName, | ||
| 72 | + ReviewAt: item.CreatedAt, | ||
| 73 | + ReviewStatus: item.ReviewStatus, | ||
| 74 | + ReleaseAt: item.CreatedAt, | ||
| 75 | + Reviewer: "", | ||
| 76 | + } | ||
| 77 | + if reviewer != nil { | ||
| 78 | + result.Reviewer = reviewer.Name | ||
| 79 | + } | ||
| 80 | + for _, detail := range item.Detail.Detail { | ||
| 81 | + if detail.Label.String() == "0" { | ||
| 82 | + continue | ||
| 83 | + } | ||
| 84 | + result.CheckList = append(result.CheckList, types.CheckDetailItem{ | ||
| 85 | + Label: detail.Label.String(), | ||
| 86 | + Prob: detail.Prob, | ||
| 87 | + Suggest: describeSuggest(detail.Suggest), | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + return result | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +func describeContentType(t int) string { | ||
| 94 | + if t == domain.TypeArticle { | ||
| 95 | + return "文本-帖子" | ||
| 96 | + } | ||
| 97 | + if t == domain.TypeComment { | ||
| 98 | + return "文本-评论" | ||
| 99 | + } | ||
| 100 | + return "" | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +func describeSuggest(s string) string { | ||
| 104 | + if s == "risk" { | ||
| 105 | + return "风险" | ||
| 106 | + } | ||
| 107 | + if s == "pass" { | ||
| 108 | + return "通过" | ||
| 109 | + } | ||
| 110 | + if s == "review" { | ||
| 111 | + return "人工审核" | ||
| 112 | + } | ||
| 113 | + return "" | ||
| 114 | +} |
| 1 | +package template | ||
| 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 MiniArticleTemplateClassSearchLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewMiniArticleTemplateClassSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleTemplateClassSearchLogic { | ||
| 23 | + return &MiniArticleTemplateClassSearchLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *MiniArticleTemplateClassSearchLogic) MiniArticleTemplateClassSearch(req *types.ArticleTemplateClassSearchRequest) (resp *types.ArticleTemplateClassSearchResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + conn = l.svcCtx.DefaultDBConn() | ||
| 33 | + dms []*domain.ArticleTemplate | ||
| 34 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 35 | + user *domain.User | ||
| 36 | + ) | ||
| 37 | + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | ||
| 38 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
| 39 | + } | ||
| 40 | + // 企业有的类目 | ||
| 41 | + queryOptions := domain.NewQueryOptions().WithKV("name", req.Name). | ||
| 42 | + MustWithKV("companyId", userToken.CompanyId) | ||
| 43 | + _, dms, err = l.svcCtx.ArticleTemplateRepository.Find(l.ctx, conn, queryOptions) | ||
| 44 | + class := domain.Values(dms, func(item *domain.ArticleTemplate) string { | ||
| 45 | + return item.TemplateClass | ||
| 46 | + }) | ||
| 47 | + | ||
| 48 | + // 个人有的类目 | ||
| 49 | + queryOptions = domain.NewQueryOptions().WithKV("name", req.Name). | ||
| 50 | + MustWithKV("userId", user.Id) | ||
| 51 | + _, dms, err = l.svcCtx.ArticleTemplateRepository.Find(l.ctx, conn, queryOptions) | ||
| 52 | + class = append(class, domain.Values(dms, func(item *domain.ArticleTemplate) string { | ||
| 53 | + return item.TemplateClass | ||
| 54 | + })...) | ||
| 55 | + class = lo.Uniq(class) | ||
| 56 | + | ||
| 57 | + resp = &types.ArticleTemplateClassSearchResponse{ | ||
| 58 | + Total: int64(len(class)), | ||
| 59 | + } | ||
| 60 | + lo.ForEach(class, func(item string, index int) { | ||
| 61 | + resp.List = append(resp.List, types.ArticleTemplateClassItem{ | ||
| 62 | + Name: item, | ||
| 63 | + }) | ||
| 64 | + }) | ||
| 65 | + | ||
| 66 | + return | ||
| 67 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 8 | + | ||
| 9 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +type MiniArticleTemplateDeleteLogic struct { | ||
| 13 | + logx.Logger | ||
| 14 | + ctx context.Context | ||
| 15 | + svcCtx *svc.ServiceContext | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +func NewMiniArticleTemplateDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleTemplateDeleteLogic { | ||
| 19 | + return &MiniArticleTemplateDeleteLogic{ | ||
| 20 | + Logger: logx.WithContext(ctx), | ||
| 21 | + ctx: ctx, | ||
| 22 | + svcCtx: svcCtx, | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +func (l *MiniArticleTemplateDeleteLogic) MiniArticleTemplateDelete(req *types.ArticleTemplateDeleteRequest) (resp *types.ArticleTemplateDeleteResponse, err error) { | ||
| 27 | + logic := NewSystemArticleTemplateDeleteLogic(l.ctx, l.svcCtx) | ||
| 28 | + return logic.SystemArticleTemplateDelete(req) | ||
| 29 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 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 MiniArticleTemplateSaveLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewMiniArticleTemplateSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleTemplateSaveLogic { | ||
| 23 | + return &MiniArticleTemplateSaveLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *MiniArticleTemplateSaveLogic) MiniArticleTemplateSave(req *types.ArticleTemplateSaveRequest) (resp *types.ArticleTemplateSaveResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + dm *domain.ArticleTemplate | ||
| 33 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 34 | + user *domain.User | ||
| 35 | + conn = l.svcCtx.DefaultDBConn() | ||
| 36 | + ) | ||
| 37 | + | ||
| 38 | + // 唯一判断 | ||
| 39 | + // 获取当前用户信息 | ||
| 40 | + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | ||
| 41 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + dm = NewDomainArticleTemplate(req.ArticleTemplate) | ||
| 45 | + dm.CompanyId = 0 | ||
| 46 | + | ||
| 47 | + dm.Operator = domain.Operator{ | ||
| 48 | + Id: userToken.UserId, | ||
| 49 | + Name: user.Name, | ||
| 50 | + Type: domain.OperatorTypeUser, | ||
| 51 | + } | ||
| 52 | + if req.BelongTo == int(domain.BelongToCompany) { | ||
| 53 | + dm.BelongTo = domain.BelongToCompany | ||
| 54 | + dm.CompanyId = user.CompanyId | ||
| 55 | + } else { | ||
| 56 | + dm.BelongTo = domain.BelongToIndividual | ||
| 57 | + dm.UserId = userToken.UserId | ||
| 58 | + } | ||
| 59 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 60 | + dm, err = l.svcCtx.ArticleTemplateRepository.Insert(l.ctx, conn, dm) | ||
| 61 | + return err | ||
| 62 | + }, true); err != nil { | ||
| 63 | + return nil, xerr.NewErrMsg("保存失败") | ||
| 64 | + } | ||
| 65 | + resp = &types.ArticleTemplateSaveResponse{} | ||
| 66 | + return | ||
| 67 | +} |
| 1 | +package template | ||
| 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 MiniArticleTemplateSearchLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewMiniArticleTemplateSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleTemplateSearchLogic { | ||
| 23 | + return &MiniArticleTemplateSearchLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *MiniArticleTemplateSearchLogic) MiniArticleTemplateSearch(req *types.ArticleTemplateSearchRequest) (resp *types.ArticleTemplateSearchResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 33 | + conn = l.svcCtx.DefaultDBConn() | ||
| 34 | + user *domain.User | ||
| 35 | + ) | ||
| 36 | + if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId); err != nil { | ||
| 37 | + return nil, xerr.NewErrMsgErr("用户不存在", err) | ||
| 38 | + } | ||
| 39 | + req.CompanyId = user.CompanyId | ||
| 40 | + logic := NewSystemArticleTemplateSearchLogic(l.ctx, l.svcCtx) | ||
| 41 | + resp, err = logic.SystemArticleTemplateSearch(req) | ||
| 42 | + if err != nil { | ||
| 43 | + return nil, err | ||
| 44 | + } | ||
| 45 | + // 过滤可见性 | ||
| 46 | + list := make([]types.ArticleTemplateItem, 0) | ||
| 47 | + lo.ForEach(resp.List, func(item types.ArticleTemplateItem, index int) { | ||
| 48 | + if item.TargetWhoRead == int(domain.ArticleTemplateLimit) { | ||
| 49 | + if !lo.Contains(item.WhoRead, user.Id) { | ||
| 50 | + return | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + list = append(list, item) | ||
| 54 | + }) | ||
| 55 | + resp.List = list | ||
| 56 | + resp.Total = int64(len(list)) | ||
| 57 | + return | ||
| 58 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
| 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 | + | ||
| 10 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +type MiniArticleTemplateSearchMineLogic struct { | ||
| 14 | + logx.Logger | ||
| 15 | + ctx context.Context | ||
| 16 | + svcCtx *svc.ServiceContext | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func NewMiniArticleTemplateSearchMineLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleTemplateSearchMineLogic { | ||
| 20 | + return &MiniArticleTemplateSearchMineLogic{ | ||
| 21 | + Logger: logx.WithContext(ctx), | ||
| 22 | + ctx: ctx, | ||
| 23 | + svcCtx: svcCtx, | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (l *MiniArticleTemplateSearchMineLogic) MiniArticleTemplateSearchMine(req *types.ArticleTemplateSearchRequest) (resp *types.ArticleTemplateSearchResponse, err error) { | ||
| 28 | + var ( | ||
| 29 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 30 | + ) | ||
| 31 | + req.UserId = userToken.UserId | ||
| 32 | + logic := NewSystemArticleTemplateSearchLogic(l.ctx, l.svcCtx) | ||
| 33 | + return logic.SystemArticleTemplateSearch(req) | ||
| 34 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 8 | + | ||
| 9 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +type MiniArticleTemplateUpdateLogic struct { | ||
| 13 | + logx.Logger | ||
| 14 | + ctx context.Context | ||
| 15 | + svcCtx *svc.ServiceContext | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +func NewMiniArticleTemplateUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleTemplateUpdateLogic { | ||
| 19 | + return &MiniArticleTemplateUpdateLogic{ | ||
| 20 | + Logger: logx.WithContext(ctx), | ||
| 21 | + ctx: ctx, | ||
| 22 | + svcCtx: svcCtx, | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +func (l *MiniArticleTemplateUpdateLogic) MiniArticleTemplateUpdate(req *types.ArticleTemplateUpdateRequest) (resp *types.ArticleTemplateUpdateResponse, err error) { | ||
| 27 | + logic := NewSystemArticleTemplateUpdateLogic(l.ctx, l.svcCtx) | ||
| 28 | + return logic.SystemArticleTemplateUpdate(req) | ||
| 29 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 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 SystemArticleTemplateBatchDeleteLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewSystemArticleTemplateBatchDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateBatchDeleteLogic { | ||
| 22 | + return &SystemArticleTemplateBatchDeleteLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *SystemArticleTemplateBatchDeleteLogic) SystemArticleTemplateBatchDelete(req *types.ArticleTemplateBatchDeleteRequest) (resp *types.ArticleTemplateBatchResponse, err error) { | ||
| 30 | + var ( | ||
| 31 | + dm *domain.ArticleTemplate | ||
| 32 | + ) | ||
| 33 | + | ||
| 34 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 35 | + for _, id := range req.Ids { | ||
| 36 | + if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, int64(id)); err != nil { | ||
| 37 | + return xerr.NewErrMsgErr("不存在", err) | ||
| 38 | + } | ||
| 39 | + if dm.TemplateClass == domain.DefaultTemplateClass { | ||
| 40 | + return xerr.NewErrMsgErr("默认模板不可删除", nil) | ||
| 41 | + } | ||
| 42 | + if dm, err = l.svcCtx.ArticleTemplateRepository.Delete(l.ctx, conn, dm); err != nil { | ||
| 43 | + return err | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + return nil | ||
| 47 | + }, true); err != nil { | ||
| 48 | + return nil, xerr.NewErrMsgErr("移除失败", err) | ||
| 49 | + } | ||
| 50 | + resp = &types.ArticleTemplateBatchResponse{} | ||
| 51 | + return | ||
| 52 | +} |
| 1 | +package template | ||
| 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 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
| 10 | + | ||
| 11 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +type SystemArticleTemplateClassSearchLogic struct { | ||
| 15 | + logx.Logger | ||
| 16 | + ctx context.Context | ||
| 17 | + svcCtx *svc.ServiceContext | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func NewSystemArticleTemplateClassSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateClassSearchLogic { | ||
| 21 | + return &SystemArticleTemplateClassSearchLogic{ | ||
| 22 | + Logger: logx.WithContext(ctx), | ||
| 23 | + ctx: ctx, | ||
| 24 | + svcCtx: svcCtx, | ||
| 25 | + } | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +func (l *SystemArticleTemplateClassSearchLogic) SystemArticleTemplateClassSearch(req *types.ArticleTemplateClassSearchRequest) (resp *types.ArticleTemplateClassSearchResponse, err error) { | ||
| 29 | + var ( | ||
| 30 | + conn = l.svcCtx.DefaultDBConn() | ||
| 31 | + dms []*domain.ArticleTemplate | ||
| 32 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 33 | + ) | ||
| 34 | + queryOptions := domain.NewQueryOptions() | ||
| 35 | + queryOptions.WithKV("name", req.Name). | ||
| 36 | + MustWithKV("companyId", userToken.CompanyId) | ||
| 37 | + _, dms, err = l.svcCtx.ArticleTemplateRepository.Find(l.ctx, conn, queryOptions) | ||
| 38 | + class := lo.Uniq(domain.Values(dms, func(item *domain.ArticleTemplate) string { | ||
| 39 | + return item.TemplateClass | ||
| 40 | + })) | ||
| 41 | + resp = &types.ArticleTemplateClassSearchResponse{ | ||
| 42 | + Total: int64(len(class)), | ||
| 43 | + } | ||
| 44 | + lo.ForEach(class, func(item string, index int) { | ||
| 45 | + resp.List = append(resp.List, types.ArticleTemplateClassItem{ | ||
| 46 | + Name: item, | ||
| 47 | + }) | ||
| 48 | + }) | ||
| 49 | + return | ||
| 50 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 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 SystemArticleTemplateDeleteLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewSystemArticleTemplateDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateDeleteLogic { | ||
| 22 | + return &SystemArticleTemplateDeleteLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *SystemArticleTemplateDeleteLogic) SystemArticleTemplateDelete(req *types.ArticleTemplateDeleteRequest) (resp *types.ArticleTemplateDeleteResponse, err error) { | ||
| 30 | + var ( | ||
| 31 | + conn = l.svcCtx.DefaultDBConn() | ||
| 32 | + dm *domain.ArticleTemplate | ||
| 33 | + ) | ||
| 34 | + if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 35 | + return nil, xerr.NewErrMsgErr("不存在", err) | ||
| 36 | + } | ||
| 37 | + if dm.TemplateClass == domain.DefaultTemplateClass { | ||
| 38 | + return nil, xerr.NewErrMsgErr("默认模板不可删除", nil) | ||
| 39 | + } | ||
| 40 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 41 | + if dm, err = l.svcCtx.ArticleTemplateRepository.Delete(l.ctx, conn, dm); err != nil { | ||
| 42 | + return err | ||
| 43 | + } | ||
| 44 | + return nil | ||
| 45 | + }, true); err != nil { | ||
| 46 | + return nil, xerr.NewErrMsgErr("移除失败", err) | ||
| 47 | + } | ||
| 48 | + resp = &types.ArticleTemplateDeleteResponse{} | ||
| 49 | + return | ||
| 50 | +} |
| 1 | +package template | ||
| 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/xerr" | ||
| 7 | + | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 10 | + | ||
| 11 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +type SystemArticleTemplateGetLogic struct { | ||
| 15 | + logx.Logger | ||
| 16 | + ctx context.Context | ||
| 17 | + svcCtx *svc.ServiceContext | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func NewSystemArticleTemplateGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateGetLogic { | ||
| 21 | + return &SystemArticleTemplateGetLogic{ | ||
| 22 | + Logger: logx.WithContext(ctx), | ||
| 23 | + ctx: ctx, | ||
| 24 | + svcCtx: svcCtx, | ||
| 25 | + } | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +func (l *SystemArticleTemplateGetLogic) SystemArticleTemplateGet(req *types.ArticleTemplateGetRequest) (resp *types.ArticleTemplateGetResponse, err error) { | ||
| 29 | + var ( | ||
| 30 | + conn = l.svcCtx.DefaultDBConn() | ||
| 31 | + dm *domain.ArticleTemplate | ||
| 32 | + userMap = make(map[int64]*domain.User) | ||
| 33 | + ) | ||
| 34 | + // 货号唯一 | ||
| 35 | + if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 36 | + return nil, xerr.NewErrMsgErr("不存在", err) | ||
| 37 | + } | ||
| 38 | + item := NewTypesArticleTemplate(dm) | ||
| 39 | + for _, id := range dm.WhoRead { | ||
| 40 | + if user, _ := domain.LazyLoad(userMap, l.ctx, conn, id, l.svcCtx.UserRepository.FindOne); user != nil { | ||
| 41 | + item.WhoReadInfo = append(item.WhoReadInfo, types.TargetUser{ | ||
| 42 | + Id: user.Id, | ||
| 43 | + Name: user.Name, | ||
| 44 | + }) | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + for _, id := range dm.WhoReview { | ||
| 48 | + if user, _ := domain.LazyLoad(userMap, l.ctx, conn, id, l.svcCtx.UserRepository.FindOne); user != nil { | ||
| 49 | + item.WhoReviewInfo = append(item.WhoReviewInfo, types.TargetUser{ | ||
| 50 | + Id: user.Id, | ||
| 51 | + Name: user.Name, | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + resp = &types.ArticleTemplateGetResponse{ | ||
| 56 | + ArticleTemplate: item, | ||
| 57 | + } | ||
| 58 | + return | ||
| 59 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "github.com/google/uuid" | ||
| 6 | + "github.com/samber/lo" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/gateway/authlib" | ||
| 10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
| 11 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
| 12 | + | ||
| 13 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 14 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 15 | + | ||
| 16 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 17 | +) | ||
| 18 | + | ||
| 19 | +type SystemArticleTemplateSaveLogic struct { | ||
| 20 | + logx.Logger | ||
| 21 | + ctx context.Context | ||
| 22 | + svcCtx *svc.ServiceContext | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func NewSystemArticleTemplateSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateSaveLogic { | ||
| 26 | + return &SystemArticleTemplateSaveLogic{ | ||
| 27 | + Logger: logx.WithContext(ctx), | ||
| 28 | + ctx: ctx, | ||
| 29 | + svcCtx: svcCtx, | ||
| 30 | + } | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +func (l *SystemArticleTemplateSaveLogic) SystemArticleTemplateSave(req *types.ArticleTemplateSaveRequest) (resp *types.ArticleTemplateSaveResponse, err error) { | ||
| 34 | + var ( | ||
| 35 | + dm *domain.ArticleTemplate | ||
| 36 | + userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 37 | + ) | ||
| 38 | + // 唯一判断 | ||
| 39 | + // 获取当前用户信息 | ||
| 40 | + userMe, err := l.svcCtx.ApiAuthService.MeInfo(l.ctx, authlib.RequestUserMeQuery{Token: req.AccessToken}) | ||
| 41 | + if err != nil { | ||
| 42 | + return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + dm = NewDomainArticleTemplate(req.ArticleTemplate) | ||
| 46 | + dm.CompanyId = userToken.CompanyId | ||
| 47 | + dm.UserId = 0 | ||
| 48 | + dm.BelongTo = domain.BelongToCompany | ||
| 49 | + dm.Operator = domain.Operator{ | ||
| 50 | + Id: userToken.UserId, | ||
| 51 | + Name: userMe.User.NickName, | ||
| 52 | + Type: domain.OperatorTypeAdmin, | ||
| 53 | + } | ||
| 54 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 55 | + dm, err = l.svcCtx.ArticleTemplateRepository.Insert(l.ctx, conn, dm) | ||
| 56 | + return err | ||
| 57 | + }, true); err != nil { | ||
| 58 | + return nil, xerr.NewErrMsg("保存失败") | ||
| 59 | + } | ||
| 60 | + resp = &types.ArticleTemplateSaveResponse{} | ||
| 61 | + return | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +func NewDomainArticleTemplate(item types.ArticleTemplateItem) *domain.ArticleTemplate { | ||
| 65 | + var paragraphs = make([]domain.Paragraph, 0) | ||
| 66 | + lo.ForEach(item.Paragraphs, func(p types.Paragraph, index int) { | ||
| 67 | + paragraphs = append(paragraphs, NewDomainParagraph(p)) | ||
| 68 | + }) | ||
| 69 | + return &domain.ArticleTemplate{ | ||
| 70 | + Name: item.Name, | ||
| 71 | + TemplateClass: item.TemplateClass, | ||
| 72 | + Paragraphs: paragraphs, | ||
| 73 | + Icon: item.Icon, | ||
| 74 | + TargetWhoRead: domain.ArticleTemplateTarget(item.TargetWhoRead), | ||
| 75 | + TargetWhoReview: domain.ArticleTemplateTarget(item.TargetWhoReview), | ||
| 76 | + WhoRead: item.WhoRead, | ||
| 77 | + WhoReview: item.WhoReview, | ||
| 78 | + Sort: 1, | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +func NewTypesArticleTemplate(item *domain.ArticleTemplate) types.ArticleTemplateItem { | ||
| 83 | + var paragraphs = make([]types.Paragraph, 0) | ||
| 84 | + lo.ForEach(item.Paragraphs, func(p domain.Paragraph, index int) { | ||
| 85 | + paragraphs = append(paragraphs, NewTypesParagraph(p)) | ||
| 86 | + }) | ||
| 87 | + // 目前固定,后期有需要添加描述字段 | ||
| 88 | + var description string | ||
| 89 | + if item.TemplateClass == domain.DefaultTemplateClass { | ||
| 90 | + if item.Name == "演绎式" { | ||
| 91 | + description = "从分析现象开始,查找发生原因,找出解决方案" | ||
| 92 | + } else if item.Name == "归纳式" { | ||
| 93 | + description = "从个别事务中概括出一般性概念、原则或结论" | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + return types.ArticleTemplateItem{ | ||
| 97 | + Id: item.Id, | ||
| 98 | + Name: item.Name, | ||
| 99 | + Description: description, | ||
| 100 | + TemplateClass: item.TemplateClass, | ||
| 101 | + Paragraphs: paragraphs, | ||
| 102 | + Icon: item.Icon, | ||
| 103 | + TargetWhoRead: int(item.TargetWhoRead), | ||
| 104 | + TargetWhoReview: int(item.TargetWhoReview), | ||
| 105 | + WhoRead: item.WhoRead, | ||
| 106 | + WhoReview: item.WhoReview, | ||
| 107 | + Operator: item.Operator.Name, | ||
| 108 | + WhoReadInfo: make([]types.TargetUser, 0), | ||
| 109 | + WhoReviewInfo: make([]types.TargetUser, 0), | ||
| 110 | + UpdatedAt: item.UpdatedAt, | ||
| 111 | + } | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +func NewDomainParagraph(item types.Paragraph) domain.Paragraph { | ||
| 115 | + idGen, _ := uuid.NewUUID() | ||
| 116 | + return domain.Paragraph{ | ||
| 117 | + ID: idGen.String(), | ||
| 118 | + Title: item.Title, | ||
| 119 | + Prompt: item.Prompt, | ||
| 120 | + Required: item.Required, | ||
| 121 | + Type: item.Type, | ||
| 122 | + } | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +func NewTypesParagraph(item domain.Paragraph) types.Paragraph { | ||
| 126 | + return types.Paragraph{ | ||
| 127 | + ID: item.ID, | ||
| 128 | + Title: item.Title, | ||
| 129 | + Prompt: item.Prompt, | ||
| 130 | + Required: item.Required, | ||
| 131 | + Type: item.Type, | ||
| 132 | + } | ||
| 133 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 6 | + | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 9 | + | ||
| 10 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +type SystemArticleTemplateSearchLogic struct { | ||
| 14 | + logx.Logger | ||
| 15 | + ctx context.Context | ||
| 16 | + svcCtx *svc.ServiceContext | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func NewSystemArticleTemplateSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateSearchLogic { | ||
| 20 | + return &SystemArticleTemplateSearchLogic{ | ||
| 21 | + Logger: logx.WithContext(ctx), | ||
| 22 | + ctx: ctx, | ||
| 23 | + svcCtx: svcCtx, | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (l *SystemArticleTemplateSearchLogic) SystemArticleTemplateSearch(req *types.ArticleTemplateSearchRequest) (resp *types.ArticleTemplateSearchResponse, err error) { | ||
| 28 | + var ( | ||
| 29 | + conn = l.svcCtx.DefaultDBConn() | ||
| 30 | + dms []*domain.ArticleTemplate | ||
| 31 | + total int64 | ||
| 32 | + userMap = make(map[int64]*domain.User) | ||
| 33 | + ) | ||
| 34 | + | ||
| 35 | + queryOptions := domain.NewQueryOptions() | ||
| 36 | + if req.Page > 0 && req.Size > 0 { | ||
| 37 | + queryOptions.WithOffsetLimit(req.Page, req.Size) | ||
| 38 | + } | ||
| 39 | + queryOptions.WithKV("name", req.Name). | ||
| 40 | + WithKV("templateClass", req.TemplateClass). | ||
| 41 | + WithKV("companyId", req.CompanyId). | ||
| 42 | + WithKV("userId", req.UserId). | ||
| 43 | + WithKV("targetUser", req.TargetUser) | ||
| 44 | + if req.Target != nil { | ||
| 45 | + queryOptions.MustWithKV("target", *req.Target) | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + total, dms, err = l.svcCtx.ArticleTemplateRepository.Find(l.ctx, conn, queryOptions) | ||
| 49 | + list := make([]types.ArticleTemplateItem, 0) | ||
| 50 | + for i := range dms { | ||
| 51 | + item := NewTypesArticleTemplate(dms[i]) | ||
| 52 | + for _, id := range dms[i].WhoRead { | ||
| 53 | + if user, _ := domain.LazyLoad(userMap, l.ctx, conn, id, l.svcCtx.UserRepository.FindOne); user != nil { | ||
| 54 | + item.WhoReadInfo = append(item.WhoReadInfo, types.TargetUser{ | ||
| 55 | + Id: user.Id, | ||
| 56 | + Name: user.Name, | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + for _, id := range dms[i].WhoReview { | ||
| 61 | + if user, _ := domain.LazyLoad(userMap, l.ctx, conn, id, l.svcCtx.UserRepository.FindOne); user != nil { | ||
| 62 | + item.WhoReviewInfo = append(item.WhoReviewInfo, types.TargetUser{ | ||
| 63 | + Id: user.Id, | ||
| 64 | + Name: user.Name, | ||
| 65 | + }) | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + list = append(list, item) | ||
| 69 | + } | ||
| 70 | + resp = &types.ArticleTemplateSearchResponse{ | ||
| 71 | + List: list, | ||
| 72 | + Total: total, | ||
| 73 | + } | ||
| 74 | + return | ||
| 75 | +} |
| 1 | +package template | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + "github.com/samber/lo" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 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 SystemArticleTemplateUpdateLogic struct { | ||
| 17 | + logx.Logger | ||
| 18 | + ctx context.Context | ||
| 19 | + svcCtx *svc.ServiceContext | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +func NewSystemArticleTemplateUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleTemplateUpdateLogic { | ||
| 23 | + return &SystemArticleTemplateUpdateLogic{ | ||
| 24 | + Logger: logx.WithContext(ctx), | ||
| 25 | + ctx: ctx, | ||
| 26 | + svcCtx: svcCtx, | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +func (l *SystemArticleTemplateUpdateLogic) SystemArticleTemplateUpdate(req *types.ArticleTemplateUpdateRequest) (resp *types.ArticleTemplateUpdateResponse, err error) { | ||
| 31 | + var ( | ||
| 32 | + conn = l.svcCtx.DefaultDBConn() | ||
| 33 | + dm *domain.ArticleTemplate | ||
| 34 | + ) | ||
| 35 | + if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, req.Id); err != nil { | ||
| 36 | + return nil, xerr.NewErrMsgErr("不存在", err) | ||
| 37 | + } | ||
| 38 | + // 不可编辑判断 | ||
| 39 | + | ||
| 40 | + // 赋值 | ||
| 41 | + item := req.ArticleTemplate | ||
| 42 | + var paragraphs = make([]domain.Paragraph, 0) | ||
| 43 | + lo.ForEach(item.Paragraphs, func(p types.Paragraph, index int) { | ||
| 44 | + paragraphs = append(paragraphs, NewDomainParagraph(p)) | ||
| 45 | + }) | ||
| 46 | + dm.Name = item.Name | ||
| 47 | + dm.TemplateClass = item.TemplateClass | ||
| 48 | + dm.Paragraphs = paragraphs | ||
| 49 | + dm.Icon = item.Icon | ||
| 50 | + dm.TargetWhoRead = domain.ArticleTemplateTarget(item.TargetWhoRead) | ||
| 51 | + dm.TargetWhoReview = domain.ArticleTemplateTarget(item.TargetWhoReview) | ||
| 52 | + dm.WhoRead = item.WhoRead | ||
| 53 | + dm.WhoReview = item.WhoReview | ||
| 54 | + | ||
| 55 | + // 更新 | ||
| 56 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 57 | + dm, err = l.svcCtx.ArticleTemplateRepository.UpdateWithVersion(l.ctx, conn, dm) | ||
| 58 | + return err | ||
| 59 | + }, true); err != nil { | ||
| 60 | + return nil, xerr.NewErrMsg("更新失败") | ||
| 61 | + } | ||
| 62 | + resp = &types.ArticleTemplateUpdateResponse{} | ||
| 63 | + return | ||
| 64 | +} |
| @@ -62,8 +62,9 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | @@ -62,8 +62,9 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | ||
| 62 | Title: item.Title, | 62 | Title: item.Title, |
| 63 | Summary: item.Summary, | 63 | Summary: item.Summary, |
| 64 | Time: item.CreatedAt, | 64 | Time: item.CreatedAt, |
| 65 | - Images: make([]string, 0), | 65 | + Images: item.GetImages(), |
| 66 | ReadFlag: false, | 66 | ReadFlag: false, |
| 67 | + Cover: item.GetCover(), | ||
| 67 | } | 68 | } |
| 68 | if author, _ := domain.LazyLoad(userMap, l.ctx, conn, item.AuthorId, l.svcCtx.UserRepository.FindOne); author != nil { | 69 | if author, _ := domain.LazyLoad(userMap, l.ctx, conn, item.AuthorId, l.svcCtx.UserRepository.FindOne); author != nil { |
| 69 | newsItem.Author = types.UserItem{ | 70 | newsItem.Author = types.UserItem{ |
| @@ -72,9 +73,6 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | @@ -72,9 +73,6 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | ||
| 72 | Avatar: lo.ToPtr(author.Avatar), | 73 | Avatar: lo.ToPtr(author.Avatar), |
| 73 | } | 74 | } |
| 74 | } | 75 | } |
| 75 | - for _, img := range item.Images { | ||
| 76 | - newsItem.Images = append(newsItem.Images, img.Url) | ||
| 77 | - } | ||
| 78 | if _, ok := readArticlesMap[item.Id]; ok { | 76 | if _, ok := readArticlesMap[item.Id]; ok { |
| 79 | newsItem.ReadFlag = true | 77 | newsItem.ReadFlag = true |
| 80 | } | 78 | } |
-
请 注册 或 登录 后发表评论