feat(core): 优化路径处理和配置端口并添加项目规范文档

- 将所有文件路径转换为 URL 友好格式,统一使用正斜杠,确保跨平台兼容
- 修改默认服务器监听端口为 :8989,提升默认配置适用性
- 数据库初始化时创建数据库文件夹,避免路径不存在导致错误
- 新增 AGENTS.md 文档,详细规范项目开发流程、代码风格、架构设计和安全性能指导
- 修正头像路径显示逻辑,确保头像 URL 正确展示
- 增加应用启动和开发的标准操作指南,提升团队协作效率
This commit is contained in:
2026-02-24 20:44:05 +08:00
parent 084d3b0faf
commit ddec422813
7 changed files with 319 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
package services
import (
"path/filepath"
"lv8girl/internal/models"
"lv8girl/internal/repositories"
)
@@ -68,7 +70,9 @@ func (s *MessageService) GetConversations(userID uint) ([]ConversationView, erro
avatar := ""
if otherUser.Avatar != "" {
avatar = "/" + otherUser.Avatar
// 确保路径使用正斜杠,并添加前导斜杠
avatarPath := filepath.ToSlash(otherUser.Avatar)
avatar = "/" + avatarPath
}
conversations = append(conversations, ConversationView{