作者 郑周

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	cmd/discuss/api/dsl/core/article_type.api
#	cmd/discuss/api/internal/types/types.go
syntax = "v1"
import "core/article_type.api"
import "core/comment.api"
import "core/message.api"
import "core/article_tag.api"
... ...
... ... @@ -43,6 +43,34 @@
]
}
},
"v1/mini/article/mark/user_read": {
"post": {
"summary": "小程序标记当前人员查看的文章",
"operationId": "MiniArticleMarkUserRead",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniArticleMarkUserReadResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniArticleMarkUserReadRequest"
}
}
],
"requestBody": {},
"tags": [
"article"
]
}
},
"v1/mini/article/search/me": {
"post": {
"summary": "小程序获取我发布的文章",
... ... @@ -153,6 +181,62 @@
]
}
},
"v1/mini/article_backup/search": {
"post": {
"summary": "小程序获取文章的编辑记录",
"operationId": "MiniArticleBackupSearch",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniArticleBackupSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniArticleBackupSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"article"
]
}
},
"v1/mini/article_draft": {
"post": {
"summary": "小程序创建文章进草稿箱",
"operationId": "MiniCreateArticleDraft",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniArticleSearchMeResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniArticleSearchMeRequest"
}
}
],
"requestBody": {},
"tags": [
"article"
]
}
},
"v1/mini/comment": {
"get": {
"summary": "小程序评论",
... ... @@ -173,7 +257,7 @@
},
"v1/mini/company/search": {
"post": {
"summary": "公司搜索",
"summary": "公司搜索(公开的)",
"operationId": "miniCompanySearch",
"responses": {
"200": {
... ... @@ -199,6 +283,34 @@
]
}
},
"v1/mini/company/search-joined": {
"post": {
"summary": "搜索已加入的公司",
"operationId": "miniCompanySearchJoined",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CompanySearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CompanySearchRequest"
}
}
],
"requestBody": {},
"tags": [
"company"
]
}
},
"v1/mini/message/business": {
"post": {
"summary": "业务消息",
... ... @@ -557,6 +669,60 @@
]
}
},
"v1/system/article/search": {
"post": {
"summary": "管理后台获取文章列表",
"operationId": "SystemSearchArticle",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemArticleSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemArticleSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"article"
]
}
},
"v1/system/article/{id}": {
"get": {
"summary": "管理后台获取文章内容详情",
"operationId": "SystemGetArticle",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemArticleGetResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"requestBody": {},
"tags": [
"article"
]
}
},
"v1/system/article_tag": {
"post": {
"summary": "后台创建文章标签",
... ... @@ -798,6 +964,29 @@
}
},
"v1/system/role/{id}": {
"get": {
"operationId": "systemGetRole",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/RoleGetResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"requestBody": {},
"tags": [
"role"
]
},
"delete": {
"operationId": "systemDeleteRole",
"responses": {
... ... @@ -829,13 +1018,13 @@
"role"
]
},
"post": {
"operationId": "systemGetRole",
"put": {
"operationId": "systemUpdateRole",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/RoleGetResponse"
"$ref": "#/definitions/RoleUpdateResponse"
}
}
},
... ... @@ -851,7 +1040,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/RoleGetRequest"
"$ref": "#/definitions/RoleUpdateRequest"
}
}
],
... ... @@ -859,36 +1048,61 @@
"tags": [
"role"
]
},
"put": {
"operationId": "systemUpdateRole",
}
},
"v1/system/user/info": {
"post": {
"summary": "系统用户信息",
"operationId": "systemUserInfo",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/RoleUpdateResponse"
"$ref": "#/definitions/SystemUserInfoResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"name": "body",
"in": "body",
"required": true,
"type": "string"
},
"schema": {
"$ref": "#/definitions/SystemUserInfoRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/user/mylike": {
"post": {
"summary": "我点赞的文章或评论",
"operationId": "miniMyLike",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniMyLikeResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/RoleUpdateRequest"
"$ref": "#/definitions/MiniMyLikeRequest"
}
}
],
"requestBody": {},
"tags": [
"role"
"user"
]
}
}
... ... @@ -1142,21 +1356,22 @@
"type": "integer",
"format": "int32"
},
"flag": {
"type": "integer",
"format": "int32",
"description": " 1:用户已加入的 2:用户未加入的公司"
},
"userId": {
"type": "integer",
"format": "int64",
"description": " 按用户搜索"
"description": " 按用户搜索(用户所加入的企业)"
},
"code": {
"type": "string",
"description": " 按编码搜索"
}
},
"title": "CompanySearchRequest",
"required": [
"page",
"size"
]
"title": "CompanySearchRequest"
},
"CompanySearchResponse": {
"type": "object",
... ... @@ -1304,7 +1519,7 @@
"description": " 创建时间"
},
"user": {
"$ref": "#/definitions/User",
"$ref": "#/definitions/SimpleUser",
"description": " 操作人"
},
"article": {
... ... @@ -1312,7 +1527,7 @@
"description": " 文章"
},
"comment": {
"$ref": "#/definitions/Comment",
"$ref": "#/definitions/SimpleComment",
"description": " 评论(不一定是自己,可能是被人@到)"
}
},
... ... @@ -1452,47 +1667,132 @@
"total"
]
},
"MiniArticleCreateRequest": {
"MiniArticleBackupItem": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "标题"
"id": {
"type": "integer",
"format": "int64"
},
"section": {
"type": "array",
"items": {
"type": "string"
},
"description": "文章的文本内容"
"title": {
"type": "string"
},
"authorId": {
"type": "integer",
"format": "int64",
"description": "发布人id"
"content": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"description": "图片"
}
},
"whoRead": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "谁可查看"
"createdAt": {
"type": "integer",
"format": "int64"
},
"whoReview": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "谁可评论"
"location": {
"$ref": "#/definitions/Location"
}
},
"title": "MiniArticleBackupItem",
"required": [
"id",
"title",
"content",
"images",
"createdAt",
"location"
]
},
"MiniArticleBackupSearchRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"articleId": {
"type": "integer",
"format": "int32"
},
"": {
"type": "integer",
"format": "int64",
"description": " 服务端自动获取"
}
},
"title": "MiniArticleBackupSearchRequest",
"required": [
"page",
"size",
"articleId"
]
},
"MiniArticleBackupSearchResponse": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int64"
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/MiniArticleBackupItem"
}
}
},
"title": "MiniArticleBackupSearchResponse",
"required": [
"total",
"list"
]
},
"MiniArticleCreateRequest": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "标题"
},
"section": {
"type": "array",
"items": {
"type": "string"
},
"description": "文章的文本内容"
},
"authorId": {
"type": "integer",
"format": "int64",
"description": "发布人id"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"description": "图片"
},
"whoRead": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "谁可查看"
},
"whoReview": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "谁可评论"
},
"location": {
"$ref": "#/definitions/Location",
... ... @@ -1518,6 +1818,45 @@
"id"
]
},
"MiniArticleDraftCreateRequest": {
"type": "object",
"properties": {
"template": {
"type": "integer",
"format": "int32",
"description": " 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式"
},
"content": {
"type": "array",
"items": {
"type": "string"
},
"description": " 填写的内容"
},
"title": {
"type": "string",
"description": "标题"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"description": "图片"
}
},
"title": "MiniArticleDraftCreateRequest",
"required": [
"template",
"content",
"title",
"images"
]
},
"MiniArticleDraftCreateResponse": {
"type": "object",
"title": "MiniArticleDraftCreateResponse"
},
"MiniArticleGetRequest": {
"type": "object",
"properties": {
... ... @@ -1526,15 +1865,14 @@
"format": "int64",
"description": "id"
},
"companyId": {
"": {
"type": "integer",
"format": "int64"
}
},
"title": "MiniArticleGetRequest",
"required": [
"id",
"-"
"id"
]
},
"MiniArticleGetResponse": {
... ... @@ -1616,6 +1954,11 @@
"type": "integer",
"format": "int32",
"description": " 评论的展示状态(0显示、1不显示)"
},
"edit": {
"type": "integer",
"format": "int32",
"description": " 文章是否存在变更记录 (0 不存在 1存在)"
}
},
"title": "MiniArticleGetResponse",
... ... @@ -1633,17 +1976,55 @@
"countLove",
"countComment",
"countRead",
"show"
"show",
"edit"
]
},
"MiniArticleMarkUserReadRequest": {
"type": "object",
"properties": {
"": {
"type": "integer",
"format": "int64",
"description": " 当前操作人"
},
"": {
"type": "integer",
"format": "int64",
"description": " 当前公司"
},
"articleId": {
"type": "integer",
"format": "int64",
"description": " 文章id"
}
},
"title": "MiniArticleMarkUserReadRequest",
"required": [
"articleId"
]
},
"MiniArticleMarkUserReadResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "MiniArticleMarkUserReadResponse",
"required": [
"id"
]
},
"MiniArticleSearchMeRequest": {
"type": "object",
"properties": {
"authorId": {
"": {
"type": "integer",
"format": "int64"
},
"companyId": {
"": {
"type": "integer",
"format": "int64"
},
... ... @@ -1658,7 +2039,6 @@
},
"title": "MiniArticleSearchMeRequest",
"required": [
"-",
"page",
"size"
]
... ... @@ -1683,6 +2063,44 @@
"list"
]
},
"MiniMyLikeRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "MiniMyLikeRequest",
"required": [
"page",
"size"
]
},
"MiniMyLikeResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/MyLikeItem"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "MiniMyLikeResponse",
"required": [
"list",
"total"
]
},
"MiniSetUserLikeRequset": {
"type": "object",
"properties": {
... ... @@ -1696,7 +2114,7 @@
"format": "int64",
"description": "评论id"
},
"userId": {
"": {
"type": "integer",
"format": "int64",
"description": "操作人"
... ... @@ -1711,7 +2129,6 @@
"required": [
"articleId",
"commentId",
"-",
"flag"
]
},
... ... @@ -1873,6 +2290,13 @@
"$ref": "#/definitions/Account"
},
"description": " 公司账号"
},
"auths": {
"type": "array",
"items": {
"$ref": "#/definitions/Auth"
},
"description": " 权限列表"
}
},
"title": "MiniUserInfoResponse",
... ... @@ -1881,7 +2305,8 @@
"totalArticle",
"totalLoved",
"totalAccepted",
"accounts"
"accounts",
"auths"
]
},
"MiniUserLikeArticleRequest": {
... ... @@ -1892,7 +2317,7 @@
"format": "int64",
"description": " 文章id"
},
"companyId": {
"": {
"type": "integer",
"format": "int64",
"description": "公司id"
... ... @@ -1911,7 +2336,6 @@
"title": "MiniUserLikeArticleRequest",
"required": [
"articleId",
"-",
"page",
"size"
]
... ... @@ -2017,6 +2441,53 @@
"companyId"
]
},
"MyLikeItem": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int64",
"description": " 发布人id"
},
"articleId": {
"type": "integer",
"format": "int64",
"description": " 文章id"
},
"commentId": {
"type": "integer",
"format": "int64",
"description": " 评论id"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": " 创建时间"
},
"user": {
"$ref": "#/definitions/SimpleUser",
"description": " 发布人"
},
"article": {
"$ref": "#/definitions/SimpleArticle",
"description": " 文章"
},
"comment": {
"$ref": "#/definitions/SimpleComment",
"description": " 评论"
}
},
"title": "MyLikeItem",
"required": [
"userId",
"articleId",
"commentId",
"createdAt",
"user",
"article",
"comment"
]
},
"RoleDeleteRequest": {
"type": "object",
"properties": {
... ... @@ -2118,11 +2589,13 @@
},
"title": "RoleItem",
"required": [
"companyId",
"name",
"authIds",
"authsDesc",
"usersDesc",
"remark",
"users",
"updatedAt"
]
},
... ... @@ -2232,6 +2705,10 @@
"type": "string",
"description": " 文章标题"
},
"summary": {
"type": "string",
"description": " 文章概要"
},
"countLove": {
"type": "integer",
"format": "int32",
... ... @@ -2241,24 +2718,385 @@
"type": "integer",
"format": "int32",
"description": " 评论数量"
},
"show": {
"type": "integer",
"format": "int32",
"description": " 文章的展示状态(0显示、1不显示)"
}
},
"title": "SimpleArticle",
"required": [
"id",
"title",
"summary",
"countLove",
"countComment"
"countComment",
"show"
]
},
"TagCreateRequest": {
"SimpleComment": {
"type": "object",
"properties": {
"companyId": {
"id": {
"type": "integer",
"format": "int64"
},
"image": {
"content": {
"type": "string",
"description": " 评论内容"
},
"countLove": {
"type": "integer",
"format": "int32",
"description": " 点赞数量"
},
"countComment": {
"type": "integer",
"format": "int32",
"description": " 评论数量"
},
"show": {
"type": "integer",
"format": "int32",
"description": " 评论的展示状态(0显示、1不显示)"
}
},
"title": "SimpleComment",
"required": [
"id",
"content",
"countLove",
"countComment",
"show"
]
},
"SimpleUser": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"companyId": {
"type": "integer",
"format": "int64",
"description": " 公司ID"
},
"companyName": {
"type": "string",
"description": " 公司名称"
},
"name": {
"type": "string",
"description": " 名称"
},
"avatar": {
"type": "string",
"description": " 头像"
},
"position": {
"type": "string",
"description": " 职位"
}
},
"title": "SimpleUser",
"required": [
"id",
"companyId",
"companyName",
"name",
"avatar",
"position"
]
},
"SystemArticleGetRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "id"
},
"": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemArticleGetRequest",
"required": [
"id"
]
},
"SystemArticleGetResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": " id"
},
"title": {
"type": "string",
"description": " 标题"
},
"authorId": {
"type": "integer",
"format": "int64",
"description": " 发布人id"
},
"author": {
"$ref": "#/definitions/Author",
"description": " 发布人"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": " 文章的发布时间"
},
"section": {
"type": "array",
"items": {
"$ref": "#/definitions/ArticleSection"
},
"description": " 文章的文本内容"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"description": " 图片"
},
"whoRead": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 谁可查看"
},
"whoReadInfo": {
"type": "array",
"items": {
"$ref": "#/definitions/UserShowName"
},
"description": " 谁可查看"
},
"whoReview": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 谁可评论"
},
"whoReviewInfo": {
"type": "array",
"items": {
"$ref": "#/definitions/UserShowName"
},
"description": " 谁可评论"
},
"location": {
"$ref": "#/definitions/Location",
"description": " 定位坐标"
},
"countLove": {
"type": "integer",
"format": "int32",
"description": " 点赞数量"
},
"countComment": {
"type": "integer",
"format": "int32",
"description": " 评论数量"
},
"countRead": {
"type": "integer",
"format": "int32",
"description": " 浏览数量"
},
"show": {
"type": "integer",
"format": "int32",
"description": " 评论的展示状态(0显示、1不显示)"
}
},
"title": "SystemArticleGetResponse",
"required": [
"id",
"title",
"authorId",
"author",
"createdAt",
"section",
"images",
"whoRead",
"whoReadInfo",
"whoReview",
"whoReviewInfo",
"location",
"countLove",
"countComment",
"countRead",
"show"
]
},
"SystemArticleSearch": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "id"
},
"title": {
"type": "string",
"description": "标题"
},
"author": {
"type": "string",
"description": "发布人"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"description": "图片"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": "文章的创建日期"
},
"countLove": {
"type": "integer",
"format": "int32",
"description": "点赞数量"
},
"CountComment": {
"type": "integer",
"format": "int32",
"description": "评论数量"
},
"show": {
"type": "integer",
"format": "int32",
"description": "是否隐藏 [0显示、1不显示]"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"description": "标签"
},
"targetUser": {
"type": "integer",
"format": "int32",
"description": "分发方式 [0分发给所有人、1分发给指定的人]"
}
},
"title": "SystemArticleSearch",
"required": [
"id",
"title",
"author",
"images",
"createdAt",
"countLove",
"CountComment",
"show",
"tags",
"targetUser"
]
},
"SystemArticleSearchRequest": {
"type": "object",
"properties": {
"": {
"type": "integer",
"format": "int64"
},
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "SystemArticleSearchRequest",
"required": [
"page",
"size"
]
},
"SystemArticleSearchResponse": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int32"
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/SystemArticleSearch"
}
}
},
"title": "SystemArticleSearchResponse",
"required": [
"total",
"list"
]
},
"SystemUserInfoRequest": {
"type": "object",
"title": "SystemUserInfoRequest"
},
"SystemUserInfoResponse": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int64"
},
"userName": {
"type": "string"
},
"avatar": {
"type": "string"
},
"companyId": {
"type": "integer",
"format": "int64"
},
"companyName": {
"type": "string"
}
},
"title": "SystemUserInfoResponse",
"required": [
"userId",
"userName",
"avatar",
"companyId",
"companyName"
]
},
"TagCreateRequest": {
"type": "object",
"properties": {
"companyId": {
"type": "integer",
"format": "int64"
},
"image": {
"type": "string"
},
"name": {
... ... @@ -2514,45 +3352,6 @@
"list"
]
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"companyId": {
"type": "integer",
"format": "int64",
"description": " 公司ID"
},
"companyName": {
"type": "string",
"description": " 公司名称"
},
"name": {
"type": "string",
"description": " 名称"
},
"avatar": {
"type": "string",
"description": " 头像"
},
"position": {
"type": "string",
"description": " 职位"
}
},
"title": "User",
"required": [
"id",
"companyId",
"companyName",
"name",
"avatar",
"position"
]
},
"UserFollowItem": {
"type": "object",
"properties": {
... ... @@ -2731,6 +3530,24 @@
"total"
]
},
"UserShowName": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "integer",
"format": "int32"
}
},
"title": "UserShowName",
"required": [
"id",
"name"
]
},
"WhichUserLikeArticle": {
"type": "object",
"properties": {
... ...
syntax = "v1"
import "article_type.api"
info(
title: "文章内容处理"
desc: "编辑处理文章内容"
... ... @@ -42,6 +40,10 @@ service Core {
@handler MiniArticleSearchMe
post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
@doc "小程序创建文章进草稿箱"
@handler MiniCreateArticleDraft
post /article_draft (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
@doc "小程序获取文章的编辑记录"
@handler MiniArticleBackupSearch
post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse)
... ...
... ... @@ -147,7 +147,7 @@ type (
Location Location `json:"location"`
}
)
// 标记人员浏览了那个文章
type (
MiniArticleMarkUserReadRequest {
UserId int64 `json:",optional"` // 当前操作人
... ... @@ -160,6 +160,18 @@ type (
}
)
//保存文章到草稿箱
type (
MiniArticleDraftCreateRequest {
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Content []string `json:"content"` // 填写的内容
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
}
MiniArticleDraftCreateResponse struct{}
)
type (
MiniArticleMarkListRequest {
Page int `json:"page"`
... ...
... ... @@ -14,7 +14,7 @@ info(
group: company
)
service Core {
@doc "公司搜索"
@doc "公司搜索(公开的)"
@handler miniCompanySearch
post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse)
}
... ... @@ -23,6 +23,18 @@ service Core {
@server(
prefix: v1
group: company
jwt : MiniAuth
)
service Core {
@doc "搜索已加入的公司"
@handler miniCompanySearchJoined
post /mini/company/search-joined(CompanySearchRequest) returns (CompanySearchResponse)
}
// 小程序接口
@server(
prefix: v1
group: company
jwt : SystemAuth
)
service Core {
... ... @@ -33,9 +45,10 @@ service Core {
type (
CompanySearchRequest struct{
Page int `json:"page"`
Size int `json:"size"`
UserId int64 `json:"userId,optional"` // 按用户搜索
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司
UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业)
Code string `json:"code,optional"` // 按编码搜索
}
CompanySearchResponse{
... ...
... ... @@ -206,13 +206,26 @@ type (
// 后台接口
//@server(
// prefix: v1
// group: user
// jwt: SystemAuth
//)
//service Core {
// @doc "系统评论"
// @handler systemUser
// get /system/user () returns ()
//}
\ No newline at end of file
@server(
prefix: v1
group: user
jwt: SystemAuth
)
service Core {
@doc "系统用户信息"
@handler systemUserInfo
post /system/user/info(SystemUserInfoRequest) returns (SystemUserInfoResponse)
}
type(
SystemUserInfoRequest{
}
SystemUserInfoResponse{
UserId int64 `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
}
)
\ No newline at end of file
... ...
package article
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func MiniCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleSearchMeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniCreateArticleDraftLogic(r.Context(), svcCtx)
resp, err := l.MiniCreateArticleDraft(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package company
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func MiniCompanySearchJoinedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanySearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewMiniCompanySearchJoinedLogic(r.Context(), svcCtx)
resp, err := l.MiniCompanySearchJoined(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -167,6 +167,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
[]rest.Route{
{
Method: http.MethodPost,
Path: "/system/user/info",
Handler: user.SystemUserInfoHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/company/search",
Handler: company.MiniCompanySearchHandler(serverCtx),
},
... ... @@ -178,6 +190,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/company/search-joined",
Handler: company.MiniCompanySearchJoinedHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/system/company/search",
Handler: company.SystemCompanySearchHandler(serverCtx),
},
... ... @@ -225,6 +249,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodPost,
Path: "/article_draft",
Handler: article.MiniCreateArticleDraftHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_backup/search",
Handler: article.MiniArticleBackupSearchHandler(serverCtx),
},
... ...
package user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserInfoRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserInfoLogic(r.Context(), svcCtx)
resp, err := l.SystemUserInfo(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniCreateArticleDraftLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniCreateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCreateArticleDraftLogic {
return &MiniCreateArticleDraftLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArticleSearchMeRequest) (resp *types.MiniArticleSearchMeResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package company
import (
"context"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniCompanySearchJoinedLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniCompanySearchJoinedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCompanySearchJoinedLogic {
return &MiniCompanySearchJoinedLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniCompanySearchJoinedLogic) MiniCompanySearchJoined(req *types.CompanySearchRequest) (resp *types.CompanySearchResponse, err error) {
var (
conn = l.svcCtx.DefaultDBConn()
companyList []*domain.Company
total int64
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
user *domain.User
companyIds []int64
)
queryOptions := domain.NewQueryOptions()
if req.Page != 0 {
queryOptions.WithOffsetLimit(req.Page, req.Size)
}
user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, userToken.UserId)
if err != nil {
return nil, xerr.NewErrMsgErr("账号有误", err)
}
resp = &types.CompanySearchResponse{
List: make([]types.Company, 0),
}
_, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
MustWithKV("phone", user.Phone).
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
WithFindOnly())
lo.ForEach(users, func(item *domain.User, index int) {
companyIds = append(companyIds, item.CompanyId)
})
if req.Flag == 1 {
total, companyList, err = l.svcCtx.CompanyRepository.Find(l.ctx, conn, queryOptions.MustWithKV("ids", companyIds))
if err != nil {
return nil, xerr.NewErrMsgErr("公司列表获取失败", err)
}
} else {
total, companyList, err = l.svcCtx.CompanyRepository.Find(l.ctx, conn, queryOptions.MustWithKV("excludeIds", companyIds))
if err != nil {
return nil, xerr.NewErrMsgErr("公司列表获取失败", err)
}
}
lo.ForEach(companyList, func(item *domain.Company, index int) {
resp.List = append(resp.List, NewCompany(item))
})
resp.Total = total
return
}
... ...
... ... @@ -2,9 +2,11 @@ package company
import (
"context"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/zeromicro/go-zero/core/logx"
)
... ... @@ -24,7 +26,37 @@ func NewMiniCompanySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext)
}
func (l *MiniCompanySearchLogic) MiniCompanySearch(req *types.CompanySearchRequest) (resp *types.CompanySearchResponse, err error) {
// todo: add your logic here and delete this line
var (
conn = l.svcCtx.DefaultDBConn()
companyList []*domain.Company
total int64
)
queryOptions := domain.NewQueryOptions()
if req.Page != 0 {
queryOptions.WithOffsetLimit(req.Page, req.Size)
}
if req.Code != "" {
queryOptions.WithKV("code", req.Code)
}
total, companyList, err = l.svcCtx.CompanyRepository.Find(l.ctx, conn, queryOptions)
if err != nil {
return nil, xerr.NewErrMsgErr("公司列表获取失败", err)
}
resp = &types.CompanySearchResponse{
Total: total,
List: make([]types.Company, 0),
}
lo.ForEach(companyList, func(item *domain.Company, index int) {
resp.List = append(resp.List, NewCompany(item))
})
return
}
func NewCompany(item *domain.Company) types.Company {
return types.Company{
Id: item.Id,
Name: item.Name,
Code: item.Code,
Logo: item.Logo,
}
}
... ...
package user
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserInfoLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserInfoLogic {
return &SystemUserInfoLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) (resp *types.SystemUserInfoResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
// Code generated by goctl. DO NOT EDIT.
package types
type Location struct {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
}
type Author struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Group string `json:"group"` // 人员的分组
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
type MiniArticleCreateRequest struct {
Title string `json:"title"` //标题
Section []string `json:"section"` //文章的文本内容
AuthorId int64 `json:"authorId,optional"` //发布人id
Images []string `json:"images,optional"` //图片
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
}
type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type MiniArticleGetResponse struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author Author `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
}
type ArticleSection struct {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
type MiniArticleSearchMeRequest struct {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleSearchMeResponse struct {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
type ArticleSearchMe struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
}
type MiniUserLikeArticleRequest struct {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
}
type MiniUserLikeArticleResponse struct {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
}
type WhichUserLikeArticle struct {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
}
type MiniSetUserLikeRequset struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
}
type MiniSetUserLikeResponse struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
}
type MiniArticleBackupSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
}
type MiniArticleBackupSearchResponse struct {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
}
type MiniArticleBackupItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
Location Location `json:"location"`
}
type MiniArticleMarkUserReadRequest struct {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
}
type MiniArticleMarkUserReadResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftCreateRequest struct {
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Content []string `json:"content"` // 填写的内容
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
}
type MiniArticleDraftCreateResponse struct {
}
type SystemArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type UserShowName struct {
Id int `json:"id"`
Name int `json:"name"`
}
type SystemArticleGetResponse struct {
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author Author `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type SystemArticleSearchRequest struct {
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type SystemArticleSearchResponse struct {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
}
type SystemArticleSearch struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []string `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
type CommentRequest struct {
}
... ... @@ -296,10 +504,22 @@ type SimpleComment struct {
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type SystemUserInfoRequest struct {
}
type SystemUserInfoResponse struct {
UserId int64 `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
}
type CompanySearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
UserId int64 `json:"userId,optional"` // 按用户搜索
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司
UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业)
Code string `json:"code,optional"` // 按编码搜索
}
... ... @@ -315,224 +535,6 @@ type Company struct {
Logo string `json:"logo,omitempty"` // 公司LOGO
}
type Location struct {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
}
type Author struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Group string `json:"group"` // 人员的分组
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
type MiniArticleCreateRequest struct {
Title string `json:"title"` //标题
Section []string `json:"section"` //文章的文本内容
AuthorId int64 `json:"authorId,optional"` //发布人id
Images []string `json:"images,optional"` //图片
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
}
type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type MiniArticleGetResponse struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author Author `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
}
type ArticleSection struct {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
type MiniArticleSearchMeRequest struct {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleSearchMeResponse struct {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
type ArticleSearchMe struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
}
type MiniUserLikeArticleRequest struct {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
}
type MiniUserLikeArticleResponse struct {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
}
type WhichUserLikeArticle struct {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
}
type MiniSetUserLikeRequset struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
}
type MiniSetUserLikeResponse struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
}
type MiniArticleBackupSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
}
type MiniArticleBackupSearchResponse struct {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
}
type MiniArticleBackupItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
Location Location `json:"location"`
}
type MiniArticleMarkUserReadRequest struct {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
}
type MiniArticleMarkUserReadResponse struct {
Id int64 `json:"id"`
}
type MiniArticleMarkListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleMarkListResponse struct {
Total int64 `json:"total"`
List []MiniArticleMarkItem `json:"list"`
}
type MiniArticleMarkItem struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author SimpleUser `json:"author"` // 发布人
UpdatedAt int64 `json:"updatedAt"`
}
type SystemArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type UserShowName struct {
Id int `json:"id"`
Name int `json:"name"`
}
type SystemArticleGetResponse struct {
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author Author `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type SystemArticleSearchRequest struct {
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type SystemArticleSearchResponse struct {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
}
type SystemArticleSearch struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []string `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
type RoleGetRequest struct {
Id int64 `path:"id"`
}
... ...
... ... @@ -216,6 +216,7 @@ func (repository *ArticleRepository) IncreaseCountLove(ctx context.Context, conn
queryFunc := func() (interface{}, error) {
tx = tx.Model(m).Updates(map[string]interface{}{
"count_love": gorm.Expr("count_love+?", incr),
"version": gorm.Expr("version+1"),
})
return nil, tx.Error
}
... ... @@ -236,7 +237,10 @@ func (repository *ArticleRepository) IncreaseCountRead(ctx context.Context, conn
return err
}
queryFunc := func() (interface{}, error) {
tx = tx.Model(m).Update("count_read", gorm.Expr("count_read+?", incr))
tx = tx.Model(m).Updates(map[string]interface{}{
"version": gorm.Expr("version+1"),
"count_read": gorm.Expr("count_read+?", incr),
})
return nil, tx.Error
}
if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil {
... ... @@ -256,7 +260,10 @@ func (repository *ArticleRepository) IncreaseCountComment(ctx context.Context, c
return err
}
queryFunc := func() (interface{}, error) {
tx = tx.Model(m).Update("count_comment", gorm.Expr("count_comment+?", incr))
tx = tx.Model(m).Updates(map[string]interface{}{
"version": gorm.Expr("version+1"),
"count_comment": gorm.Expr("count_comment+?", incr),
})
return nil, tx.Error
}
if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil {
... ...
... ... @@ -142,6 +142,9 @@ func (repository *CompanyRepository) Find(ctx context.Context, conn transaction.
if v, ok := queryOptions["ids"]; ok {
tx.Where("id in (?)", v)
}
if v, ok := queryOptions["excludeIds"]; ok {
tx.Where("id not in (?)", v)
}
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
return dms, tx.Error
}
... ...