Files
shop-user-trade/model/config/knapsack_config.go
2026-04-02 10:22:36 +08:00

81 lines
2.4 KiB
Go

package config
import "shop-user-trade/consts/knapsack"
// KnapsackAssetConfigInterface 背包资产配置接口
type KnapsackAssetConfigInterface interface {
GetType() knapsack.KnapsackAssetType
}
// PhysicalKnapsackConfig 实物资产背包配置
type PhysicalKnapsackConfig struct {
Shipping PhysicalShippingConfig `orm:"shipping" json:"shipping"`
}
// PhysicalShippingConfig 实物配送配置
type PhysicalShippingConfig struct {
DeliveryMethod string `json:"deliveryMethod"` // 配送方式
}
func (PhysicalKnapsackConfig) GetType() knapsack.KnapsackAssetType {
return knapsack.KnapsackAssetTypePhysical
}
// ServiceKnapsackConfig 服务资产背包配置
type ServiceKnapsackConfig struct {
ServiceAssetType knapsack.ServiceAssetType `json:"serviceType"`
ServiceAssetArrivalConfig ServiceAssetArrivalConfig `json:"serviceArrivalConfig"`
}
type ServiceAssetArrivalConfig struct {
Schedule ScheduleConfig `json:"schedule,omitempty"`
Booking BookingConfig `json:"booking,omitempty"`
}
type ScheduleConfig struct {
TimeSlots []TimeSlot `json:"timeSlots"`
Exceptions []ScheduleException `json:"exceptions,omitempty"`
}
type BookingConfig struct {
MinAdvance int `json:"minAdvance,omitempty"`
MinDuration int `json:"minDuration,omitempty"`
CancelWindow int `json:"cancelWindow,omitempty"`
}
type TimeSlot struct {
DayOfWeek string `json:"dayOfWeek"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
Capacity int `json:"capacity,omitempty"`
}
type ScheduleException struct {
Date string `json:"date"`
Status int `json:"status"`
Reason string `json:"reason,omitempty"`
DayOfWeek string `json:"dayOfWeek"`
}
func (ServiceKnapsackConfig) GetType() knapsack.KnapsackAssetType {
return knapsack.KnapsackAssetTypeService
}
// VirtualKnapsackConfig 虚拟资产背包配置
type VirtualKnapsackConfig struct {
VirtualAssetType knapsack.VirtualAssetType `json:"virtualType"`
CollectionPrice int64 `json:"collectionPrice,omitempty"`
ApiConfig *VirtualApiConfig `json:"apiConfig,omitempty"`
}
type VirtualApiConfig struct {
Method string `json:"method"`
RequestURL string `json:"requestUrl"`
Headers map[string]string `json:"headers,omitempty"`
AuthType string `json:"authType,omitempty"`
}
func (VirtualKnapsackConfig) GetType() knapsack.KnapsackAssetType {
return knapsack.KnapsackAssetTypeVirtual
}