feat(biji-houdaun): 实现用户注册、登录、 Markdown 文件和图片上传功能

- 新增用户注册、登录接口及服务实现
- 添加 Markdown 文件创建、更新接口及服务实现
- 实现图片上传、获取接口及服务实现
- 集成 Snowflake ID 生成器
- 添加全局异常处理和统一返回结果封装
- 配置跨域访问和静态资源处理
- 实现基础的 XSS 防护
This commit is contained in:
ikmkj
2025-06-16 20:20:08 +08:00
parent 8a4bf2d245
commit 1ef2e116a6
27 changed files with 1049 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package com.test.bijihoudaun.controller;
import com.test.bijihoudaun.entity.MarkdownFile;
import com.test.bijihoudaun.service.MarkdownFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/markdown")
public class MarkdownController {
@Autowired
private MarkdownFileService markdownFileService;
@PostMapping
public ResponseEntity<MarkdownFile> createMarkdown(
@RequestParam Integer userId,
@RequestParam String title,
@RequestParam String fileName,
@RequestBody String content) {
MarkdownFile file = markdownFileService.createMarkdownFile(
userId, title, fileName, content);
return ResponseEntity.ok(file);
}
@PutMapping("/{id}")
public ResponseEntity<MarkdownFile> updateMarkdown(
@PathVariable Integer id,
@RequestBody String content) {
MarkdownFile file = markdownFileService.updateMarkdownContent(id, content);
if (file != null) {
return ResponseEntity.ok(file);
}
return ResponseEntity.notFound().build();
}
}