Initial commit: 商品售卖网站
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package schemas
|
||||
|
||||
type CreateAddressRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Phone string `json:"phone" binding:"required"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
District string `json:"district"`
|
||||
Address string `json:"address" binding:"required"`
|
||||
IsDefault bool `json:"is_default"`
|
||||
}
|
||||
|
||||
type UpdateAddressRequest struct {
|
||||
Name *string `json:"name"`
|
||||
Phone *string `json:"phone"`
|
||||
Province *string `json:"province"`
|
||||
City *string `json:"city"`
|
||||
District *string `json:"district"`
|
||||
Address *string `json:"address"`
|
||||
IsDefault *bool `json:"is_default"`
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package schemas
|
||||
|
||||
type CreateArticleRequest struct {
|
||||
Title string `json:"title" binding:"required"`
|
||||
Content string `json:"content" binding:"required"`
|
||||
Summary string `json:"summary"`
|
||||
CoverImage string `json:"cover_image"`
|
||||
IsPinned bool `json:"is_pinned"`
|
||||
IsPublished bool `json:"is_published"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
}
|
||||
|
||||
type UpdateArticleRequest struct {
|
||||
Title *string `json:"title"`
|
||||
Content *string `json:"content"`
|
||||
Summary *string `json:"summary"`
|
||||
CoverImage *string `json:"cover_image"`
|
||||
IsPinned *bool `json:"is_pinned"`
|
||||
IsPublished *bool `json:"is_published"`
|
||||
SortOrder *int `json:"sort_order"`
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package schemas
|
||||
|
||||
type RegisterRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Username string `json:"username" binding:"required,min=2,max=50"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
InviteCode string `json:"invite_code"`
|
||||
}
|
||||
|
||||
type LoginRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
|
||||
type ForgotPasswordRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
}
|
||||
|
||||
type ResetPasswordRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Code string `json:"code" binding:"required"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
type VerifyEmailRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Code string `json:"code" binding:"required"`
|
||||
}
|
||||
|
||||
type ChangePasswordRequest struct {
|
||||
OldPassword string `json:"old_password" binding:"required"`
|
||||
NewPassword string `json:"new_password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
type AuthResponse struct {
|
||||
Token string `json:"token"`
|
||||
User UserResponse `json:"user"`
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Role string `json:"role"`
|
||||
PurchaseCredits int `json:"purchase_credits"`
|
||||
InviteCode string `json:"invite_code"`
|
||||
EmailVerified bool `json:"email_verified"`
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
Username string `json:"username" binding:"required,min=2,max=50"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package schemas
|
||||
|
||||
type CreateLotteryRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
StartTime string `json:"start_time" binding:"required"`
|
||||
EndTime string `json:"end_time" binding:"required"`
|
||||
Cycle string `json:"cycle"`
|
||||
DailyQuota *int `json:"daily_quota"`
|
||||
TotalQuota *int `json:"total_quota"`
|
||||
RegistrationValidity *int `json:"registration_validity"`
|
||||
}
|
||||
|
||||
type UpdateLotteryRequest struct {
|
||||
Name *string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
StartTime *string `json:"start_time"`
|
||||
EndTime *string `json:"end_time"`
|
||||
Cycle *string `json:"cycle"`
|
||||
DailyQuota *int `json:"daily_quota"`
|
||||
TotalQuota *int `json:"total_quota"`
|
||||
RegistrationValidity *int `json:"registration_validity"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
}
|
||||
|
||||
type AddLotteryPrizeRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Type string `json:"type" binding:"required,oneof=physical virtual credit"`
|
||||
Quantity int `json:"quantity" binding:"required,min=1"`
|
||||
Weight int `json:"weight"`
|
||||
CreditReward *int `json:"credit_reward"`
|
||||
DrawMode string `json:"draw_mode"`
|
||||
}
|
||||
|
||||
type RegisterLotteryRequest struct {
|
||||
LotteryID uint `json:"lottery_id" binding:"required"`
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package schemas
|
||||
|
||||
type AddToCartRequest struct {
|
||||
ProductID uint `json:"product_id" binding:"required"`
|
||||
Quantity int `json:"quantity" binding:"required,min=1"`
|
||||
}
|
||||
|
||||
type UpdateCartRequest struct {
|
||||
Quantity int `json:"quantity" binding:"required,min=1"`
|
||||
}
|
||||
|
||||
type CreateOrderRequest struct {
|
||||
ShippingAddressID uint `json:"shipping_address_id" binding:"required"`
|
||||
PaymentMethod string `json:"payment_method"`
|
||||
}
|
||||
|
||||
type RefundRequest struct {
|
||||
Reason string `json:"reason" binding:"required"`
|
||||
}
|
||||
|
||||
type ShipOrderRequest struct {
|
||||
TrackingNumber string `json:"tracking_number" binding:"required"`
|
||||
ShippingPhoto string `json:"shipping_photo"`
|
||||
ExpressPhoto string `json:"express_photo"`
|
||||
CustomsPhoto string `json:"customs_photo"`
|
||||
}
|
||||
|
||||
type ProcessRefundRequest struct {
|
||||
Status string `json:"status" binding:"required,oneof=approved rejected"`
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package schemas
|
||||
|
||||
type CreateCategoryRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
ParentID *uint `json:"parent_id"`
|
||||
MinAmount *float64 `json:"min_amount"`
|
||||
MaxAmount *float64 `json:"max_amount"`
|
||||
MinQuantity *int `json:"min_quantity"`
|
||||
MaxQuantity *int `json:"max_quantity"`
|
||||
MinWeight *float64 `json:"min_weight"`
|
||||
MaxWeight *float64 `json:"max_weight"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
}
|
||||
|
||||
type UpdateCategoryRequest struct {
|
||||
Name *string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
ParentID *uint `json:"parent_id"`
|
||||
MinAmount *float64 `json:"min_amount"`
|
||||
MaxAmount *float64 `json:"max_amount"`
|
||||
MinQuantity *int `json:"min_quantity"`
|
||||
MaxQuantity *int `json:"max_quantity"`
|
||||
MinWeight *float64 `json:"min_weight"`
|
||||
MaxWeight *float64 `json:"max_weight"`
|
||||
SortOrder *int `json:"sort_order"`
|
||||
}
|
||||
|
||||
type CreateProductRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
Price float64 `json:"price" binding:"required"`
|
||||
MinPurchase int `json:"min_purchase"`
|
||||
MaxPurchase *int `json:"max_purchase"`
|
||||
MinWeight *float64 `json:"min_weight"`
|
||||
MaxWeight *float64 `json:"max_weight"`
|
||||
MinAmount *float64 `json:"min_amount"`
|
||||
MaxAmount *float64 `json:"max_amount"`
|
||||
RequireCredit bool `json:"require_credit"`
|
||||
CreditCost int `json:"credit_cost"`
|
||||
CreditReward int `json:"credit_reward"`
|
||||
Images string `json:"images"`
|
||||
BrandID *uint `json:"brand_id"`
|
||||
CategoryIDs []uint `json:"category_ids"`
|
||||
CustomFields []CustomFieldRequest `json:"custom_fields"`
|
||||
}
|
||||
|
||||
type UpdateProductRequest struct {
|
||||
Name *string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
Price *float64 `json:"price"`
|
||||
MinPurchase *int `json:"min_purchase"`
|
||||
MaxPurchase *int `json:"max_purchase"`
|
||||
MinWeight *float64 `json:"min_weight"`
|
||||
MaxWeight *float64 `json:"max_weight"`
|
||||
MinAmount *float64 `json:"min_amount"`
|
||||
MaxAmount *float64 `json:"max_amount"`
|
||||
RequireCredit *bool `json:"require_credit"`
|
||||
CreditCost *int `json:"credit_cost"`
|
||||
CreditReward *int `json:"credit_reward"`
|
||||
Images *string `json:"images"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
BrandID *uint `json:"brand_id"`
|
||||
CategoryIDs []uint `json:"category_ids"`
|
||||
CustomFields []CustomFieldRequest `json:"custom_fields"`
|
||||
}
|
||||
|
||||
type CustomFieldRequest struct {
|
||||
FieldName string `json:"field_name" binding:"required"`
|
||||
FieldValue string `json:"field_value"`
|
||||
}
|
||||
|
||||
type PaginationRequest struct {
|
||||
Page int `form:"page,default=1"`
|
||||
PageSize int `form:"page_size,default=20"`
|
||||
}
|
||||
|
||||
type ProductListRequest struct {
|
||||
PaginationRequest
|
||||
CategoryID *uint `form:"category_id"`
|
||||
BrandID *uint `form:"brand_id"`
|
||||
Keyword string `form:"keyword"`
|
||||
MinPrice *float64 `form:"min_price"`
|
||||
MaxPrice *float64 `form:"max_price"`
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package schemas
|
||||
|
||||
type UpdateSettingsRequest struct {
|
||||
Settings map[string]string `json:"settings" binding:"required"`
|
||||
}
|
||||
|
||||
type AuthorizeSupplierRequest struct {
|
||||
Type string `json:"type" binding:"required,oneof=category product"`
|
||||
RefID uint `json:"ref_id" binding:"required"`
|
||||
}
|
||||
|
||||
type AddSupplierRequest struct {
|
||||
Username string `json:"username" binding:"required"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
type UpdateInventoryRequest struct {
|
||||
Quantity int `json:"quantity" binding:"required,min=0"`
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package schemas
|
||||
|
||||
type CreateTicketRequest struct {
|
||||
Title string `json:"title" binding:"required"`
|
||||
Content string `json:"content" binding:"required"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
|
||||
type UpdateTicketRequest struct {
|
||||
Status *string `json:"status"`
|
||||
AssignedTo *uint `json:"assigned_to"`
|
||||
Reply *string `json:"reply"`
|
||||
}
|
||||
Reference in New Issue
Block a user