商城后端模板

This commit is contained in:
dzl
2025-09-24 10:02:03 +08:00
commit 658ff89c6a
93 changed files with 55153 additions and 0 deletions

View File

@@ -0,0 +1,225 @@
/**
* @swagger
* components:
* schemas:
* Announcement:
* type: object
* required:
* - title
* - content
* - type
* - priority
* properties:
* id:
* type: integer
* description: 公告ID
* example: 1
* title:
* type: string
* description: 公告标题
* example: "系统维护通知"
* content:
* type: string
* description: 公告内容
* example: "系统将于今晚进行维护预计维护时间2小时期间可能影响部分功能使用。"
* type:
* type: string
* description: 公告类型
* enum: [system, activity, maintenance, urgent]
* example: "maintenance"
* priority:
* type: string
* description: 优先级
* enum: [high, medium, low]
* example: "high"
* status:
* type: string
* description: 公告状态
* enum: [draft, published, expired]
* example: "published"
* isTop:
* type: boolean
* description: 是否置顶
* example: false
* publishTime:
* type: string
* format: date-time
* description: 发布时间
* example: "2024-01-15T10:00:00Z"
* expireTime:
* type: string
* format: date-time
* description: 过期时间
* example: "2024-01-20T10:00:00Z"
* createdBy:
* type: integer
* description: 创建者用户ID
* example: 1
* createdAt:
* type: string
* format: date-time
* description: 创建时间
* example: "2024-01-15T09:00:00Z"
* updatedAt:
* type: string
* format: date-time
* description: 更新时间
* example: "2024-01-15T09:30:00Z"
* creator:
* type: object
* description: 创建者信息
* properties:
* id:
* type: integer
* example: 1
* username:
* type: string
* example: "admin"
* email:
* type: string
* example: "admin@example.com"
*
* AnnouncementCreate:
* type: object
* required:
* - title
* - content
* - type
* - priority
* properties:
* title:
* type: string
* description: 公告标题
* example: "系统维护通知"
* content:
* type: string
* description: 公告内容
* example: "系统将于今晚进行维护预计维护时间2小时。"
* type:
* type: string
* description: 公告类型
* enum: [system, activity, maintenance, urgent]
* example: "maintenance"
* priority:
* type: string
* description: 优先级
* enum: [high, medium, low]
* example: "high"
* status:
* type: string
* description: 公告状态
* enum: [draft, published]
* default: draft
* example: "draft"
* isTop:
* type: boolean
* description: 是否置顶
* default: false
* example: false
* publishTime:
* type: string
* format: date-time
* description: 发布时间
* example: "2024-01-15T10:00:00Z"
* expireTime:
* type: string
* format: date-time
* description: 过期时间
* example: "2024-01-20T10:00:00Z"
*
* AnnouncementUpdate:
* type: object
* properties:
* title:
* type: string
* description: 公告标题
* example: "系统维护通知(更新)"
* content:
* type: string
* description: 公告内容
* example: "系统维护时间调整为明晚进行。"
* type:
* type: string
* description: 公告类型
* enum: [system, activity, maintenance, urgent]
* example: "maintenance"
* priority:
* type: string
* description: 优先级
* enum: [high, medium, low]
* example: "medium"
* status:
* type: string
* description: 公告状态
* enum: [draft, published, expired]
* example: "published"
* isTop:
* type: boolean
* description: 是否置顶
* example: true
* publishTime:
* type: string
* format: date-time
* description: 发布时间
* example: "2024-01-16T10:00:00Z"
* expireTime:
* type: string
* format: date-time
* description: 过期时间
* example: "2024-01-21T10:00:00Z"
*
* AnnouncementList:
* type: object
* properties:
* success:
* type: boolean
* example: true
* data:
* type: object
* properties:
* announcements:
* type: array
* items:
* $ref: '#/components/schemas/Announcement'
* total:
* type: integer
* description: 总记录数
* example: 50
* page:
* type: integer
* description: 当前页码
* example: 1
* limit:
* type: integer
* description: 每页数量
* example: 10
* totalPages:
* type: integer
* description: 总页数
* example: 5
*
* AnnouncementResponse:
* type: object
* properties:
* success:
* type: boolean
* example: true
* message:
* type: string
* example: "操作成功"
* data:
* $ref: '#/components/schemas/Announcement'
*
* AnnouncementError:
* type: object
* properties:
* success:
* type: boolean
* example: false
* message:
* type: string
* example: "操作失败"
* error:
* type: string
* example: "公告不存在"
*/

93
docs/schemas/cart.js Normal file
View File

@@ -0,0 +1,93 @@
/**
* @swagger
* components:
* schemas:
* CartItem:
* type: object
* required:
* - user_id
* - product_id
* - quantity
* properties:
* id:
* type: integer
* description: 购物车商品ID
* user_id:
* type: integer
* description: 用户ID
* product_id:
* type: integer
* description: 商品ID
* quantity:
* type: integer
* description: 商品数量
* created_at:
* type: string
* format: date-time
* description: 创建时间
* updated_at:
* type: string
* format: date-time
* description: 更新时间
*
* CartItemWithProduct:
* type: object
* properties:
* id:
* type: integer
* description: 购物车商品ID
* product_id:
* type: integer
* description: 商品ID
* product_name:
* type: string
* description: 商品名称
* quantity:
* type: integer
* description: 商品数量
* points_price:
* type: integer
* description: 积分价格
* rongdou_price:
* type: number
* description: 融豆价格
* image_url:
* type: string
* description: 商品图片URL
* stock:
* type: integer
* description: 库存数量
* payment_methods:
* type: array
* items:
* type: string
* description: 支付方式列表
* created_at:
* type: string
* format: date-time
* description: 创建时间
*
* AddToCartRequest:
* type: object
* required:
* - product_id
* - quantity
* properties:
* product_id:
* type: integer
* description: 商品ID
* quantity:
* type: integer
* minimum: 1
* description: 商品数量
*
* UpdateCartRequest:
* type: object
* required:
* - quantity
* properties:
* quantity:
* type: integer
* minimum: 1
* description: 商品数量
*/

102
docs/schemas/order.js Normal file
View File

@@ -0,0 +1,102 @@
/**
* @swagger
* components:
* schemas:
* Order:
* type: object
* required:
* - user_id
* - total_amount
* - status
* properties:
* id:
* type: integer
* description: 订单ID
* order_number:
* type: string
* description: 订单号
* user_id:
* type: integer
* description: 用户ID
* total_amount:
* type: number
* description: 订单总金额
* total_points:
* type: integer
* description: 订单总积分
* total_rongdou:
* type: number
* description: 订单总融豆
* status:
* type: string
* description: 订单状态
* enum: [pending, confirmed, shipped, delivered, cancelled]
* payment_status:
* type: string
* description: 支付状态
* enum: [pending, paid, failed, refunded]
* shipping_address:
* type: string
* description: 收货地址
* created_at:
* type: string
* format: date-time
* description: 创建时间
* updated_at:
* type: string
* format: date-time
* description: 更新时间
*
* OrderItem:
* type: object
* properties:
* id:
* type: integer
* description: 订单商品ID
* order_id:
* type: integer
* description: 订单ID
* product_id:
* type: integer
* description: 商品ID
* quantity:
* type: integer
* description: 商品数量
* price:
* type: number
* description: 商品价格
* points_price:
* type: integer
* description: 积分价格
* rongdou_price:
* type: number
* description: 融豆价格
* created_at:
* type: string
* format: date-time
* description: 创建时间
*
* PreOrder:
* type: object
* properties:
* preOrderId:
* type: integer
* description: 预订单ID
* orderNumber:
* type: string
* description: 订单号
* totalAmount:
* type: number
* description: 总金额
* totalPoints:
* type: integer
* description: 所需积分总数
* totalRongdou:
* type: number
* description: 所需融豆总数
* paymentMethods:
* type: array
* items:
* type: string
* description: 去重后的支付方式列表
*/

53
docs/schemas/product.js Normal file
View File

@@ -0,0 +1,53 @@
/**
* @swagger
* components:
* schemas:
* Product:
* type: object
* required:
* - name
* - points_price
* - stock
* properties:
* id:
* type: integer
* description: 商品ID
* name:
* type: string
* description: 商品名称
* category:
* type: string
* description: 商品分类
* points_price:
* type: integer
* description: 积分价格
* rongdou_price:
* type: number
* description: 融豆价格
* stock:
* type: integer
* description: 库存数量
* image_url:
* type: string
* description: 商品图片URL
* description:
* type: string
* description: 商品描述
* status:
* type: string
* description: 商品状态
* enum: [active, inactive]
* payment_methods:
* type: array
* items:
* type: string
* description: 支付方式列表
* created_at:
* type: string
* format: date-time
* description: 创建时间
* updated_at:
* type: string
* format: date-time
* description: 更新时间
*/

104
docs/schemas/user.js Normal file
View File

@@ -0,0 +1,104 @@
/**
* @swagger
* components:
* schemas:
* User:
* type: object
* required:
* - username
* - email
* properties:
* id:
* type: integer
* description: 用户ID
* username:
* type: string
* description: 用户名
* email:
* type: string
* format: email
* description: 邮箱地址
* phone:
* type: string
* description: 手机号码
* points:
* type: integer
* description: 积分余额
* rongdou:
* type: number
* description: 融豆余额
* avatar:
* type: string
* description: 头像URL
* status:
* type: string
* description: 用户状态
* enum: [active, inactive, banned]
* created_at:
* type: string
* format: date-time
* description: 创建时间
* updated_at:
* type: string
* format: date-time
* description: 更新时间
*
* UserProfile:
* type: object
* properties:
* id:
* type: integer
* description: 用户ID
* username:
* type: string
* description: 用户名
* email:
* type: string
* description: 邮箱地址
* phone:
* type: string
* description: 手机号码
* points:
* type: integer
* description: 积分余额
* rongdou:
* type: number
* description: 融豆余额
* avatar:
* type: string
* description: 头像URL
*
* LoginRequest:
* type: object
* required:
* - username
* - password
* properties:
* username:
* type: string
* description: 用户名或邮箱
* password:
* type: string
* description: 密码
*
* RegisterRequest:
* type: object
* required:
* - username
* - email
* - password
* properties:
* username:
* type: string
* description: 用户名
* email:
* type: string
* format: email
* description: 邮箱地址
* password:
* type: string
* description: 密码
* phone:
* type: string
* description: 手机号码
*/