代码初始化
This commit is contained in:
80
model/config/knapsack_config.go
Normal file
80
model/config/knapsack_config.go
Normal file
@@ -0,0 +1,80 @@
|
||||
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
|
||||
}
|
||||
35
model/config/market_config.go
Normal file
35
model/config/market_config.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package config
|
||||
|
||||
// MarketConfigInterface 市场配置接口
|
||||
type MarketConfigInterface interface {
|
||||
GetMarketType() string
|
||||
}
|
||||
|
||||
// PhysicalMarketConfig 实物市场配置
|
||||
type PhysicalMarketConfig struct {
|
||||
DeliveryMethod string `json:"deliveryMethod"`
|
||||
DeliveryFee int64 `json:"deliveryFee"`
|
||||
}
|
||||
|
||||
func (PhysicalMarketConfig) GetMarketType() string {
|
||||
return "physical"
|
||||
}
|
||||
|
||||
// ServiceMarketConfig 服务市场配置
|
||||
type ServiceMarketConfig struct {
|
||||
ServiceLocation string `json:"serviceLocation"`
|
||||
ServiceDuration int `json:"serviceDuration"`
|
||||
}
|
||||
|
||||
func (ServiceMarketConfig) GetMarketType() string {
|
||||
return "service"
|
||||
}
|
||||
|
||||
// VirtualMarketConfig 虚拟市场配置
|
||||
type VirtualMarketConfig struct {
|
||||
TransferMethod string `json:"transferMethod"`
|
||||
}
|
||||
|
||||
func (VirtualMarketConfig) GetMarketType() string {
|
||||
return "virtual"
|
||||
}
|
||||
Reference in New Issue
Block a user