升级商城逻辑

This commit is contained in:
2025-09-02 09:29:20 +08:00
parent 16bfc525c2
commit 49eed40ad0
30 changed files with 22710 additions and 1339 deletions

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: 手机号码
*/