正在显示
36 个修改的文件
包含
3746 行增加
和
169 行删除
@@ -333,6 +333,32 @@ | @@ -333,6 +333,32 @@ | ||
333 | ] | 333 | ] |
334 | } | 334 | } |
335 | }, | 335 | }, |
336 | + "v1/mini/article_backup/{id}": { | ||
337 | + "get": { | ||
338 | + "summary": "小程序获取文章的编辑记录", | ||
339 | + "operationId": "MiniGetArticleBackup", | ||
340 | + "responses": { | ||
341 | + "200": { | ||
342 | + "description": "A successful response.", | ||
343 | + "schema": { | ||
344 | + "$ref": "#/definitions/MiniGetArticleBackupResponse" | ||
345 | + } | ||
346 | + } | ||
347 | + }, | ||
348 | + "parameters": [ | ||
349 | + { | ||
350 | + "name": "id", | ||
351 | + "in": "path", | ||
352 | + "required": true, | ||
353 | + "type": "string" | ||
354 | + } | ||
355 | + ], | ||
356 | + "requestBody": {}, | ||
357 | + "tags": [ | ||
358 | + "article" | ||
359 | + ] | ||
360 | + } | ||
361 | + }, | ||
336 | "v1/mini/article_comment": { | 362 | "v1/mini/article_comment": { |
337 | "post": { | 363 | "post": { |
338 | "summary": "小程序填写文章的评论", | 364 | "summary": "小程序填写文章的评论", |
@@ -766,7 +792,7 @@ | @@ -766,7 +792,7 @@ | ||
766 | "v1/mini/homepage/user_beliked": { | 792 | "v1/mini/homepage/user_beliked": { |
767 | "post": { | 793 | "post": { |
768 | "summary": "个人主页-获赞的列表", | 794 | "summary": "个人主页-获赞的列表", |
769 | - "operationId": "miniHomepageUserBeliked", | 795 | + "operationId": "miniHomepageUserBeLiked", |
770 | "responses": { | 796 | "responses": { |
771 | "200": { | 797 | "200": { |
772 | "description": "A successful response.", | 798 | "description": "A successful response.", |
@@ -1722,6 +1748,58 @@ | @@ -1722,6 +1748,58 @@ | ||
1722 | } | 1748 | } |
1723 | }, | 1749 | }, |
1724 | "v1/system/article": { | 1750 | "v1/system/article": { |
1751 | + "delete": { | ||
1752 | + "summary": "管理后台删除文章", | ||
1753 | + "operationId": "SystemDeleteArticle", | ||
1754 | + "responses": { | ||
1755 | + "200": { | ||
1756 | + "description": "A successful response.", | ||
1757 | + "schema": { | ||
1758 | + "$ref": "#/definitions/SystemArticleDeleteResponse" | ||
1759 | + } | ||
1760 | + } | ||
1761 | + }, | ||
1762 | + "parameters": [ | ||
1763 | + { | ||
1764 | + "name": "body", | ||
1765 | + "in": "body", | ||
1766 | + "required": true, | ||
1767 | + "schema": { | ||
1768 | + "$ref": "#/definitions/SystemArticleDeleteRequest" | ||
1769 | + } | ||
1770 | + } | ||
1771 | + ], | ||
1772 | + "requestBody": {}, | ||
1773 | + "tags": [ | ||
1774 | + "article" | ||
1775 | + ] | ||
1776 | + }, | ||
1777 | + "post": { | ||
1778 | + "summary": "管理后台新增文章", | ||
1779 | + "operationId": "SystemCreateArticle", | ||
1780 | + "responses": { | ||
1781 | + "200": { | ||
1782 | + "description": "A successful response.", | ||
1783 | + "schema": { | ||
1784 | + "$ref": "#/definitions/SystemArticleCreateResponse" | ||
1785 | + } | ||
1786 | + } | ||
1787 | + }, | ||
1788 | + "parameters": [ | ||
1789 | + { | ||
1790 | + "name": "body", | ||
1791 | + "in": "body", | ||
1792 | + "required": true, | ||
1793 | + "schema": { | ||
1794 | + "$ref": "#/definitions/SystemArticleCreateRequest" | ||
1795 | + } | ||
1796 | + } | ||
1797 | + ], | ||
1798 | + "requestBody": {}, | ||
1799 | + "tags": [ | ||
1800 | + "article" | ||
1801 | + ] | ||
1802 | + }, | ||
1725 | "put": { | 1803 | "put": { |
1726 | "summary": "管理后台编辑帖子", | 1804 | "summary": "管理后台编辑帖子", |
1727 | "operationId": "SystemUpdateArticle", | 1805 | "operationId": "SystemUpdateArticle", |
@@ -1750,6 +1828,196 @@ | @@ -1750,6 +1828,196 @@ | ||
1750 | ] | 1828 | ] |
1751 | } | 1829 | } |
1752 | }, | 1830 | }, |
1831 | + "v1/system/article/deleted/list": { | ||
1832 | + "post": { | ||
1833 | + "summary": "管理后台已删除列表", | ||
1834 | + "operationId": "SystemArticleSearchDeleted", | ||
1835 | + "responses": { | ||
1836 | + "200": { | ||
1837 | + "description": "A successful response.", | ||
1838 | + "schema": { | ||
1839 | + "$ref": "#/definitions/SystemArticleSearchDeletedResponse" | ||
1840 | + } | ||
1841 | + } | ||
1842 | + }, | ||
1843 | + "parameters": [ | ||
1844 | + { | ||
1845 | + "name": "body", | ||
1846 | + "in": "body", | ||
1847 | + "required": true, | ||
1848 | + "schema": { | ||
1849 | + "$ref": "#/definitions/SystemArticleSearchDeletedRequest" | ||
1850 | + } | ||
1851 | + } | ||
1852 | + ], | ||
1853 | + "requestBody": {}, | ||
1854 | + "tags": [ | ||
1855 | + "article" | ||
1856 | + ] | ||
1857 | + } | ||
1858 | + }, | ||
1859 | + "v1/system/article/deleted/restore": { | ||
1860 | + "put": { | ||
1861 | + "summary": "管理后台文章删除恢复", | ||
1862 | + "operationId": "SystemRestoreArticleDeleted", | ||
1863 | + "responses": { | ||
1864 | + "200": { | ||
1865 | + "description": "A successful response.", | ||
1866 | + "schema": { | ||
1867 | + "$ref": "#/definitions/SystemArticleDeletedRestoreResponse" | ||
1868 | + } | ||
1869 | + } | ||
1870 | + }, | ||
1871 | + "parameters": [ | ||
1872 | + { | ||
1873 | + "name": "body", | ||
1874 | + "in": "body", | ||
1875 | + "required": true, | ||
1876 | + "schema": { | ||
1877 | + "$ref": "#/definitions/SystemArticleDeletedRestoreRequest" | ||
1878 | + } | ||
1879 | + } | ||
1880 | + ], | ||
1881 | + "requestBody": {}, | ||
1882 | + "tags": [ | ||
1883 | + "article" | ||
1884 | + ] | ||
1885 | + } | ||
1886 | + }, | ||
1887 | + "v1/system/article/draft": { | ||
1888 | + "delete": { | ||
1889 | + "summary": "管理后台删除草稿", | ||
1890 | + "operationId": "SystemDeleteArticleDraft", | ||
1891 | + "responses": { | ||
1892 | + "200": { | ||
1893 | + "description": "A successful response.", | ||
1894 | + "schema": { | ||
1895 | + "$ref": "#/definitions/SystemArticleDraftDeleteResponse" | ||
1896 | + } | ||
1897 | + } | ||
1898 | + }, | ||
1899 | + "parameters": [ | ||
1900 | + { | ||
1901 | + "name": "body", | ||
1902 | + "in": "body", | ||
1903 | + "required": true, | ||
1904 | + "schema": { | ||
1905 | + "$ref": "#/definitions/SystemArticleDraftDeleteRequest" | ||
1906 | + } | ||
1907 | + } | ||
1908 | + ], | ||
1909 | + "requestBody": {}, | ||
1910 | + "tags": [ | ||
1911 | + "article" | ||
1912 | + ] | ||
1913 | + }, | ||
1914 | + "post": { | ||
1915 | + "summary": "管理后台新增草稿", | ||
1916 | + "operationId": "SystemCreateArticleDraft", | ||
1917 | + "responses": { | ||
1918 | + "200": { | ||
1919 | + "description": "A successful response.", | ||
1920 | + "schema": { | ||
1921 | + "$ref": "#/definitions/SystemArticleDraftCreateResponse" | ||
1922 | + } | ||
1923 | + } | ||
1924 | + }, | ||
1925 | + "parameters": [ | ||
1926 | + { | ||
1927 | + "name": "body", | ||
1928 | + "in": "body", | ||
1929 | + "required": true, | ||
1930 | + "schema": { | ||
1931 | + "$ref": "#/definitions/SystemArticleDraftCreateRequest" | ||
1932 | + } | ||
1933 | + } | ||
1934 | + ], | ||
1935 | + "requestBody": {}, | ||
1936 | + "tags": [ | ||
1937 | + "article" | ||
1938 | + ] | ||
1939 | + }, | ||
1940 | + "put": { | ||
1941 | + "summary": "管理后台编辑草稿", | ||
1942 | + "operationId": "SystemUpdateArticleDraft", | ||
1943 | + "responses": { | ||
1944 | + "200": { | ||
1945 | + "description": "A successful response.", | ||
1946 | + "schema": { | ||
1947 | + "$ref": "#/definitions/SystemArticleDraftUpdateResponse" | ||
1948 | + } | ||
1949 | + } | ||
1950 | + }, | ||
1951 | + "parameters": [ | ||
1952 | + { | ||
1953 | + "name": "body", | ||
1954 | + "in": "body", | ||
1955 | + "required": true, | ||
1956 | + "schema": { | ||
1957 | + "$ref": "#/definitions/SystemArticleDraftUpdateRequest" | ||
1958 | + } | ||
1959 | + } | ||
1960 | + ], | ||
1961 | + "requestBody": {}, | ||
1962 | + "tags": [ | ||
1963 | + "article" | ||
1964 | + ] | ||
1965 | + } | ||
1966 | + }, | ||
1967 | + "v1/system/article/draft/search": { | ||
1968 | + "post": { | ||
1969 | + "summary": "管理后台草稿列表", | ||
1970 | + "operationId": "SystemSearchArticleDraft", | ||
1971 | + "responses": { | ||
1972 | + "200": { | ||
1973 | + "description": "A successful response.", | ||
1974 | + "schema": { | ||
1975 | + "$ref": "#/definitions/SystemArticleDraftSearchResponse" | ||
1976 | + } | ||
1977 | + } | ||
1978 | + }, | ||
1979 | + "parameters": [ | ||
1980 | + { | ||
1981 | + "name": "body", | ||
1982 | + "in": "body", | ||
1983 | + "required": true, | ||
1984 | + "schema": { | ||
1985 | + "$ref": "#/definitions/SystemArticleDraftSearchRequest" | ||
1986 | + } | ||
1987 | + } | ||
1988 | + ], | ||
1989 | + "requestBody": {}, | ||
1990 | + "tags": [ | ||
1991 | + "article" | ||
1992 | + ] | ||
1993 | + } | ||
1994 | + }, | ||
1995 | + "v1/system/article/draft/{id}": { | ||
1996 | + "get": { | ||
1997 | + "summary": "管理后台获取草稿", | ||
1998 | + "operationId": "SystemGetArticleDraft", | ||
1999 | + "responses": { | ||
2000 | + "200": { | ||
2001 | + "description": "A successful response.", | ||
2002 | + "schema": { | ||
2003 | + "$ref": "#/definitions/SystemArticleDraftGetResponse" | ||
2004 | + } | ||
2005 | + } | ||
2006 | + }, | ||
2007 | + "parameters": [ | ||
2008 | + { | ||
2009 | + "name": "id", | ||
2010 | + "in": "path", | ||
2011 | + "required": true, | ||
2012 | + "type": "string" | ||
2013 | + } | ||
2014 | + ], | ||
2015 | + "requestBody": {}, | ||
2016 | + "tags": [ | ||
2017 | + "article" | ||
2018 | + ] | ||
2019 | + } | ||
2020 | + }, | ||
1753 | "v1/system/article/history": { | 2021 | "v1/system/article/history": { |
1754 | "post": { | 2022 | "post": { |
1755 | "summary": "管理后台编辑历史", | 2023 | "summary": "管理后台编辑历史", |
@@ -3808,12 +4076,31 @@ | @@ -3808,12 +4076,31 @@ | ||
3808 | "type": "string" | 4076 | "type": "string" |
3809 | } | 4077 | } |
3810 | }, | 4078 | }, |
4079 | + "videos": { | ||
4080 | + "type": "array", | ||
4081 | + "items": { | ||
4082 | + "$ref": "#/definitions/Video" | ||
4083 | + } | ||
4084 | + }, | ||
4085 | + "changeField": { | ||
4086 | + "type": "array", | ||
4087 | + "items": { | ||
4088 | + "type": "string" | ||
4089 | + } | ||
4090 | + }, | ||
3811 | "createdAt": { | 4091 | "createdAt": { |
3812 | "type": "integer", | 4092 | "type": "integer", |
3813 | "format": "int64" | 4093 | "format": "int64" |
3814 | }, | 4094 | }, |
3815 | "location": { | 4095 | "location": { |
3816 | "$ref": "#/definitions/Location" | 4096 | "$ref": "#/definitions/Location" |
4097 | + }, | ||
4098 | + "action": { | ||
4099 | + "type": "string" | ||
4100 | + }, | ||
4101 | + "show": { | ||
4102 | + "type": "integer", | ||
4103 | + "format": "int32" | ||
3817 | } | 4104 | } |
3818 | }, | 4105 | }, |
3819 | "title": "MiniArticleBackupItem", | 4106 | "title": "MiniArticleBackupItem", |
@@ -3822,8 +4109,12 @@ | @@ -3822,8 +4109,12 @@ | ||
3822 | "title", | 4109 | "title", |
3823 | "content", | 4110 | "content", |
3824 | "images", | 4111 | "images", |
4112 | + "videos", | ||
4113 | + "changeField", | ||
3825 | "createdAt", | 4114 | "createdAt", |
3826 | - "location" | 4115 | + "location", |
4116 | + "action", | ||
4117 | + "show" | ||
3827 | ] | 4118 | ] |
3828 | }, | 4119 | }, |
3829 | "MiniArticleBackupSearchRequest": { | 4120 | "MiniArticleBackupSearchRequest": { |
@@ -4991,7 +5282,7 @@ | @@ -4991,7 +5282,7 @@ | ||
4991 | "type": "object", | 5282 | "type": "object", |
4992 | "title": "MiniEditUserInfoResponse" | 5283 | "title": "MiniEditUserInfoResponse" |
4993 | }, | 5284 | }, |
4994 | - "MiniGetArticleCommentRequest": { | 5285 | + "MiniGetArticleBackupRequest": { |
4995 | "type": "object", | 5286 | "type": "object", |
4996 | "properties": { | 5287 | "properties": { |
4997 | "id": { | 5288 | "id": { |
@@ -5000,14 +5291,92 @@ | @@ -5000,14 +5291,92 @@ | ||
5000 | }, | 5291 | }, |
5001 | "": { | 5292 | "": { |
5002 | "type": "integer", | 5293 | "type": "integer", |
5003 | - "format": "int64" | ||
5004 | - }, | ||
5005 | - "": { | ||
5006 | - "type": "integer", | ||
5007 | - "format": "int64" | 5294 | + "format": "int64", |
5295 | + "description": " 服务端自动获取" | ||
5008 | } | 5296 | } |
5009 | }, | 5297 | }, |
5010 | - "title": "MiniGetArticleCommentRequest", | 5298 | + "title": "MiniGetArticleBackupRequest", |
5299 | + "required": [ | ||
5300 | + "id" | ||
5301 | + ] | ||
5302 | + }, | ||
5303 | + "MiniGetArticleBackupResponse": { | ||
5304 | + "type": "object", | ||
5305 | + "properties": { | ||
5306 | + "id": { | ||
5307 | + "type": "integer", | ||
5308 | + "format": "int64" | ||
5309 | + }, | ||
5310 | + "title": { | ||
5311 | + "type": "string" | ||
5312 | + }, | ||
5313 | + "content": { | ||
5314 | + "type": "string" | ||
5315 | + }, | ||
5316 | + "images": { | ||
5317 | + "type": "array", | ||
5318 | + "items": { | ||
5319 | + "type": "string" | ||
5320 | + } | ||
5321 | + }, | ||
5322 | + "videos": { | ||
5323 | + "type": "array", | ||
5324 | + "items": { | ||
5325 | + "$ref": "#/definitions/Video" | ||
5326 | + } | ||
5327 | + }, | ||
5328 | + "changeField": { | ||
5329 | + "type": "array", | ||
5330 | + "items": { | ||
5331 | + "type": "string" | ||
5332 | + } | ||
5333 | + }, | ||
5334 | + "createdAt": { | ||
5335 | + "type": "integer", | ||
5336 | + "format": "int64" | ||
5337 | + }, | ||
5338 | + "location": { | ||
5339 | + "$ref": "#/definitions/Location" | ||
5340 | + }, | ||
5341 | + "action": { | ||
5342 | + "type": "string" | ||
5343 | + }, | ||
5344 | + "show": { | ||
5345 | + "type": "integer", | ||
5346 | + "format": "int32" | ||
5347 | + } | ||
5348 | + }, | ||
5349 | + "title": "MiniGetArticleBackupResponse", | ||
5350 | + "required": [ | ||
5351 | + "id", | ||
5352 | + "title", | ||
5353 | + "content", | ||
5354 | + "images", | ||
5355 | + "videos", | ||
5356 | + "changeField", | ||
5357 | + "createdAt", | ||
5358 | + "location", | ||
5359 | + "action", | ||
5360 | + "show" | ||
5361 | + ] | ||
5362 | + }, | ||
5363 | + "MiniGetArticleCommentRequest": { | ||
5364 | + "type": "object", | ||
5365 | + "properties": { | ||
5366 | + "id": { | ||
5367 | + "type": "integer", | ||
5368 | + "format": "int64" | ||
5369 | + }, | ||
5370 | + "": { | ||
5371 | + "type": "integer", | ||
5372 | + "format": "int64" | ||
5373 | + }, | ||
5374 | + "": { | ||
5375 | + "type": "integer", | ||
5376 | + "format": "int64" | ||
5377 | + } | ||
5378 | + }, | ||
5379 | + "title": "MiniGetArticleCommentRequest", | ||
5011 | "required": [ | 5380 | "required": [ |
5012 | "id" | 5381 | "id" |
5013 | ] | 5382 | ] |
@@ -5114,6 +5483,9 @@ | @@ -5114,6 +5483,9 @@ | ||
5114 | "size": { | 5483 | "size": { |
5115 | "type": "integer", | 5484 | "type": "integer", |
5116 | "format": "int32" | 5485 | "format": "int32" |
5486 | + }, | ||
5487 | + "name": { | ||
5488 | + "type": "string" | ||
5117 | } | 5489 | } |
5118 | }, | 5490 | }, |
5119 | "title": "MiniHomePageUserFollowerSearchRequest", | 5491 | "title": "MiniHomePageUserFollowerSearchRequest", |
@@ -5210,10 +5582,14 @@ | @@ -5210,10 +5582,14 @@ | ||
5210 | "format": "int32", | 5582 | "format": "int32", |
5211 | "description": " 数量" | 5583 | "description": " 数量" |
5212 | }, | 5584 | }, |
5213 | - "orderByHotScore": { | 5585 | + "orderByKey": { |
5214 | "type": "string", | 5586 | "type": "string", |
5215 | "default": "desc", | 5587 | "default": "desc", |
5216 | - "description": " 热度排序 升序 asc 降序 desc" | 5588 | + "description": " 按规则排序 (热度:HotScore All:时间排序 Time:时间排序)" |
5589 | + }, | ||
5590 | + "orderByValue": { | ||
5591 | + "type": "string", | ||
5592 | + "description": " 排序值 升序 asc 降序 desc" | ||
5217 | }, | 5593 | }, |
5218 | "keywords": { | 5594 | "keywords": { |
5219 | "type": "string", | 5595 | "type": "string", |
@@ -5224,7 +5600,7 @@ | @@ -5224,7 +5600,7 @@ | ||
5224 | "format": "int64", | 5600 | "format": "int64", |
5225 | "description": " 开始时间" | 5601 | "description": " 开始时间" |
5226 | }, | 5602 | }, |
5227 | - "beginTime": { | 5603 | + "endTime": { |
5228 | "type": "integer", | 5604 | "type": "integer", |
5229 | "format": "int64", | 5605 | "format": "int64", |
5230 | "description": " 结束时间" | 5606 | "description": " 结束时间" |
@@ -5234,7 +5610,8 @@ | @@ -5234,7 +5610,8 @@ | ||
5234 | "required": [ | 5610 | "required": [ |
5235 | "authorId", | 5611 | "authorId", |
5236 | "size", | 5612 | "size", |
5237 | - "orderByHotScore" | 5613 | + "orderByKey", |
5614 | + "orderByValue" | ||
5238 | ] | 5615 | ] |
5239 | }, | 5616 | }, |
5240 | "MiniHomepageUserNewsResposne": { | 5617 | "MiniHomepageUserNewsResposne": { |
@@ -5250,12 +5627,17 @@ | @@ -5250,12 +5627,17 @@ | ||
5250 | "type": "integer", | 5627 | "type": "integer", |
5251 | "format": "int64", | 5628 | "format": "int64", |
5252 | "description": " 最后文章ID" | 5629 | "description": " 最后文章ID" |
5630 | + }, | ||
5631 | + "total": { | ||
5632 | + "type": "integer", | ||
5633 | + "format": "int64" | ||
5253 | } | 5634 | } |
5254 | }, | 5635 | }, |
5255 | "title": "MiniHomepageUserNewsResposne", | 5636 | "title": "MiniHomepageUserNewsResposne", |
5256 | "required": [ | 5637 | "required": [ |
5257 | "list", | 5638 | "list", |
5258 | - "lastArticleId" | 5639 | + "lastArticleId", |
5640 | + "total" | ||
5259 | ] | 5641 | ] |
5260 | }, | 5642 | }, |
5261 | "MiniListArticleCommentRequest": { | 5643 | "MiniListArticleCommentRequest": { |
@@ -6080,6 +6462,25 @@ | @@ -6080,6 +6462,25 @@ | ||
6080 | "comment" | 6462 | "comment" |
6081 | ] | 6463 | ] |
6082 | }, | 6464 | }, |
6465 | + "Operator": { | ||
6466 | + "type": "object", | ||
6467 | + "properties": { | ||
6468 | + "id": { | ||
6469 | + "type": "integer", | ||
6470 | + "format": "int64", | ||
6471 | + "description": " 人员id" | ||
6472 | + }, | ||
6473 | + "name": { | ||
6474 | + "type": "string", | ||
6475 | + "description": " 人员的名字" | ||
6476 | + } | ||
6477 | + }, | ||
6478 | + "title": "Operator", | ||
6479 | + "required": [ | ||
6480 | + "id", | ||
6481 | + "name" | ||
6482 | + ] | ||
6483 | + }, | ||
6083 | "Position": { | 6484 | "Position": { |
6084 | "type": "object", | 6485 | "type": "object", |
6085 | "properties": { | 6486 | "properties": { |
@@ -6664,65 +7065,40 @@ | @@ -6664,65 +7065,40 @@ | ||
6664 | "list" | 7065 | "list" |
6665 | ] | 7066 | ] |
6666 | }, | 7067 | }, |
6667 | - "SystemArticleGetHistoryRequest": { | ||
6668 | - "type": "object", | ||
6669 | - "properties": { | ||
6670 | - "id": { | ||
6671 | - "type": "integer", | ||
6672 | - "format": "int64", | ||
6673 | - "description": "id" | ||
6674 | - }, | ||
6675 | - "": { | ||
6676 | - "type": "integer", | ||
6677 | - "format": "int64" | ||
6678 | - } | ||
6679 | - }, | ||
6680 | - "title": "SystemArticleGetHistoryRequest", | ||
6681 | - "required": [ | ||
6682 | - "id" | ||
6683 | - ] | ||
6684 | - }, | ||
6685 | - "SystemArticleGetHistoryResponse": { | 7068 | + "SystemArticleCreateRequest": { |
6686 | "type": "object", | 7069 | "type": "object", |
6687 | "properties": { | 7070 | "properties": { |
6688 | - "id": { | ||
6689 | - "type": "integer", | ||
6690 | - "format": "int64", | ||
6691 | - "description": " id" | ||
6692 | - }, | ||
6693 | - "articleId": { | ||
6694 | - "type": "integer", | ||
6695 | - "format": "int64", | ||
6696 | - "description": " 文章ID" | ||
6697 | - }, | ||
6698 | "title": { | 7071 | "title": { |
6699 | "type": "string", | 7072 | "type": "string", |
6700 | - "description": " 标题" | 7073 | + "description": "标题" |
6701 | }, | 7074 | }, |
6702 | - "createdAt": { | 7075 | + "content": { |
7076 | + "type": "string", | ||
7077 | + "description": "文章的文本内容" | ||
7078 | + }, | ||
7079 | + "authorId": { | ||
6703 | "type": "integer", | 7080 | "type": "integer", |
6704 | "format": "int64", | 7081 | "format": "int64", |
6705 | - "description": " 文章的发布时间" | ||
6706 | - }, | ||
6707 | - "section": { | ||
6708 | - "type": "array", | ||
6709 | - "items": { | ||
6710 | - "$ref": "#/definitions/ArticleSection" | ||
6711 | - }, | ||
6712 | - "description": " 文章的文本内容" | 7082 | + "description": "发布人id" |
6713 | }, | 7083 | }, |
6714 | "images": { | 7084 | "images": { |
6715 | "type": "array", | 7085 | "type": "array", |
6716 | "items": { | 7086 | "items": { |
6717 | "type": "string" | 7087 | "type": "string" |
6718 | }, | 7088 | }, |
6719 | - "description": " 图片" | 7089 | + "description": "图片" |
6720 | }, | 7090 | }, |
6721 | "video": { | 7091 | "video": { |
6722 | "type": "array", | 7092 | "type": "array", |
6723 | "items": { | 7093 | "items": { |
6724 | "$ref": "#/definitions/Video" | 7094 | "$ref": "#/definitions/Video" |
6725 | - } | 7095 | + }, |
7096 | + "description": " 视频" | ||
7097 | + }, | ||
7098 | + "targetUser": { | ||
7099 | + "type": "integer", | ||
7100 | + "format": "int32", | ||
7101 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
6726 | }, | 7102 | }, |
6727 | "whoRead": { | 7103 | "whoRead": { |
6728 | "type": "array", | 7104 | "type": "array", |
@@ -6730,14 +7106,7 @@ | @@ -6730,14 +7106,7 @@ | ||
6730 | "type": "integer", | 7106 | "type": "integer", |
6731 | "format": "int64" | 7107 | "format": "int64" |
6732 | }, | 7108 | }, |
6733 | - "description": " 谁可查看" | ||
6734 | - }, | ||
6735 | - "whoReadInfo": { | ||
6736 | - "type": "array", | ||
6737 | - "items": { | ||
6738 | - "$ref": "#/definitions/UserShowName" | ||
6739 | - }, | ||
6740 | - "description": " 谁可查看" | 7109 | + "description": "谁可查看" |
6741 | }, | 7110 | }, |
6742 | "whoReview": { | 7111 | "whoReview": { |
6743 | "type": "array", | 7112 | "type": "array", |
@@ -6745,52 +7114,33 @@ | @@ -6745,52 +7114,33 @@ | ||
6745 | "type": "integer", | 7114 | "type": "integer", |
6746 | "format": "int64" | 7115 | "format": "int64" |
6747 | }, | 7116 | }, |
6748 | - "description": " 谁可评论" | ||
6749 | - }, | ||
6750 | - "whoReviewInfo": { | ||
6751 | - "type": "array", | ||
6752 | - "items": { | ||
6753 | - "$ref": "#/definitions/UserShowName" | ||
6754 | - }, | ||
6755 | - "description": " 谁可评论" | 7117 | + "description": "谁可评论" |
6756 | }, | 7118 | }, |
6757 | - "location": { | ||
6758 | - "$ref": "#/definitions/Location", | ||
6759 | - "description": " 定位坐标" | 7119 | + "matchUrl": { |
7120 | + "type": "object", | ||
7121 | + "description": " 匹配文章内容中的url文本" | ||
6760 | }, | 7122 | }, |
6761 | - "targetUser": { | 7123 | + "articleDraftId": { |
6762 | "type": "integer", | 7124 | "type": "integer", |
6763 | - "format": "int32", | ||
6764 | - "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | 7125 | + "format": "int64", |
7126 | + "description": " 草稿ID" | ||
6765 | }, | 7127 | }, |
6766 | - "tags": { | ||
6767 | - "type": "array", | ||
6768 | - "items": { | ||
6769 | - "type": "integer", | ||
6770 | - "format": "int64" | ||
6771 | - }, | ||
6772 | - "description": " 标签" | 7128 | + "AccessToken": { |
7129 | + "type": "string", | ||
7130 | + "description": " 授权token" | ||
6773 | } | 7131 | } |
6774 | }, | 7132 | }, |
6775 | - "title": "SystemArticleGetHistoryResponse", | 7133 | + "title": "SystemArticleCreateRequest", |
6776 | "required": [ | 7134 | "required": [ |
6777 | - "id", | ||
6778 | - "articleId", | ||
6779 | "title", | 7135 | "title", |
6780 | - "createdAt", | ||
6781 | - "section", | ||
6782 | - "images", | ||
6783 | - "video", | ||
6784 | - "whoRead", | ||
6785 | - "whoReadInfo", | ||
6786 | - "whoReview", | ||
6787 | - "whoReviewInfo", | ||
6788 | - "location", | 7136 | + "content", |
7137 | + "authorId", | ||
6789 | "targetUser", | 7138 | "targetUser", |
6790 | - "tags" | 7139 | + "articleDraftId", |
7140 | + "x-mmm-accesstoken" | ||
6791 | ] | 7141 | ] |
6792 | }, | 7142 | }, |
6793 | - "SystemArticleGetRequest": { | 7143 | + "SystemArticleCreateResponse": { |
6794 | "type": "object", | 7144 | "type": "object", |
6795 | "properties": { | 7145 | "properties": { |
6796 | "id": { | 7146 | "id": { |
@@ -6798,46 +7148,942 @@ | @@ -6798,46 +7148,942 @@ | ||
6798 | "format": "int64", | 7148 | "format": "int64", |
6799 | "description": "id" | 7149 | "description": "id" |
6800 | }, | 7150 | }, |
6801 | - "": { | ||
6802 | - "type": "integer", | ||
6803 | - "format": "int64" | ||
6804 | - } | ||
6805 | - }, | ||
6806 | - "title": "SystemArticleGetRequest", | ||
6807 | - "required": [ | ||
6808 | - "id" | ||
6809 | - ] | ||
6810 | - }, | ||
6811 | - "SystemArticleGetResponse": { | ||
6812 | - "type": "object", | ||
6813 | - "properties": { | ||
6814 | - "id": { | ||
6815 | - "type": "integer", | ||
6816 | - "format": "int64", | ||
6817 | - "description": " id" | ||
6818 | - }, | ||
6819 | "title": { | 7151 | "title": { |
6820 | "type": "string", | 7152 | "type": "string", |
6821 | - "description": " 标题" | ||
6822 | - }, | ||
6823 | - "authorId": { | ||
6824 | - "type": "integer", | ||
6825 | - "format": "int64", | ||
6826 | - "description": " 发布人id" | 7153 | + "description": "标题" |
6827 | }, | 7154 | }, |
6828 | - "author": { | ||
6829 | - "$ref": "#/definitions/ArticleAuthor", | ||
6830 | - "description": " 发布人" | 7155 | + "content": { |
7156 | + "type": "string", | ||
7157 | + "description": "文章的文本内容" | ||
6831 | }, | 7158 | }, |
6832 | - "createdAt": { | 7159 | + "authorId": { |
6833 | "type": "integer", | 7160 | "type": "integer", |
6834 | "format": "int64", | 7161 | "format": "int64", |
6835 | - "description": " 文章的发布时间" | 7162 | + "description": "发布人id" |
6836 | }, | 7163 | }, |
6837 | - "section": { | 7164 | + "images": { |
6838 | "type": "array", | 7165 | "type": "array", |
6839 | "items": { | 7166 | "items": { |
6840 | - "$ref": "#/definitions/ArticleSection" | 7167 | + "type": "string" |
7168 | + }, | ||
7169 | + "description": "图片" | ||
7170 | + }, | ||
7171 | + "video": { | ||
7172 | + "type": "array", | ||
7173 | + "items": { | ||
7174 | + "$ref": "#/definitions/Video" | ||
7175 | + }, | ||
7176 | + "description": " 视频" | ||
7177 | + }, | ||
7178 | + "targetUser": { | ||
7179 | + "type": "integer", | ||
7180 | + "format": "int32", | ||
7181 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7182 | + }, | ||
7183 | + "whoRead": { | ||
7184 | + "type": "array", | ||
7185 | + "items": { | ||
7186 | + "type": "integer", | ||
7187 | + "format": "int64" | ||
7188 | + }, | ||
7189 | + "description": "谁可查看" | ||
7190 | + }, | ||
7191 | + "whoReview": { | ||
7192 | + "type": "array", | ||
7193 | + "items": { | ||
7194 | + "type": "integer", | ||
7195 | + "format": "int64" | ||
7196 | + }, | ||
7197 | + "description": "谁可评论" | ||
7198 | + }, | ||
7199 | + "matchUrl": { | ||
7200 | + "type": "object", | ||
7201 | + "description": " 匹配文章内容中的url文本" | ||
7202 | + } | ||
7203 | + }, | ||
7204 | + "title": "SystemArticleCreateResponse", | ||
7205 | + "required": [ | ||
7206 | + "id", | ||
7207 | + "title", | ||
7208 | + "content", | ||
7209 | + "targetUser", | ||
7210 | + "matchUrl" | ||
7211 | + ] | ||
7212 | + }, | ||
7213 | + "SystemArticleDeleteRequest": { | ||
7214 | + "type": "object", | ||
7215 | + "properties": { | ||
7216 | + "id": { | ||
7217 | + "type": "integer", | ||
7218 | + "format": "int64", | ||
7219 | + "description": "id" | ||
7220 | + } | ||
7221 | + }, | ||
7222 | + "title": "SystemArticleDeleteRequest", | ||
7223 | + "required": [ | ||
7224 | + "id" | ||
7225 | + ] | ||
7226 | + }, | ||
7227 | + "SystemArticleDeleteResponse": { | ||
7228 | + "type": "object", | ||
7229 | + "properties": { | ||
7230 | + "id": { | ||
7231 | + "type": "integer", | ||
7232 | + "format": "int64", | ||
7233 | + "description": "id" | ||
7234 | + }, | ||
7235 | + "title": { | ||
7236 | + "type": "string", | ||
7237 | + "description": "标题" | ||
7238 | + }, | ||
7239 | + "authorId": { | ||
7240 | + "type": "integer", | ||
7241 | + "format": "int64", | ||
7242 | + "description": "发布人id" | ||
7243 | + } | ||
7244 | + }, | ||
7245 | + "title": "SystemArticleDeleteResponse", | ||
7246 | + "required": [ | ||
7247 | + "id", | ||
7248 | + "title" | ||
7249 | + ] | ||
7250 | + }, | ||
7251 | + "SystemArticleDeletedRestoreRequest": { | ||
7252 | + "type": "object", | ||
7253 | + "properties": { | ||
7254 | + "id": { | ||
7255 | + "type": "integer", | ||
7256 | + "format": "int64", | ||
7257 | + "description": "ID" | ||
7258 | + } | ||
7259 | + }, | ||
7260 | + "title": "SystemArticleDeletedRestoreRequest", | ||
7261 | + "required": [ | ||
7262 | + "id" | ||
7263 | + ] | ||
7264 | + }, | ||
7265 | + "SystemArticleDeletedRestoreResponse": { | ||
7266 | + "type": "object", | ||
7267 | + "properties": { | ||
7268 | + "id": { | ||
7269 | + "type": "integer", | ||
7270 | + "format": "int64", | ||
7271 | + "description": "ID" | ||
7272 | + }, | ||
7273 | + "title": { | ||
7274 | + "type": "string", | ||
7275 | + "description": "标题" | ||
7276 | + }, | ||
7277 | + "authorId": { | ||
7278 | + "type": "integer", | ||
7279 | + "format": "int64", | ||
7280 | + "description": "发布人id" | ||
7281 | + } | ||
7282 | + }, | ||
7283 | + "title": "SystemArticleDeletedRestoreResponse", | ||
7284 | + "required": [ | ||
7285 | + "id", | ||
7286 | + "title", | ||
7287 | + "authorId" | ||
7288 | + ] | ||
7289 | + }, | ||
7290 | + "SystemArticleDraftCreateRequest": { | ||
7291 | + "type": "object", | ||
7292 | + "properties": { | ||
7293 | + "title": { | ||
7294 | + "type": "string", | ||
7295 | + "description": "标题" | ||
7296 | + }, | ||
7297 | + "content": { | ||
7298 | + "type": "string", | ||
7299 | + "description": "文章的文本内容" | ||
7300 | + }, | ||
7301 | + "authorId": { | ||
7302 | + "type": "integer", | ||
7303 | + "format": "int64", | ||
7304 | + "description": "发布人id" | ||
7305 | + }, | ||
7306 | + "images": { | ||
7307 | + "type": "array", | ||
7308 | + "items": { | ||
7309 | + "type": "string" | ||
7310 | + }, | ||
7311 | + "description": "图片" | ||
7312 | + }, | ||
7313 | + "video": { | ||
7314 | + "type": "array", | ||
7315 | + "items": { | ||
7316 | + "$ref": "#/definitions/Video" | ||
7317 | + }, | ||
7318 | + "description": " 视频" | ||
7319 | + }, | ||
7320 | + "targetUser": { | ||
7321 | + "type": "integer", | ||
7322 | + "format": "int32", | ||
7323 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7324 | + }, | ||
7325 | + "whoRead": { | ||
7326 | + "type": "array", | ||
7327 | + "items": { | ||
7328 | + "type": "integer", | ||
7329 | + "format": "int64" | ||
7330 | + }, | ||
7331 | + "description": "谁可查看" | ||
7332 | + }, | ||
7333 | + "whoReview": { | ||
7334 | + "type": "array", | ||
7335 | + "items": { | ||
7336 | + "type": "integer", | ||
7337 | + "format": "int64" | ||
7338 | + }, | ||
7339 | + "description": "谁可评论" | ||
7340 | + }, | ||
7341 | + "matchUrl": { | ||
7342 | + "type": "object", | ||
7343 | + "description": " 匹配文章内容中的url文本" | ||
7344 | + }, | ||
7345 | + "tags": { | ||
7346 | + "type": "array", | ||
7347 | + "items": { | ||
7348 | + "type": "integer", | ||
7349 | + "format": "int64" | ||
7350 | + }, | ||
7351 | + "description": " 标签" | ||
7352 | + }, | ||
7353 | + "AccessToken": { | ||
7354 | + "type": "string", | ||
7355 | + "description": " 授权token" | ||
7356 | + } | ||
7357 | + }, | ||
7358 | + "title": "SystemArticleDraftCreateRequest", | ||
7359 | + "required": [ | ||
7360 | + "title", | ||
7361 | + "content", | ||
7362 | + "authorId", | ||
7363 | + "targetUser", | ||
7364 | + "tags", | ||
7365 | + "x-mmm-accesstoken" | ||
7366 | + ] | ||
7367 | + }, | ||
7368 | + "SystemArticleDraftCreateResponse": { | ||
7369 | + "type": "object", | ||
7370 | + "properties": { | ||
7371 | + "id": { | ||
7372 | + "type": "integer", | ||
7373 | + "format": "int64", | ||
7374 | + "description": "ID" | ||
7375 | + }, | ||
7376 | + "title": { | ||
7377 | + "type": "string", | ||
7378 | + "description": "标题" | ||
7379 | + }, | ||
7380 | + "content": { | ||
7381 | + "type": "string", | ||
7382 | + "description": "文章的文本内容" | ||
7383 | + }, | ||
7384 | + "authorId": { | ||
7385 | + "type": "integer", | ||
7386 | + "format": "int64", | ||
7387 | + "description": "发布人id" | ||
7388 | + }, | ||
7389 | + "images": { | ||
7390 | + "type": "array", | ||
7391 | + "items": { | ||
7392 | + "type": "string" | ||
7393 | + }, | ||
7394 | + "description": "图片" | ||
7395 | + }, | ||
7396 | + "video": { | ||
7397 | + "type": "array", | ||
7398 | + "items": { | ||
7399 | + "$ref": "#/definitions/Video" | ||
7400 | + }, | ||
7401 | + "description": " 视频" | ||
7402 | + }, | ||
7403 | + "targetUser": { | ||
7404 | + "type": "integer", | ||
7405 | + "format": "int32", | ||
7406 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7407 | + }, | ||
7408 | + "whoRead": { | ||
7409 | + "type": "array", | ||
7410 | + "items": { | ||
7411 | + "type": "integer", | ||
7412 | + "format": "int64" | ||
7413 | + }, | ||
7414 | + "description": "谁可查看" | ||
7415 | + }, | ||
7416 | + "whoReview": { | ||
7417 | + "type": "array", | ||
7418 | + "items": { | ||
7419 | + "type": "integer", | ||
7420 | + "format": "int64" | ||
7421 | + }, | ||
7422 | + "description": "谁可评论" | ||
7423 | + }, | ||
7424 | + "matchUrl": { | ||
7425 | + "type": "object", | ||
7426 | + "description": " 匹配文章内容中的url文本" | ||
7427 | + }, | ||
7428 | + "tags": { | ||
7429 | + "type": "array", | ||
7430 | + "items": { | ||
7431 | + "type": "integer", | ||
7432 | + "format": "int64" | ||
7433 | + }, | ||
7434 | + "description": " 标签" | ||
7435 | + } | ||
7436 | + }, | ||
7437 | + "title": "SystemArticleDraftCreateResponse", | ||
7438 | + "required": [ | ||
7439 | + "id", | ||
7440 | + "title", | ||
7441 | + "content", | ||
7442 | + "authorId", | ||
7443 | + "targetUser", | ||
7444 | + "tags" | ||
7445 | + ] | ||
7446 | + }, | ||
7447 | + "SystemArticleDraftDeleteRequest": { | ||
7448 | + "type": "object", | ||
7449 | + "properties": { | ||
7450 | + "id": { | ||
7451 | + "type": "integer", | ||
7452 | + "format": "int64", | ||
7453 | + "description": "ID" | ||
7454 | + } | ||
7455 | + }, | ||
7456 | + "title": "SystemArticleDraftDeleteRequest", | ||
7457 | + "required": [ | ||
7458 | + "id" | ||
7459 | + ] | ||
7460 | + }, | ||
7461 | + "SystemArticleDraftDeleteResponse": { | ||
7462 | + "type": "object", | ||
7463 | + "properties": { | ||
7464 | + "id": { | ||
7465 | + "type": "integer", | ||
7466 | + "format": "int64", | ||
7467 | + "description": "ID" | ||
7468 | + }, | ||
7469 | + "title": { | ||
7470 | + "type": "string", | ||
7471 | + "description": "标题" | ||
7472 | + }, | ||
7473 | + "content": { | ||
7474 | + "type": "string", | ||
7475 | + "description": "文章的文本内容" | ||
7476 | + }, | ||
7477 | + "authorId": { | ||
7478 | + "type": "integer", | ||
7479 | + "format": "int64", | ||
7480 | + "description": "发布人id" | ||
7481 | + }, | ||
7482 | + "images": { | ||
7483 | + "type": "array", | ||
7484 | + "items": { | ||
7485 | + "type": "string" | ||
7486 | + }, | ||
7487 | + "description": "图片" | ||
7488 | + }, | ||
7489 | + "video": { | ||
7490 | + "type": "array", | ||
7491 | + "items": { | ||
7492 | + "$ref": "#/definitions/Video" | ||
7493 | + }, | ||
7494 | + "description": " 视频" | ||
7495 | + }, | ||
7496 | + "targetUser": { | ||
7497 | + "type": "integer", | ||
7498 | + "format": "int32", | ||
7499 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7500 | + }, | ||
7501 | + "whoRead": { | ||
7502 | + "type": "array", | ||
7503 | + "items": { | ||
7504 | + "type": "integer", | ||
7505 | + "format": "int64" | ||
7506 | + }, | ||
7507 | + "description": "谁可查看" | ||
7508 | + }, | ||
7509 | + "whoReview": { | ||
7510 | + "type": "array", | ||
7511 | + "items": { | ||
7512 | + "type": "integer", | ||
7513 | + "format": "int64" | ||
7514 | + }, | ||
7515 | + "description": "谁可评论" | ||
7516 | + }, | ||
7517 | + "matchUrl": { | ||
7518 | + "type": "object", | ||
7519 | + "description": " 匹配文章内容中的url文本" | ||
7520 | + }, | ||
7521 | + "tags": { | ||
7522 | + "type": "array", | ||
7523 | + "items": { | ||
7524 | + "type": "integer", | ||
7525 | + "format": "int64" | ||
7526 | + }, | ||
7527 | + "description": " 标签" | ||
7528 | + } | ||
7529 | + }, | ||
7530 | + "title": "SystemArticleDraftDeleteResponse", | ||
7531 | + "required": [ | ||
7532 | + "id", | ||
7533 | + "title", | ||
7534 | + "content", | ||
7535 | + "authorId", | ||
7536 | + "targetUser", | ||
7537 | + "tags" | ||
7538 | + ] | ||
7539 | + }, | ||
7540 | + "SystemArticleDraftGetRequest": { | ||
7541 | + "type": "object", | ||
7542 | + "properties": { | ||
7543 | + "id": { | ||
7544 | + "type": "integer", | ||
7545 | + "format": "int64", | ||
7546 | + "description": "id" | ||
7547 | + }, | ||
7548 | + "": { | ||
7549 | + "type": "integer", | ||
7550 | + "format": "int64", | ||
7551 | + "description": "公司ID(前端不传)" | ||
7552 | + } | ||
7553 | + }, | ||
7554 | + "title": "SystemArticleDraftGetRequest", | ||
7555 | + "required": [ | ||
7556 | + "id" | ||
7557 | + ] | ||
7558 | + }, | ||
7559 | + "SystemArticleDraftGetResponse": { | ||
7560 | + "type": "object", | ||
7561 | + "properties": { | ||
7562 | + "id": { | ||
7563 | + "type": "integer", | ||
7564 | + "format": "int64", | ||
7565 | + "description": "ID" | ||
7566 | + }, | ||
7567 | + "title": { | ||
7568 | + "type": "string", | ||
7569 | + "description": "标题" | ||
7570 | + }, | ||
7571 | + "content": { | ||
7572 | + "type": "string", | ||
7573 | + "description": "文章的文本内容" | ||
7574 | + }, | ||
7575 | + "authorId": { | ||
7576 | + "type": "integer", | ||
7577 | + "format": "int64", | ||
7578 | + "description": "发布人id" | ||
7579 | + }, | ||
7580 | + "images": { | ||
7581 | + "type": "array", | ||
7582 | + "items": { | ||
7583 | + "type": "string" | ||
7584 | + }, | ||
7585 | + "description": "图片" | ||
7586 | + }, | ||
7587 | + "video": { | ||
7588 | + "type": "array", | ||
7589 | + "items": { | ||
7590 | + "$ref": "#/definitions/Video" | ||
7591 | + }, | ||
7592 | + "description": " 视频" | ||
7593 | + }, | ||
7594 | + "targetUser": { | ||
7595 | + "type": "integer", | ||
7596 | + "format": "int32", | ||
7597 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7598 | + }, | ||
7599 | + "whoRead": { | ||
7600 | + "type": "array", | ||
7601 | + "items": { | ||
7602 | + "type": "integer", | ||
7603 | + "format": "int64" | ||
7604 | + }, | ||
7605 | + "description": "谁可查看" | ||
7606 | + }, | ||
7607 | + "whoReview": { | ||
7608 | + "type": "array", | ||
7609 | + "items": { | ||
7610 | + "type": "integer", | ||
7611 | + "format": "int64" | ||
7612 | + }, | ||
7613 | + "description": "谁可评论" | ||
7614 | + }, | ||
7615 | + "matchUrl": { | ||
7616 | + "type": "object", | ||
7617 | + "description": " 匹配文章内容中的url文本" | ||
7618 | + }, | ||
7619 | + "tags": { | ||
7620 | + "type": "array", | ||
7621 | + "items": { | ||
7622 | + "type": "integer", | ||
7623 | + "format": "int64" | ||
7624 | + }, | ||
7625 | + "description": " 标签" | ||
7626 | + } | ||
7627 | + }, | ||
7628 | + "title": "SystemArticleDraftGetResponse", | ||
7629 | + "required": [ | ||
7630 | + "id", | ||
7631 | + "title", | ||
7632 | + "content", | ||
7633 | + "authorId", | ||
7634 | + "targetUser", | ||
7635 | + "tags" | ||
7636 | + ] | ||
7637 | + }, | ||
7638 | + "SystemArticleDraftSearch": { | ||
7639 | + "type": "object", | ||
7640 | + "properties": { | ||
7641 | + "id": { | ||
7642 | + "type": "integer", | ||
7643 | + "format": "int64", | ||
7644 | + "description": "ID" | ||
7645 | + }, | ||
7646 | + "title": { | ||
7647 | + "type": "string", | ||
7648 | + "description": "标题" | ||
7649 | + }, | ||
7650 | + "images": { | ||
7651 | + "type": "array", | ||
7652 | + "items": { | ||
7653 | + "type": "string" | ||
7654 | + }, | ||
7655 | + "description": "图片" | ||
7656 | + }, | ||
7657 | + "operator": { | ||
7658 | + "type": "string", | ||
7659 | + "description": "操作人" | ||
7660 | + }, | ||
7661 | + "authorId": { | ||
7662 | + "type": "integer", | ||
7663 | + "format": "int64", | ||
7664 | + "description": "发布人id" | ||
7665 | + }, | ||
7666 | + "author": { | ||
7667 | + "type": "string", | ||
7668 | + "description": "发布人" | ||
7669 | + }, | ||
7670 | + "updatedAt": { | ||
7671 | + "type": "integer", | ||
7672 | + "format": "int64", | ||
7673 | + "description": "编辑时间" | ||
7674 | + } | ||
7675 | + }, | ||
7676 | + "title": "SystemArticleDraftSearch", | ||
7677 | + "required": [ | ||
7678 | + "id", | ||
7679 | + "title", | ||
7680 | + "images", | ||
7681 | + "operator", | ||
7682 | + "authorId", | ||
7683 | + "author", | ||
7684 | + "updatedAt" | ||
7685 | + ] | ||
7686 | + }, | ||
7687 | + "SystemArticleDraftSearchRequest": { | ||
7688 | + "type": "object", | ||
7689 | + "properties": { | ||
7690 | + "page": { | ||
7691 | + "type": "integer", | ||
7692 | + "format": "int32", | ||
7693 | + "description": "页码" | ||
7694 | + }, | ||
7695 | + "size": { | ||
7696 | + "type": "integer", | ||
7697 | + "format": "int32", | ||
7698 | + "description": "每页行数" | ||
7699 | + }, | ||
7700 | + "companyId": { | ||
7701 | + "type": "integer", | ||
7702 | + "format": "int64", | ||
7703 | + "description": "公司ID(前端不传)" | ||
7704 | + }, | ||
7705 | + "title": { | ||
7706 | + "type": "string", | ||
7707 | + "description": "标题" | ||
7708 | + }, | ||
7709 | + "operator": { | ||
7710 | + "type": "string", | ||
7711 | + "description": "编辑人" | ||
7712 | + }, | ||
7713 | + "beginTime": { | ||
7714 | + "type": "integer", | ||
7715 | + "format": "int64", | ||
7716 | + "description": "开始时间" | ||
7717 | + }, | ||
7718 | + "endTime": { | ||
7719 | + "type": "integer", | ||
7720 | + "format": "int64", | ||
7721 | + "description": "结束时间" | ||
7722 | + } | ||
7723 | + }, | ||
7724 | + "title": "SystemArticleDraftSearchRequest", | ||
7725 | + "required": [ | ||
7726 | + "page", | ||
7727 | + "size" | ||
7728 | + ] | ||
7729 | + }, | ||
7730 | + "SystemArticleDraftSearchResponse": { | ||
7731 | + "type": "object", | ||
7732 | + "properties": { | ||
7733 | + "total": { | ||
7734 | + "type": "integer", | ||
7735 | + "format": "int32" | ||
7736 | + }, | ||
7737 | + "list": { | ||
7738 | + "type": "array", | ||
7739 | + "items": { | ||
7740 | + "$ref": "#/definitions/SystemArticleDraftSearch" | ||
7741 | + } | ||
7742 | + } | ||
7743 | + }, | ||
7744 | + "title": "SystemArticleDraftSearchResponse", | ||
7745 | + "required": [ | ||
7746 | + "total", | ||
7747 | + "list" | ||
7748 | + ] | ||
7749 | + }, | ||
7750 | + "SystemArticleDraftUpdateRequest": { | ||
7751 | + "type": "object", | ||
7752 | + "properties": { | ||
7753 | + "id": { | ||
7754 | + "type": "integer", | ||
7755 | + "format": "int64", | ||
7756 | + "description": " ID" | ||
7757 | + }, | ||
7758 | + "title": { | ||
7759 | + "type": "string", | ||
7760 | + "description": "标题" | ||
7761 | + }, | ||
7762 | + "content": { | ||
7763 | + "type": "string", | ||
7764 | + "description": "文章的文本内容" | ||
7765 | + }, | ||
7766 | + "authorId": { | ||
7767 | + "type": "integer", | ||
7768 | + "format": "int64", | ||
7769 | + "description": "发布人id" | ||
7770 | + }, | ||
7771 | + "images": { | ||
7772 | + "type": "array", | ||
7773 | + "items": { | ||
7774 | + "type": "string" | ||
7775 | + }, | ||
7776 | + "description": "图片" | ||
7777 | + }, | ||
7778 | + "video": { | ||
7779 | + "type": "array", | ||
7780 | + "items": { | ||
7781 | + "$ref": "#/definitions/Video" | ||
7782 | + }, | ||
7783 | + "description": " 视频" | ||
7784 | + }, | ||
7785 | + "targetUser": { | ||
7786 | + "type": "integer", | ||
7787 | + "format": "int32", | ||
7788 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7789 | + }, | ||
7790 | + "whoRead": { | ||
7791 | + "type": "array", | ||
7792 | + "items": { | ||
7793 | + "type": "integer", | ||
7794 | + "format": "int64" | ||
7795 | + }, | ||
7796 | + "description": "谁可查看" | ||
7797 | + }, | ||
7798 | + "whoReview": { | ||
7799 | + "type": "array", | ||
7800 | + "items": { | ||
7801 | + "type": "integer", | ||
7802 | + "format": "int64" | ||
7803 | + }, | ||
7804 | + "description": "谁可评论" | ||
7805 | + }, | ||
7806 | + "matchUrl": { | ||
7807 | + "type": "object", | ||
7808 | + "description": " 匹配文章内容中的url文本" | ||
7809 | + }, | ||
7810 | + "tags": { | ||
7811 | + "type": "array", | ||
7812 | + "items": { | ||
7813 | + "type": "integer", | ||
7814 | + "format": "int64" | ||
7815 | + }, | ||
7816 | + "description": " 标签" | ||
7817 | + }, | ||
7818 | + "AccessToken": { | ||
7819 | + "type": "string", | ||
7820 | + "description": " 授权token" | ||
7821 | + } | ||
7822 | + }, | ||
7823 | + "title": "SystemArticleDraftUpdateRequest", | ||
7824 | + "required": [ | ||
7825 | + "id", | ||
7826 | + "title", | ||
7827 | + "content", | ||
7828 | + "authorId", | ||
7829 | + "targetUser", | ||
7830 | + "tags", | ||
7831 | + "x-mmm-accesstoken" | ||
7832 | + ] | ||
7833 | + }, | ||
7834 | + "SystemArticleDraftUpdateResponse": { | ||
7835 | + "type": "object", | ||
7836 | + "properties": { | ||
7837 | + "id": { | ||
7838 | + "type": "integer", | ||
7839 | + "format": "int64", | ||
7840 | + "description": "ID" | ||
7841 | + }, | ||
7842 | + "title": { | ||
7843 | + "type": "string", | ||
7844 | + "description": "标题" | ||
7845 | + }, | ||
7846 | + "content": { | ||
7847 | + "type": "string", | ||
7848 | + "description": "文章的文本内容" | ||
7849 | + }, | ||
7850 | + "authorId": { | ||
7851 | + "type": "integer", | ||
7852 | + "format": "int64", | ||
7853 | + "description": "发布人id" | ||
7854 | + }, | ||
7855 | + "images": { | ||
7856 | + "type": "array", | ||
7857 | + "items": { | ||
7858 | + "type": "string" | ||
7859 | + }, | ||
7860 | + "description": "图片" | ||
7861 | + }, | ||
7862 | + "video": { | ||
7863 | + "type": "array", | ||
7864 | + "items": { | ||
7865 | + "$ref": "#/definitions/Video" | ||
7866 | + }, | ||
7867 | + "description": " 视频" | ||
7868 | + }, | ||
7869 | + "targetUser": { | ||
7870 | + "type": "integer", | ||
7871 | + "format": "int32", | ||
7872 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
7873 | + }, | ||
7874 | + "whoRead": { | ||
7875 | + "type": "array", | ||
7876 | + "items": { | ||
7877 | + "type": "integer", | ||
7878 | + "format": "int64" | ||
7879 | + }, | ||
7880 | + "description": "谁可查看" | ||
7881 | + }, | ||
7882 | + "whoReview": { | ||
7883 | + "type": "array", | ||
7884 | + "items": { | ||
7885 | + "type": "integer", | ||
7886 | + "format": "int64" | ||
7887 | + }, | ||
7888 | + "description": "谁可评论" | ||
7889 | + }, | ||
7890 | + "matchUrl": { | ||
7891 | + "type": "object", | ||
7892 | + "description": " 匹配文章内容中的url文本" | ||
7893 | + }, | ||
7894 | + "tags": { | ||
7895 | + "type": "array", | ||
7896 | + "items": { | ||
7897 | + "type": "integer", | ||
7898 | + "format": "int64" | ||
7899 | + }, | ||
7900 | + "description": " 标签" | ||
7901 | + } | ||
7902 | + }, | ||
7903 | + "title": "SystemArticleDraftUpdateResponse", | ||
7904 | + "required": [ | ||
7905 | + "id", | ||
7906 | + "title", | ||
7907 | + "content", | ||
7908 | + "authorId", | ||
7909 | + "targetUser", | ||
7910 | + "tags" | ||
7911 | + ] | ||
7912 | + }, | ||
7913 | + "SystemArticleGetHistoryRequest": { | ||
7914 | + "type": "object", | ||
7915 | + "properties": { | ||
7916 | + "id": { | ||
7917 | + "type": "integer", | ||
7918 | + "format": "int64", | ||
7919 | + "description": "id" | ||
7920 | + }, | ||
7921 | + "": { | ||
7922 | + "type": "integer", | ||
7923 | + "format": "int64" | ||
7924 | + } | ||
7925 | + }, | ||
7926 | + "title": "SystemArticleGetHistoryRequest", | ||
7927 | + "required": [ | ||
7928 | + "id" | ||
7929 | + ] | ||
7930 | + }, | ||
7931 | + "SystemArticleGetHistoryResponse": { | ||
7932 | + "type": "object", | ||
7933 | + "properties": { | ||
7934 | + "id": { | ||
7935 | + "type": "integer", | ||
7936 | + "format": "int64", | ||
7937 | + "description": " id" | ||
7938 | + }, | ||
7939 | + "articleId": { | ||
7940 | + "type": "integer", | ||
7941 | + "format": "int64", | ||
7942 | + "description": " 文章ID" | ||
7943 | + }, | ||
7944 | + "title": { | ||
7945 | + "type": "string", | ||
7946 | + "description": " 标题" | ||
7947 | + }, | ||
7948 | + "createdAt": { | ||
7949 | + "type": "integer", | ||
7950 | + "format": "int64", | ||
7951 | + "description": " 文章的发布时间" | ||
7952 | + }, | ||
7953 | + "section": { | ||
7954 | + "type": "array", | ||
7955 | + "items": { | ||
7956 | + "$ref": "#/definitions/ArticleSection" | ||
7957 | + }, | ||
7958 | + "description": " 文章的文本内容" | ||
7959 | + }, | ||
7960 | + "images": { | ||
7961 | + "type": "array", | ||
7962 | + "items": { | ||
7963 | + "type": "string" | ||
7964 | + }, | ||
7965 | + "description": " 图片" | ||
7966 | + }, | ||
7967 | + "video": { | ||
7968 | + "type": "array", | ||
7969 | + "items": { | ||
7970 | + "$ref": "#/definitions/Video" | ||
7971 | + } | ||
7972 | + }, | ||
7973 | + "whoRead": { | ||
7974 | + "type": "array", | ||
7975 | + "items": { | ||
7976 | + "type": "integer", | ||
7977 | + "format": "int64" | ||
7978 | + }, | ||
7979 | + "description": " 谁可查看" | ||
7980 | + }, | ||
7981 | + "whoReadInfo": { | ||
7982 | + "type": "array", | ||
7983 | + "items": { | ||
7984 | + "$ref": "#/definitions/UserShowName" | ||
7985 | + }, | ||
7986 | + "description": " 谁可查看" | ||
7987 | + }, | ||
7988 | + "whoReview": { | ||
7989 | + "type": "array", | ||
7990 | + "items": { | ||
7991 | + "type": "integer", | ||
7992 | + "format": "int64" | ||
7993 | + }, | ||
7994 | + "description": " 谁可评论" | ||
7995 | + }, | ||
7996 | + "whoReviewInfo": { | ||
7997 | + "type": "array", | ||
7998 | + "items": { | ||
7999 | + "$ref": "#/definitions/UserShowName" | ||
8000 | + }, | ||
8001 | + "description": " 谁可评论" | ||
8002 | + }, | ||
8003 | + "location": { | ||
8004 | + "$ref": "#/definitions/Location", | ||
8005 | + "description": " 定位坐标" | ||
8006 | + }, | ||
8007 | + "targetUser": { | ||
8008 | + "type": "integer", | ||
8009 | + "format": "int32", | ||
8010 | + "description": " 分发方式 [0分发给所有人、1分发给指定的人]" | ||
8011 | + }, | ||
8012 | + "tags": { | ||
8013 | + "type": "array", | ||
8014 | + "items": { | ||
8015 | + "type": "integer", | ||
8016 | + "format": "int64" | ||
8017 | + }, | ||
8018 | + "description": " 标签" | ||
8019 | + } | ||
8020 | + }, | ||
8021 | + "title": "SystemArticleGetHistoryResponse", | ||
8022 | + "required": [ | ||
8023 | + "id", | ||
8024 | + "articleId", | ||
8025 | + "title", | ||
8026 | + "createdAt", | ||
8027 | + "section", | ||
8028 | + "images", | ||
8029 | + "video", | ||
8030 | + "whoRead", | ||
8031 | + "whoReadInfo", | ||
8032 | + "whoReview", | ||
8033 | + "whoReviewInfo", | ||
8034 | + "location", | ||
8035 | + "targetUser", | ||
8036 | + "tags" | ||
8037 | + ] | ||
8038 | + }, | ||
8039 | + "SystemArticleGetRequest": { | ||
8040 | + "type": "object", | ||
8041 | + "properties": { | ||
8042 | + "id": { | ||
8043 | + "type": "integer", | ||
8044 | + "format": "int64", | ||
8045 | + "description": "id" | ||
8046 | + }, | ||
8047 | + "": { | ||
8048 | + "type": "integer", | ||
8049 | + "format": "int64" | ||
8050 | + } | ||
8051 | + }, | ||
8052 | + "title": "SystemArticleGetRequest", | ||
8053 | + "required": [ | ||
8054 | + "id" | ||
8055 | + ] | ||
8056 | + }, | ||
8057 | + "SystemArticleGetResponse": { | ||
8058 | + "type": "object", | ||
8059 | + "properties": { | ||
8060 | + "id": { | ||
8061 | + "type": "integer", | ||
8062 | + "format": "int64", | ||
8063 | + "description": " id" | ||
8064 | + }, | ||
8065 | + "title": { | ||
8066 | + "type": "string", | ||
8067 | + "description": " 标题" | ||
8068 | + }, | ||
8069 | + "authorId": { | ||
8070 | + "type": "integer", | ||
8071 | + "format": "int64", | ||
8072 | + "description": " 发布人id" | ||
8073 | + }, | ||
8074 | + "author": { | ||
8075 | + "$ref": "#/definitions/ArticleAuthor", | ||
8076 | + "description": " 发布人" | ||
8077 | + }, | ||
8078 | + "createdAt": { | ||
8079 | + "type": "integer", | ||
8080 | + "format": "int64", | ||
8081 | + "description": " 文章的发布时间" | ||
8082 | + }, | ||
8083 | + "section": { | ||
8084 | + "type": "array", | ||
8085 | + "items": { | ||
8086 | + "$ref": "#/definitions/ArticleSection" | ||
6841 | }, | 8087 | }, |
6842 | "description": " 文章的文本内容" | 8088 | "description": " 文章的文本内容" |
6843 | }, | 8089 | }, |
@@ -7107,6 +8353,11 @@ | @@ -7107,6 +8353,11 @@ | ||
7107 | "format": "int64", | 8353 | "format": "int64", |
7108 | "description": "文章的创建日期" | 8354 | "description": "文章的创建日期" |
7109 | }, | 8355 | }, |
8356 | + "updatedAt": { | ||
8357 | + "type": "integer", | ||
8358 | + "format": "int64", | ||
8359 | + "description": "文章的编辑日期" | ||
8360 | + }, | ||
7110 | "countLove": { | 8361 | "countLove": { |
7111 | "type": "integer", | 8362 | "type": "integer", |
7112 | "format": "int32", | 8363 | "format": "int32", |
@@ -7133,6 +8384,15 @@ | @@ -7133,6 +8384,15 @@ | ||
7133 | "type": "integer", | 8384 | "type": "integer", |
7134 | "format": "int32", | 8385 | "format": "int32", |
7135 | "description": "分发方式 [0分发给所有人、1分发给指定的人]" | 8386 | "description": "分发方式 [0分发给所有人、1分发给指定的人]" |
8387 | + }, | ||
8388 | + "operator": { | ||
8389 | + "$ref": "#/definitions/Operator", | ||
8390 | + "description": "运营操作人" | ||
8391 | + }, | ||
8392 | + "source": { | ||
8393 | + "type": "integer", | ||
8394 | + "format": "int32", | ||
8395 | + "description": "来源[1用户发布、2运营发布]" | ||
7136 | } | 8396 | } |
7137 | }, | 8397 | }, |
7138 | "title": "SystemArticleSearch", | 8398 | "title": "SystemArticleSearch", |
@@ -7143,11 +8403,134 @@ | @@ -7143,11 +8403,134 @@ | ||
7143 | "author", | 8403 | "author", |
7144 | "images", | 8404 | "images", |
7145 | "createdAt", | 8405 | "createdAt", |
8406 | + "updatedAt", | ||
7146 | "countLove", | 8407 | "countLove", |
7147 | "countComment", | 8408 | "countComment", |
7148 | "show", | 8409 | "show", |
7149 | "tags", | 8410 | "tags", |
7150 | - "targetUser" | 8411 | + "targetUser", |
8412 | + "operator", | ||
8413 | + "source" | ||
8414 | + ] | ||
8415 | + }, | ||
8416 | + "SystemArticleSearchDeletedItem": { | ||
8417 | + "type": "object", | ||
8418 | + "properties": { | ||
8419 | + "id": { | ||
8420 | + "type": "integer", | ||
8421 | + "format": "int64", | ||
8422 | + "description": "ID" | ||
8423 | + }, | ||
8424 | + "title": { | ||
8425 | + "type": "string", | ||
8426 | + "description": "标题" | ||
8427 | + }, | ||
8428 | + "images": { | ||
8429 | + "type": "array", | ||
8430 | + "items": { | ||
8431 | + "type": "string" | ||
8432 | + }, | ||
8433 | + "description": "图片" | ||
8434 | + }, | ||
8435 | + "authorId": { | ||
8436 | + "type": "integer", | ||
8437 | + "format": "int64", | ||
8438 | + "description": "发布人id" | ||
8439 | + }, | ||
8440 | + "author": { | ||
8441 | + "type": "string", | ||
8442 | + "description": "发布人" | ||
8443 | + }, | ||
8444 | + "source": { | ||
8445 | + "type": "integer", | ||
8446 | + "format": "int32", | ||
8447 | + "description": "来源 1-用户发布 2-运营发布" | ||
8448 | + }, | ||
8449 | + "deletedType": { | ||
8450 | + "type": "integer", | ||
8451 | + "format": "int32", | ||
8452 | + "description": "类型 1-运营删除 2-用户删除" | ||
8453 | + }, | ||
8454 | + "deletedAt": { | ||
8455 | + "type": "integer", | ||
8456 | + "format": "int64", | ||
8457 | + "description": "删除时间" | ||
8458 | + } | ||
8459 | + }, | ||
8460 | + "title": "SystemArticleSearchDeletedItem", | ||
8461 | + "required": [ | ||
8462 | + "id", | ||
8463 | + "title", | ||
8464 | + "images", | ||
8465 | + "authorId", | ||
8466 | + "author", | ||
8467 | + "source", | ||
8468 | + "deletedType", | ||
8469 | + "deletedAt" | ||
8470 | + ] | ||
8471 | + }, | ||
8472 | + "SystemArticleSearchDeletedRequest": { | ||
8473 | + "type": "object", | ||
8474 | + "properties": { | ||
8475 | + "page": { | ||
8476 | + "type": "integer", | ||
8477 | + "format": "int32", | ||
8478 | + "description": "页码" | ||
8479 | + }, | ||
8480 | + "size": { | ||
8481 | + "type": "integer", | ||
8482 | + "format": "int32", | ||
8483 | + "description": "每页行数" | ||
8484 | + }, | ||
8485 | + "title": { | ||
8486 | + "type": "string", | ||
8487 | + "description": "标题" | ||
8488 | + }, | ||
8489 | + "author": { | ||
8490 | + "type": "integer", | ||
8491 | + "format": "int64", | ||
8492 | + "description": "发布人" | ||
8493 | + }, | ||
8494 | + "deletedType": { | ||
8495 | + "type": "integer", | ||
8496 | + "format": "int32", | ||
8497 | + "description": "类型 1-运营删除 2-用户删除" | ||
8498 | + }, | ||
8499 | + "beginTime": { | ||
8500 | + "type": "integer", | ||
8501 | + "format": "int64", | ||
8502 | + "description": "开始时间" | ||
8503 | + }, | ||
8504 | + "endTime": { | ||
8505 | + "type": "integer", | ||
8506 | + "format": "int64", | ||
8507 | + "description": "结束时间" | ||
8508 | + } | ||
8509 | + }, | ||
8510 | + "title": "SystemArticleSearchDeletedRequest", | ||
8511 | + "required": [ | ||
8512 | + "page", | ||
8513 | + "size" | ||
8514 | + ] | ||
8515 | + }, | ||
8516 | + "SystemArticleSearchDeletedResponse": { | ||
8517 | + "type": "object", | ||
8518 | + "properties": { | ||
8519 | + "total": { | ||
8520 | + "type": "integer", | ||
8521 | + "format": "int32" | ||
8522 | + }, | ||
8523 | + "list": { | ||
8524 | + "type": "array", | ||
8525 | + "items": { | ||
8526 | + "$ref": "#/definitions/SystemArticleSearchDeletedItem" | ||
8527 | + } | ||
8528 | + } | ||
8529 | + }, | ||
8530 | + "title": "SystemArticleSearchDeletedResponse", | ||
8531 | + "required": [ | ||
8532 | + "total", | ||
8533 | + "list" | ||
7151 | ] | 8534 | ] |
7152 | }, | 8535 | }, |
7153 | "SystemArticleSearchMeRequest": { | 8536 | "SystemArticleSearchMeRequest": { |
@@ -7247,6 +8630,10 @@ | @@ -7247,6 +8630,10 @@ | ||
7247 | "type": "integer", | 8630 | "type": "integer", |
7248 | "format": "int32", | 8631 | "format": "int32", |
7249 | "description": "每页行数" | 8632 | "description": "每页行数" |
8633 | + }, | ||
8634 | + "orderMode": { | ||
8635 | + "type": "string", | ||
8636 | + "description": "排序方式" | ||
7250 | } | 8637 | } |
7251 | }, | 8638 | }, |
7252 | "title": "SystemArticleSearchRequest", | 8639 | "title": "SystemArticleSearchRequest", |
@@ -7353,7 +8740,6 @@ | @@ -7353,7 +8740,6 @@ | ||
7353 | "title": "SystemArticleUpdateRequest", | 8740 | "title": "SystemArticleUpdateRequest", |
7354 | "required": [ | 8741 | "required": [ |
7355 | "id", | 8742 | "id", |
7356 | - "template", | ||
7357 | "section", | 8743 | "section", |
7358 | "title", | 8744 | "title", |
7359 | "images", | 8745 | "images", |
@@ -121,4 +121,40 @@ service Core { | @@ -121,4 +121,40 @@ service Core { | ||
121 | @doc "管理后台文章恢复" | 121 | @doc "管理后台文章恢复" |
122 | @handler SystemArticleRestore | 122 | @handler SystemArticleRestore |
123 | post /article/restore (SystemArticleRestoreRequest) returns (SystemArticleRestoreResponse) | 123 | post /article/restore (SystemArticleRestoreRequest) returns (SystemArticleRestoreResponse) |
124 | + | ||
125 | + @doc "管理后台删除文章" | ||
126 | + @handler SystemDeleteArticle | ||
127 | + delete /article (SystemArticleDeleteRequest) returns (SystemArticleDeleteResponse) | ||
128 | + | ||
129 | + @doc "管理后台新增文章" | ||
130 | + @handler SystemCreateArticle | ||
131 | + post /article (SystemArticleCreateRequest) returns (SystemArticleCreateResponse) | ||
132 | + | ||
133 | + @doc "管理后台新增草稿" | ||
134 | + @handler SystemCreateArticleDraft | ||
135 | + post /article/draft (SystemArticleDraftCreateRequest) returns (SystemArticleDraftCreateResponse) | ||
136 | + | ||
137 | + @doc "管理后台编辑草稿" | ||
138 | + @handler SystemUpdateArticleDraft | ||
139 | + put /article/draft (SystemArticleDraftUpdateRequest) returns (SystemArticleDraftUpdateResponse) | ||
140 | + | ||
141 | + @doc "管理后台草稿列表" | ||
142 | + @handler SystemSearchArticleDraft | ||
143 | + post /article/draft/search (SystemArticleDraftSearchRequest) returns (SystemArticleDraftSearchResponse) | ||
144 | + | ||
145 | + @doc "管理后台删除草稿" | ||
146 | + @handler SystemDeleteArticleDraft | ||
147 | + delete /article/draft (SystemArticleDraftDeleteRequest) returns (SystemArticleDraftDeleteResponse) | ||
148 | + | ||
149 | + @doc "管理后台获取草稿" | ||
150 | + @handler SystemGetArticleDraft | ||
151 | + get /article/draft/:id (SystemArticleDraftGetRequest) returns (SystemArticleDraftGetResponse) | ||
152 | + | ||
153 | + @doc "管理后台已删除列表" | ||
154 | + @handler SystemArticleSearchDeleted | ||
155 | + post /article/deleted/list (SystemArticleSearchDeletedRequest) returns (SystemArticleSearchDeletedResponse) | ||
156 | + | ||
157 | + @doc "管理后台文章删除恢复" | ||
158 | + @handler SystemRestoreArticleDeleted | ||
159 | + put /article/deleted/restore (SystemArticleDeletedRestoreRequest) returns (SystemArticleDeletedRestoreResponse) | ||
124 | } | 160 | } |
@@ -25,6 +25,11 @@ type ArticleAuthor { | @@ -25,6 +25,11 @@ type ArticleAuthor { | ||
25 | Company string `json:"company"` // 公司 | 25 | Company string `json:"company"` // 公司 |
26 | } | 26 | } |
27 | 27 | ||
28 | +type Operator { | ||
29 | + Id int64 `json:"id,string"`// 人员id | ||
30 | + Name string `json:"name"` // 人员的名字 | ||
31 | +} | ||
32 | + | ||
28 | //小程序端创建发布文章 | 33 | //小程序端创建发布文章 |
29 | type ( | 34 | type ( |
30 | MiniArticleCreateRequest { | 35 | MiniArticleCreateRequest { |
@@ -431,11 +436,14 @@ type ( | @@ -431,11 +436,14 @@ type ( | ||
431 | Author string `json:"author"` //发布人 | 436 | Author string `json:"author"` //发布人 |
432 | Images []string `json:"images"` //图片 | 437 | Images []string `json:"images"` //图片 |
433 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 438 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
439 | + UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 | ||
434 | CountLove int `json:"countLove"` //点赞数量 | 440 | CountLove int `json:"countLove"` //点赞数量 |
435 | CountComment int `json:"countComment"` //评论数量 | 441 | CountComment int `json:"countComment"` //评论数量 |
436 | Show int `json:"show"` //是否隐藏 [0显示、1不显示] | 442 | Show int `json:"show"` //是否隐藏 [0显示、1不显示] |
437 | Tags []string `json:"tags"` //标签 | 443 | Tags []string `json:"tags"` //标签 |
438 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 444 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
445 | + Operator Operator `json:"operator"` //运营操作人 | ||
446 | + Source int `json:"source"` //来源[1用户发布、2运营发布] | ||
439 | } | 447 | } |
440 | ) | 448 | ) |
441 | // 管理后台编辑文章 | 449 | // 管理后台编辑文章 |
@@ -469,6 +477,45 @@ type ( | @@ -469,6 +477,45 @@ type ( | ||
469 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 477 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
470 | } | 478 | } |
471 | ) | 479 | ) |
480 | +// 管理后台新增文章 | ||
481 | +type ( | ||
482 | + SystemArticleCreateRequest { | ||
483 | + Title string `json:"title"` //标题 | ||
484 | + Content string `json:"content"` //文章的文本内容 | ||
485 | + AuthorId int64 `json:"authorId"` //发布人id | ||
486 | + Images []string `json:"images,optional"` //图片 | ||
487 | + Videos []Video `json:"video,optional"` // 视频 | ||
488 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
489 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
490 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
491 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
492 | + ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID | ||
493 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
494 | + } | ||
495 | + SystemArticleCreateResponse { | ||
496 | + Id int64 `json:"id"` //id | ||
497 | + Title string `json:"title"` //标题 | ||
498 | + Content string `json:"content"` //文章的文本内容 | ||
499 | + AuthorId int64 `json:"authorId,optional"` //发布人id | ||
500 | + Images []string `json:"images,optional"` //图片 | ||
501 | + Videos []Video `json:"video,optional"` // 视频 | ||
502 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
503 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
504 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
505 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
506 | + } | ||
507 | +) | ||
508 | +//管理后台删除文章 | ||
509 | +type ( | ||
510 | + SystemArticleDeleteRequest { | ||
511 | + Id int64 `json:"id"` //id | ||
512 | + } | ||
513 | + SystemArticleDeleteResponse { | ||
514 | + Id int64 `json:"id"` //id | ||
515 | + Title string `json:"title"` //标题 | ||
516 | + AuthorId int64 `json:"authorId,optional"` //发布人id | ||
517 | + } | ||
518 | +) | ||
472 | // 管理后台编辑历史列表 | 519 | // 管理后台编辑历史列表 |
473 | type ( | 520 | type ( |
474 | //历史 | 521 | //历史 |
@@ -578,4 +625,171 @@ type ( | @@ -578,4 +625,171 @@ type ( | ||
578 | CreatedAt int64 `json:"createdAt"` | 625 | CreatedAt int64 `json:"createdAt"` |
579 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 626 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
580 | } | 627 | } |
628 | +) | ||
629 | + | ||
630 | +//后台新增文章草稿 | ||
631 | +type ( | ||
632 | + SystemArticleDraftCreateRequest { | ||
633 | + Title string `json:"title"` //标题 | ||
634 | + Content string `json:"content"` //文章的文本内容 | ||
635 | + AuthorId int64 `json:"authorId"` //发布人id | ||
636 | + Images []string `json:"images,optional"` //图片 | ||
637 | + Videos []Video `json:"video,optional"` // 视频 | ||
638 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
639 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
640 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
641 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
642 | + Tags []int64 `json:"tags"` // 标签 | ||
643 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
644 | + } | ||
645 | + SystemArticleDraftCreateResponse { | ||
646 | + Id int64 `json:"id"` //ID | ||
647 | + Title string `json:"title"` //标题 | ||
648 | + Content string `json:"content"` //文章的文本内容 | ||
649 | + AuthorId int64 `json:"authorId"` //发布人id | ||
650 | + Images []string `json:"images,optional"` //图片 | ||
651 | + Videos []Video `json:"video,optional"` // 视频 | ||
652 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
653 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
654 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
655 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
656 | + Tags []int64 `json:"tags"` // 标签 | ||
657 | + } | ||
658 | +) | ||
659 | + | ||
660 | +//后台编辑文章草稿 | ||
661 | +type ( | ||
662 | + SystemArticleDraftUpdateRequest { | ||
663 | + Id int64 `json:"id"` // ID | ||
664 | + Title string `json:"title"` //标题 | ||
665 | + Content string `json:"content"` //文章的文本内容 | ||
666 | + AuthorId int64 `json:"authorId"` //发布人id | ||
667 | + Images []string `json:"images,optional"` //图片 | ||
668 | + Videos []Video `json:"video,optional"` // 视频 | ||
669 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
670 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
671 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
672 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
673 | + Tags []int64 `json:"tags"` // 标签 | ||
674 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
675 | + } | ||
676 | + SystemArticleDraftUpdateResponse { | ||
677 | + Id int64 `json:"id"` //ID | ||
678 | + Title string `json:"title"` //标题 | ||
679 | + Content string `json:"content"` //文章的文本内容 | ||
680 | + AuthorId int64 `json:"authorId"` //发布人id | ||
681 | + Images []string `json:"images,optional"` //图片 | ||
682 | + Videos []Video `json:"video,optional"` // 视频 | ||
683 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
684 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
685 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
686 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
687 | + Tags []int64 `json:"tags"` // 标签 | ||
688 | + } | ||
689 | +) | ||
690 | + | ||
691 | +//管理后台文章草稿列表 | ||
692 | +type ( | ||
693 | + SystemArticleDraftSearchRequest { | ||
694 | + Page int `json:"page"` //页码 | ||
695 | + Size int `json:"size"` //每页行数 | ||
696 | + CompanyId int64 `json:"companyId,optional"` //公司ID(前端不传) | ||
697 | + Title string `json:"title,optional"` //标题 | ||
698 | + Operator string `json:"operator,optional"` //编辑人 | ||
699 | + BeginTime int64 `json:"beginTime,optional"`//开始时间 | ||
700 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
701 | + } | ||
702 | + SystemArticleDraftSearchResponse { | ||
703 | + Total int `json:"total"` | ||
704 | + List []SystemArticleDraftSearch `json:"list"` | ||
705 | + } | ||
706 | + SystemArticleDraftSearch { | ||
707 | + Id int64 `json:"id"` //ID | ||
708 | + Title string `json:"title"` //标题 | ||
709 | + Images []string `json:"images"` //图片 | ||
710 | + Operator string `json:"operator"` //操作人 | ||
711 | + AuthorId int64 `json:"authorId"` //发布人id | ||
712 | + Author string `json:"author"` //发布人 | ||
713 | + UpdatedAt int64 `json:"updatedAt"` //编辑时间 | ||
714 | + } | ||
715 | +) | ||
716 | + | ||
717 | +//管理后台删除草稿 | ||
718 | +type ( | ||
719 | + SystemArticleDraftDeleteRequest { | ||
720 | + Id int64 `json:"id"` //ID | ||
721 | + } | ||
722 | + SystemArticleDraftDeleteResponse { | ||
723 | + Id int64 `json:"id"` //ID | ||
724 | + Title string `json:"title"` //标题 | ||
725 | + Content string `json:"content"` //文章的文本内容 | ||
726 | + AuthorId int64 `json:"authorId"` //发布人id | ||
727 | + Images []string `json:"images,optional"` //图片 | ||
728 | + Videos []Video `json:"video,optional"` // 视频 | ||
729 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
730 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
731 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
732 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
733 | + Tags []int64 `json:"tags"` // 标签 | ||
734 | + } | ||
735 | +) | ||
736 | + | ||
737 | +//管理后台获取草稿 | ||
738 | +type ( | ||
739 | + SystemArticleDraftGetRequest { | ||
740 | + Id int64 `path:"id"` //id | ||
741 | + CompanyId int64 `path:",optional"` //公司ID(前端不传) | ||
742 | + } | ||
743 | + SystemArticleDraftGetResponse { | ||
744 | + Id int64 `json:"id"` //ID | ||
745 | + Title string `json:"title"` //标题 | ||
746 | + Content string `json:"content"` //文章的文本内容 | ||
747 | + AuthorId int64 `json:"authorId"` //发布人id | ||
748 | + Images []string `json:"images,optional"` //图片 | ||
749 | + Videos []Video `json:"video,optional"` // 视频 | ||
750 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
751 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
752 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
753 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
754 | + Tags []int64 `json:"tags"` // 标签 | ||
755 | + } | ||
756 | +) | ||
757 | + | ||
758 | +//管理后台已删除列表 | ||
759 | +type ( | ||
760 | + SystemArticleSearchDeletedRequest { | ||
761 | + Page int `json:"page"` //页码 | ||
762 | + Size int `json:"size"` //每页行数 | ||
763 | + Title string `json:"title,optional"` //标题 | ||
764 | + Author int64 `json:"author,optional"` //发布人 | ||
765 | + DeletedType int `json:"deletedType,optional"`//类型 1-运营删除 2-用户删除 | ||
766 | + BeginTime int64 `json:"beginTime,optional"`//开始时间 | ||
767 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
768 | + } | ||
769 | + SystemArticleSearchDeletedResponse { | ||
770 | + Total int `json:"total"` | ||
771 | + List []SystemArticleSearchDeletedItem `json:"list"` | ||
772 | + } | ||
773 | + SystemArticleSearchDeletedItem { | ||
774 | + Id int64 `json:"id"` //ID | ||
775 | + Title string `json:"title"` //标题 | ||
776 | + Images []string `json:"images"` //图片 | ||
777 | + AuthorId int64 `json:"authorId"` //发布人id | ||
778 | + Author string `json:"author"` //发布人 | ||
779 | + Source int `json:"source"` //来源 1-用户发布 2-运营发布 | ||
780 | + DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | ||
781 | + DeletedAt int64 `json:"deletedAt"` //删除时间 | ||
782 | + } | ||
783 | +) | ||
784 | + | ||
785 | +//管理后台已删除文章恢复 | ||
786 | +type ( | ||
787 | + SystemArticleDeletedRestoreRequest { | ||
788 | + Id int64 `json:"id"` //ID | ||
789 | + } | ||
790 | + SystemArticleDeletedRestoreResponse { | ||
791 | + Id int64 `json:"id"` //ID | ||
792 | + Title string `json:"title"` //标题 | ||
793 | + AuthorId int64 `json:"authorId"` //发布人id | ||
794 | + } | ||
581 | ) | 795 | ) |
1 | +package article | ||
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/article" | ||
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 SystemArticleSearchDeletedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleSearchDeletedRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemArticleSearchDeletedLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemArticleSearchDeleted(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDraftCreateRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemCreateArticleDraftLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemCreateArticleDraft(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemCreateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleCreateRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemCreateArticleLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemCreateArticle(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemDeleteArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDraftDeleteRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemDeleteArticleDraftLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemDeleteArticleDraft(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemDeleteArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDeleteRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemDeleteArticleLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemDeleteArticle(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemGetArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDraftGetRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemGetArticleDraftLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemGetArticleDraft(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemRestoreArticleDeletedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDeletedRestoreRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemRestoreArticleDeletedLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemRestoreArticleDeleted(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemSearchArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDraftSearchRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemSearchArticleDraftLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemSearchArticleDraft(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
1 | +package article | ||
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/article" | ||
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 SystemUpdateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
14 | + return func(w http.ResponseWriter, r *http.Request) { | ||
15 | + var req types.SystemArticleDraftUpdateRequest | ||
16 | + if err := httpx.Parse(r, &req); err != nil { | ||
17 | + httpx.ErrorCtx(r.Context(), w, err) | ||
18 | + return | ||
19 | + } | ||
20 | + | ||
21 | + l := article.NewSystemUpdateArticleDraftLogic(r.Context(), svcCtx) | ||
22 | + resp, err := l.SystemUpdateArticleDraft(&req) | ||
23 | + result.HttpResult(r, w, resp, err) | ||
24 | + } | ||
25 | +} |
@@ -598,6 +598,51 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -598,6 +598,51 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
598 | Path: "/article/restore", | 598 | Path: "/article/restore", |
599 | Handler: article.SystemArticleRestoreHandler(serverCtx), | 599 | Handler: article.SystemArticleRestoreHandler(serverCtx), |
600 | }, | 600 | }, |
601 | + { | ||
602 | + Method: http.MethodDelete, | ||
603 | + Path: "/article", | ||
604 | + Handler: article.SystemDeleteArticleHandler(serverCtx), | ||
605 | + }, | ||
606 | + { | ||
607 | + Method: http.MethodPost, | ||
608 | + Path: "/article", | ||
609 | + Handler: article.SystemCreateArticleHandler(serverCtx), | ||
610 | + }, | ||
611 | + { | ||
612 | + Method: http.MethodPost, | ||
613 | + Path: "/article/draft", | ||
614 | + Handler: article.SystemCreateArticleDraftHandler(serverCtx), | ||
615 | + }, | ||
616 | + { | ||
617 | + Method: http.MethodPut, | ||
618 | + Path: "/article/draft", | ||
619 | + Handler: article.SystemUpdateArticleDraftHandler(serverCtx), | ||
620 | + }, | ||
621 | + { | ||
622 | + Method: http.MethodPost, | ||
623 | + Path: "/article/draft/search", | ||
624 | + Handler: article.SystemSearchArticleDraftHandler(serverCtx), | ||
625 | + }, | ||
626 | + { | ||
627 | + Method: http.MethodDelete, | ||
628 | + Path: "/article/draft", | ||
629 | + Handler: article.SystemDeleteArticleDraftHandler(serverCtx), | ||
630 | + }, | ||
631 | + { | ||
632 | + Method: http.MethodGet, | ||
633 | + Path: "/article/draft/:id", | ||
634 | + Handler: article.SystemGetArticleDraftHandler(serverCtx), | ||
635 | + }, | ||
636 | + { | ||
637 | + Method: http.MethodPost, | ||
638 | + Path: "/article/deleted/list", | ||
639 | + Handler: article.SystemArticleSearchDeletedHandler(serverCtx), | ||
640 | + }, | ||
641 | + { | ||
642 | + Method: http.MethodPut, | ||
643 | + Path: "/article/deleted/restore", | ||
644 | + Handler: article.SystemRestoreArticleDeletedHandler(serverCtx), | ||
645 | + }, | ||
601 | }..., | 646 | }..., |
602 | ), | 647 | ), |
603 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | 648 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), |
1 | +package article | ||
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/contextdata" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
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 SystemArticleSearchDeletedLogic struct { | ||
18 | + logx.Logger | ||
19 | + ctx context.Context | ||
20 | + svcCtx *svc.ServiceContext | ||
21 | + conn transaction.Conn | ||
22 | +} | ||
23 | + | ||
24 | +func NewSystemArticleSearchDeletedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemArticleSearchDeletedLogic { | ||
25 | + return &SystemArticleSearchDeletedLogic{ | ||
26 | + Logger: logx.WithContext(ctx), | ||
27 | + ctx: ctx, | ||
28 | + svcCtx: svcCtx, | ||
29 | + conn: svcCtx.DefaultDBConn(), | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
33 | +func (l *SystemArticleSearchDeletedLogic) SystemArticleSearchDeleted(req *types.SystemArticleSearchDeletedRequest) (resp *types.SystemArticleSearchDeletedResponse, err error) { | ||
34 | + queryOptions := domain.NewQueryOptions(). | ||
35 | + WithOffsetLimit(req.Page, req.Size). | ||
36 | + WithKV("isDel", 1). | ||
37 | + WithKV("title", req.Title). | ||
38 | + WithKV("authorId", req.Author). | ||
39 | + WithKV("beginDeletedAt", req.BeginTime). | ||
40 | + WithKV("endDeletedAt", req.EndTime). | ||
41 | + WithKV("deletedType", req.DeletedType). | ||
42 | + WithKV("orderMode", "deletedAt descending") | ||
43 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
44 | + total, articles, err := l.svcCtx.ArticleRepository.Find(l.ctx, l.conn, userToken.CompanyId, queryOptions) | ||
45 | + if err != nil { | ||
46 | + return nil, xerr.NewErrMsgErr("搜索已删除列表异常", err) | ||
47 | + } | ||
48 | + resp = &types.SystemArticleSearchDeletedResponse{ | ||
49 | + Total: int(total), | ||
50 | + List: make([]types.SystemArticleSearchDeletedItem, 0), | ||
51 | + } | ||
52 | + authorIds := make([]int64, 0) | ||
53 | + lo.ForEach(articles, func(item *domain.Article, index int) { | ||
54 | + authorIds = append(authorIds, item.AuthorId) | ||
55 | + }) | ||
56 | + //查询用户数据,重新赋值更新用户名称 | ||
57 | + _, users, _ := l.svcCtx.UserRepository.Find(l.ctx, l.conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds)) | ||
58 | + lo.ForEach(articles, func(item *domain.Article, index int) { | ||
59 | + //图片 | ||
60 | + images := make([]string, 0) | ||
61 | + lo.ForEach(item.Images, func(img domain.Image, n int) { | ||
62 | + images = append(images, img.Url) | ||
63 | + }) | ||
64 | + //发布人 | ||
65 | + author := item.Author.Name | ||
66 | + for _, user := range users { | ||
67 | + if user.Id == item.AuthorId { | ||
68 | + author = user.Name | ||
69 | + } | ||
70 | + } | ||
71 | + resp.List = append(resp.List, types.SystemArticleSearchDeletedItem{ | ||
72 | + Id: item.Id, | ||
73 | + Title: item.Title, | ||
74 | + Images: images, | ||
75 | + AuthorId: item.AuthorId, | ||
76 | + Author: author, | ||
77 | + Source: item.Source, | ||
78 | + DeletedType: item.DeletedType, | ||
79 | + DeletedAt: item.DeletedAt, | ||
80 | + }) | ||
81 | + }) | ||
82 | + return | ||
83 | +} |
1 | +package article | ||
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/cmd/discuss/interanl/pkg/gateway/authlib" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
11 | + "strconv" | ||
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 SystemCreateArticleDraftLogic struct { | ||
20 | + logx.Logger | ||
21 | + ctx context.Context | ||
22 | + svcCtx *svc.ServiceContext | ||
23 | + conn transaction.Conn | ||
24 | +} | ||
25 | + | ||
26 | +func NewSystemCreateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCreateArticleDraftLogic { | ||
27 | + return &SystemCreateArticleDraftLogic{ | ||
28 | + Logger: logx.WithContext(ctx), | ||
29 | + ctx: ctx, | ||
30 | + svcCtx: svcCtx, | ||
31 | + conn: svcCtx.DefaultDBConn(), | ||
32 | + } | ||
33 | +} | ||
34 | + | ||
35 | +func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.SystemArticleDraftCreateRequest) (resp *types.SystemArticleDraftCreateResponse, err error) { | ||
36 | + // 检查发布人 | ||
37 | + author, err := l.svcCtx.UserRepository.FindOne(l.ctx, l.conn, req.AuthorId) | ||
38 | + if err != nil { | ||
39 | + return nil, xerr.NewErrMsgErr("创建草稿失败", err) | ||
40 | + } | ||
41 | + companyInfo, err := l.svcCtx.CompanyRepository.FindOne(l.ctx, l.conn, author.CompanyId) | ||
42 | + if err != nil { | ||
43 | + return nil, xerr.NewErrMsgErr("创建草稿失败", err) | ||
44 | + } | ||
45 | + //图片 | ||
46 | + images, err := getImages(req.Images) | ||
47 | + if err != nil { | ||
48 | + return nil, xerr.NewErrMsg(err.Error()) | ||
49 | + } | ||
50 | + //视频 | ||
51 | + videos, err := getVideos(req.Videos) | ||
52 | + if err != nil { | ||
53 | + return nil, xerr.NewErrMsg(err.Error()) | ||
54 | + } | ||
55 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
56 | + // 获取当前用户信息 | ||
57 | + userMe, err := l.svcCtx.ApiAuthService.MeInfo(l.ctx, authlib.RequestUserMeQuery{Token: req.AccessToken}) | ||
58 | + if err != nil { | ||
59 | + return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | ||
60 | + } | ||
61 | + articleDraft := &domain.ArticleDraftOperation{ | ||
62 | + CompanyId: companyInfo.Id, | ||
63 | + AuthorId: req.AuthorId, | ||
64 | + Title: req.Title, | ||
65 | + Content: req.Content, | ||
66 | + Images: images, | ||
67 | + Videos: videos, | ||
68 | + TargetUser: domain.ArticleTarget(req.TargetUser), | ||
69 | + WhoRead: req.WhoRead, | ||
70 | + WhoReview: req.WhoReview, | ||
71 | + MatchUrl: req.MatchUrl, | ||
72 | + Source: domain.ArticleSourceOperator, | ||
73 | + Operator: domain.Operator{ | ||
74 | + Id: userToken.UserId, | ||
75 | + Name: userMe.User.NickName, | ||
76 | + }, | ||
77 | + Tags: req.Tags, | ||
78 | + } | ||
79 | + 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 | + if err != nil { | ||
82 | + return err | ||
83 | + } | ||
84 | + return nil | ||
85 | + }, true) | ||
86 | + resp = &types.SystemArticleDraftCreateResponse{ | ||
87 | + Id: articleDraft.Id, | ||
88 | + Title: articleDraft.Title, | ||
89 | + Content: articleDraft.Content, | ||
90 | + AuthorId: articleDraft.AuthorId, | ||
91 | + Images: req.Images, | ||
92 | + Videos: req.Videos, | ||
93 | + TargetUser: req.TargetUser, | ||
94 | + WhoRead: req.WhoRead, | ||
95 | + WhoReview: req.WhoReview, | ||
96 | + MatchUrl: req.MatchUrl, | ||
97 | + Tags: req.Tags, | ||
98 | + } | ||
99 | + return | ||
100 | +} | ||
101 | + | ||
102 | +// getImages 获取图片信息 | ||
103 | +func getImages(imgs []string) ([]domain.Image, error) { | ||
104 | + // 获取图片的尺寸大小 | ||
105 | + images := make([]domain.Image, 0) | ||
106 | + if len(imgs) <= 0 { | ||
107 | + return images, nil | ||
108 | + } | ||
109 | + for _, val := range imgs { | ||
110 | + fInfo, err := oss.GetImageInfo(val) | ||
111 | + if err != nil { | ||
112 | + return images, xerr.NewErrMsg("获取图片失败") | ||
113 | + } | ||
114 | + w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
115 | + h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | ||
116 | + images = append(images, domain.Image{ | ||
117 | + Url: val, | ||
118 | + Width: w, | ||
119 | + Height: h, | ||
120 | + }) | ||
121 | + } | ||
122 | + return images, nil | ||
123 | +} | ||
124 | + | ||
125 | +// getVideos 获取视频信息 | ||
126 | +func getVideos(list []types.Video) ([]domain.Video, error) { | ||
127 | + videos := make([]domain.Video, 0) | ||
128 | + if len(list) <= 0 { | ||
129 | + return videos, nil | ||
130 | + } | ||
131 | + if len(list) > 0 { | ||
132 | + for _, item := range list { | ||
133 | + cover, w, h, err := oss.GetVideoCover(item.Url) | ||
134 | + if err != nil { | ||
135 | + return videos, xerr.NewErrMsg("获取视频信息失败") | ||
136 | + } | ||
137 | + videos = append(videos, domain.Video{ | ||
138 | + Url: item.Url, | ||
139 | + Cover: cover, | ||
140 | + Width: w, | ||
141 | + Height: h, | ||
142 | + }) | ||
143 | + } | ||
144 | + } | ||
145 | + return videos, nil | ||
146 | +} |
1 | +package article | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "github.com/pkg/errors" | ||
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/tool/oss" | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
13 | + "strconv" | ||
14 | + "strings" | ||
15 | + "unicode/utf8" | ||
16 | + | ||
17 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
18 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
19 | + | ||
20 | + "github.com/zeromicro/go-zero/core/logx" | ||
21 | +) | ||
22 | + | ||
23 | +type SystemCreateArticleLogic struct { | ||
24 | + logx.Logger | ||
25 | + ctx context.Context | ||
26 | + svcCtx *svc.ServiceContext | ||
27 | + conn transaction.Conn | ||
28 | +} | ||
29 | + | ||
30 | +func NewSystemCreateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCreateArticleLogic { | ||
31 | + return &SystemCreateArticleLogic{ | ||
32 | + Logger: logx.WithContext(ctx), | ||
33 | + ctx: ctx, | ||
34 | + svcCtx: svcCtx, | ||
35 | + conn: svcCtx.DefaultDBConn(), | ||
36 | + } | ||
37 | +} | ||
38 | + | ||
39 | +func (l *SystemCreateArticleLogic) SystemCreateArticle(req *types.SystemArticleCreateRequest) (resp *types.SystemArticleCreateResponse, err error) { | ||
40 | + err = l.validate(req) | ||
41 | + if err != nil { | ||
42 | + return nil, xerr.NewErrMsg(err.Error()) | ||
43 | + } | ||
44 | + // 检查发布人 | ||
45 | + author, err := l.svcCtx.UserRepository.FindOne(l.ctx, l.conn, req.AuthorId) | ||
46 | + if err != nil { | ||
47 | + return nil, xerr.NewErrMsgErr("创建文章内容失败", err) | ||
48 | + } | ||
49 | + companyInfo, err := l.svcCtx.CompanyRepository.FindOne(l.ctx, l.conn, author.CompanyId) | ||
50 | + if err != nil { | ||
51 | + return nil, xerr.NewErrMsgErr("创建文章内容失败", err) | ||
52 | + } | ||
53 | + //文章作者 | ||
54 | + articleAuthor := domain.UserSimple{ | ||
55 | + Id: author.Id, | ||
56 | + Name: author.Name, | ||
57 | + Avatar: author.Avatar, | ||
58 | + Position: author.Position, | ||
59 | + Company: companyInfo.Name, | ||
60 | + CompanyId: author.CompanyId, | ||
61 | + } | ||
62 | + //图片 | ||
63 | + images, err := l.getImages(req) | ||
64 | + if err != nil { | ||
65 | + return nil, xerr.NewErrMsg(err.Error()) | ||
66 | + } | ||
67 | + //视频 | ||
68 | + videos, err := l.getVideos(req) | ||
69 | + if err != nil { | ||
70 | + return nil, xerr.NewErrMsg(err.Error()) | ||
71 | + } | ||
72 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
73 | + // 获取当前用户信息 | ||
74 | + userMe, err := l.svcCtx.ApiAuthService.MeInfo(l.ctx, authlib.RequestUserMeQuery{Token: req.AccessToken}) | ||
75 | + if err != nil { | ||
76 | + return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | ||
77 | + } | ||
78 | + article := &domain.Article{ | ||
79 | + CompanyId: companyInfo.Id, | ||
80 | + AuthorId: req.AuthorId, | ||
81 | + Author: articleAuthor, | ||
82 | + Title: req.Title, | ||
83 | + Images: images, | ||
84 | + Videos: videos, | ||
85 | + WhoRead: make([]int64, 0), | ||
86 | + WhoReview: make([]int64, 0), | ||
87 | + Location: domain.Location{}, | ||
88 | + TargetUser: domain.ArticleTarget(req.TargetUser), | ||
89 | + Show: domain.ArticleShowEnable, | ||
90 | + Tags: make([]int64, 0), | ||
91 | + MatchUrl: make(map[string]string), | ||
92 | + Source: domain.ArticleSourceOperator, | ||
93 | + Operator: domain.Operator{ | ||
94 | + Id: userToken.UserId, | ||
95 | + Name: userMe.User.NickName, | ||
96 | + }, | ||
97 | + } | ||
98 | + if len(req.MatchUrl) > 0 { | ||
99 | + article.MatchUrl = req.MatchUrl | ||
100 | + } | ||
101 | + //检查文章可被哪些人查看 | ||
102 | + whoRead, err := l.validateAndGetWhoRead(req, article) | ||
103 | + if err != nil { | ||
104 | + return nil, err | ||
105 | + } | ||
106 | + //检查文章可被哪些人评论 | ||
107 | + whoReview := []int64{} | ||
108 | + if len(req.WhoReview) > 0 { | ||
109 | + whoReview = lo.Uniq(req.WhoReview) | ||
110 | + } | ||
111 | + //验证可评论 | ||
112 | + if err = l.validateWhoReview(whoRead, whoReview, article); err != nil { | ||
113 | + return nil, err | ||
114 | + } | ||
115 | + article.WhoRead = whoRead | ||
116 | + article.WhoReview = whoReview | ||
117 | + sections := l.getSections(req, article) | ||
118 | + //设置内容摘要 | ||
119 | + article.SetSummary(sections) | ||
120 | + //草稿ID | ||
121 | + if req.ArticleDraftId > 0 { | ||
122 | + articleDraft, err := l.svcCtx.ArticleDraftOperationRepository.FindOne(l.ctx, l.conn, req.ArticleDraftId) | ||
123 | + if err != nil { | ||
124 | + return nil, xerr.NewErrMsg("草稿不存在") | ||
125 | + } | ||
126 | + if articleDraft.CompanyId != userToken.CompanyId { | ||
127 | + return nil, xerr.NewErrMsg("您没有权限") | ||
128 | + } | ||
129 | + } | ||
130 | + //保存数据 | ||
131 | + err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { | ||
132 | + _, err = l.svcCtx.ArticleRepository.Insert(ctx, conn, article) | ||
133 | + if err != nil { | ||
134 | + return xerr.NewErrMsgErr("创建文章失败", err) | ||
135 | + } | ||
136 | + for i := range sections { | ||
137 | + sections[i].ArticleId = article.Id | ||
138 | + _, err = l.svcCtx.ArticleSectionRepository.Insert(ctx, conn, sections[i]) | ||
139 | + if err != nil { | ||
140 | + return xerr.NewErrMsgErr("创建文章内容失败", err) | ||
141 | + } | ||
142 | + } | ||
143 | + // 生成 备份数据 | ||
144 | + var backupData domain.ArticleBackup | ||
145 | + backupData.MakeBackup(articleAuthor, article, sections, "原始版本") | ||
146 | + _, err = l.svcCtx.ArticleBackupRepository.Insert(l.ctx, conn, &backupData) | ||
147 | + if err != nil { | ||
148 | + return xerr.NewErrMsgErr("创建文章失败", err) | ||
149 | + } | ||
150 | + //删除草稿 | ||
151 | + if req.ArticleDraftId > 0 { | ||
152 | + _, err = l.svcCtx.ArticleDraftOperationRepository.Delete(l.ctx, conn, &domain.ArticleDraftOperation{Id: req.ArticleDraftId}) | ||
153 | + if err != nil { | ||
154 | + return xerr.NewErrMsg("删除草稿失败") | ||
155 | + } | ||
156 | + } | ||
157 | + return nil | ||
158 | + }, true) | ||
159 | + if err != nil { | ||
160 | + return nil, xerr.NewErrMsgErr("创建文章失败", err) | ||
161 | + } | ||
162 | + resp = &types.SystemArticleCreateResponse{ | ||
163 | + Id: article.Id, | ||
164 | + Title: article.Title, | ||
165 | + Content: req.Content, | ||
166 | + AuthorId: req.AuthorId, | ||
167 | + Images: req.Images, | ||
168 | + Videos: req.Videos, | ||
169 | + TargetUser: req.TargetUser, | ||
170 | + WhoRead: whoRead, | ||
171 | + WhoReview: whoReview, | ||
172 | + } | ||
173 | + return | ||
174 | +} | ||
175 | + | ||
176 | +// validate 验证 | ||
177 | +func (l *SystemCreateArticleLogic) validate(req *types.SystemArticleCreateRequest) error { | ||
178 | + //文章标题 | ||
179 | + if utf8.RuneCountInString(req.Title) > 64 { | ||
180 | + return errors.New("标题最多只能输入64字") | ||
181 | + } | ||
182 | + //文章内容 | ||
183 | + if utf8.RuneCountInString(req.Content) > 1000 { | ||
184 | + return errors.New("内容最多只能输入1000字") | ||
185 | + } | ||
186 | + //图片 | ||
187 | + if len(req.Images) > 9 { | ||
188 | + return errors.New("图片数量最多9张") | ||
189 | + } | ||
190 | + return nil | ||
191 | +} | ||
192 | + | ||
193 | +// getImages 获取图片信息 | ||
194 | +func (l *SystemCreateArticleLogic) getImages(req *types.SystemArticleCreateRequest) ([]domain.Image, error) { | ||
195 | + // 获取图片的尺寸大小 | ||
196 | + images := make([]domain.Image, 0) | ||
197 | + for _, val := range req.Images { | ||
198 | + fInfo, err := oss.GetImageInfo(val) | ||
199 | + if err != nil { | ||
200 | + return images, xerr.NewErrMsg("获取图片失败") | ||
201 | + } | ||
202 | + w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
203 | + h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | ||
204 | + images = append(images, domain.Image{ | ||
205 | + Url: val, | ||
206 | + Width: w, | ||
207 | + Height: h, | ||
208 | + }) | ||
209 | + } | ||
210 | + return images, nil | ||
211 | +} | ||
212 | + | ||
213 | +// getVideo 获取视频信息 | ||
214 | +func (l *SystemCreateArticleLogic) getVideos(req *types.SystemArticleCreateRequest) ([]domain.Video, error) { | ||
215 | + videos := make([]domain.Video, 0) | ||
216 | + if len(req.Videos) > 0 { | ||
217 | + for _, item := range req.Videos { | ||
218 | + cover, w, h, err := oss.GetVideoCover(item.Url) | ||
219 | + if err != nil { | ||
220 | + return videos, xerr.NewErrMsg("获取视频信息失败") | ||
221 | + } | ||
222 | + videos = append(videos, domain.Video{ | ||
223 | + Url: item.Url, | ||
224 | + Cover: cover, | ||
225 | + Width: w, | ||
226 | + Height: h, | ||
227 | + }) | ||
228 | + } | ||
229 | + } | ||
230 | + return videos, nil | ||
231 | +} | ||
232 | + | ||
233 | +// validateAndGetWhoRead 验证并获取可阅读 | ||
234 | +func (l *SystemCreateArticleLogic) validateAndGetWhoRead(req *types.SystemArticleCreateRequest, article *domain.Article) ([]int64, error) { | ||
235 | + whoRead := make([]int64, 0) | ||
236 | + if len(req.WhoRead) > 0 { | ||
237 | + whoRead = lo.Uniq(req.WhoRead) | ||
238 | + var u *domain.User | ||
239 | + var err error | ||
240 | + for _, val := range whoRead { | ||
241 | + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, l.conn, val) | ||
242 | + if err != nil { | ||
243 | + return whoRead, xerr.NewErrMsgErr("文章可查看人设置错误", err) | ||
244 | + } | ||
245 | + if u.CompanyId != article.CompanyId { | ||
246 | + return whoRead, xerr.NewErrMsg("文章可查看人设置错误") | ||
247 | + } | ||
248 | + } | ||
249 | + } | ||
250 | + return whoRead, nil | ||
251 | +} | ||
252 | + | ||
253 | +// validateWhoReview 验证可评论 | ||
254 | +func (l *SystemCreateArticleLogic) validateWhoReview(whoRead []int64, whoReview []int64, article *domain.Article) error { | ||
255 | + //有指定可查看人的情况 | ||
256 | + if len(whoRead) > 0 { | ||
257 | + if len(whoReview) > 0 { | ||
258 | + // 检查 whoRead 是否 完全包含 whoReview | ||
259 | + ok := lo.Every(whoRead, whoReview) | ||
260 | + if !ok { | ||
261 | + return xerr.NewErrMsg("文章可评论人设置错误") | ||
262 | + } | ||
263 | + } | ||
264 | + if len(whoReview) == 0 { | ||
265 | + //有指定可查看人 ,但未指定可评论人 | ||
266 | + return xerr.NewErrMsg("文章可评论人设置错误") | ||
267 | + } | ||
268 | + } | ||
269 | + //没有指定可查看人的情况 | ||
270 | + if len(whoRead) == 0 { | ||
271 | + if len(whoReview) > 0 { | ||
272 | + // 未指定可查看人(全员可看),有指定可评论人, | ||
273 | + var u *domain.User | ||
274 | + var err error | ||
275 | + for _, val := range whoReview { | ||
276 | + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, l.conn, val) | ||
277 | + if err != nil { | ||
278 | + return xerr.NewErrMsgErr("文章可评论人设置错误", err) | ||
279 | + } | ||
280 | + if u.CompanyId != article.CompanyId { | ||
281 | + return xerr.NewErrMsg("文章可评论人设置错误") | ||
282 | + } | ||
283 | + } | ||
284 | + } | ||
285 | + } | ||
286 | + return nil | ||
287 | +} | ||
288 | + | ||
289 | +// getSections 文章内容 | ||
290 | +func (l *SystemCreateArticleLogic) getSections(req *types.SystemArticleCreateRequest, article *domain.Article) []*domain.ArticleSection { | ||
291 | + articleSections := make([]*domain.ArticleSection, 0) | ||
292 | + sortBy := 1 | ||
293 | + sections := strings.Split(req.Content, "\n") | ||
294 | + lo.ForEach(sections, func(item string, index int) { | ||
295 | + section := domain.ArticleSection{ | ||
296 | + CompanyId: article.CompanyId, | ||
297 | + Version: article.Version, | ||
298 | + ArticleId: article.Id, | ||
299 | + Content: item, | ||
300 | + SortBy: sortBy, | ||
301 | + } | ||
302 | + articleSections = append(articleSections, §ion) | ||
303 | + sortBy++ | ||
304 | + }) | ||
305 | + return articleSections | ||
306 | +} |
1 | +package article | ||
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/contextdata" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
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 SystemDeleteArticleDraftLogic struct { | ||
18 | + logx.Logger | ||
19 | + ctx context.Context | ||
20 | + svcCtx *svc.ServiceContext | ||
21 | + conn transaction.Conn | ||
22 | +} | ||
23 | + | ||
24 | +func NewSystemDeleteArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemDeleteArticleDraftLogic { | ||
25 | + return &SystemDeleteArticleDraftLogic{ | ||
26 | + Logger: logx.WithContext(ctx), | ||
27 | + ctx: ctx, | ||
28 | + svcCtx: svcCtx, | ||
29 | + conn: svcCtx.DefaultDBConn(), | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
33 | +func (l *SystemDeleteArticleDraftLogic) SystemDeleteArticleDraft(req *types.SystemArticleDraftDeleteRequest) (resp *types.SystemArticleDraftDeleteResponse, err error) { | ||
34 | + // 草稿数据 | ||
35 | + articleDraft, err := l.svcCtx.ArticleDraftOperationRepository.FindOne(l.ctx, l.conn, req.Id) | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsg("草稿不存在") | ||
38 | + } | ||
39 | + //操作人 | ||
40 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
41 | + if userToken.CompanyId != articleDraft.CompanyId { | ||
42 | + return nil, xerr.NewErrMsg("您没有权限删除") | ||
43 | + } | ||
44 | + _, err = l.svcCtx.ArticleDraftOperationRepository.Delete(l.ctx, l.conn, articleDraft) | ||
45 | + if err != nil { | ||
46 | + return nil, xerr.NewErrMsg("删除草稿失败") | ||
47 | + } | ||
48 | + //图片 | ||
49 | + images := make([]string, 0) | ||
50 | + lo.ForEach(articleDraft.Images, func(img domain.Image, n int) { | ||
51 | + images = append(images, img.Url) | ||
52 | + }) | ||
53 | + //视频 | ||
54 | + videos := make([]types.Video, 0) | ||
55 | + lo.ForEach(articleDraft.Videos, func(video domain.Video, n int) { | ||
56 | + videos = append(videos, types.Video{ | ||
57 | + Url: video.Url, | ||
58 | + Cover: video.Cover, | ||
59 | + Width: video.Width, | ||
60 | + Height: video.Height, | ||
61 | + }) | ||
62 | + }) | ||
63 | + resp = &types.SystemArticleDraftDeleteResponse{ | ||
64 | + Id: articleDraft.Id, | ||
65 | + Title: articleDraft.Title, | ||
66 | + Content: articleDraft.Content, | ||
67 | + AuthorId: articleDraft.AuthorId, | ||
68 | + Images: images, | ||
69 | + Videos: videos, | ||
70 | + TargetUser: int(articleDraft.TargetUser), | ||
71 | + WhoRead: articleDraft.WhoRead, | ||
72 | + WhoReview: articleDraft.WhoReview, | ||
73 | + MatchUrl: articleDraft.MatchUrl, | ||
74 | + Tags: articleDraft.Tags, | ||
75 | + } | ||
76 | + return | ||
77 | +} |
1 | +package article | ||
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 SystemDeleteArticleLogic struct { | ||
17 | + logx.Logger | ||
18 | + ctx context.Context | ||
19 | + svcCtx *svc.ServiceContext | ||
20 | + conn transaction.Conn | ||
21 | +} | ||
22 | + | ||
23 | +func NewSystemDeleteArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemDeleteArticleLogic { | ||
24 | + return &SystemDeleteArticleLogic{ | ||
25 | + Logger: logx.WithContext(ctx), | ||
26 | + ctx: ctx, | ||
27 | + svcCtx: svcCtx, | ||
28 | + conn: svcCtx.DefaultDBConn(), | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleDeleteRequest) (resp *types.SystemArticleDeleteResponse, err error) { | ||
33 | + // 文章数据 | ||
34 | + article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, l.conn, req.Id) | ||
35 | + if err != nil { | ||
36 | + return nil, xerr.NewErrMsgErr("帖子不存在", err) | ||
37 | + } | ||
38 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
39 | + if userToken.CompanyId != article.CompanyId { | ||
40 | + return nil, xerr.NewErrMsg("您没有权限") | ||
41 | + } | ||
42 | + article.DeletedType = domain.ArticleDeletedTypeOperator | ||
43 | + err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { | ||
44 | + //更新删除类型 | ||
45 | + _, err = l.svcCtx.ArticleRepository.Update(l.ctx, conn, article) | ||
46 | + if err != nil { | ||
47 | + return err | ||
48 | + } | ||
49 | + _, err = l.svcCtx.ArticleRepository.Delete(l.ctx, l.conn, article) | ||
50 | + if err != nil { | ||
51 | + return err | ||
52 | + } | ||
53 | + return nil | ||
54 | + }, true) | ||
55 | + if err != nil { | ||
56 | + return nil, xerr.NewErrMsgErr("删除失败", err) | ||
57 | + } | ||
58 | + resp = &types.SystemArticleDeleteResponse{ | ||
59 | + Id: article.Id, | ||
60 | + Title: article.Title, | ||
61 | + AuthorId: article.AuthorId, | ||
62 | + } | ||
63 | + return | ||
64 | +} |
1 | +package article | ||
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/contextdata" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
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 SystemGetArticleDraftLogic struct { | ||
18 | + logx.Logger | ||
19 | + ctx context.Context | ||
20 | + svcCtx *svc.ServiceContext | ||
21 | + conn transaction.Conn | ||
22 | +} | ||
23 | + | ||
24 | +func NewSystemGetArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemGetArticleDraftLogic { | ||
25 | + return &SystemGetArticleDraftLogic{ | ||
26 | + Logger: logx.WithContext(ctx), | ||
27 | + ctx: ctx, | ||
28 | + svcCtx: svcCtx, | ||
29 | + conn: svcCtx.DefaultDBConn(), | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
33 | +func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArticleDraftGetRequest) (resp *types.SystemArticleDraftGetResponse, err error) { | ||
34 | + // 草稿数据 | ||
35 | + articleDraft, err := l.svcCtx.ArticleDraftOperationRepository.FindOne(l.ctx, l.conn, req.Id) | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsg("草稿不存在") | ||
38 | + } | ||
39 | + //操作人 | ||
40 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
41 | + //不同公司不能获取数据 | ||
42 | + if userToken.CompanyId != articleDraft.CompanyId { | ||
43 | + return nil, xerr.NewErrMsg("您没有权限查看该数据") | ||
44 | + } | ||
45 | + //图片 | ||
46 | + images := make([]string, 0) | ||
47 | + lo.ForEach(articleDraft.Images, func(img domain.Image, n int) { | ||
48 | + images = append(images, img.Url) | ||
49 | + }) | ||
50 | + //视频 | ||
51 | + videos := make([]types.Video, 0) | ||
52 | + lo.ForEach(articleDraft.Videos, func(video domain.Video, n int) { | ||
53 | + videos = append(videos, types.Video{ | ||
54 | + Url: video.Url, | ||
55 | + Cover: video.Cover, | ||
56 | + Width: video.Width, | ||
57 | + Height: video.Height, | ||
58 | + }) | ||
59 | + }) | ||
60 | + resp = &types.SystemArticleDraftGetResponse{ | ||
61 | + Id: articleDraft.Id, | ||
62 | + Title: articleDraft.Title, | ||
63 | + Content: articleDraft.Content, | ||
64 | + AuthorId: articleDraft.AuthorId, | ||
65 | + Images: images, | ||
66 | + Videos: videos, | ||
67 | + TargetUser: int(articleDraft.TargetUser), | ||
68 | + WhoRead: articleDraft.WhoRead, | ||
69 | + WhoReview: articleDraft.WhoReview, | ||
70 | + MatchUrl: articleDraft.MatchUrl, | ||
71 | + Tags: articleDraft.Tags, | ||
72 | + } | ||
73 | + return | ||
74 | +} |
1 | +package article | ||
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/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 SystemRestoreArticleDeletedLogic struct { | ||
15 | + logx.Logger | ||
16 | + ctx context.Context | ||
17 | + svcCtx *svc.ServiceContext | ||
18 | + conn transaction.Conn | ||
19 | +} | ||
20 | + | ||
21 | +func NewSystemRestoreArticleDeletedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemRestoreArticleDeletedLogic { | ||
22 | + return &SystemRestoreArticleDeletedLogic{ | ||
23 | + Logger: logx.WithContext(ctx), | ||
24 | + ctx: ctx, | ||
25 | + svcCtx: svcCtx, | ||
26 | + conn: svcCtx.DefaultDBConn(), | ||
27 | + } | ||
28 | +} | ||
29 | + | ||
30 | +func (l *SystemRestoreArticleDeletedLogic) SystemRestoreArticleDeleted(req *types.SystemArticleDeletedRestoreRequest) (resp *types.SystemArticleDeletedRestoreResponse, err error) { | ||
31 | + // 文章数据 | ||
32 | + article, err := l.svcCtx.ArticleRepository.FindOneWithUnscoped(l.ctx, l.conn, req.Id) | ||
33 | + if err != nil { | ||
34 | + return nil, xerr.NewErrMsgErr("帖子不存在", err) | ||
35 | + } | ||
36 | + _, err = l.svcCtx.ArticleRepository.Restore(l.ctx, l.conn, article) | ||
37 | + if err != nil { | ||
38 | + return nil, xerr.NewErrMsg("恢复帖子失败") | ||
39 | + } | ||
40 | + resp = &types.SystemArticleDeletedRestoreResponse{ | ||
41 | + Id: article.Id, | ||
42 | + Title: article.Title, | ||
43 | + AuthorId: article.AuthorId, | ||
44 | + } | ||
45 | + return | ||
46 | +} |
1 | +package article | ||
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 SystemSearchArticleDraftLogic struct { | ||
17 | + logx.Logger | ||
18 | + ctx context.Context | ||
19 | + svcCtx *svc.ServiceContext | ||
20 | + conn transaction.Conn | ||
21 | +} | ||
22 | + | ||
23 | +func NewSystemSearchArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemSearchArticleDraftLogic { | ||
24 | + return &SystemSearchArticleDraftLogic{ | ||
25 | + Logger: logx.WithContext(ctx), | ||
26 | + ctx: ctx, | ||
27 | + svcCtx: svcCtx, | ||
28 | + conn: svcCtx.DefaultDBConn(), | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.SystemArticleDraftSearchRequest) (resp *types.SystemArticleDraftSearchResponse, err error) { | ||
33 | + queryOptions := domain.NewQueryOptions(). | ||
34 | + WithOffsetLimit(req.Page, req.Size). | ||
35 | + WithKV("companyId", req.CompanyId). | ||
36 | + WithKV("title", req.Title). | ||
37 | + WithKV("operator", req.Operator). | ||
38 | + WithKV("beginTime", req.BeginTime). | ||
39 | + WithKV("endTime", req.EndTime) | ||
40 | + total, articleDrafts, err := l.svcCtx.ArticleDraftOperationRepository.Find(l.ctx, l.conn, queryOptions) | ||
41 | + if err != nil { | ||
42 | + return nil, xerr.NewErrMsgErr("搜索草稿异常", err) | ||
43 | + } | ||
44 | + resp = &types.SystemArticleDraftSearchResponse{ | ||
45 | + Total: int(total), | ||
46 | + List: make([]types.SystemArticleDraftSearch, 0), | ||
47 | + } | ||
48 | + authorIds := make([]int64, 0) | ||
49 | + lo.ForEach(articleDrafts, func(item *domain.ArticleDraftOperation, index int) { | ||
50 | + authorIds = append(authorIds, item.AuthorId) | ||
51 | + }) | ||
52 | + //查询用户数据,重新赋值更新用户名称 | ||
53 | + _, users, _ := l.svcCtx.UserRepository.Find(l.ctx, l.conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds)) | ||
54 | + lo.ForEach(articleDrafts, func(item *domain.ArticleDraftOperation, index int) { | ||
55 | + //图片 | ||
56 | + images := make([]string, 0) | ||
57 | + lo.ForEach(item.Images, func(img domain.Image, n int) { | ||
58 | + images = append(images, img.Url) | ||
59 | + }) | ||
60 | + //发布人 | ||
61 | + author := "" | ||
62 | + for _, user := range users { | ||
63 | + if user.Id == item.AuthorId { | ||
64 | + author = user.Name | ||
65 | + } | ||
66 | + } | ||
67 | + resp.List = append(resp.List, types.SystemArticleDraftSearch{ | ||
68 | + Id: item.Id, | ||
69 | + Title: item.Title, | ||
70 | + Images: images, | ||
71 | + Operator: item.Operator.Name, | ||
72 | + AuthorId: item.AuthorId, | ||
73 | + Author: author, | ||
74 | + UpdatedAt: item.UpdatedAt, | ||
75 | + }) | ||
76 | + }) | ||
77 | + return | ||
78 | +} |
@@ -82,11 +82,17 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -82,11 +82,17 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
82 | Author: author, | 82 | Author: author, |
83 | Images: images, | 83 | Images: images, |
84 | CreatedAt: item.CreatedAt, | 84 | CreatedAt: item.CreatedAt, |
85 | + UpdatedAt: item.UpdatedAt, | ||
85 | CountLove: item.CountLove, | 86 | CountLove: item.CountLove, |
86 | CountComment: item.CountComment, | 87 | CountComment: item.CountComment, |
87 | Show: int(item.Show), | 88 | Show: int(item.Show), |
88 | Tags: articleTags, | 89 | Tags: articleTags, |
89 | TargetUser: int(item.TargetUser), | 90 | TargetUser: int(item.TargetUser), |
91 | + Source: item.Source, | ||
92 | + Operator: types.Operator{ | ||
93 | + Id: item.Operator.Id, | ||
94 | + Name: item.Operator.Name, | ||
95 | + }, | ||
90 | }) | 96 | }) |
91 | }) | 97 | }) |
92 | return | 98 | return |
1 | +package article | ||
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/cmd/discuss/interanl/pkg/gateway/authlib" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
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 SystemUpdateArticleDraftLogic struct { | ||
18 | + logx.Logger | ||
19 | + ctx context.Context | ||
20 | + svcCtx *svc.ServiceContext | ||
21 | + conn transaction.Conn | ||
22 | +} | ||
23 | + | ||
24 | +func NewSystemUpdateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUpdateArticleDraftLogic { | ||
25 | + return &SystemUpdateArticleDraftLogic{ | ||
26 | + Logger: logx.WithContext(ctx), | ||
27 | + ctx: ctx, | ||
28 | + svcCtx: svcCtx, | ||
29 | + conn: svcCtx.DefaultDBConn(), | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
33 | +func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.SystemArticleDraftUpdateRequest) (resp *types.SystemArticleDraftUpdateResponse, err error) { | ||
34 | + // 草稿数据 | ||
35 | + articleDraft, err := l.svcCtx.ArticleDraftOperationRepository.FindOne(l.ctx, l.conn, req.Id) | ||
36 | + if err != nil { | ||
37 | + return nil, xerr.NewErrMsgErr("草稿不存在", err) | ||
38 | + } | ||
39 | + articleDraft.Title = req.Title | ||
40 | + articleDraft.Content = req.Content | ||
41 | + articleDraft.AuthorId = req.AuthorId | ||
42 | + articleDraft.TargetUser = domain.ArticleTarget(req.TargetUser) | ||
43 | + articleDraft.WhoRead = req.WhoRead | ||
44 | + articleDraft.WhoReview = req.WhoReview | ||
45 | + articleDraft.Tags = req.Tags | ||
46 | + articleDraft.Source = domain.ArticleSourceOperator | ||
47 | + articleDraft.MatchUrl = req.MatchUrl | ||
48 | + //图片 | ||
49 | + images, err := getImages(req.Images) | ||
50 | + if err != nil { | ||
51 | + return nil, xerr.NewErrMsg(err.Error()) | ||
52 | + } | ||
53 | + articleDraft.Images = images | ||
54 | + //视频 | ||
55 | + videos, err := getVideos(req.Videos) | ||
56 | + if err != nil { | ||
57 | + return nil, xerr.NewErrMsg(err.Error()) | ||
58 | + } | ||
59 | + articleDraft.Videos = videos | ||
60 | + //操作人 | ||
61 | + userToken := contextdata.GetUserTokenFromCtx(l.ctx) | ||
62 | + // 获取当前用户信息 | ||
63 | + userMe, err := l.svcCtx.ApiAuthService.MeInfo(l.ctx, authlib.RequestUserMeQuery{Token: req.AccessToken}) | ||
64 | + if err != nil { | ||
65 | + return nil, xerr.NewErrMsgErr("获取当前用户信息失败", err) | ||
66 | + } | ||
67 | + articleDraft.Operator = domain.Operator{ | ||
68 | + Id: userToken.UserId, | ||
69 | + Name: userMe.User.NickName, | ||
70 | + } | ||
71 | + 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 | + if err != nil { | ||
74 | + return err | ||
75 | + } | ||
76 | + return nil | ||
77 | + }, true) | ||
78 | + if err != nil { | ||
79 | + return nil, xerr.NewErrMsg("保存草稿失败") | ||
80 | + } | ||
81 | + resp = &types.SystemArticleDraftUpdateResponse{ | ||
82 | + Id: articleDraft.Id, | ||
83 | + Title: articleDraft.Title, | ||
84 | + Content: articleDraft.Content, | ||
85 | + AuthorId: articleDraft.AuthorId, | ||
86 | + Images: req.Images, | ||
87 | + Videos: req.Videos, | ||
88 | + TargetUser: int(articleDraft.TargetUser), | ||
89 | + WhoRead: articleDraft.WhoRead, | ||
90 | + WhoReview: articleDraft.WhoReview, | ||
91 | + MatchUrl: articleDraft.MatchUrl, | ||
92 | + Tags: articleDraft.Tags, | ||
93 | + } | ||
94 | + return | ||
95 | +} |
@@ -27,13 +27,14 @@ type ServiceContext struct { | @@ -27,13 +27,14 @@ type ServiceContext struct { | ||
27 | DB *gorm.DB | 27 | DB *gorm.DB |
28 | Redis *redis.Redis | 28 | Redis *redis.Redis |
29 | 29 | ||
30 | - ArticleBackupRepository domain.ArticleBackupRepository | ||
31 | - ArticleCommentRepository domain.ArticleCommentRepository | ||
32 | - ArticleDraftRepository domain.ArticleDraftRepository | ||
33 | - ArticleRepository domain.ArticleRepository | ||
34 | - ArticleSectionRepository domain.ArticleSectionRepository | ||
35 | - ArticleTagRepository domain.ArticleTagRepository | ||
36 | - ArticleAndTagRepository domain.ArticleAndTagRepository | 30 | + ArticleBackupRepository domain.ArticleBackupRepository |
31 | + ArticleCommentRepository domain.ArticleCommentRepository | ||
32 | + ArticleDraftRepository domain.ArticleDraftRepository | ||
33 | + ArticleRepository domain.ArticleRepository | ||
34 | + ArticleSectionRepository domain.ArticleSectionRepository | ||
35 | + ArticleTagRepository domain.ArticleTagRepository | ||
36 | + ArticleAndTagRepository domain.ArticleAndTagRepository | ||
37 | + ArticleDraftOperationRepository domain.ArticleDraftOperationRepository | ||
37 | 38 | ||
38 | CompanyRepository domain.CompanyRepository | 39 | CompanyRepository domain.CompanyRepository |
39 | DepartmentRepository domain.DepartmentRepository | 40 | DepartmentRepository domain.DepartmentRepository |
@@ -81,12 +82,13 @@ func NewServiceContext(c config.Config) *ServiceContext { | @@ -81,12 +82,13 @@ func NewServiceContext(c config.Config) *ServiceContext { | ||
81 | LogRequest: middleware.NewLogRequestMiddleware(c.LogRequest).Handle, | 82 | LogRequest: middleware.NewLogRequestMiddleware(c.LogRequest).Handle, |
82 | MiniProgram: miniProgram, | 83 | MiniProgram: miniProgram, |
83 | 84 | ||
84 | - ArticleBackupRepository: repository.NewArticleBackupRepository(cache.NewCachedRepository(mlCache)), | ||
85 | - ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), | ||
86 | - ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), | ||
87 | - ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), | ||
88 | - ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)), | ||
89 | - ArticleAndTagRepository: repository.NewArticleAndTagRepository(cache.NewCachedRepository(mlCache)), | 85 | + ArticleBackupRepository: repository.NewArticleBackupRepository(cache.NewCachedRepository(mlCache)), |
86 | + ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), | ||
87 | + ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), | ||
88 | + ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), | ||
89 | + ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)), | ||
90 | + ArticleAndTagRepository: repository.NewArticleAndTagRepository(cache.NewCachedRepository(mlCache)), | ||
91 | + ArticleDraftOperationRepository: repository.NewArticleDraftOperationRepository(cache.NewCachedRepository(mlCache)), | ||
90 | 92 | ||
91 | CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), | 93 | CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), |
92 | DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), | 94 | DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), |
@@ -895,6 +895,11 @@ type ArticleAuthor struct { | @@ -895,6 +895,11 @@ type ArticleAuthor struct { | ||
895 | Company string `json:"company"` // 公司 | 895 | Company string `json:"company"` // 公司 |
896 | } | 896 | } |
897 | 897 | ||
898 | +type Operator struct { | ||
899 | + Id int64 `json:"id,string"` // 人员id | ||
900 | + Name string `json:"name"` // 人员的名字 | ||
901 | +} | ||
902 | + | ||
898 | type MiniArticleCreateRequest struct { | 903 | type MiniArticleCreateRequest struct { |
899 | Title string `json:"title"` //标题 | 904 | Title string `json:"title"` //标题 |
900 | Section []string `json:"section"` //文章的文本内容 | 905 | Section []string `json:"section"` //文章的文本内容 |
@@ -1263,11 +1268,14 @@ type SystemArticleSearch struct { | @@ -1263,11 +1268,14 @@ type SystemArticleSearch struct { | ||
1263 | Author string `json:"author"` //发布人 | 1268 | Author string `json:"author"` //发布人 |
1264 | Images []string `json:"images"` //图片 | 1269 | Images []string `json:"images"` //图片 |
1265 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 1270 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
1271 | + UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 | ||
1266 | CountLove int `json:"countLove"` //点赞数量 | 1272 | CountLove int `json:"countLove"` //点赞数量 |
1267 | CountComment int `json:"countComment"` //评论数量 | 1273 | CountComment int `json:"countComment"` //评论数量 |
1268 | Show int `json:"show"` //是否隐藏 [0显示、1不显示] | 1274 | Show int `json:"show"` //是否隐藏 [0显示、1不显示] |
1269 | Tags []string `json:"tags"` //标签 | 1275 | Tags []string `json:"tags"` //标签 |
1270 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 1276 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
1277 | + Operator Operator `json:"operator"` //运营操作人 | ||
1278 | + Source int `json:"source"` //来源[1用户发布、2运营发布] | ||
1271 | } | 1279 | } |
1272 | 1280 | ||
1273 | type SystemArticleUpdateRequest struct { | 1281 | type SystemArticleUpdateRequest struct { |
@@ -1299,6 +1307,43 @@ type SystemArticleUpdateResponse struct { | @@ -1299,6 +1307,43 @@ type SystemArticleUpdateResponse struct { | ||
1299 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 1307 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
1300 | } | 1308 | } |
1301 | 1309 | ||
1310 | +type SystemArticleCreateRequest struct { | ||
1311 | + Title string `json:"title"` //标题 | ||
1312 | + Content string `json:"content"` //文章的文本内容 | ||
1313 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1314 | + Images []string `json:"images,optional"` //图片 | ||
1315 | + Videos []Video `json:"video,optional"` // 视频 | ||
1316 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1317 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1318 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1319 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1320 | + ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID | ||
1321 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
1322 | +} | ||
1323 | + | ||
1324 | +type SystemArticleCreateResponse struct { | ||
1325 | + Id int64 `json:"id"` //id | ||
1326 | + Title string `json:"title"` //标题 | ||
1327 | + Content string `json:"content"` //文章的文本内容 | ||
1328 | + AuthorId int64 `json:"authorId,optional"` //发布人id | ||
1329 | + Images []string `json:"images,optional"` //图片 | ||
1330 | + Videos []Video `json:"video,optional"` // 视频 | ||
1331 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1332 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1333 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1334 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
1335 | +} | ||
1336 | + | ||
1337 | +type SystemArticleDeleteRequest struct { | ||
1338 | + Id int64 `json:"id"` //id | ||
1339 | +} | ||
1340 | + | ||
1341 | +type SystemArticleDeleteResponse struct { | ||
1342 | + Id int64 `json:"id"` //id | ||
1343 | + Title string `json:"title"` //标题 | ||
1344 | + AuthorId int64 `json:"authorId,optional"` //发布人id | ||
1345 | +} | ||
1346 | + | ||
1302 | type SystemArticleHistoryRequest struct { | 1347 | type SystemArticleHistoryRequest struct { |
1303 | ArticleId int64 `json:"articleId"` //文章ID | 1348 | ArticleId int64 `json:"articleId"` //文章ID |
1304 | Author string `json:"author,optional"` //发布人 | 1349 | Author string `json:"author,optional"` //发布人 |
@@ -1401,6 +1446,161 @@ type MiniSearchArticleItem struct { | @@ -1401,6 +1446,161 @@ type MiniSearchArticleItem struct { | ||
1401 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 1446 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
1402 | } | 1447 | } |
1403 | 1448 | ||
1449 | +type SystemArticleDraftCreateRequest struct { | ||
1450 | + Title string `json:"title"` //标题 | ||
1451 | + Content string `json:"content"` //文章的文本内容 | ||
1452 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1453 | + Images []string `json:"images,optional"` //图片 | ||
1454 | + Videos []Video `json:"video,optional"` // 视频 | ||
1455 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1456 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1457 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1458 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1459 | + Tags []int64 `json:"tags"` // 标签 | ||
1460 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
1461 | +} | ||
1462 | + | ||
1463 | +type SystemArticleDraftCreateResponse struct { | ||
1464 | + Id int64 `json:"id"` //ID | ||
1465 | + Title string `json:"title"` //标题 | ||
1466 | + Content string `json:"content"` //文章的文本内容 | ||
1467 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1468 | + Images []string `json:"images,optional"` //图片 | ||
1469 | + Videos []Video `json:"video,optional"` // 视频 | ||
1470 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1471 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1472 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1473 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1474 | + Tags []int64 `json:"tags"` // 标签 | ||
1475 | +} | ||
1476 | + | ||
1477 | +type SystemArticleDraftUpdateRequest struct { | ||
1478 | + Id int64 `json:"id"` // ID | ||
1479 | + Title string `json:"title"` //标题 | ||
1480 | + Content string `json:"content"` //文章的文本内容 | ||
1481 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1482 | + Images []string `json:"images,optional"` //图片 | ||
1483 | + Videos []Video `json:"video,optional"` // 视频 | ||
1484 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1485 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1486 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1487 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1488 | + Tags []int64 `json:"tags"` // 标签 | ||
1489 | + AccessToken string `header:"x-mmm-accesstoken"` // 授权token | ||
1490 | +} | ||
1491 | + | ||
1492 | +type SystemArticleDraftUpdateResponse struct { | ||
1493 | + Id int64 `json:"id"` //ID | ||
1494 | + Title string `json:"title"` //标题 | ||
1495 | + Content string `json:"content"` //文章的文本内容 | ||
1496 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1497 | + Images []string `json:"images,optional"` //图片 | ||
1498 | + Videos []Video `json:"video,optional"` // 视频 | ||
1499 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1500 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1501 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1502 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1503 | + Tags []int64 `json:"tags"` // 标签 | ||
1504 | +} | ||
1505 | + | ||
1506 | +type SystemArticleDraftSearchRequest struct { | ||
1507 | + Page int `json:"page"` //页码 | ||
1508 | + Size int `json:"size"` //每页行数 | ||
1509 | + CompanyId int64 `json:"companyId,optional"` //公司ID(前端不传) | ||
1510 | + Title string `json:"title,optional"` //标题 | ||
1511 | + Operator string `json:"operator,optional"` //编辑人 | ||
1512 | + BeginTime int64 `json:"beginTime,optional"` //开始时间 | ||
1513 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
1514 | +} | ||
1515 | + | ||
1516 | +type SystemArticleDraftSearchResponse struct { | ||
1517 | + Total int `json:"total"` | ||
1518 | + List []SystemArticleDraftSearch `json:"list"` | ||
1519 | +} | ||
1520 | + | ||
1521 | +type SystemArticleDraftSearch struct { | ||
1522 | + Id int64 `json:"id"` //ID | ||
1523 | + Title string `json:"title"` //标题 | ||
1524 | + Images []string `json:"images"` //图片 | ||
1525 | + Operator string `json:"operator"` //操作人 | ||
1526 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1527 | + Author string `json:"author"` //发布人 | ||
1528 | + UpdatedAt int64 `json:"updatedAt"` //编辑时间 | ||
1529 | +} | ||
1530 | + | ||
1531 | +type SystemArticleDraftDeleteRequest struct { | ||
1532 | + Id int64 `json:"id"` //ID | ||
1533 | +} | ||
1534 | + | ||
1535 | +type SystemArticleDraftDeleteResponse struct { | ||
1536 | + Id int64 `json:"id"` //ID | ||
1537 | + Title string `json:"title"` //标题 | ||
1538 | + Content string `json:"content"` //文章的文本内容 | ||
1539 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1540 | + Images []string `json:"images,optional"` //图片 | ||
1541 | + Videos []Video `json:"video,optional"` // 视频 | ||
1542 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1543 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1544 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1545 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1546 | + Tags []int64 `json:"tags"` // 标签 | ||
1547 | +} | ||
1548 | + | ||
1549 | +type SystemArticleDraftGetRequest struct { | ||
1550 | + Id int64 `path:"id"` //id | ||
1551 | + CompanyId int64 `path:",optional"` //公司ID(前端不传) | ||
1552 | +} | ||
1553 | + | ||
1554 | +type SystemArticleDraftGetResponse struct { | ||
1555 | + Id int64 `json:"id"` //ID | ||
1556 | + Title string `json:"title"` //标题 | ||
1557 | + Content string `json:"content"` //文章的文本内容 | ||
1558 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1559 | + Images []string `json:"images,optional"` //图片 | ||
1560 | + Videos []Video `json:"video,optional"` // 视频 | ||
1561 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
1562 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
1563 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
1564 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
1565 | + Tags []int64 `json:"tags"` // 标签 | ||
1566 | +} | ||
1567 | + | ||
1568 | +type SystemArticleSearchDeletedRequest struct { | ||
1569 | + Page int `json:"page"` //页码 | ||
1570 | + Size int `json:"size"` //每页行数 | ||
1571 | + Title string `json:"title,optional"` //标题 | ||
1572 | + Author int64 `json:"author,optional"` //发布人 | ||
1573 | + DeletedType int `json:"deletedType,optional"` //类型 1-运营删除 2-用户删除 | ||
1574 | + BeginTime int64 `json:"beginTime,optional"` //开始时间 | ||
1575 | + EndTime int64 `json:"endTime,optional"` //结束时间 | ||
1576 | +} | ||
1577 | + | ||
1578 | +type SystemArticleSearchDeletedResponse struct { | ||
1579 | + Total int `json:"total"` | ||
1580 | + List []SystemArticleSearchDeletedItem `json:"list"` | ||
1581 | +} | ||
1582 | + | ||
1583 | +type SystemArticleSearchDeletedItem struct { | ||
1584 | + Id int64 `json:"id"` //ID | ||
1585 | + Title string `json:"title"` //标题 | ||
1586 | + Images []string `json:"images"` //图片 | ||
1587 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1588 | + Author string `json:"author"` //发布人 | ||
1589 | + Source int `json:"source"` //来源 1-用户发布 2-运营发布 | ||
1590 | + DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | ||
1591 | + DeletedAt int64 `json:"deletedAt"` //删除时间 | ||
1592 | +} | ||
1593 | + | ||
1594 | +type SystemArticleDeletedRestoreRequest struct { | ||
1595 | + Id int64 `json:"id"` //ID | ||
1596 | +} | ||
1597 | + | ||
1598 | +type SystemArticleDeletedRestoreResponse struct { | ||
1599 | + Id int64 `json:"id"` //ID | ||
1600 | + Title string `json:"title"` //标题 | ||
1601 | + AuthorId int64 `json:"authorId"` //发布人id | ||
1602 | +} | ||
1603 | + | ||
1404 | type RoleGetRequest struct { | 1604 | type RoleGetRequest struct { |
1405 | Id int64 `path:"id"` | 1605 | Id int64 `path:"id"` |
1406 | } | 1606 | } |
1 | + | ||
2 | +syntax = "v1" | ||
3 | + | ||
4 | +info( | ||
5 | + title: "xx实例" | ||
6 | + desc: "xx实例" | ||
7 | + author: "author" | ||
8 | + email: "email" | ||
9 | + version: "v1" | ||
10 | +) | ||
11 | + | ||
12 | +@server( | ||
13 | + prefix: article_draft_operation/v1 | ||
14 | + group: article_draft_operation | ||
15 | + jwt: JwtAuth | ||
16 | +) | ||
17 | +service Core { | ||
18 | + @handler getArticleDraftOperation | ||
19 | + post /article_draft_operation/:id (ArticleDraftOperationGetRequest) returns (ArticleDraftOperationGetResponse) | ||
20 | + @handler saveArticleDraftOperation | ||
21 | + post /article_draft_operation (ArticleDraftOperationSaveRequest) returns (ArticleDraftOperationSaveResponse) | ||
22 | + @handler deleteArticleDraftOperation | ||
23 | + delete /article_draft_operation/:id (ArticleDraftOperationDeleteRequest) returns (ArticleDraftOperationDeleteResponse) | ||
24 | + @handler updateArticleDraftOperation | ||
25 | + put /article_draft_operation/:id (ArticleDraftOperationUpdateRequest) returns (ArticleDraftOperationUpdateResponse) | ||
26 | + @handler searchArticleDraftOperation | ||
27 | + post /article_draft_operation/search (ArticleDraftOperationSearchRequest) returns (ArticleDraftOperationSearchResponse) | ||
28 | +} | ||
29 | + | ||
30 | +type ( | ||
31 | + ArticleDraftOperationGetRequest { | ||
32 | + Id int64 `path:"id"` | ||
33 | + } | ||
34 | + ArticleDraftOperationGetResponse struct{ | ||
35 | + ArticleDraftOperation ArticleDraftOperationItem `json:"article_draft_operation"` | ||
36 | + } | ||
37 | + | ||
38 | + ArticleDraftOperationSaveRequest struct{ | ||
39 | + ArticleDraftOperation ArticleDraftOperationItem `json:"article_draft_operation"` | ||
40 | + } | ||
41 | + ArticleDraftOperationSaveResponse struct{} | ||
42 | + | ||
43 | + ArticleDraftOperationDeleteRequest struct{ | ||
44 | + Id int64 `path:"id"` | ||
45 | + } | ||
46 | + ArticleDraftOperationDeleteResponse struct{} | ||
47 | + | ||
48 | + ArticleDraftOperationUpdateRequest struct{ | ||
49 | + Id int64 `path:"id"` | ||
50 | + ArticleDraftOperation ArticleDraftOperationItem `json:"article_draft_operation"` | ||
51 | + } | ||
52 | + ArticleDraftOperationUpdateResponse struct{} | ||
53 | + | ||
54 | + ArticleDraftOperationSearchRequest struct{ | ||
55 | + Page int `json:"page"` | ||
56 | + Size int `json:"size"` | ||
57 | + } | ||
58 | + ArticleDraftOperationSearchResponse{ | ||
59 | + List []ArticleDraftOperationItem `json:"list"` | ||
60 | + Total int64 `json:"total"` | ||
61 | + } | ||
62 | + ArticleDraftOperationItem struct{ | ||
63 | + | ||
64 | + } | ||
65 | +) |
1 | + | ||
2 | +syntax = "proto3"; | ||
3 | + | ||
4 | +option go_package ="./pb"; | ||
5 | + | ||
6 | +package pb; | ||
7 | + | ||
8 | +message ArticleDraftOperationGetReq { | ||
9 | + int64 Id = 1; | ||
10 | +} | ||
11 | +message ArticleDraftOperationGetResp{ | ||
12 | + ArticleDraftOperationItem User = 1; | ||
13 | +} | ||
14 | + | ||
15 | +message ArticleDraftOperationSaveReq { | ||
16 | + | ||
17 | +} | ||
18 | +message ArticleDraftOperationSaveResp{ | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +message ArticleDraftOperationDeleteReq { | ||
23 | + int64 Id = 1; | ||
24 | +} | ||
25 | +message ArticleDraftOperationDeleteResp{ | ||
26 | + | ||
27 | +} | ||
28 | + | ||
29 | +message ArticleDraftOperationUpdateReq { | ||
30 | + int64 Id = 1; | ||
31 | +} | ||
32 | +message ArticleDraftOperationUpdateResp{ | ||
33 | + | ||
34 | +} | ||
35 | + | ||
36 | +message ArticleDraftOperationSearchReq { | ||
37 | + int64 PageNumber = 1; | ||
38 | + int64 PageSize = 2; | ||
39 | +} | ||
40 | +message ArticleDraftOperationSearchResp{ | ||
41 | + repeated ArticleDraftOperationItem List =1; | ||
42 | + int64 Total =2; | ||
43 | +} | ||
44 | +message ArticleDraftOperationItem { | ||
45 | + | ||
46 | +} | ||
47 | + | ||
48 | +service ArticleDraftOperationService { | ||
49 | + rpc ArticleDraftOperationGet(ArticleDraftOperationGetReq) returns(ArticleDraftOperationGetResp); | ||
50 | + rpc ArticleDraftOperationSave(ArticleDraftOperationSaveReq) returns(ArticleDraftOperationSaveResp); | ||
51 | + rpc ArticleDraftOperationDelete(ArticleDraftOperationDeleteReq) returns(ArticleDraftOperationDeleteResp); | ||
52 | + rpc ArticleDraftOperationUpdate(ArticleDraftOperationUpdateReq) returns(ArticleDraftOperationUpdateResp); | ||
53 | + rpc ArticleDraftOperationSearch(ArticleDraftOperationSearchReq) returns(ArticleDraftOperationSearchResp); | ||
54 | +} |
@@ -24,6 +24,7 @@ func Migrate(db *gorm.DB) { | @@ -24,6 +24,7 @@ func Migrate(db *gorm.DB) { | ||
24 | &models.MessageBusiness{}, | 24 | &models.MessageBusiness{}, |
25 | &models.Department{}, | 25 | &models.Department{}, |
26 | &models.ArticleAndTag{}, | 26 | &models.ArticleAndTag{}, |
27 | + &models.ArticleDraftOperation{}, | ||
27 | } | 28 | } |
28 | 29 | ||
29 | db.AutoMigrate(modelsList...) | 30 | db.AutoMigrate(modelsList...) |
@@ -2,11 +2,10 @@ package models | @@ -2,11 +2,10 @@ package models | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | - "time" | ||
6 | - | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
8 | "gorm.io/gorm" | 6 | "gorm.io/gorm" |
9 | "gorm.io/plugin/soft_delete" | 7 | "gorm.io/plugin/soft_delete" |
8 | + "time" | ||
10 | ) | 9 | ) |
11 | 10 | ||
12 | type Article struct { | 11 | type Article struct { |
@@ -33,6 +32,9 @@ type Article struct { | @@ -33,6 +32,9 @@ type Article struct { | ||
33 | Show int // 评论的展示状态(1显示、2不显示) | 32 | Show int // 评论的展示状态(1显示、2不显示) |
34 | Summary string // 内容概要 | 33 | Summary string // 内容概要 |
35 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | 34 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 |
35 | + Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 | ||
36 | + Operator domain.Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 | ||
37 | + DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除 | ||
36 | } | 38 | } |
37 | 39 | ||
38 | func (m *Article) TableName() string { | 40 | func (m *Article) TableName() string { |
1 | +package models | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | + "gorm.io/gorm" | ||
7 | + "gorm.io/plugin/soft_delete" | ||
8 | + "time" | ||
9 | +) | ||
10 | + | ||
11 | +// ArticleDraftOperation 运营草稿 | ||
12 | +type ArticleDraftOperation struct { | ||
13 | + Id int64 `gorm:"primaryKey"` // 唯一标识 | ||
14 | + CompanyId int64 `gorm:"comment:公司ID"` // 公司ID | ||
15 | + AuthorId int64 `gorm:"comment:发布人ID"` // 发布人 | ||
16 | + Title string `gorm:"comment:标题"` // 文章标题 | ||
17 | + Content string `json:"content"` // 文章内容 | ||
18 | + Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片 | ||
19 | + Videos []domain.Video `gorm:"type:jsonb;serializer:json"` // 视频 | ||
20 | + TargetUser domain.ArticleTarget `gorm:"comment:分发方式 0所有人 1指定人"` // 分发方式 0 分发给所有人 1 分发给指定的人 | ||
21 | + WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 | ||
22 | + WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 | ||
23 | + Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签 | ||
24 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
25 | + Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 | ||
26 | + Operator domain.Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 | ||
27 | + Version int `gorm:"comment:版本号"` // 版本号 | ||
28 | + CreatedAt int64 `gorm:"comment:创建时间"` // 创建时间 | ||
29 | + UpdatedAt int64 `gorm:"comment:编辑时间"` // 编辑时间 | ||
30 | + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` // 删除标记 | ||
31 | + DeletedAt int64 `gorm:"comment:删除时间"` // 删除时间 | ||
32 | +} | ||
33 | + | ||
34 | +func (m *ArticleDraftOperation) TableName() string { | ||
35 | + return "article_draft_operation" | ||
36 | +} | ||
37 | + | ||
38 | +func (m *ArticleDraftOperation) BeforeCreate(tx *gorm.DB) (err error) { | ||
39 | + nowTime := time.Now().Unix() | ||
40 | + m.CreatedAt = nowTime | ||
41 | + m.UpdatedAt = nowTime | ||
42 | + return | ||
43 | +} | ||
44 | + | ||
45 | +func (m *ArticleDraftOperation) BeforeUpdate(tx *gorm.DB) (err error) { | ||
46 | + m.UpdatedAt = time.Now().Unix() | ||
47 | + m.Version += 1 | ||
48 | + return | ||
49 | +} | ||
50 | + | ||
51 | +func (m *ArticleDraftOperation) CacheKeyFunc() string { | ||
52 | + if m.Id == 0 { | ||
53 | + return "" | ||
54 | + } | ||
55 | + return fmt.Sprintf("%v:cache:%v:id:%v", domain.ProjectName, m.TableName(), m.Id) | ||
56 | +} | ||
57 | + | ||
58 | +func (m *ArticleDraftOperation) CacheKeyFuncByObject(obj interface{}) string { | ||
59 | + if v, ok := obj.(*ArticleDraftOperation); ok { | ||
60 | + return v.CacheKeyFunc() | ||
61 | + } | ||
62 | + return "" | ||
63 | +} | ||
64 | + | ||
65 | +func (m *ArticleDraftOperation) CachePrimaryKeyFunc() string { | ||
66 | + if len("") == 0 { | ||
67 | + return "" | ||
68 | + } | ||
69 | + return fmt.Sprintf("%v:cache:%v:primarykey:%v", domain.ProjectName, m.TableName(), "key") | ||
70 | +} |
1 | +package repository | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "github.com/jinzhu/copier" | ||
6 | + "github.com/pkg/errors" | ||
7 | + "github.com/tiptok/gocomm/pkg/cache" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
11 | + "gorm.io/gorm" | ||
12 | +) | ||
13 | + | ||
14 | +type ArticleDraftOperationRepository struct { | ||
15 | + *cache.CachedRepository | ||
16 | +} | ||
17 | + | ||
18 | +func (repository *ArticleDraftOperationRepository) Insert(ctx context.Context, conn transaction.Conn, dm *domain.ArticleDraftOperation) (*domain.ArticleDraftOperation, error) { | ||
19 | + var ( | ||
20 | + err error | ||
21 | + m = &models.ArticleDraftOperation{} | ||
22 | + tx = conn.DB() | ||
23 | + ) | ||
24 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
25 | + return nil, err | ||
26 | + } | ||
27 | + if tx = tx.Model(m).Save(m); tx.Error != nil { | ||
28 | + return nil, tx.Error | ||
29 | + } | ||
30 | + dm.Id = m.Id | ||
31 | + return repository.ModelToDomainModel(m) | ||
32 | + | ||
33 | +} | ||
34 | + | ||
35 | +func (repository *ArticleDraftOperationRepository) Update(ctx context.Context, conn transaction.Conn, dm *domain.ArticleDraftOperation) (*domain.ArticleDraftOperation, error) { | ||
36 | + var ( | ||
37 | + err error | ||
38 | + m *models.ArticleDraftOperation | ||
39 | + tx = conn.DB() | ||
40 | + ) | ||
41 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
42 | + return nil, err | ||
43 | + } | ||
44 | + queryFunc := func() (interface{}, error) { | ||
45 | + tx = tx.Model(m).Updates(m) | ||
46 | + return nil, tx.Error | ||
47 | + } | ||
48 | + if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
49 | + return nil, err | ||
50 | + } | ||
51 | + return repository.ModelToDomainModel(m) | ||
52 | +} | ||
53 | + | ||
54 | +func (repository *ArticleDraftOperationRepository) UpdateWithVersion(ctx context.Context, transaction transaction.Conn, dm *domain.ArticleDraftOperation) (*domain.ArticleDraftOperation, error) { | ||
55 | + var ( | ||
56 | + err error | ||
57 | + m *models.ArticleDraftOperation | ||
58 | + tx = transaction.DB() | ||
59 | + ) | ||
60 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
61 | + return nil, err | ||
62 | + } | ||
63 | + oldVersion := dm.Version | ||
64 | + m.Version += 1 | ||
65 | + queryFunc := func() (interface{}, error) { | ||
66 | + tx = tx.Model(m).Select("*").Where("id = ?", m.Id).Where("version = ?", oldVersion).Updates(m) | ||
67 | + if tx.RowsAffected == 0 { | ||
68 | + return nil, domain.ErrUpdateFail | ||
69 | + } | ||
70 | + return nil, tx.Error | ||
71 | + } | ||
72 | + if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
73 | + return nil, err | ||
74 | + } | ||
75 | + return repository.ModelToDomainModel(m) | ||
76 | +} | ||
77 | + | ||
78 | +func (repository *ArticleDraftOperationRepository) Delete(ctx context.Context, conn transaction.Conn, dm *domain.ArticleDraftOperation) (*domain.ArticleDraftOperation, error) { | ||
79 | + var ( | ||
80 | + tx = conn.DB() | ||
81 | + m = &models.ArticleDraftOperation{Id: dm.Identify().(int64)} | ||
82 | + ) | ||
83 | + queryFunc := func() (interface{}, error) { | ||
84 | + tx = tx.Where("id = ?", m.Id).Delete(m) | ||
85 | + return m, tx.Error | ||
86 | + } | ||
87 | + if _, err := repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
88 | + return dm, err | ||
89 | + } | ||
90 | + return repository.ModelToDomainModel(m) | ||
91 | +} | ||
92 | + | ||
93 | +func (repository *ArticleDraftOperationRepository) FindOne(ctx context.Context, conn transaction.Conn, id int64) (*domain.ArticleDraftOperation, error) { | ||
94 | + var ( | ||
95 | + err error | ||
96 | + tx = conn.DB() | ||
97 | + m = new(models.ArticleDraftOperation) | ||
98 | + ) | ||
99 | + queryFunc := func() (interface{}, error) { | ||
100 | + tx = tx.Model(m).Where("id = ?", id).First(m) | ||
101 | + if errors.Is(tx.Error, gorm.ErrRecordNotFound) { | ||
102 | + return nil, domain.ErrNotFound | ||
103 | + } | ||
104 | + return m, tx.Error | ||
105 | + } | ||
106 | + cacheModel := new(models.ArticleDraftOperation) | ||
107 | + cacheModel.Id = id | ||
108 | + if err = repository.QueryCache(cacheModel.CacheKeyFunc, m, queryFunc); err != nil { | ||
109 | + return nil, err | ||
110 | + } | ||
111 | + return repository.ModelToDomainModel(m) | ||
112 | +} | ||
113 | + | ||
114 | +func (repository *ArticleDraftOperationRepository) Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*domain.ArticleDraftOperation, error) { | ||
115 | + var ( | ||
116 | + tx = conn.DB() | ||
117 | + ms []*models.ArticleDraftOperation | ||
118 | + dms = make([]*domain.ArticleDraftOperation, 0) | ||
119 | + total int64 | ||
120 | + ) | ||
121 | + queryFunc := func() (interface{}, error) { | ||
122 | + tx = tx.Model(&ms).Order("updated_at desc") | ||
123 | + //标题 | ||
124 | + if v, ok := queryOptions["title"]; ok { | ||
125 | + tx = tx.Where("title like ?", "%"+v.(string)+"%") | ||
126 | + } | ||
127 | + //公司ID | ||
128 | + if v, ok := queryOptions["companyId"]; ok { | ||
129 | + tx = tx.Where("company_id = ?", v) | ||
130 | + } | ||
131 | + //最近修改时间 | ||
132 | + if v, ok := queryOptions["beginTime"]; ok { | ||
133 | + tx = tx.Where("updated_at >= ?", v) | ||
134 | + } | ||
135 | + if v, ok := queryOptions["endTime"]; ok { | ||
136 | + tx = tx.Where("updated_at <= ?", v) | ||
137 | + } | ||
138 | + //操作人 | ||
139 | + if v, ok := queryOptions["operator"]; ok { | ||
140 | + tx = tx.Where(`"operator" ->> 'name' like ?`, "%"+v.(string)+"%") | ||
141 | + } | ||
142 | + if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | ||
143 | + return dms, tx.Error | ||
144 | + } | ||
145 | + return dms, nil | ||
146 | + } | ||
147 | + | ||
148 | + if _, err := repository.Query(queryFunc); err != nil { | ||
149 | + return 0, nil, err | ||
150 | + } | ||
151 | + | ||
152 | + for _, item := range ms { | ||
153 | + if dm, err := repository.ModelToDomainModel(item); err != nil { | ||
154 | + return 0, dms, err | ||
155 | + } else { | ||
156 | + dms = append(dms, dm) | ||
157 | + } | ||
158 | + } | ||
159 | + return total, dms, nil | ||
160 | +} | ||
161 | + | ||
162 | +func (repository *ArticleDraftOperationRepository) ModelToDomainModel(from *models.ArticleDraftOperation) (*domain.ArticleDraftOperation, error) { | ||
163 | + to := &domain.ArticleDraftOperation{} | ||
164 | + err := copier.Copy(to, from) | ||
165 | + return to, err | ||
166 | +} | ||
167 | + | ||
168 | +func (repository *ArticleDraftOperationRepository) DomainModelToModel(from *domain.ArticleDraftOperation) (*models.ArticleDraftOperation, error) { | ||
169 | + to := &models.ArticleDraftOperation{} | ||
170 | + err := copier.Copy(to, from) | ||
171 | + return to, err | ||
172 | +} | ||
173 | + | ||
174 | +func NewArticleDraftOperationRepository(cache *cache.CachedRepository) domain.ArticleDraftOperationRepository { | ||
175 | + return &ArticleDraftOperationRepository{CachedRepository: cache} | ||
176 | +} |
@@ -3,6 +3,7 @@ package repository | @@ -3,6 +3,7 @@ package repository | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | "fmt" | 5 | "fmt" |
6 | + "gorm.io/plugin/soft_delete" | ||
6 | "strings" | 7 | "strings" |
7 | 8 | ||
8 | "github.com/pkg/errors" | 9 | "github.com/pkg/errors" |
@@ -53,6 +54,28 @@ func (repository *ArticleRepository) Update(ctx context.Context, conn transactio | @@ -53,6 +54,28 @@ func (repository *ArticleRepository) Update(ctx context.Context, conn transactio | ||
53 | return repository.ModelToDomainModel(m) | 54 | return repository.ModelToDomainModel(m) |
54 | } | 55 | } |
55 | 56 | ||
57 | +func (repository *ArticleRepository) Restore(ctx context.Context, conn transaction.Conn, dm *domain.Article) (*domain.Article, error) { | ||
58 | + var ( | ||
59 | + err error | ||
60 | + m *models.Article | ||
61 | + tx = conn.DB() | ||
62 | + ) | ||
63 | + if m, err = repository.DomainModelToModel(dm); err != nil { | ||
64 | + return nil, err | ||
65 | + } | ||
66 | + m.DeletedAt = 0 | ||
67 | + m.IsDel = soft_delete.DeletedAt(soft_delete.FlagActived) | ||
68 | + m.DeletedType = 0 | ||
69 | + queryFunc := func() (interface{}, error) { | ||
70 | + tx = tx.Model(m).Unscoped().Select("*").Updates(m) | ||
71 | + return nil, tx.Error | ||
72 | + } | ||
73 | + if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil { | ||
74 | + return nil, err | ||
75 | + } | ||
76 | + return repository.ModelToDomainModel(m) | ||
77 | +} | ||
78 | + | ||
56 | func (repository *ArticleRepository) UpdateWithVersion(ctx context.Context, transaction transaction.Conn, dm *domain.Article) (*domain.Article, error) { | 79 | func (repository *ArticleRepository) UpdateWithVersion(ctx context.Context, transaction transaction.Conn, dm *domain.Article) (*domain.Article, error) { |
57 | var ( | 80 | var ( |
58 | err error | 81 | err error |
@@ -113,6 +136,27 @@ func (repository *ArticleRepository) FindOne(ctx context.Context, conn transacti | @@ -113,6 +136,27 @@ func (repository *ArticleRepository) FindOne(ctx context.Context, conn transacti | ||
113 | return repository.ModelToDomainModel(m) | 136 | return repository.ModelToDomainModel(m) |
114 | } | 137 | } |
115 | 138 | ||
139 | +func (repository *ArticleRepository) FindOneWithUnscoped(ctx context.Context, conn transaction.Conn, id int64) (*domain.Article, error) { | ||
140 | + var ( | ||
141 | + err error | ||
142 | + tx = conn.DB() | ||
143 | + m = new(models.Article) | ||
144 | + ) | ||
145 | + queryFunc := func() (interface{}, error) { | ||
146 | + tx = tx.Model(m).Unscoped().Where("id = ?", id).First(m) | ||
147 | + if errors.Is(tx.Error, gorm.ErrRecordNotFound) { | ||
148 | + return nil, domain.ErrNotFound | ||
149 | + } | ||
150 | + return m, tx.Error | ||
151 | + } | ||
152 | + cacheModel := new(models.Article) | ||
153 | + cacheModel.Id = id | ||
154 | + if err = repository.QueryCache(cacheModel.CacheKeyFunc, m, queryFunc); err != nil { | ||
155 | + return nil, err | ||
156 | + } | ||
157 | + return repository.ModelToDomainModel(m) | ||
158 | +} | ||
159 | + | ||
116 | func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*domain.Article, error) { | 160 | func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*domain.Article, error) { |
117 | var ( | 161 | var ( |
118 | tx = conn.DB() | 162 | tx = conn.DB() |
@@ -133,6 +177,8 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | @@ -133,6 +177,8 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | ||
133 | tx = tx.Order("count_love asc") | 177 | tx = tx.Order("count_love asc") |
134 | case "countLove descending": | 178 | case "countLove descending": |
135 | tx = tx.Order("count_love desc") | 179 | tx = tx.Order("count_love desc") |
180 | + case "deletedAt descending": | ||
181 | + tx = tx.Order("deleted_at desc") | ||
136 | default: | 182 | default: |
137 | tx = tx.Order("created_at desc") | 183 | tx = tx.Order("created_at desc") |
138 | } | 184 | } |
@@ -154,6 +200,20 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | @@ -154,6 +200,20 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | ||
154 | if v, ok := queryOptions["authorId"]; ok { | 200 | if v, ok := queryOptions["authorId"]; ok { |
155 | tx = tx.Where("author_id=?", v) | 201 | tx = tx.Where("author_id=?", v) |
156 | } | 202 | } |
203 | + if v, ok := queryOptions["deletedType"]; ok { | ||
204 | + tx = tx.Where("deleted_type = ?", v) | ||
205 | + } | ||
206 | + //删除 | ||
207 | + if v, ok := queryOptions["isDel"]; ok { | ||
208 | + tx = tx.Unscoped().Where("is_del = ?", v) | ||
209 | + } | ||
210 | + //删除时间 | ||
211 | + if v, ok := queryOptions["beginDeletedAt"]; ok { | ||
212 | + tx = tx.Where("deleted_at >= ?", v) | ||
213 | + } | ||
214 | + if v, ok := queryOptions["endDeletedAt"]; ok { | ||
215 | + tx = tx.Where("deleted_at < ?", v) | ||
216 | + } | ||
157 | if v, ok := queryOptions["tags"]; ok && len(v.([]int64)) > 0 { | 217 | if v, ok := queryOptions["tags"]; ok && len(v.([]int64)) > 0 { |
158 | values := make([]string, 0) | 218 | values := make([]string, 0) |
159 | for _, item := range v.([]int64) { | 219 | for _, item := range v.([]int64) { |
@@ -384,6 +444,9 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | @@ -384,6 +444,9 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | ||
384 | Summary: from.Summary, | 444 | Summary: from.Summary, |
385 | MatchUrl: from.MatchUrl, | 445 | MatchUrl: from.MatchUrl, |
386 | Videos: from.Videos, | 446 | Videos: from.Videos, |
447 | + Source: from.Source, | ||
448 | + Operator: from.Operator, | ||
449 | + DeletedType: from.DeletedType, | ||
387 | } | 450 | } |
388 | return to, nil | 451 | return to, nil |
389 | } | 452 | } |
@@ -413,6 +476,9 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | @@ -413,6 +476,9 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | ||
413 | Summary: from.Summary, | 476 | Summary: from.Summary, |
414 | MatchUrl: from.MatchUrl, | 477 | MatchUrl: from.MatchUrl, |
415 | Videos: from.Videos, | 478 | Videos: from.Videos, |
479 | + Source: from.Source, | ||
480 | + Operator: from.Operator, | ||
481 | + DeletedType: from.DeletedType, | ||
416 | } | 482 | } |
417 | // err := copier.Copy(to, from) | 483 | // err := copier.Copy(to, from) |
418 | return to, nil | 484 | return to, nil |
@@ -15,22 +15,25 @@ type Article struct { | @@ -15,22 +15,25 @@ type Article struct { | ||
15 | UpdatedAt int64 `json:"updatedAt,omitempty"` | 15 | UpdatedAt int64 `json:"updatedAt,omitempty"` |
16 | DeletedAt int64 `json:"deletedAt,omitempty"` | 16 | DeletedAt int64 `json:"deletedAt,omitempty"` |
17 | Version int `json:"version,omitempty"` | 17 | Version int `json:"version,omitempty"` |
18 | - AuthorId int64 `json:"authorId"` // 发布人 | ||
19 | - Author UserSimple `json:"author"` // 发布人 | ||
20 | - Title string `json:"title"` // 文章标题 | ||
21 | - Images []Image `json:"images"` // 图片 | ||
22 | - Videos []Video `json:"videos"` // 视频 | ||
23 | - WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
24 | - WhoReview []int64 `json:"whoReview"` // 评论人 | ||
25 | - Location Location `json:"location"` // 坐标 | ||
26 | - TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 | ||
27 | - CountLove int `json:"countLove"` // 点赞数量 | ||
28 | - CountComment int `json:"countComment"` // 评论数量 | ||
29 | - CountRead int `json:"countRead"` // 浏览数量 | ||
30 | - Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) | ||
31 | - Tags []int64 `json:"tags"` // 定性标签 | ||
32 | - Summary string `json:"summary"` // 内容概要 | ||
33 | - MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 18 | + AuthorId int64 `json:"authorId"` // 发布人 |
19 | + Author UserSimple `json:"author"` // 发布人 | ||
20 | + Title string `json:"title"` // 文章标题 | ||
21 | + Images []Image `json:"images"` // 图片 | ||
22 | + Videos []Video `json:"videos"` // 视频 | ||
23 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
24 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
25 | + Location Location `json:"location"` // 坐标 | ||
26 | + TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 | ||
27 | + CountLove int `json:"countLove"` // 点赞数量 | ||
28 | + CountComment int `json:"countComment"` // 评论数量 | ||
29 | + CountRead int `json:"countRead"` // 浏览数量 | ||
30 | + Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) | ||
31 | + Tags []int64 `json:"tags"` // 定性标签 | ||
32 | + Summary string `json:"summary"` // 内容概要 | ||
33 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
34 | + Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 | ||
35 | + Operator Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 | ||
36 | + DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除 | ||
34 | // ...more | 37 | // ...more |
35 | } | 38 | } |
36 | 39 | ||
@@ -38,8 +41,10 @@ type ArticleRepository interface { | @@ -38,8 +41,10 @@ type ArticleRepository interface { | ||
38 | Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | 41 | Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) |
39 | Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | 42 | Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) |
40 | Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | 43 | Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) |
44 | + Restore(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | ||
41 | UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | 45 | UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) |
42 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error) | 46 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error) |
47 | + FindOneWithUnscoped(ctx context.Context, conn transaction.Conn, id int64) (*Article, error) | ||
43 | Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error) | 48 | Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*Article, error) |
44 | FindAuthorsLatestFirstArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) | 49 | FindAuthorsLatestFirstArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) |
45 | FindAuthorsLatestFirstUnreadArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) | 50 | FindAuthorsLatestFirstUnreadArticle(ctx context.Context, conn transaction.Conn, companyId int64, authors []int64, whoRead int64, limit int) (int64, []*Article, error) |
@@ -65,6 +70,12 @@ type ArticleTarget int | @@ -65,6 +70,12 @@ type ArticleTarget int | ||
65 | const ( | 70 | const ( |
66 | ArticleTargetAll ArticleTarget = 0 //内容分发给所有人 | 71 | ArticleTargetAll ArticleTarget = 0 //内容分发给所有人 |
67 | ArticleTargetLimit ArticleTarget = 1 //分发给指定的人 | 72 | ArticleTargetLimit ArticleTarget = 1 //分发给指定的人 |
73 | + | ||
74 | + ArticleSourceUser int = 1 //文章来源 用户发布 | ||
75 | + ArticleSourceOperator int = 2 //文章来源 运营发布 | ||
76 | + | ||
77 | + ArticleDeletedTypeOperator int = 1 // 文章删除类型 运营删除 | ||
78 | + ArticleDeletedTypeUser int = 2 // 文章删除类型 用户删除 | ||
68 | ) | 79 | ) |
69 | 80 | ||
70 | func (a ArticleTarget) Named() string { | 81 | func (a ArticleTarget) Named() string { |
1 | +package domain | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
6 | + "gorm.io/plugin/soft_delete" | ||
7 | +) | ||
8 | + | ||
9 | +// ArticleDraftOperation 运营草稿 | ||
10 | +type ArticleDraftOperation struct { | ||
11 | + Id int64 `json:"id"` // 唯一标识 | ||
12 | + CompanyId int64 `json:"companyId,string"` // 公司ID | ||
13 | + AuthorId int64 `json:"authorId"` // 发布人 | ||
14 | + Title string `json:"title"` // 文章标题 | ||
15 | + Content string `json:"content"` // 文章内容 | ||
16 | + Images []Image `json:"images"` // 图片 | ||
17 | + Videos []Video `json:"videos"` // 视频 | ||
18 | + TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 | ||
19 | + WhoRead []int64 `json:"whoRead"` // 谁可以看 | ||
20 | + WhoReview []int64 `json:"whoReview"` // 评论人 | ||
21 | + Tags []int64 `json:"tags"` //定性标签 | ||
22 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
23 | + Source int `json:"source"` // 来源 1-用户发布 2-运营发布 | ||
24 | + Operator Operator `json:"operator"` // 运营操作人 | ||
25 | + Version int `json:"version,omitempty"` // 版本号 | ||
26 | + CreatedAt int64 `json:"createdAt,omitempty"` // 创建时间 | ||
27 | + UpdatedAt int64 `json:"updatedAt,omitempty"` // 编辑时间 | ||
28 | + IsDel soft_delete.DeletedAt `json:"isDel,omitempty"` // 删除标记 | ||
29 | + DeletedAt int64 `json:"deletedAt,omitempty"` // 删除时间 | ||
30 | +} | ||
31 | + | ||
32 | +type ArticleDraftOperationRepository interface { | ||
33 | + Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraftOperation) (*ArticleDraftOperation, error) | ||
34 | + Update(ctx context.Context, conn transaction.Conn, dm *ArticleDraftOperation) (*ArticleDraftOperation, error) | ||
35 | + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleDraftOperation) (*ArticleDraftOperation, error) | ||
36 | + Delete(ctx context.Context, conn transaction.Conn, dm *ArticleDraftOperation) (*ArticleDraftOperation, error) | ||
37 | + FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleDraftOperation, error) | ||
38 | + Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleDraftOperation, error) | ||
39 | +} | ||
40 | + | ||
41 | +func (m *ArticleDraftOperation) Identify() interface{} { | ||
42 | + if m.Id == 0 { | ||
43 | + return nil | ||
44 | + } | ||
45 | + return m.Id | ||
46 | +} |
@@ -45,10 +45,8 @@ type UserSimple struct { | @@ -45,10 +45,8 @@ type UserSimple struct { | ||
45 | CompanyId int64 `json:"companyId"` | 45 | CompanyId int64 `json:"companyId"` |
46 | } | 46 | } |
47 | 47 | ||
48 | -// 记录数据的操作人 | ||
49 | -// type Operator struct { | ||
50 | -// From string `json:"from"` // 操作来源 | ||
51 | -// Id int `json:"id"` // 人员id | ||
52 | -// Name string `json:"name"` // 人员名字 | ||
53 | -// UpdatedAt int64 `json:"updatedAt"` // 时间 | ||
54 | -// } | 48 | +// 运营操作人 |
49 | +type Operator struct { | ||
50 | + Id int64 `json:"id,string"` // 人员id | ||
51 | + Name string `json:"name"` // 人员名字 | ||
52 | +} |
@@ -26,4 +26,9 @@ CREATE TABLE `company` ( | @@ -26,4 +26,9 @@ CREATE TABLE `company` ( | ||
26 | CREATE TABLE `user_follow` ( | 26 | CREATE TABLE `user_follow` ( |
27 | `id` int(0) NOT NULL COMMENT '唯一标识', | 27 | `id` int(0) NOT NULL COMMENT '唯一标识', |
28 | PRIMARY KEY (`id`) USING BTREE | 28 | PRIMARY KEY (`id`) USING BTREE |
29 | +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; | ||
30 | + | ||
31 | +CREATE TABLE `article_draft_operation` ( | ||
32 | + `id` int(0) NOT NULL COMMENT '唯一标识', | ||
33 | + PRIMARY KEY (`id`) USING BTREE | ||
29 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; | 34 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; |
-
请 注册 或 登录 后发表评论