修复了一些逻辑漏洞

This commit is contained in:
2025-12-05 16:35:14 +08:00
parent d3fc16b546
commit acb871855e
2 changed files with 48 additions and 57 deletions

View File

@@ -122,7 +122,7 @@ func DeleteConversationHandler(c *gin.Context) {
/**
* GetConversationByRoomHandler
* 功能:根据 room_id 获取或创建会话
* 功能:根据 room_id 获取会话(不自动创建)
* 路径:GET /api/conversations/by-room/:room_id
*/
func GetConversationByRoomHandler(c *gin.Context) {
@@ -137,7 +137,7 @@ func GetConversationByRoomHandler(c *gin.Context) {
conv, err := service.ConversationSvc.GetOrCreateConversationByRoom(userID.(string), roomID)
if err != nil {
if err == gorm.ErrRecordNotFound {
utils.NotFound(c, "房间不存在或无权访问")
utils.NotFound(c, "会话不存在")
} else {
utils.InternalError(c, "查询失败")
}