作者 tangxvhui

Merge branch 'dev' into test

... ... @@ -15,6 +15,58 @@
"application/json"
],
"paths": {
"v1/common/sms/code": {
"post": {
"summary": "短信验证码",
"operationId": "commonSmsCode",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CommonSmsCodeResposne"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CommonSmsCodeRequest"
}
}
],
"requestBody": {},
"tags": [
"common"
]
}
},
"v1/log/{module}": {
"get": {
"summary": "日志查询",
"operationId": "commonGetLog",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "module",
"in": "path",
"required": true,
"type": "string"
}
],
"requestBody": {},
"tags": [
"common"
]
}
},
"v1/mini/article": {
"post": {
"summary": "小程序创建发布内容",
... ... @@ -667,10 +719,38 @@
]
}
},
"v1/mini/message/business": {
"v1/mini/message/comment": {
"post": {
"summary": "评论消息",
"operationId": "miniComment",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MessageBusinessResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MessageRequest"
}
}
],
"requestBody": {},
"tags": [
"message"
]
}
},
"v1/mini/message/like": {
"post": {
"summary": "业务消息",
"operationId": "miniBusiness",
"summary": "点赞消息",
"operationId": "miniLike",
"responses": {
"200": {
"description": "A successful response.",
... ... @@ -685,7 +765,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MessageBusinessRequest"
"$ref": "#/definitions/MessageRequest"
}
}
],
... ... @@ -713,7 +793,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MessageSystemRequest"
"$ref": "#/definitions/MessageRequest"
}
}
],
... ... @@ -1069,6 +1149,34 @@
]
}
},
"v1/mini/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/MiniMyLikeRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/news": {
"post": {
"summary": "用户快讯",
... ... @@ -1541,6 +1649,90 @@
]
}
},
"v1/system/article_comment/edit": {
"post": {
"summary": "管理后台变更评论",
"operationId": "SystemEditAticleComment",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemEditCommentResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemEditCommentRequest"
}
}
],
"requestBody": {},
"tags": [
"comment"
]
}
},
"v1/system/article_comment/edit_show": {
"post": {
"summary": "管理后台变更评论的显示状态",
"operationId": "SystemEditAticleCommentShow",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemEditCommentShowResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemEditCommentShowRequest"
}
}
],
"requestBody": {},
"tags": [
"comment"
]
}
},
"v1/system/article_comment/list": {
"post": {
"summary": "管理后台查看所有的评论",
"operationId": "SystemListAticleComment",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemListCommentResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemListCommentRequest"
}
}
],
"requestBody": {},
"tags": [
"comment"
]
}
},
"v1/system/article_comment/search": {
"post": {
"summary": "管理后台文章评论列表",
... ... @@ -1597,6 +1789,32 @@
]
}
},
"v1/system/article_comment/{id}": {
"get": {
"summary": "管理后台评论的详情",
"operationId": "SystemGetAticleComment",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemGetCommentResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"requestBody": {},
"tags": [
"comment"
]
}
},
"v1/system/article_tag": {
"post": {
"summary": "后台创建文章标签",
... ... @@ -1755,6 +1973,34 @@
]
}
},
"v1/system/company/positions/search": {
"post": {
"summary": "公司职位搜索",
"operationId": "systemCompanyPositionsSearch",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CompanyPositionsSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CompanyPositionsSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"company"
]
}
},
"v1/system/company/search": {
"post": {
"summary": "公司搜索",
... ... @@ -2242,34 +2488,6 @@
"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/MiniMyLikeRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
}
},
"definitions": {
... ... @@ -2724,6 +2942,22 @@
"name"
]
},
"CommonSmsCodeRequest": {
"type": "object",
"properties": {
"phone": {
"type": "string"
}
},
"title": "CommonSmsCodeRequest",
"required": [
"phone"
]
},
"CommonSmsCodeResposne": {
"type": "object",
"title": "CommonSmsCodeResposne"
},
"Company": {
"type": "object",
"properties": {
... ... @@ -2743,6 +2977,11 @@
"logo": {
"type": "string",
"description": " 公司LOGO"
},
"joinedFlag": {
"type": "integer",
"format": "int32",
"description": " 已加入标识(1:已加入 其他:未加入)"
}
},
"title": "Company",
... ... @@ -2750,17 +2989,42 @@
"id",
"name",
"code",
"logo"
"logo",
"joinedFlag"
]
},
"CompanySearchRequest": {
"CompanyPositionsSearchRequest": {
"type": "object",
"title": "CompanyPositionsSearchRequest"
},
"CompanyPositionsSearchResponse": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/Position"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "CompanyPositionsSearchResponse",
"required": [
"list",
"total"
]
},
"CompanySearchRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
... ... @@ -2777,6 +3041,10 @@
"code": {
"type": "string",
"description": " 按编码搜索"
},
"content": {
"type": "string",
"description": " 按公司名/编码搜索"
}
},
"title": "CompanySearchRequest"
... ... @@ -2822,6 +3090,14 @@
"name": {
"type": "string",
"description": " 部门名称"
},
"userIds": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 部门下的用户"
}
},
"title": "Department",
... ... @@ -2829,7 +3105,8 @@
"id",
"companyId",
"parentId",
"name"
"name",
"userIds"
]
},
"DepartmentAddRequest": {
... ... @@ -3069,29 +3346,6 @@
"comment"
]
},
"MessageBusinessRequest": {
"type": "object",
"properties": {
"type": {
"type": "integer",
"format": "int32"
},
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "MessageBusinessRequest",
"required": [
"type",
"page",
"size"
]
},
"MessageBusinessResponse": {
"type": "object",
"properties": {
... ... @@ -3112,6 +3366,24 @@
"total"
]
},
"MessageRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "MessageRequest",
"required": [
"page",
"size"
]
},
"MessageSystemItem": {
"type": "object",
"properties": {
... ... @@ -3148,24 +3420,6 @@
"createdAt"
]
},
"MessageSystemRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "MessageSystemRequest",
"required": [
"page",
"size"
]
},
"MessageSystemResponse": {
"type": "object",
"properties": {
... ... @@ -3555,7 +3809,7 @@
"format": "int32",
"description": " 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式"
},
"Section": {
"section": {
"type": "array",
"items": {
"type": "string"
... ... @@ -3598,7 +3852,7 @@
"required": [
"id",
"template",
"Section",
"section",
"title",
"images",
"whoRead",
... ... @@ -3898,12 +4152,17 @@
"format": "int32",
"description": " 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)"
},
"meFollowFlag": {
"type": "integer",
"format": "int32",
"description": " 当前人员对作者的关注标识 (0 没有关注 1有关注)"
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"description": "文章的标签"
"description": " 文章的标签"
}
},
"title": "MiniArticleGetResponse",
... ... @@ -3924,6 +4183,7 @@
"show",
"edit",
"meLoveFlag",
"meFollowFlag",
"tags"
]
},
... ... @@ -4482,6 +4742,10 @@
"type": "string",
"description": " 发布人"
},
"avatar": {
"type": "string",
"description": " 发布人的头像"
},
"images": {
"type": "array",
"items": {
... ... @@ -4503,6 +4767,7 @@
"articleId",
"title",
"author",
"avatar",
"images",
"createdAt",
"meReadFlag"
... ... @@ -4549,12 +4814,7 @@
"title": "MiniSearchArticleRequest",
"required": [
"page",
"size",
"tagCategory",
"tagId",
"beginTime",
"endTime",
"searchWord"
"size"
]
},
"MiniSearchArticleResponse": {
... ... @@ -4604,7 +4864,6 @@
"title": "MiniSetUserLikeRequset",
"required": [
"articleId",
"commentId",
"flag"
]
},
... ... @@ -4678,6 +4937,11 @@
},
"code": {
"type": "string"
},
"isFromQr": {
"type": "boolean",
"format": "boolean",
"description": " true:扫码添加 false:手动查找添加"
}
},
"title": "MiniUserApplyJoinCompanyRequest",
... ... @@ -4688,7 +4952,16 @@
},
"MiniUserApplyJoinCompanyResponse": {
"type": "object",
"title": "MiniUserApplyJoinCompanyResponse"
"properties": {
"token": {
"type": "string",
"description": " x-token"
}
},
"title": "MiniUserApplyJoinCompanyResponse",
"required": [
"token"
]
},
"MiniUserAuditRequest": {
"type": "object",
... ... @@ -4746,6 +5019,9 @@
"size": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
}
},
"title": "MiniUserFollowedSearchRequest"
... ... @@ -5056,6 +5332,18 @@
"comment"
]
},
"Position": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"title": "Position",
"required": [
"name"
]
},
"RoleDeleteRequest": {
"type": "object",
"properties": {
... ... @@ -5554,9 +5842,8 @@
"format": "int64",
"description": " 文章顶层ID"
},
"authorId": {
"type": "integer",
"format": "int64",
"author": {
"type": "string",
"description": " 用户"
},
"show": {
... ... @@ -5579,8 +5866,7 @@
"required": [
"page",
"size",
"articleId",
"topId"
"articleId"
]
},
"SystemArticleCommentSearchResponse": {
... ... @@ -5840,6 +6126,11 @@
"$ref": "#/definitions/ArticleTagItem"
},
"description": "标签"
},
"targetUser": {
"type": "integer",
"format": "int32",
"description": "分发方式 [0分发给所有人、1分发给指定的人]"
}
},
"title": "SystemArticleGetResponse",
... ... @@ -5860,7 +6151,8 @@
"countComment",
"countRead",
"show",
"tags"
"tags",
"targetUser"
]
},
"SystemArticleHistory": {
... ... @@ -6339,6 +6631,344 @@
"targetUser"
]
},
"SystemCommentItem": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "评论id"
},
"pid": {
"type": "integer",
"format": "int64"
},
"topId": {
"type": "integer",
"format": "int64"
},
"articleId": {
"type": "integer",
"format": "int64",
"description": "对应的文章id"
},
"articleTitle": {
"type": "string",
"description": "文章标题"
},
"fromUserId": {
"type": "integer",
"format": "int64",
"description": "填写评论的人"
},
"fromUser": {
"$ref": "#/definitions/CommentAuthor",
"description": "填写评论的人"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": "评论的填写时间"
},
"content": {
"type": "string",
"description": "评论的内容"
},
"show": {
"type": "integer",
"format": "int32",
"description": "是否展示 [1显示] [2不显示]"
},
"countReplay": {
"type": "integer",
"format": "int32",
"description": "回复数量"
},
"countUserLove": {
"type": "integer",
"format": "int32",
"description": "用户点赞数量"
},
"countAdminLove": {
"type": "integer",
"format": "int32",
"description": "运营点赞数量"
}
},
"title": "SystemCommentItem",
"required": [
"id",
"pid",
"topId",
"articleId",
"articleTitle",
"fromUserId",
"fromUser",
"createdAt",
"content",
"show",
"countReplay",
"countUserLove",
"countAdminLove"
]
},
"SystemEditCommentRequest": {
"type": "object",
"properties": {
"": {
"type": "integer",
"format": "int64"
},
"id": {
"type": "integer",
"format": "int64"
},
"show": {
"type": "integer",
"format": "int32",
"description": "[1 显示评论] [2: 隐藏评论]"
},
"countAdminLove": {
"type": "integer",
"format": "int32"
}
},
"title": "SystemEditCommentRequest",
"required": [
"id",
"show"
]
},
"SystemEditCommentResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemEditCommentResponse",
"required": [
"id"
]
},
"SystemEditCommentShowRequest": {
"type": "object",
"properties": {
"": {
"type": "integer",
"format": "int64"
},
"id": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
}
},
"show": {
"type": "integer",
"format": "int32",
"description": "[1 显示评论] [2: 隐藏评论]"
}
},
"title": "SystemEditCommentShowRequest",
"required": [
"id",
"show"
]
},
"SystemEditCommentShowResponse": {
"type": "object",
"properties": {
"id": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
}
}
},
"title": "SystemEditCommentShowResponse",
"required": [
"id"
]
},
"SystemGetCommentRequest": {
"type": "object",
"properties": {
"": {
"type": "integer",
"format": "int64"
},
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemGetCommentRequest",
"required": [
"id"
]
},
"SystemGetCommentResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": "评论id"
},
"pid": {
"type": "integer",
"format": "int64"
},
"topId": {
"type": "integer",
"format": "int64"
},
"articleId": {
"type": "integer",
"format": "int64",
"description": "对应的文章id"
},
"articleTitle": {
"type": "string",
"description": "文章标题"
},
"fromUserId": {
"type": "integer",
"format": "int64",
"description": "填写评论的人"
},
"fromUser": {
"$ref": "#/definitions/CommentAuthor",
"description": "填写评论的人"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": "评论的填写时间"
},
"sectionContent": {
"type": "string",
"description": "引用的段落内容"
},
"content": {
"type": "string",
"description": " 评论的内容"
},
"show": {
"type": "integer",
"format": "int32",
"description": "是否展示 [1显示] [2不显示]"
},
"countReplay": {
"type": "integer",
"format": "int32",
"description": "回复数量"
},
"countUserLove": {
"type": "integer",
"format": "int32",
"description": "用户点赞数量"
},
"countAdminLove": {
"type": "integer",
"format": "int32",
"description": "运营点赞数量"
}
},
"title": "SystemGetCommentResponse",
"required": [
"id",
"pid",
"topId",
"articleId",
"articleTitle",
"fromUserId",
"fromUser",
"createdAt",
"sectionContent",
"content",
"show",
"countReplay",
"countUserLove",
"countAdminLove"
]
},
"SystemListCommentRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"": {
"type": "integer",
"format": "int64"
},
"topId": {
"type": "integer",
"format": "int64",
"description": " 评论的顶层ID"
},
"fromUser": {
"type": "string",
"description": " 用户"
},
"show": {
"type": "integer",
"format": "int32",
"description": " 显示状态"
},
"beginTime": {
"type": "integer",
"format": "int64",
"description": " 填写评论的开始时间"
},
"endTime": {
"type": "integer",
"format": "int64",
"description": " 填写评论的结束时间"
},
"articleTitle": {
"type": "string"
},
"content": {
"type": "string"
}
},
"title": "SystemListCommentRequest",
"required": [
"page",
"size"
]
},
"SystemListCommentResponse": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int32"
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/SystemCommentItem"
}
}
},
"title": "SystemListCommentResponse",
"required": [
"total",
"list"
]
},
"SystemUser": {
"type": "object",
"properties": {
... ... @@ -6579,11 +7209,31 @@
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string",
"description": " 姓名"
},
"roles": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 权限角色"
},
"enable": {
"type": "integer",
"format": "int32",
"description": " 状态 1:启用 2:禁用"
}
},
"title": "SystemUserAccountUpdateRequest",
"required": [
"id"
"id",
"name",
"roles",
"enable"
]
},
"SystemUserAccountUpdateResponse": {
... ... @@ -6786,8 +7436,7 @@
"required": [
"image",
"name",
"category",
"other"
"category"
]
},
"TagCreateResponse": {
... ... @@ -6868,8 +7517,7 @@
"id",
"image",
"name",
"category",
"other"
"category"
]
},
"TagEditResponse": {
... ... @@ -7164,6 +7812,10 @@
"type": "string",
"description": " 公司编码(邀请码)"
},
"companyLogo": {
"$ref": "#/definitions/string",
"description": " 公司LOGO"
},
"flag": {
"type": "integer",
"format": "int32",
... ... @@ -7174,7 +7826,7 @@
"description": " 名称"
},
"avatar": {
"type": "string",
"$ref": "#/definitions/string",
"description": " 头像"
},
"phone": {
... ... @@ -7229,6 +7881,7 @@
"companyId",
"companyName",
"companyCode",
"companyLogo",
"flag",
"name",
"avatar",
... ... @@ -7271,6 +7924,17 @@
"type": "boolean",
"format": "boolean",
"description": " 已读标识 true:已读 false:未读"
},
"images": {
"type": "array",
"items": {
"type": "string"
},
"description": " 图片列表"
},
"author": {
"$ref": "#/definitions/UserItem",
"description": " 作者"
}
},
"title": "UserNewsItem",
... ... @@ -7280,7 +7944,9 @@
"title",
"summary",
"time",
"readFlag"
"readFlag",
"images",
"author"
]
},
"UserSearchRequest": {
... ...
... ... @@ -70,9 +70,12 @@ service Core {
@doc "取消关注"
@handler miniUserUnFollow
post /mini/user/unfollow (FollowRequest)
@doc "我点赞的文章或评论"
@doc "我点赞的-文章或评论列表"
@handler miniMyLike
post /mini/user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse)
@doc "我被点赞-文章或评论列表"
@handler miniMyBeLiked
post /mini/user/mybeliked (MiniBeLikedRequest)returns (MiniBeLikedResponse)
}
type(
... ... @@ -220,7 +223,7 @@ type(
// 我点赞的文章或评论
// 1.我点赞的文章或评论 2.我的文章或评论被点赞
type (
MiniMyLikeRequest{
Page int `json:"page"`
... ... @@ -249,6 +252,28 @@ type (
CountComment int `json:"countComment"` // 评论数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
MiniBeLikedRequest{
Page int `json:"page"`
Size int `json:"size"`
}
MiniBeLikedResponse {
List []MyBeLikedItem `json:"list"`
Total int64 `json:"total"`
}
MyBeLikedItem {
UserId int64 `json:"userId"` // 点赞人id
ArticleId int64 `json:"articleId"` // 文章id
CommentId int64 `json:"commentId"` // 评论id
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 点赞人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
}
)
... ...
... ... @@ -275,6 +275,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/mini/user/mylike",
Handler: user.MiniMyLikeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/mybeliked",
Handler: user.MiniMyBeLikedHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
... ...
package user
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/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 MiniMyBeLikedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniBeLikedRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := user.NewMiniMyBeLikedLogic(r.Context(), svcCtx)
resp, err := l.MiniMyBeLiked(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
... ... @@ -17,7 +18,8 @@ func MiniUserStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err)
return
}
userToken := contextdata.GetUserTokenFromCtx(r.Context())
req.UserId = userToken.UserId
l := user.NewSystemUserStatisticsLogic(r.Context(), svcCtx)
resp, err := l.SystemUserStatistics(&req)
result.HttpResult(r, w, resp, err)
... ...
... ... @@ -2,6 +2,7 @@ package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
... ... @@ -56,7 +57,7 @@ func (l *MiniSetUserLikeLogic) cancelSetUserLikeArticle(req *types.MiniSetUserLi
// 检查id
userInfo, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.UserId)
if err != nil {
//无法确认 文章的id
//无法确认 人员的id
return nil, xerr.NewErrMsgErr("无法确认操作人员信息", err)
}
articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId)
... ... @@ -129,7 +130,7 @@ func (l *MiniSetUserLikeLogic) cancelSetUserLikeComment(req *types.MiniSetUserLi
// 检查id
userInfo, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.UserId)
if err != nil {
//无法确认 文章的id
//无法确认 人员的id
return nil, xerr.NewErrMsgErr("无法确认操作人员信息", err)
}
articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArticleId)
... ... @@ -249,6 +250,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ
CommentId: 0,
CommentAuthor: 0,
UserId: req.UserId,
ToUserId: articleInfo.AuthorId,
}
// 添加点赞标识
_, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo)
... ... @@ -338,6 +340,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeComment(req *types.MiniSetUserLikeRequ
CommentId: req.CommentId,
CommentAuthor: commentInfo.FromUserId,
UserId: req.UserId,
ToUserId: commentInfo.FromUserId,
}
// 设置赞标识
_, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo)
... ...
... ... @@ -37,6 +37,12 @@ func NewSystemUpdateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext
func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleUpdateRequest) (resp *types.SystemArticleUpdateResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
userToken := contextdata.GetUserTokenFromCtx(l.ctx)
// 预处理参数
if req.TargetUser == 0 {
//TargetUser 设定为分发给所有人,清空 WhoRead
req.WhoRead = make([]int64, 0)
}
article, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.Id)
if err != nil {
return nil, xerr.NewErrMsgErr("帖子不存在", err)
... ...
... ... @@ -102,6 +102,7 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList
AtWho: []types.CommentAtWho{},
CreatedAt: val.CreatedAt,
MeLoveFlag: 0,
Content: val.Content,
},
Reply: []types.ArticleCommentItem{},
TotalReply: int64(val.CountReply),
... ... @@ -175,6 +176,7 @@ func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlag
AtWho: []types.CommentAtWho{},
CreatedAt: val.CreatedAt,
MeLoveFlag: 0,
Content: val.Content,
}
if _, ok := loveFlagMap[val.Id]; ok {
... ...
... ... @@ -52,6 +52,7 @@ func (l *SystemEditAticleCommentShowLogic) SystemEditAticleCommentShow(req *type
}
}
}
if err != nil {
return resp, err
}
... ...
... ... @@ -199,6 +199,7 @@ func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageRequest, msgType doma
Content: v.Content,
CountLove: v.CountUserLove,
CountComment: v.CountReply,
Show: int(v.Show),
}
}
... ...
package user
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/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 MiniMyBeLikedLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniMyBeLikedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniMyBeLikedLogic {
return &MiniMyBeLikedLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniMyBeLikedLogic) MiniMyBeLiked(req *types.MiniBeLikedRequest) (resp *types.MiniBeLikedResponse, err error) {
var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
var conn = l.svcCtx.DefaultDBConn()
total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
WithKV("commentId", userToken.CompanyId).
WithKV("toUserId", userToken.UserId))
if err != nil {
return nil, err
}
resp = &types.MiniBeLikedResponse{}
resp.Total = total
resp.List = make([]types.MyBeLikedItem, 0)
if total == 0 || len(list) == 0 {
return resp, nil
}
var userMap = make(map[int64]*domain.User)
var articleMap = make(map[int64]*domain.Article)
var commentMap = make(map[int64]*domain.ArticleComment)
lo.ForEach(list, func(item *domain.UserLoveFlag, index int) {
var (
user *domain.User
article *domain.Article
comment *domain.ArticleComment
)
user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.UserId, l.svcCtx.UserRepository.FindOne)
article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
// 点赞评论
if item.CommentId != 0 {
comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne)
}
resp.List = append(resp.List, l.NewItemSimple(item, user, article, comment))
})
return resp, nil
}
func (l *MiniMyBeLikedLogic) NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyBeLikedItem {
item := types.MyBeLikedItem{
UserId: love.UserId,
ArticleId: love.ArticleId,
CommentId: love.CommentId,
CreatedAt: love.CreatedAt,
}
if user != nil {
item.User = &types.SimpleUser{
Id: user.Id,
CompanyId: user.CompanyId,
Name: user.Name,
Avatar: user.Avatar,
Position: user.Position,
}
}
if article != nil {
item.Article = &types.SimpleArticle{
Id: article.Id,
Title: article.Title,
Summary: article.Summary,
CountLove: article.CountLove,
CountComment: article.CountComment,
Show: int(article.Show),
}
}
if comment != nil {
item.Comment = &types.SimpleComment{
Id: comment.Id,
Content: comment.Content,
CountLove: comment.CountUserLove,
CountComment: comment.CountReply,
Show: int(comment.Show),
}
}
return item
}
... ...
... ... @@ -32,6 +32,7 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types.
total, list, err := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
WithKV("commentId", userToken.CompanyId).
WithKV("userId", userToken.UserId))
if err != nil {
return nil, err
... ... @@ -54,25 +55,22 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types.
article *domain.Article
comment *domain.ArticleComment
)
if item.CommentId != 0 { // 点赞评论
user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.CommentAuthor, l.svcCtx.UserRepository.FindOne)
article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.ToUserId, l.svcCtx.UserRepository.FindOne)
article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
// 点赞评论
if item.CommentId != 0 {
comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne)
} else {
user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.ArticleAuthor, l.svcCtx.UserRepository.FindOne)
article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
}
resp.List = append(resp.List, NewItemSimple(item, user, article, comment))
resp.List = append(resp.List, l.NewItemSimple(item, user, article, comment))
})
return
return resp, nil
}
func NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyLikeItem {
func (l *MiniMyLikeLogic) NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyLikeItem {
item := types.MyLikeItem{
UserId: love.UserId,
UserId: love.ToUserId,
ArticleId: love.ArticleId,
CommentId: love.CommentId,
CreatedAt: love.CreatedAt,
... ...
... ... @@ -587,6 +587,26 @@ type SimpleComment struct {
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type MiniBeLikedRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type MiniBeLikedResponse struct {
List []MyBeLikedItem `json:"list"`
Total int64 `json:"total"`
}
type MyBeLikedItem struct {
UserId int64 `json:"userId"` // 点赞人id
ArticleId int64 `json:"articleId"` // 文章id
CommentId int64 `json:"commentId"` // 评论id
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 点赞人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
}
type SystemUserInfoRequest struct {
Token string `header:"x-mmm-accesstoken"`
}
... ...
... ... @@ -16,6 +16,7 @@ type UserLoveFlag struct {
ArticleAuthor int64 // 文章的发布人
CommentAuthor int64 // 评论的填写人
UserId int64
ToUserId int64
CreatedAt int64
UpdatedAt int64
DeletedAt int64
... ...
... ... @@ -132,6 +132,9 @@ func (repository *UserLoveFlagRepository) Find(ctx context.Context, conn transac
if v, ok := queryOptions["userId"]; ok {
tx = tx.Where("user_id=?", v)
}
if v, ok := queryOptions["toUserId"]; ok {
tx = tx.Where("to_user_id=?", v)
}
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
return dms, tx.Error
}
... ... @@ -160,6 +163,7 @@ func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLo
CommentAuthor: from.CommentAuthor,
CommentId: from.CommentId,
UserId: from.UserId,
ToUserId: from.ToUserId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
... ... @@ -177,6 +181,7 @@ func (repository *UserLoveFlagRepository) DomainModelToModel(from *domain.UserLo
ArticleAuthor: from.ArticleAuthor,
CommentAuthor: from.CommentAuthor,
UserId: from.UserId,
ToUserId: from.ToUserId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
... ...
... ... @@ -14,7 +14,8 @@ type UserLoveFlag struct {
ArticleAuthor int64 `json:"articleAuthor"` // 文章的发布人
CommentId int64 `json:"commentId"` // 点赞评论时,填评论id
CommentAuthor int64 `json:"commentAuthor"` // 评论的填写人
UserId int64 `json:"userId"`
ToUserId int64 `json:"toUserId"` // 点赞的接受人
UserId int64 `json:"userId"` // 点赞的人
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
... ...