新功能(#79): 实现促销管理接口并支持数量配价

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-05-27 00:54:32 -07:00
parent 5ebfe0a981
commit e27b2320b4
28 changed files with 1462 additions and 1 deletions
+115
View File
@@ -316,6 +316,45 @@ type ContactRequest struct {
Notes string `json:"notes" validate:"max=2000"`
}
type PromoPrice struct {
Id int64 `json:"id"`
SubscribeId int64 `json:"subscribe_id"`
PromoRuleId int64 `json:"promo_rule_id"`
Quantity int64 `json:"quantity"`
PromoPrice int64 `json:"promo_price"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type PromoPriceItem struct {
SubscribeId int64 `json:"subscribe_id" validate:"required,gt=0"`
Quantity int64 `json:"quantity" validate:"required,gt=0,lte=1000"`
PromoPrice int64 `json:"promo_price" validate:"required,gt=0"`
}
type PromoRule struct {
Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Params map[string]interface{} `json:"params"`
Priority int64 `json:"priority"`
Enabled bool `json:"enabled"`
StartTime *int64 `json:"start_time"`
EndTime *int64 `json:"end_time"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type PromoUsage struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
PromoRuleId int64 `json:"promo_rule_id"`
SubscribeId int64 `json:"subscribe_id"`
OrderNo string `json:"order_no"`
PromoPrice int64 `json:"promo_price"`
CreatedAt int64 `json:"created_at"`
}
type Coupon struct {
Id int64 `json:"id"`
Name string `json:"name"`
@@ -375,6 +414,16 @@ type CreateCouponRequest struct {
Enable *bool `json:"enable,omitempty"`
}
type CreatePromoRuleRequest struct {
Name string `json:"name" validate:"required,max=100"`
Type string `json:"type" validate:"required,oneof=new_user inactive_user campaign"`
Params map[string]interface{} `json:"params"`
Priority int64 `json:"priority" validate:"gte=0"`
Enabled *bool `json:"enabled"`
StartTime *int64 `json:"start_time"`
EndTime *int64 `json:"end_time"`
}
type CreateDocumentRequest struct {
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
@@ -1107,6 +1156,48 @@ type GetCouponListResponse struct {
List []Coupon `json:"list"`
}
type GetPromoPriceListRequest struct {
PromoRuleId int64 `form:"promo_rule_id" validate:"required,gt=0"`
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
}
type GetPromoPriceListResponse struct {
Total int64 `json:"total"`
List []PromoPrice `json:"list"`
}
type GetPromoRuleDetailRequest struct {
Id int64 `uri:"id" validate:"required,gt=0"`
}
type GetPromoRuleListRequest struct {
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
Type string `form:"type" validate:"omitempty,oneof=new_user inactive_user campaign"`
Enabled *bool `form:"enabled"`
Search string `form:"search,omitempty"`
}
type GetPromoRuleListResponse struct {
Total int64 `json:"total"`
List []PromoRule `json:"list"`
}
type GetPromoUsageListRequest struct {
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
RuleId int64 `form:"rule_id,omitempty"`
UserId int64 `form:"user_id,omitempty"`
SubscribeId int64 `form:"subscribe_id,omitempty"`
OrderNo string `form:"order_no,omitempty"`
}
type GetPromoUsageListResponse struct {
Total int64 `json:"total"`
List []PromoUsage `json:"list"`
}
type GetDetailRequest struct {
Id int64 `form:"id" validate:"required"`
}
@@ -3128,6 +3219,30 @@ type UpdateCouponRequest struct {
Enable *bool `json:"enable,omitempty"`
}
type SetPromoPriceRequest struct {
PromoRuleId int64 `json:"promo_rule_id" validate:"required,gt=0"`
Items []PromoPriceItem `json:"items" validate:"required,dive"`
}
type DeletePromoPriceRequest struct {
Id int64 `uri:"id" validate:"required,gt=0"`
}
type DeletePromoRuleRequest struct {
Id int64 `uri:"id" validate:"required,gt=0"`
}
type UpdatePromoRuleRequest struct {
Id int64 `uri:"id" validate:"required,gt=0"`
Name string `json:"name" validate:"required,max=100"`
Type string `json:"type" validate:"required,oneof=new_user inactive_user campaign"`
Params map[string]interface{} `json:"params"`
Priority int64 `json:"priority" validate:"gte=0"`
Enabled *bool `json:"enabled"`
StartTime *int64 `json:"start_time"`
EndTime *int64 `json:"end_time"`
}
type UpdateDocumentRequest struct {
Id int64 `json:"id" validate:"required"`
Title string `json:"title" validate:"required"`