调整路由以符合 RESTful 规范,新增 API Token 撤销功能

This commit is contained in:
2026-01-14 10:13:57 +08:00
parent 9c10dfd496
commit 5160ae78cc
10 changed files with 658 additions and 536 deletions

View File

@@ -35,7 +35,7 @@ type PickupResponse struct {
// @Produce application/zip
// @Success 200 {file} file
// @Failure 404 {object} model.Response
// @Router /api/download/batch/{pickup_code} [get]
// @Router /api/batches/{pickup_code}/download [get]
func (h *PickupHandler) DownloadBatch(c *gin.Context) {
code := c.Param("pickup_code")
batch, err := h.batchService.GetBatchByPickupCode(code)
@@ -88,7 +88,7 @@ func NewPickupHandler() *PickupHandler {
// @Param pickup_code path string true "取件码"
// @Success 200 {object} model.Response{data=PickupResponse}
// @Failure 404 {object} model.Response
// @Router /api/pickup/{pickup_code} [get]
// @Router /api/batches/{pickup_code} [get]
func (h *PickupHandler) Pickup(c *gin.Context) {
code := c.Param("pickup_code")
if code == "" {
@@ -124,7 +124,7 @@ func (h *PickupHandler) Pickup(c *gin.Context) {
// @Success 200 {file} file
// @Failure 404 {object} model.Response
// @Failure 410 {object} model.Response
// @Router /api/download/file/{file_id} [get]
// @Router /api/files/{file_id}/download [get]
func (h *PickupHandler) DownloadFile(c *gin.Context) {
fileIDStr := c.Param("file_id")
fileID, _ := strconv.ParseUint(fileIDStr, 10, 32)