basePath: / definitions: handlers.AdminChatPayload: properties: content: type: string type: object handlers.AdminVerifyTokenRequest: properties: token: type: string type: object handlers.ChatMessagePayload: properties: content: type: string type: object handlers.CheckoutPayload: properties: contactEmail: type: string contactPhone: type: string note: type: string notifyEmail: type: string paymentMethod: type: string productId: type: string quantity: type: integer type: object handlers.MaintenancePayload: properties: maintenance: type: boolean reason: type: string type: object handlers.ProductPayload: properties: active: type: boolean codes: items: type: string type: array coverUrl: type: string deliveryMode: type: string description: type: string discountPrice: type: number fixedContent: type: string fulfillmentType: type: string maxPerAccount: type: integer name: type: string paymentQrUrls: items: type: string type: array price: type: number requireLogin: type: boolean screenshotUrls: items: type: string type: array showContact: type: boolean showNote: type: boolean tags: type: string type: object handlers.SwaggerBoolOK: properties: ok: type: boolean type: object handlers.SwaggerBoolOKWrap: properties: data: $ref: '#/definitions/handlers.SwaggerBoolOK' type: object handlers.SwaggerCancelMsg: properties: message: type: string ok: type: boolean type: object handlers.SwaggerCancelWrap: properties: data: $ref: '#/definitions/handlers.SwaggerCancelMsg' type: object handlers.SwaggerCheckoutData: properties: orderId: type: string paymentExpectedTotal: type: number paymentExpiresAt: type: string paymentMethod: type: string paymentQrUrls: items: type: string type: array productId: type: string productQty: type: integer qrCodeUrl: type: string status: type: string viewCount: type: integer type: object handlers.SwaggerCheckoutWrap: properties: data: $ref: '#/definitions/handlers.SwaggerCheckoutData' type: object handlers.SwaggerConfirmData: properties: deliveredCodes: items: type: string type: array deliveryMode: type: string isManual: type: boolean orderId: type: string status: type: string type: object handlers.SwaggerConfirmWrap: properties: data: $ref: '#/definitions/handlers.SwaggerConfirmData' type: object handlers.SwaggerErrorBody: properties: error: type: string type: object handlers.SwaggerMaintenanceData: properties: maintenance: type: boolean reason: type: string type: object handlers.SwaggerMaintenanceWrap: properties: data: $ref: '#/definitions/handlers.SwaggerMaintenanceData' type: object handlers.SwaggerMessagesInner: properties: messages: items: $ref: '#/definitions/models.ChatMessage' type: array type: object handlers.SwaggerMessagesWrap: properties: data: $ref: '#/definitions/handlers.SwaggerMessagesInner' type: object handlers.SwaggerOneChatMsgWrap: properties: data: $ref: '#/definitions/handlers.SwaggerSingleChatWrap' type: object handlers.SwaggerOrdersBody: properties: data: items: $ref: '#/definitions/models.Order' type: array type: object handlers.SwaggerPaymentStatusData: properties: expectedTotal: type: number paymentExpiresAt: type: string paymentMethod: type: string status: type: string type: object handlers.SwaggerPaymentStatusWrap: properties: data: $ref: '#/definitions/handlers.SwaggerPaymentStatusData' type: object handlers.SwaggerProductListBody: properties: data: items: $ref: '#/definitions/models.Product' type: array type: object handlers.SwaggerProductOneBody: properties: data: $ref: '#/definitions/models.Product' type: object handlers.SwaggerProductViewData: properties: counted: type: boolean id: type: string viewCount: type: integer type: object handlers.SwaggerProductViewWrap: properties: data: $ref: '#/definitions/handlers.SwaggerProductViewData' type: object handlers.SwaggerSMTPWrap: properties: data: $ref: '#/definitions/storage.SMTPConfig' type: object handlers.SwaggerSingleChatWrap: properties: message: $ref: '#/definitions/models.ChatMessage' type: object handlers.SwaggerStatsData: properties: totalOrders: type: integer totalVisits: type: integer type: object handlers.SwaggerStatsWrap: properties: data: $ref: '#/definitions/handlers.SwaggerStatsData' type: object handlers.SwaggerStringOKBody: properties: data: type: string type: object handlers.SwaggerValidBody: properties: valid: type: boolean type: object handlers.SwaggerVisitData: properties: counted: type: boolean totalVisits: type: integer type: object handlers.SwaggerVisitWrap: properties: data: $ref: '#/definitions/handlers.SwaggerVisitData' type: object handlers.SwaggerWebhookMengyaResp: properties: matched: type: boolean matched_order_id: type: string ok: type: boolean type: object handlers.SwaggerWishlistItems: properties: items: items: type: string type: array type: object handlers.SwaggerWishlistWrap: properties: data: $ref: '#/definitions/handlers.SwaggerWishlistItems' type: object handlers.TogglePayload: properties: active: type: boolean type: object handlers.WishlistItemPayload: properties: productId: type: string type: object models.ChatMessage: properties: accountId: type: string accountName: type: string content: type: string fromAdmin: type: boolean id: type: string sentAt: type: string type: object models.Order: properties: contactEmail: type: string contactPhone: type: string createdAt: type: string deliveredCodes: items: type: string type: array deliveryMode: type: string id: type: string note: type: string notifyEmail: type: string paymentExpectedTotal: type: number paymentExpiresAt: type: string paymentMethod: type: string productId: type: string productName: type: string quantity: type: integer status: type: string userAccount: type: string userName: type: string type: object models.Product: properties: active: type: boolean codes: items: type: string type: array coverUrl: type: string createdAt: type: string deliveryMode: type: string description: type: string discountPrice: type: number fixedContent: type: string fulfillmentType: type: string id: type: string maxPerAccount: type: integer name: type: string paymentQrUrls: description: PaymentQrURLs 萌芽支付收款码图片链接(可多条)。 items: type: string type: array price: type: number quantity: type: integer requireLogin: type: boolean screenshotUrls: items: type: string type: array showContact: type: boolean showNote: type: boolean tags: items: type: string type: array totalSold: type: integer updatedAt: type: string verificationUrl: type: string viewCount: type: integer type: object storage.SMTPConfig: properties: email: type: string enabled: type: boolean fromName: type: string host: type: string password: type: string port: type: string type: object host: localhost:8080 info: contact: {} description: 商品、下单、站点统计、收藏与客服聊天;用户登录由萌芽账户认证中心(SproutGate)校验。监听地址以 HTTP_LISTEN_ADDR 为准。 title: 萌芽小店 API version: 1.0.0-go paths: /: get: description: 返回服务描述、主要路径指引与版本(非 OpenAPI 详尽列表,完整契约见 /swagger)。 produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object summary: API 根信息与端点索引 tags: - 元信息 /api/admin/chat: get: produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 全部会话列表 tags: - 管理端-聊天 /api/admin/chat/{account}: delete: parameters: - description: 用户账号 in: path name: account required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerBoolOKWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 清空会话 tags: - 管理端-聊天 get: parameters: - description: 用户账号 in: path name: account required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerMessagesWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 指定用户聊天记录 tags: - 管理端-聊天 post: consumes: - application/json parameters: - description: 用户账号 in: path name: account required: true type: string - description: 回复内容 in: body name: body required: true schema: $ref: '#/definitions/handlers.AdminChatPayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerOneChatMsgWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 管理员回复 tags: - 管理端-聊天 /api/admin/orders: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerOrdersBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 全部订单(管理) tags: - 管理端-订单 /api/admin/orders/{id}: delete: parameters: - description: 订单 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerBoolOKWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 删除订单 tags: - 管理端-订单 /api/admin/products: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerProductListBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 全部商品(管理) tags: - 管理端-商品 post: consumes: - application/json parameters: - description: 商品字段 in: body name: body required: true schema: $ref: '#/definitions/handlers.ProductPayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerProductOneBody' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 创建商品 tags: - 管理端-商品 /api/admin/products/{id}: delete: parameters: - description: 商品 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerBoolOKWrap' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 删除商品 tags: - 管理端-商品 put: consumes: - application/json parameters: - description: 商品 ID in: path name: id required: true type: string - description: 商品字段 in: body name: body required: true schema: $ref: '#/definitions/handlers.ProductPayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerProductOneBody' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 更新商品 tags: - 管理端-商品 /api/admin/products/{id}/status: patch: consumes: - application/json parameters: - description: 商品 ID in: path name: id required: true type: string - description: '{active}' in: body name: body required: true schema: $ref: '#/definitions/handlers.TogglePayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerProductOneBody' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 切换上架状态 tags: - 管理端-商品 /api/admin/site/maintenance: post: consumes: - application/json parameters: - description: 维护开关与原因 in: body name: body required: true schema: $ref: '#/definitions/handlers.MaintenancePayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerMaintenanceWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 设置维护模式 tags: - 管理端-站点 /api/admin/site/smtp: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerSMTPWrap' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 获取 SMTP 配置 tags: - 管理端-站点 post: consumes: - application/json parameters: - description: SMTP 字段 in: body name: body required: true schema: $ref: '#/definitions/storage.SMTPConfig' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerStringOKBody' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 保存 SMTP 配置 tags: - 管理端-站点 /api/admin/system-status: get: produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - AdminToken: [] summary: 系统运行状态 tags: - 管理端-系统 /api/admin/verify: post: consumes: - application/json description: '响应为 {"valid": true/false},不泄露真实口令。' parameters: - description: 待校验 token in: body name: body required: true schema: $ref: '#/definitions/handlers.AdminVerifyTokenRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerValidBody' summary: 校验管理员令牌 tags: - 管理端-认证 /api/chat/messages: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerMessagesWrap' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - BearerAuth: [] summary: 我的聊天消息 tags: - 聊天(用户) post: consumes: - application/json parameters: - description: 消息正文 in: body name: body required: true schema: $ref: '#/definitions/handlers.ChatMessagePayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerOneChatMsgWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "429": description: Too Many Requests schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - BearerAuth: [] summary: 发送用户消息 tags: - 聊天(用户) /api/checkout: post: consumes: - application/json parameters: - description: Bearer 用户 token(部分商品必填) in: header name: Authorization type: string - description: 结账参数 in: body name: body required: true schema: $ref: '#/definitions/handlers.CheckoutPayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerCheckoutWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "409": description: 库存锁定冲突或同用户待支付 schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 结账创建订单 tags: - 订单 /api/health: get: produces: - application/json responses: "200": description: status ok;rabbitmq 为 disabled|ok|error:... schema: additionalProperties: true type: object summary: 健康检查 tags: - 健康检查 /api/orders: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerOrdersBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - BearerAuth: [] summary: 我的订单 tags: - 订单 /api/orders/{id}/cancel: post: parameters: - description: 订单 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerCancelWrap' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "409": description: Conflict schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 取消订单 tags: - 订单 /api/orders/{id}/confirm: post: parameters: - description: 订单 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerConfirmWrap' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "409": description: 待支付未到账等 schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "410": description: 已取消或超时 schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 确认订单 tags: - 订单 /api/orders/{id}/payment-status: get: parameters: - description: 订单 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerPaymentStatusWrap' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 订单支付状态 tags: - 订单 /api/products: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerProductListBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 上架商品列表 tags: - 公开 /api/products/{id}/view: post: parameters: - description: 商品 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerProductViewWrap' "404": description: Not Found schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 记录商品浏览 tags: - 公开 /api/site/maintenance: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerMaintenanceWrap' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 维护模式状态 tags: - 公开 /api/site/visit: post: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerVisitWrap' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 记录站点访问 tags: - 公开 /api/stats: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerStatsWrap' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 站点统计 tags: - 公开 /api/webhooks/mengya-pay: post: consumes: - application/json parameters: - description: 与 WEBHOOK_MENGYA_SECRET 一致 in: header name: X-Webhook-Secret type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerWebhookMengyaResp' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "403": description: Forbidden schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' summary: 萌芽支付 Webhook tags: - Webhook /api/wishlist: get: produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerWishlistWrap' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - BearerAuth: [] summary: 收藏列表 tags: - 收藏 post: consumes: - application/json parameters: - description: 商品 ID in: body name: body required: true schema: $ref: '#/definitions/handlers.WishlistItemPayload' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerWishlistWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - BearerAuth: [] summary: 添加收藏 tags: - 收藏 /api/wishlist/{id}: delete: parameters: - description: 商品 ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/handlers.SwaggerWishlistWrap' "400": description: Bad Request schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.SwaggerErrorBody' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.SwaggerErrorBody' security: - BearerAuth: [] summary: 移除收藏 tags: - 收藏 schemes: - http - https securityDefinitions: AdminToken: description: 管理端令牌(也可使用 Authorization 头或 query token,见各接口说明) in: header name: X-Admin-Token type: apiKey BearerAuth: description: '用户访问令牌,格式: Bearer 空格 + token' in: header name: Authorization type: apiKey WebhookSecret: description: 与服务端 WEBHOOK_MENGYA_SECRET 一致时校验萌芽支付 Webhook in: header name: X-Webhook-Secret type: apiKey swagger: "2.0"