更新API文档

newzwz
哆哆咯哆哆咯 1 week ago
parent 59501feb4a
commit 9f79bd04e1

@ -2,7 +2,7 @@
"openapi": "3.0.0", "openapi": "3.0.0",
"info": { "info": {
"title": "珞珈岛API文档", "title": "珞珈岛API文档",
"description": "API文档", "description": "珞珈岛社交平台API接口文档",
"version": "1.0" "version": "1.0"
}, },
"servers": [ "servers": [
@ -100,7 +100,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultVoid" "$ref": "#/components/schemas/ResultLong"
} }
} }
} }
@ -110,7 +110,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultVoid" "$ref": "#/components/schemas/ResultLong"
} }
} }
} }
@ -229,7 +229,17 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "操作成功",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultVoid"
}
}
}
},
"500": {
"description": "操作失败,请稍后重试",
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
@ -303,7 +313,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultVoid" "$ref": "#/components/schemas/ResultLong"
} }
} }
} }
@ -313,7 +323,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultVoid" "$ref": "#/components/schemas/ResultLong"
} }
} }
} }
@ -403,6 +413,61 @@
} }
} }
}, },
"/user/verify-captcha": {
"post": {
"tags": [
"用户管理"
],
"summary": "验证图形验证码",
"description": "验证用户输入的图形验证码是否正确",
"operationId": "verifyCaptcha",
"parameters": [
{
"name": "captchaKey",
"in": "cookie",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "验证码验证成功",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/Result"
}
}
}
},
"500": {
"description": "验证码已失效或验证码错误",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/Result"
}
}
}
}
}
}
},
"/user/register": { "/user/register": {
"post": { "post": {
"tags": [ "tags": [
@ -639,49 +704,6 @@
} }
} }
}, },
"/sendPrivateMessage": {
"post": {
"tags": [
"聊天模块"
],
"summary": "发送私信",
"description": "发送私信给指定用户",
"operationId": "sendPrivateMessage",
"parameters": [
{
"name": "senderId",
"in": "query",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MessageRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/post/cover": { "/post/cover": {
"post": { "post": {
"tags": [ "tags": [
@ -731,20 +753,38 @@
} }
} }
}, },
"/post/of/me": { "/user/captcha": {
"get": {
"tags": [
"用户管理"
],
"summary": "生成验证码图片",
"description": "生成图形验证码并设置Cookie存储captchaKey",
"operationId": "generateCaptcha",
"responses": {
"200": {
"description": "验证码生成成功"
},
"500": {
"description": "验证码生成失败"
}
}
}
},
"/post/user": {
"get": { "get": {
"tags": [ "tags": [
"帖子模块" "帖子模块"
], ],
"summary": "查看自己的帖子", "summary": "查看用户的帖子",
"operationId": "pagePostOfMe", "operationId": "pagePostOfUser",
"responses": { "responses": {
"200": { "200": {
"description": "获取成功", "description": "获取成功",
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponsePostBasicInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponsePostBasicInfoDTO"
} }
} }
} }
@ -754,7 +794,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponsePostBasicInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponsePostBasicInfoDTO"
} }
} }
} }
@ -775,7 +815,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponsePostBasicInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponsePostBasicInfoDTO"
} }
} }
} }
@ -785,7 +825,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponsePostBasicInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponsePostBasicInfoDTO"
} }
} }
} }
@ -835,6 +875,102 @@
} }
} }
}, },
"/message/history": {
"get": {
"tags": [
"聊天模块"
],
"summary": "历史记录",
"description": "传入分页参数,获取与特定用户的完整聊天记录",
"operationId": "getChatHistory",
"responses": {
"200": {
"description": "获取成功",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultScrollPageResponseMessageResponse"
}
}
}
},
"500": {
"description": "获取失败,请稍后重试",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultScrollPageResponseMessageResponse"
}
}
}
}
}
}
},
"/message/chat-list": {
"get": {
"tags": [
"聊天模块"
],
"summary": "聊天列表",
"description": "传入分页参数,查询私信用户列表(带最新消息)",
"operationId": "getChatList",
"responses": {
"200": {
"description": "获取成功",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultScrollPageResponseChatItemDTO"
}
}
}
},
"500": {
"description": "获取失败,请稍后重试",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultScrollPageResponseChatItemDTO"
}
}
}
}
}
}
},
"/follow/post": {
"get": {
"tags": [
"关注模块"
],
"summary": "关注收件箱",
"description": "传入分页参数,查询关注的人的发帖推送",
"operationId": "queryPostFollow",
"responses": {
"200": {
"description": "获取成功",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultScrollPageResponsePostBasicInfoDTO"
}
}
}
},
"500": {
"description": "获取失败,请稍后重试",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultScrollPageResponsePostBasicInfoDTO"
}
}
}
}
}
}
},
"/follow/or/not/{id}": { "/follow/or/not/{id}": {
"get": { "get": {
"tags": [ "tags": [
@ -856,7 +992,17 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "已关注",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultBoolean"
}
}
}
},
"500": {
"description": "未关注",
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
@ -873,8 +1019,8 @@
"tags": [ "tags": [
"关注模块" "关注模块"
], ],
"summary": "关注列表", "summary": "共同关注",
"description": "传入用户id返回该用户的关注列表", "description": "传入用户id返回该与该用户的共同关注",
"operationId": "followCommons", "operationId": "followCommons",
"parameters": [ "parameters": [
{ {
@ -889,7 +1035,17 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "获取成功",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ResultListUserDTO"
}
}
}
},
"500": {
"description": "获取失败,请稍后重试",
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
@ -914,7 +1070,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponseCommentInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponseCommentInfoDTO"
} }
} }
} }
@ -924,7 +1080,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponseCommentInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponseCommentInfoDTO"
} }
} }
} }
@ -945,7 +1101,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponseCommentInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponseCommentInfoDTO"
} }
} }
} }
@ -955,7 +1111,7 @@
"content": { "content": {
"*/*": { "*/*": {
"schema": { "schema": {
"$ref": "#/components/schemas/ResultPageResponseCommentInfoDTO" "$ref": "#/components/schemas/ResultScrollPageResponseCommentInfoDTO"
} }
} }
} }
@ -1056,18 +1212,31 @@
"parentCommentId": { "parentCommentId": {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"description": "该评论的父评论id" "description": "该评论的父评论id若不是回复则传入空值"
},
"topId": {
"type": "integer",
"format": "int64",
"description": "该评论的顶级评论id"
} }
}, },
"required": [ "required": [
"content" "content"
] ]
}, },
"Result": {
"type": "object",
"description": "统一返回前端的结果",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"description": "状态码"
},
"msg": {
"type": "string",
"description": "提示消息"
},
"data": {
"description": "响应数据"
}
}
},
"UserRegisterDTO": { "UserRegisterDTO": {
"type": "object", "type": "object",
"description": "用户注册DTO", "description": "用户注册DTO",
@ -1228,79 +1397,45 @@
} }
} }
}, },
"MessageRequest": { "ResultLong": {
"type": "object", "type": "object",
"description": "消息请求对象", "description": "统一返回前端的结果",
"properties": { "properties": {
"messageType": { "code": {
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"description": "消息类型0-私信1-系统通知", "description": "状态码"
"enum": [
"0",
"1"
],
"example": 0
}, },
"content": { "msg": {
"type": "string", "type": "string",
"description": "消息内容", "description": "提示消息"
"maxLength": 500,
"minLength": 1
}, },
"receiverId": { "data": {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"description": "接收者ID" "description": "响应数据"
},
"senderName": {
"type": "string",
"description": "发送者用户名"
},
"senderAvatar": {
"type": "string",
"description": "发送者头像"
} }
}, }
"required": [
"content",
"senderAvatar",
"senderName"
]
}, },
"PostPageQueryDTO": { "PostPageQueryDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
"current": { "lastVal": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"size": { "offset": {
"type": "integer",
"format": "int64"
}
}
},
"PageResponsePostBasicInfoDTO": {
"type": "object",
"properties": {
"current": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int32"
}, },
"size": { "size": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"total": { "userId": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
}, "description": "想要查看的用户的id输入空时为自己的id"
"records": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PostBasicInfoDTO"
}
} }
} }
}, },
@ -1360,13 +1495,18 @@
"userAvatar": { "userAvatar": {
"type": "string", "type": "string",
"description": "匿名情况下用户头像" "description": "匿名情况下用户头像"
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "帖子创建时间"
} }
}, },
"required": [ "required": [
"title" "title"
] ]
}, },
"ResultPageResponsePostBasicInfoDTO": { "ResultScrollPageResponsePostBasicInfoDTO": {
"type": "object", "type": "object",
"description": "统一返回前端的结果", "description": "统一返回前端的结果",
"properties": { "properties": {
@ -1380,11 +1520,34 @@
"description": "提示消息" "description": "提示消息"
}, },
"data": { "data": {
"$ref": "#/components/schemas/PageResponsePostBasicInfoDTO", "$ref": "#/components/schemas/ScrollPageResponsePostBasicInfoDTO",
"description": "响应数据" "description": "响应数据"
} }
} }
}, },
"ScrollPageResponsePostBasicInfoDTO": {
"type": "object",
"properties": {
"lastVal": {
"type": "integer",
"format": "int64"
},
"offset": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int64"
},
"records": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PostBasicInfoDTO"
}
}
}
},
"PostInfoDTO": { "PostInfoDTO": {
"type": "object", "type": "object",
"description": "修改帖子信息", "description": "修改帖子信息",
@ -1448,6 +1611,11 @@
"userAvatar": { "userAvatar": {
"type": "string", "type": "string",
"description": "匿名情况下用户头像" "description": "匿名情况下用户头像"
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "帖子创建时间"
} }
}, },
"required": [ "required": [
@ -1455,6 +1623,201 @@
"title" "title"
] ]
}, },
"ChatPageQueryDTO": {
"type": "object",
"properties": {
"lastVal": {
"type": "integer",
"format": "int64"
},
"offset": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int64"
},
"chatUserId": {
"type": "integer",
"format": "int64"
}
}
},
"MessageResponse": {
"type": "object",
"description": "消息返回对象",
"properties": {
"messageType": {
"type": "integer",
"format": "int32",
"description": "消息类型0-私信1-系统通知",
"enum": [
"0",
"1"
],
"example": 0
},
"content": {
"type": "string",
"description": "消息内容",
"maxLength": 500,
"minLength": 1
},
"senderId": {
"type": "integer",
"format": "int64",
"description": "发送者ID"
},
"receiverId": {
"type": "integer",
"format": "int64",
"description": "接收者ID"
},
"senderName": {
"type": "string",
"description": "发送者用户名"
},
"senderAvatar": {
"type": "string",
"description": "发送者头像"
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "消息创建时间"
}
},
"required": [
"content",
"senderAvatar",
"senderName"
]
},
"ResultScrollPageResponseMessageResponse": {
"type": "object",
"description": "统一返回前端的结果",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"description": "状态码"
},
"msg": {
"type": "string",
"description": "提示消息"
},
"data": {
"$ref": "#/components/schemas/ScrollPageResponseMessageResponse",
"description": "响应数据"
}
}
},
"ScrollPageResponseMessageResponse": {
"type": "object",
"properties": {
"lastVal": {
"type": "integer",
"format": "int64"
},
"offset": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int64"
},
"records": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageResponse"
}
}
}
},
"ChatItemDTO": {
"type": "object",
"description": "聊天列表项DTO",
"properties": {
"chatUserId": {
"type": "integer",
"format": "int64",
"description": "聊天对象的用户ID",
"example": 123456
},
"avatar": {
"type": "string",
"description": "聊天对象的头像URL",
"example": "https://example.com/avatar.jpg"
},
"username": {
"type": "string",
"description": "聊天对象的用户名",
"example": "张三"
},
"latestMessage": {
"type": "string",
"description": "最新消息内容",
"example": "今天下午开会",
"maxLength": 500
},
"latestTime": {
"type": "string",
"format": "date-time",
"description": "最新消息时间",
"example": "2023-10-15T14:30:00"
}
},
"required": [
"chatUserId",
"latestMessage",
"latestTime",
"username"
]
},
"ResultScrollPageResponseChatItemDTO": {
"type": "object",
"description": "统一返回前端的结果",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"description": "状态码"
},
"msg": {
"type": "string",
"description": "提示消息"
},
"data": {
"$ref": "#/components/schemas/ScrollPageResponseChatItemDTO",
"description": "响应数据"
}
}
},
"ScrollPageResponseChatItemDTO": {
"type": "object",
"properties": {
"lastVal": {
"type": "integer",
"format": "int64"
},
"offset": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int64"
},
"records": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ChatItemDTO"
}
}
}
},
"ResultBoolean": { "ResultBoolean": {
"type": "object", "type": "object",
"description": "统一返回前端的结果", "description": "统一返回前端的结果",
@ -1499,10 +1862,14 @@
"CommentPageQueryDTO": { "CommentPageQueryDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
"current": { "lastVal": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"offset": {
"type": "integer",
"format": "int32"
},
"size": { "size": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
@ -1512,10 +1879,16 @@
"format": "int64", "format": "int64",
"title": "帖子ID" "title": "帖子ID"
}, },
"commentId": { "parentCommentId": {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"title": "评论ID" "title": "评论ID"
},
"orderByTime": {
"type": "boolean"
},
"orderByHot": {
"type": "boolean"
} }
}, },
"title": "分页查询评论请求DTO" "title": "分页查询评论请求DTO"
@ -1591,18 +1964,37 @@
} }
} }
}, },
"PageResponseCommentInfoDTO": { "ResultScrollPageResponseCommentInfoDTO": {
"type": "object", "type": "object",
"description": "统一返回前端的结果",
"properties": { "properties": {
"current": { "code": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int32",
"description": "状态码"
}, },
"size": { "msg": {
"type": "string",
"description": "提示消息"
},
"data": {
"$ref": "#/components/schemas/ScrollPageResponseCommentInfoDTO",
"description": "响应数据"
}
}
},
"ScrollPageResponseCommentInfoDTO": {
"type": "object",
"properties": {
"lastVal": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
"total": { "offset": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
}, },
@ -1613,25 +2005,6 @@
} }
} }
} }
},
"ResultPageResponseCommentInfoDTO": {
"type": "object",
"description": "统一返回前端的结果",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"description": "状态码"
},
"msg": {
"type": "string",
"description": "提示消息"
},
"data": {
"$ref": "#/components/schemas/PageResponseCommentInfoDTO",
"description": "响应数据"
}
}
} }
} }
} }

@ -9,13 +9,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class OpenApiConfig { public class OpenApiConfig {
@Bean @Bean
public OpenAPI customOpenAPI() { public OpenAPI customOpenAPI() {
return new OpenAPI() return new OpenAPI()
.info(new Info() .info(new Info()
.title("珞珈岛API文档") .title("珞珈岛API文档")
.description("珞珈岛社交平台API接口文档")
.version("1.0") .version("1.0")
.description("API文档")
); );
} }
} }

@ -22,7 +22,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
"/post/detail", "/post/detail",
"/comment/list", "/comment/list",
"/comment/list/reply", "/comment/list/reply",
"/openapi/luojia-channel" "/openapi/luojia-channel",
"/swagger-ui.html"
); );
} }

@ -8,6 +8,9 @@ import com.luojia_channel.modules.interact.dto.ChatPageQueryDTO;
import com.luojia_channel.modules.interact.service.ChatService; import com.luojia_channel.modules.interact.service.ChatService;
import com.luojia_channel.modules.message.dto.MessageResponse; import com.luojia_channel.modules.message.dto.MessageResponse;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -15,15 +18,19 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("/message") @RequestMapping("/message")
@RequiredArgsConstructor @RequiredArgsConstructor
@Tag(name = "聊天模块", description = "好友聊天模块相关接口")
public class ChatController { public class ChatController {
private final ChatService chatService; private final ChatService chatService;
@Operation( @Operation(
summary = "聊天列表", summary = "聊天列表",
description = "传入分页参数,查询私信用户列表(带最新消息)", description = "传入分页参数,查询私信用户列表(带最新消息)",
tags = {"私信模块"} tags = {"聊天模块"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "获取成功"),
@ApiResponse(responseCode = "500", description = "获取失败,请稍后重试")
})
@GetMapping("/chat-list") @GetMapping("/chat-list")
public Result<ScrollPageResponse<ChatItemDTO>> getChatList(@RequestBody ChatPageQueryDTO chatPageQueryDTO) { public Result<ScrollPageResponse<ChatItemDTO>> getChatList(@RequestBody ChatPageQueryDTO chatPageQueryDTO) {
return Result.success(chatService.getChatList(chatPageQueryDTO)); return Result.success(chatService.getChatList(chatPageQueryDTO));
@ -32,8 +39,12 @@ public class ChatController {
@Operation( @Operation(
summary = "历史记录", summary = "历史记录",
description = "传入分页参数,获取与特定用户的完整聊天记录", description = "传入分页参数,获取与特定用户的完整聊天记录",
tags = {"关注模块"} tags = {"聊天模块"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "获取成功"),
@ApiResponse(responseCode = "500", description = "获取失败,请稍后重试")
})
@GetMapping("/history") @GetMapping("/history")
public Result<ScrollPageResponse<MessageResponse>> getChatHistory(@RequestBody ChatPageQueryDTO chatPageQueryDTO) { public Result<ScrollPageResponse<MessageResponse>> getChatHistory(@RequestBody ChatPageQueryDTO chatPageQueryDTO) {
return Result.success(chatService.getChatHistory(chatPageQueryDTO)); return Result.success(chatService.getChatHistory(chatPageQueryDTO));

@ -8,6 +8,8 @@ import com.luojia_channel.modules.interact.service.FollowService;
import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO;
import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -28,6 +30,10 @@ public class FollowController {
description = "关注用户传入用户id和是否关注的状态", description = "关注用户传入用户id和是否关注的状态",
tags = {"关注模块"} tags = {"关注模块"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "操作成功"),
@ApiResponse(responseCode = "500", description = "操作失败,请稍后重试")
})
public Result<Void> follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow){ public Result<Void> follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow){
followService.follow(followUserId, isFollow); followService.follow(followUserId, isFollow);
return Result.success(); return Result.success();
@ -38,6 +44,10 @@ public class FollowController {
description = "传入用户id返回是否关注该用户", description = "传入用户id返回是否关注该用户",
tags = {"关注模块"} tags = {"关注模块"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "已关注"),
@ApiResponse(responseCode = "500", description = "未关注")
})
public Result<Boolean> isFollow(@PathVariable("id") Long followUserId){ public Result<Boolean> isFollow(@PathVariable("id") Long followUserId){
return Result.success(followService.isFollow(followUserId)); return Result.success(followService.isFollow(followUserId));
} }
@ -47,6 +57,10 @@ public class FollowController {
description = "传入用户id返回该与该用户的共同关注", description = "传入用户id返回该与该用户的共同关注",
tags = {"关注模块"} tags = {"关注模块"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "获取成功"),
@ApiResponse(responseCode = "500", description = "获取失败,请稍后重试")
})
public Result<List<UserDTO>> followCommons(@PathVariable("id") Long id){ public Result<List<UserDTO>> followCommons(@PathVariable("id") Long id){
return Result.success(followService.followCommons(id)); return Result.success(followService.followCommons(id));
} }
@ -57,6 +71,10 @@ public class FollowController {
description = "传入分页参数,查询关注的人的发帖推送", description = "传入分页参数,查询关注的人的发帖推送",
tags = {"关注模块"} tags = {"关注模块"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "获取成功"),
@ApiResponse(responseCode = "500", description = "获取失败,请稍后重试")
})
public Result<ScrollPageResponse<PostBasicInfoDTO>> queryPostFollow(@RequestBody PostPageQueryDTO postPageQueryDTO){ public Result<ScrollPageResponse<PostBasicInfoDTO>> queryPostFollow(@RequestBody PostPageQueryDTO postPageQueryDTO){
return Result.success(followService.queryPostFollow(postPageQueryDTO)); return Result.success(followService.queryPostFollow(postPageQueryDTO));
} }

@ -88,8 +88,14 @@ public class UserLoginController {
*/ */
@GetMapping("/captcha") @GetMapping("/captcha")
@Operation( @Operation(
summary = "生成验证码图片" summary = "生成验证码图片",
description = "生成图形验证码并设置Cookie存储captchaKey",
tags = {"用户管理"}
) )
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "验证码生成成功"),
@ApiResponse(responseCode = "500", description = "验证码生成失败")
})
public void generateCaptcha(HttpServletRequest request, public void generateCaptcha(HttpServletRequest request,
HttpServletResponse res) throws IOException { HttpServletResponse res) throws IOException {
@ -114,7 +120,18 @@ public class UserLoginController {
* @return * @return
*/ */
@PostMapping("/verify-captcha") @PostMapping("/verify-captcha")
public Result verifyCaptcha(@RequestBody Map<String, String> params, @CookieValue(value = "captchaKey", required = false) String captchaKey, HttpSession session) { @Operation(
summary = "验证图形验证码",
description = "验证用户输入的图形验证码是否正确",
tags = {"用户管理"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "验证码验证成功"),
@ApiResponse(responseCode = "500", description = "验证码已失效或验证码错误")
})
public Result verifyCaptcha(@RequestBody Map<String, String> params,
@CookieValue(value = "captchaKey", required = false) String captchaKey,
HttpSession session) {
String captcha = params.get("captcha"); String captcha = params.get("captcha");
if (captchaKey == null) { if (captchaKey == null) {

@ -1,36 +1,36 @@
#本地开发环境 #本地开发环境
# lj: lj:
# db: db:
# host: localhost host: localhost
# password: 123456 password: 123456
# redis: redis:
# host: localhost host: localhost
# port: 6379 port: 6379
# password: 123456 password: 123456
# rabbitmq: rabbitmq:
# host: localhost host: localhost
# port: 15672 port: 15672
# username: root username: root
# password: 123456 password: 123456
# minio: minio:
# endpoint: http://localhost:9000 endpoint: http://localhost:9000
# accessKey: minioadmin accessKey: minioadmin
# secretKey: minioadmin secretKey: minioadmin
lj: #lj:
db: # db:
host: 192.168.59.129 # host: 192.168.59.129
password: Forely123! # password: Forely123!
redis: # redis:
host: 192.168.59.129 # host: 192.168.59.129
port: 6379 # port: 6379
password: Forely123! # password: Forely123!
rabbitmq: # rabbitmq:
host: 192.168.59.129 # host: 192.168.59.129
port: 5672 # port: 5672
username: admin # username: admin
password: Forely123! # password: Forely123!
minio: # minio:
endpoint: http://192.168.59.129:9000 # endpoint: http://192.168.59.129:9000
accessKey: forely # accessKey: forely
secretKey: Forely123! # secretKey: Forely123!

@ -3,6 +3,13 @@ server:
springdoc: springdoc:
api-docs: api-docs:
path: /openapi/luojia-channel path: /openapi/luojia-channel
swagger-ui:
path: /swagger-ui.html
disable-swagger-default-url: true
tags-sorter: alpha
operations-sorter: alpha
packages-to-scan: com.luojia_channel.modules
paths-to-match: /user/**, /post/**, /comment/**, /message/**, /follow/**, /file/**
spring: spring:
application: application:
name: service name: service

@ -1,36 +1,36 @@
#本地开发环境 #本地开发环境
# lj: lj:
# db: db:
# host: localhost host: localhost
# password: 123456 password: 123456
# redis: redis:
# host: localhost host: localhost
# port: 6379 port: 6379
# password: 123456 password: 123456
# rabbitmq: rabbitmq:
# host: localhost host: localhost
# port: 15672 port: 15672
# username: root username: root
# password: 123456 password: 123456
# minio: minio:
# endpoint: http://localhost:9000 endpoint: http://localhost:9000
# accessKey: minioadmin accessKey: minioadmin
# secretKey: minioadmin secretKey: minioadmin
lj: #lj:
db: # db:
host: 192.168.59.129 # host: 192.168.59.129
password: Forely123! # password: Forely123!
redis: # redis:
host: 192.168.59.129 # host: 192.168.59.129
port: 6379 # port: 6379
password: Forely123! # password: Forely123!
rabbitmq: # rabbitmq:
host: 192.168.59.129 # host: 192.168.59.129
port: 5672 # port: 5672
username: admin # username: admin
password: Forely123! # password: Forely123!
minio: # minio:
endpoint: http://192.168.59.129:9000 # endpoint: http://192.168.59.129:9000
accessKey: forely # accessKey: forely
secretKey: Forely123! # secretKey: Forely123!

@ -3,6 +3,13 @@ server:
springdoc: springdoc:
api-docs: api-docs:
path: /openapi/luojia-channel path: /openapi/luojia-channel
swagger-ui:
path: /swagger-ui.html
disable-swagger-default-url: true
tags-sorter: alpha
operations-sorter: alpha
packages-to-scan: com.luojia_channel.modules
paths-to-match: /user/**, /post/**, /comment/**, /message/**, /follow/**, /file/**
spring: spring:
application: application:
name: service name: service

@ -113,7 +113,7 @@ const goToProfile = () => {
const logout = () => { const logout = () => {
userStore.logout(); userStore.logout();
router.push({ name: 'Home' }); // router.push({ name: 'MainPage' }); //
isDropdownVisible.value = false; // isDropdownVisible.value = false; //
}; };

@ -215,7 +215,7 @@ async function login() {
localStorage.setItem('refreshToken', refreshToken); localStorage.setItem('refreshToken', refreshToken);
userStore.login({ userStore.login({
avatar: '/assets/default-avatar/boy_1.png', avatar:require ('@/assets/default-avatar/boy_1.png'),
userName: '珈人一号', userName: '珈人一号',
userid:1 userid:1
}); });

Loading…
Cancel
Save