完善订单相关逻辑和商品推荐逻辑,添加接口注释

This commit is contained in:
dzl
2025-10-17 17:26:37 +08:00
parent f9a757046c
commit e535e8a9c5
6 changed files with 619 additions and 103 deletions

View File

@@ -2,6 +2,45 @@ const express = require('express');
const { getDB } = require('../database');
const router = express.Router();
/**
* @swagger
* /api/category:
* get:
* summary: 获取一级分类及其二级分类
* description: 返回所有一级分类,每个一级分类包含其下的二级分类
* tags: [category]
* responses:
* 200:
* description: 成功返回一级分类及其二级分类
* content:
* application/json:
* schema:
* type: object
* properties:
* success:
* type: boolean
* example: true
* data:
* type: array
* items:
* type: object
* properties:
* name:
* type: string
* example: "一级分类1"
* relative:
* type: array
* items:
* type: object
* properties:
* name:
* type: string
* example: "二级分类1-1"
* img:
* type: string
* example: "https://example.com/image.jpg"
*/
router.get('/', async (req, res) => {
try {
const db = await getDB();