163 lines
3.7 KiB
Go
163 lines
3.7 KiB
Go
package handlers
|
|
|
|
import (
|
|
"time"
|
|
|
|
"mengyastore-backend/internal/models"
|
|
"mengyastore-backend/internal/storage"
|
|
)
|
|
|
|
// 以下类型仅用于 swag/OpenAPI 描述,与实际 handler 返回值形状对齐。
|
|
|
|
type SwaggerErrorBody struct {
|
|
Error string `json:"error"`
|
|
}
|
|
|
|
type SwaggerValidBody struct {
|
|
Valid bool `json:"valid"`
|
|
}
|
|
|
|
type SwaggerProductListBody struct {
|
|
Data []models.Product `json:"data"`
|
|
}
|
|
|
|
type SwaggerProductOneBody struct {
|
|
Data models.Product `json:"data"`
|
|
}
|
|
|
|
type SwaggerOrdersBody struct {
|
|
Data []models.Order `json:"data"`
|
|
}
|
|
|
|
type SwaggerSMTPWrap struct {
|
|
Data storage.SMTPConfig `json:"data"`
|
|
}
|
|
|
|
type SwaggerStringOKBody struct {
|
|
Data string `json:"data"`
|
|
}
|
|
|
|
type SwaggerBoolOKWrap struct {
|
|
Data SwaggerBoolOK `json:"data"`
|
|
}
|
|
|
|
type SwaggerBoolOK struct {
|
|
OK bool `json:"ok"`
|
|
}
|
|
|
|
type SwaggerProductViewWrap struct {
|
|
Data SwaggerProductViewData `json:"data"`
|
|
}
|
|
|
|
type SwaggerProductViewData struct {
|
|
ID string `json:"id"`
|
|
ViewCount int `json:"viewCount"`
|
|
Counted bool `json:"counted"`
|
|
}
|
|
|
|
type SwaggerStatsWrap struct {
|
|
Data SwaggerStatsData `json:"data"`
|
|
}
|
|
|
|
type SwaggerStatsData struct {
|
|
TotalOrders int `json:"totalOrders"`
|
|
TotalVisits int `json:"totalVisits"`
|
|
}
|
|
|
|
type SwaggerVisitWrap struct {
|
|
Data SwaggerVisitData `json:"data"`
|
|
}
|
|
|
|
type SwaggerVisitData struct {
|
|
TotalVisits int `json:"totalVisits"`
|
|
Counted bool `json:"counted"`
|
|
}
|
|
|
|
type SwaggerMaintenanceWrap struct {
|
|
Data SwaggerMaintenanceData `json:"data"`
|
|
}
|
|
|
|
type SwaggerMaintenanceData struct {
|
|
Maintenance bool `json:"maintenance"`
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
type SwaggerCheckoutWrap struct {
|
|
Data SwaggerCheckoutData `json:"data"`
|
|
}
|
|
|
|
type SwaggerCheckoutData struct {
|
|
OrderID string `json:"orderId"`
|
|
QrCodeURL string `json:"qrCodeUrl"`
|
|
ProductID string `json:"productId"`
|
|
ProductQty int `json:"productQty"`
|
|
ViewCount int `json:"viewCount"`
|
|
Status string `json:"status"`
|
|
PaymentMethod string `json:"paymentMethod"`
|
|
PaymentExpectedTotal float64 `json:"paymentExpectedTotal,omitempty"`
|
|
PaymentQrURLs []string `json:"paymentQrUrls,omitempty"`
|
|
PaymentExpiresAt *time.Time `json:"paymentExpiresAt,omitempty"`
|
|
}
|
|
|
|
type SwaggerConfirmWrap struct {
|
|
Data SwaggerConfirmData `json:"data"`
|
|
}
|
|
|
|
type SwaggerConfirmData struct {
|
|
OrderID string `json:"orderId"`
|
|
Status string `json:"status"`
|
|
DeliveryMode string `json:"deliveryMode"`
|
|
DeliveredCodes []string `json:"deliveredCodes"`
|
|
IsManual bool `json:"isManual"`
|
|
}
|
|
|
|
type SwaggerPaymentStatusWrap struct {
|
|
Data SwaggerPaymentStatusData `json:"data"`
|
|
}
|
|
|
|
type SwaggerPaymentStatusData struct {
|
|
Status string `json:"status"`
|
|
ExpectedTotal float64 `json:"expectedTotal"`
|
|
PaymentExpiresAt *time.Time `json:"paymentExpiresAt"`
|
|
PaymentMethod string `json:"paymentMethod"`
|
|
}
|
|
|
|
type SwaggerWebhookMengyaResp struct {
|
|
OK bool `json:"ok"`
|
|
Matched bool `json:"matched"`
|
|
MatchedOrderID string `json:"matched_order_id,omitempty"`
|
|
}
|
|
|
|
type SwaggerCancelWrap struct {
|
|
Data SwaggerCancelMsg `json:"data"`
|
|
}
|
|
|
|
type SwaggerCancelMsg struct {
|
|
OK bool `json:"ok"`
|
|
Message string `json:"message,omitempty"`
|
|
}
|
|
|
|
type SwaggerWishlistWrap struct {
|
|
Data SwaggerWishlistItems `json:"data"`
|
|
}
|
|
|
|
type SwaggerWishlistItems struct {
|
|
Items []string `json:"items"`
|
|
}
|
|
|
|
type SwaggerMessagesWrap struct {
|
|
Data SwaggerMessagesInner `json:"data"`
|
|
}
|
|
|
|
type SwaggerMessagesInner struct {
|
|
Messages []models.ChatMessage `json:"messages"`
|
|
}
|
|
|
|
type SwaggerOneChatMsgWrap struct {
|
|
Data SwaggerSingleChatWrap `json:"data"`
|
|
}
|
|
|
|
type SwaggerSingleChatWrap struct {
|
|
Message models.ChatMessage `json:"message"`
|
|
}
|