Documentation ¶
Index ¶
- Constants
- func NewCouponResourceAllocator(ctx context.Context) business.IResourceAllocator
- func NewIMoneyResourceAllocator(ctx context.Context) business.IResourceAllocator
- func NewProductResourceAllocator(ctx context.Context) business.IResourceAllocator
- type AllocateResourceService
- type CouponResource
- func (this *CouponResource) CanSplit() bool
- func (this *CouponResource) GetCoupon() *b_coupon.Coupon
- func (this *CouponResource) GetDeductionMoney(deductableMoney int) int
- func (this *CouponResource) GetLockName() string
- func (this *CouponResource) GetPostage() int
- func (this *CouponResource) GetPrice() int
- func (this *CouponResource) GetRawResourceObject() interface{}
- func (this *CouponResource) GetType() string
- func (this *CouponResource) IsAllocated() bool
- func (this *CouponResource) IsNeedLockWhenConsume() bool
- func (this *CouponResource) IsValid() error
- func (this *CouponResource) ResetAllocation()
- func (this *CouponResource) SaveForOrder(order business.IOrder) error
- func (this *CouponResource) SetAllocated()
- func (this *CouponResource) ToMap() map[string]interface{}
- type CouponResourceAllocator
- type CouponUsage
- type GroupResourceService
- type IMoneyResource
- func (this *IMoneyResource) AddFrozenRecord(frozenRecordId int)
- func (this *IMoneyResource) CanSplit() bool
- func (this *IMoneyResource) GetDeductionMoney(deductableMoney int) int
- func (this *IMoneyResource) GetLockName() string
- func (this *IMoneyResource) GetPostage() int
- func (this *IMoneyResource) GetPrice() int
- func (this *IMoneyResource) GetRawResourceObject() interface{}
- func (this *IMoneyResource) GetType() string
- func (this *IMoneyResource) IsNeedLockWhenConsume() bool
- func (this *IMoneyResource) IsValid() error
- func (this *IMoneyResource) ToMap() map[string]interface{}
- type IMoneyResourceAllocator
- type MergeSameSkuProductService
- type ParseResourceService
- type ProductResource
- func (this *ProductResource) CanSplit() bool
- func (this *ProductResource) GetDeductionMoney(deductableMoney int) int
- func (this *ProductResource) GetLockName() string
- func (this *ProductResource) GetPoolProduct() *product.PoolProduct
- func (this *ProductResource) GetPostage() int
- func (this *ProductResource) GetPrice() int
- func (this *ProductResource) GetRawResourceObject() interface{}
- func (this *ProductResource) GetType() string
- func (this *ProductResource) IsAllocated() bool
- func (this *ProductResource) IsNeedLockWhenConsume() bool
- func (this *ProductResource) IsValid() error
- func (this *ProductResource) ResetAllocation()
- func (this *ProductResource) SaveForOrder(order business.IOrder) error
- func (this *ProductResource) SetAllocated()
- func (this *ProductResource) SetPoolProduct(poolProduct *product.PoolProduct)
- func (this *ProductResource) ToMap() map[string]interface{}
- type ProductResourceAllocator
- type Resource
- func (this *Resource) CanSplit() bool
- func (this *Resource) GetDeductionMoney() float64
- func (this *Resource) GetLockName() string
- func (this *Resource) GetPostage() float64
- func (this *Resource) GetPrice() float64
- func (this *Resource) GetType() string
- func (this *Resource) IsAllocated() bool
- func (this *Resource) IsNeedLockWhenConsume() bool
- func (this *Resource) IsValid() error
- func (this *Resource) ResetAllocation()
- func (this *Resource) SaveForOrder(order business.IOrder) error
- func (this *Resource) SetAllocated()
- func (this *Resource) ToMap() map[string]interface{}
- type ResourceGroup
- type ResourceManager
- func (this *ResourceManager) AddResource(resource business.IResource)
- func (this *ResourceManager) AddResources(resources []business.IResource)
- func (this *ResourceManager) AllocateForOrder(newOrder business.IOrder) error
- func (this *ResourceManager) GetNonProductResources() []business.IResource
- func (this *ResourceManager) GetProductResources() []business.IResource
- func (this *ResourceManager) GroupResourceBySupplier() []*ResourceGroup
- func (this *ResourceManager) Lock() error
- func (this *ResourceManager) ReleaseAllocatedResources()
- func (this *ResourceManager) Unlock() error
- func (this *ResourceManager) Validate() error
- type SkuMergedProduct
Constants ¶
View Source
const RESOURCE_TYPE_COUPON = "coupon"
View Source
const RESOURCE_TYPE_IMONEY = "imoney"
View Source
const RESOURCE_TYPE_PRODUCT = "product"
View Source
const RESOURCE_TYPE_SKU_MERGED_PRODUCT = "sku_merged_product"
Variables ¶
This section is empty.
Functions ¶
func NewCouponResourceAllocator ¶
func NewCouponResourceAllocator(ctx context.Context) business.IResourceAllocator
func NewIMoneyResourceAllocator ¶
func NewIMoneyResourceAllocator(ctx context.Context) business.IResourceAllocator
func NewProductResourceAllocator ¶
func NewProductResourceAllocator(ctx context.Context) business.IResourceAllocator
Types ¶
type AllocateResourceService ¶
type AllocateResourceService struct { eel.ServiceBase // contains filtered or unexported fields }
func NewAllocateResourceService ¶
func NewAllocateResourceService(ctx context.Context) *AllocateResourceService
func (*AllocateResourceService) Release ¶
func (this *AllocateResourceService) Release(resources []business.IResource)
type CouponResource ¶
type CouponResource struct { eel.EntityBase Resource Code string // contains filtered or unexported fields }
func NewCouponResource ¶
func NewCouponResource(ctx context.Context) *CouponResource
func (*CouponResource) CanSplit ¶
func (this *CouponResource) CanSplit() bool
func (*CouponResource) GetCoupon ¶
func (this *CouponResource) GetCoupon() *b_coupon.Coupon
func (*CouponResource) GetDeductionMoney ¶
func (this *CouponResource) GetDeductionMoney(deductableMoney int) int
func (*CouponResource) GetLockName ¶
func (this *CouponResource) GetLockName() string
func (*CouponResource) GetPostage ¶
func (this *CouponResource) GetPostage() int
func (*CouponResource) GetPrice ¶
func (this *CouponResource) GetPrice() int
func (*CouponResource) GetRawResourceObject ¶
func (this *CouponResource) GetRawResourceObject() interface{}
func (*CouponResource) GetType ¶
func (this *CouponResource) GetType() string
func (*CouponResource) IsAllocated ¶
func (this *CouponResource) IsAllocated() bool
func (*CouponResource) IsNeedLockWhenConsume ¶
func (this *CouponResource) IsNeedLockWhenConsume() bool
func (*CouponResource) IsValid ¶
func (this *CouponResource) IsValid() error
func (*CouponResource) ResetAllocation ¶
func (this *CouponResource) ResetAllocation()
func (*CouponResource) SaveForOrder ¶
func (this *CouponResource) SaveForOrder(order business.IOrder) error
func (*CouponResource) SetAllocated ¶
func (this *CouponResource) SetAllocated()
func (*CouponResource) ToMap ¶
func (this *CouponResource) ToMap() map[string]interface{}
type CouponResourceAllocator ¶
type CouponResourceAllocator struct {
eel.ServiceBase
}
func (*CouponResourceAllocator) Allocate ¶
func (this *CouponResourceAllocator) Allocate(resource business.IResource, newOrder business.IOrder) error
Allocate 申请优惠券资源,使用优惠券
func (*CouponResourceAllocator) Release ¶
func (this *CouponResourceAllocator) Release(resource business.IResource)
Release 释放冻结的资产
type CouponUsage ¶
type GroupResourceService ¶
type GroupResourceService struct {
eel.ServiceBase
}
func NewGroupResourceService ¶
func NewGroupResourceService(ctx context.Context) *GroupResourceService
func (*GroupResourceService) Group ¶
func (this *GroupResourceService) Group(resources []business.IResource) map[int]*ResourceGroup
type IMoneyResource ¶
type IMoneyResource struct { eel.EntityBase Resource Code string Count int SourceUserId int DestUserId int FrozenRecordIds []int }
func NewIMoneyResource ¶
func NewIMoneyResource(ctx context.Context) *IMoneyResource
func (*IMoneyResource) AddFrozenRecord ¶
func (this *IMoneyResource) AddFrozenRecord(frozenRecordId int)
func (*IMoneyResource) CanSplit ¶
func (this *IMoneyResource) CanSplit() bool
func (*IMoneyResource) GetDeductionMoney ¶
func (this *IMoneyResource) GetDeductionMoney(deductableMoney int) int
func (*IMoneyResource) GetLockName ¶
func (this *IMoneyResource) GetLockName() string
func (*IMoneyResource) GetPostage ¶
func (this *IMoneyResource) GetPostage() int
func (*IMoneyResource) GetPrice ¶
func (this *IMoneyResource) GetPrice() int
func (*IMoneyResource) GetRawResourceObject ¶
func (this *IMoneyResource) GetRawResourceObject() interface{}
func (*IMoneyResource) GetType ¶
func (this *IMoneyResource) GetType() string
func (*IMoneyResource) IsNeedLockWhenConsume ¶
func (this *IMoneyResource) IsNeedLockWhenConsume() bool
func (*IMoneyResource) IsValid ¶
func (this *IMoneyResource) IsValid() error
func (*IMoneyResource) ToMap ¶
func (this *IMoneyResource) ToMap() map[string]interface{}
type IMoneyResourceAllocator ¶
type IMoneyResourceAllocator struct {
eel.ServiceBase
}
func (*IMoneyResourceAllocator) Allocate ¶
func (this *IMoneyResourceAllocator) Allocate(resource business.IResource, newOrder business.IOrder) error
Allocate 申请商品资源,减少库存
func (*IMoneyResourceAllocator) Release ¶
func (this *IMoneyResourceAllocator) Release(resource business.IResource)
Release 释放冻结的资产
type MergeSameSkuProductService ¶
type MergeSameSkuProductService struct {
eel.ServiceBase
}
func NewMergeSameSkuProductService ¶
func NewMergeSameSkuProductService(ctx context.Context) *MergeSameSkuProductService
func (*MergeSameSkuProductService) Merge ¶
func (this *MergeSameSkuProductService) Merge(resources []business.IResource) []*SkuMergedProduct
type ParseResourceService ¶
type ParseResourceService struct {
eel.ServiceBase
}
func NewParseResourceService ¶
func NewParseResourceService(ctx context.Context) *ParseResourceService
func (*ParseResourceService) Parse ¶
func (this *ParseResourceService) Parse(salesmanId int, productsArray []interface{}, imoneysArray []interface{}, couponUsage *CouponUsage) []business.IResource
func (*ParseResourceService) ParseFromOrderResources ¶
func (this *ParseResourceService) ParseFromOrderResources(resourcesData []map[string]interface{}) []business.IResource
从订单数据中反序列化资源 todo
type ProductResource ¶
type ProductResource struct { eel.EntityBase Resource PoolProductId int Sku string Count int SalesmanId int Price int // contains filtered or unexported fields }
func NewProductResource ¶
func NewProductResource(ctx context.Context) *ProductResource
func (*ProductResource) CanSplit ¶
func (this *ProductResource) CanSplit() bool
func (*ProductResource) GetDeductionMoney ¶
func (this *ProductResource) GetDeductionMoney(deductableMoney int) int
func (*ProductResource) GetLockName ¶
func (this *ProductResource) GetLockName() string
func (*ProductResource) GetPoolProduct ¶
func (this *ProductResource) GetPoolProduct() *product.PoolProduct
func (*ProductResource) GetPostage ¶
func (this *ProductResource) GetPostage() int
func (*ProductResource) GetPrice ¶
func (this *ProductResource) GetPrice() int
func (*ProductResource) GetRawResourceObject ¶
func (this *ProductResource) GetRawResourceObject() interface{}
func (*ProductResource) GetType ¶
func (this *ProductResource) GetType() string
func (*ProductResource) IsAllocated ¶
func (this *ProductResource) IsAllocated() bool
func (*ProductResource) IsNeedLockWhenConsume ¶
func (this *ProductResource) IsNeedLockWhenConsume() bool
func (*ProductResource) IsValid ¶
func (this *ProductResource) IsValid() error
func (*ProductResource) ResetAllocation ¶
func (this *ProductResource) ResetAllocation()
func (*ProductResource) SaveForOrder ¶
func (this *ProductResource) SaveForOrder(order business.IOrder) error
func (*ProductResource) SetAllocated ¶
func (this *ProductResource) SetAllocated()
func (*ProductResource) SetPoolProduct ¶
func (this *ProductResource) SetPoolProduct(poolProduct *product.PoolProduct)
func (*ProductResource) ToMap ¶
func (this *ProductResource) ToMap() map[string]interface{}
type ProductResourceAllocator ¶
type ProductResourceAllocator struct {
eel.ServiceBase
}
func (*ProductResourceAllocator) Allocate ¶
func (this *ProductResourceAllocator) Allocate(resource business.IResource, newOrder business.IOrder) error
Allocate 申请商品资源,减少库存
func (*ProductResourceAllocator) Release ¶
func (this *ProductResourceAllocator) Release(resource business.IResource)
Release 释放商品资源,恢复库存
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) GetDeductionMoney ¶
func (*Resource) GetLockName ¶
func (*Resource) GetPostage ¶
func (*Resource) IsAllocated ¶
func (*Resource) IsNeedLockWhenConsume ¶
func (*Resource) ResetAllocation ¶
func (this *Resource) ResetAllocation()
func (*Resource) SetAllocated ¶
func (this *Resource) SetAllocated()
type ResourceGroup ¶
type ResourceGroup struct { eel.EntityBase SupplierId int Resources []business.IResource // contains filtered or unexported fields }
func (*ResourceGroup) AddResource ¶
func (this *ResourceGroup) AddResource(resource business.IResource)
func (*ResourceGroup) GetImoneyResources ¶
func (this *ResourceGroup) GetImoneyResources() []business.IResource
func (*ResourceGroup) GetProductResources ¶
func (this *ResourceGroup) GetProductResources() []business.IResource
type ResourceManager ¶
type ResourceManager struct { eel.ServiceBase Resources []business.IResource // contains filtered or unexported fields }
func NewResourceManager ¶
func NewResourceManager(ctx context.Context) *ResourceManager
func (*ResourceManager) AddResource ¶
func (this *ResourceManager) AddResource(resource business.IResource)
func (*ResourceManager) AddResources ¶
func (this *ResourceManager) AddResources(resources []business.IResource)
func (*ResourceManager) AllocateForOrder ¶
func (this *ResourceManager) AllocateForOrder(newOrder business.IOrder) error
Allocate 申请订单中涉及的资源
func (*ResourceManager) GetNonProductResources ¶
func (this *ResourceManager) GetNonProductResources() []business.IResource
func (*ResourceManager) GetProductResources ¶
func (this *ResourceManager) GetProductResources() []business.IResource
func (*ResourceManager) GroupResourceBySupplier ¶
func (this *ResourceManager) GroupResourceBySupplier() []*ResourceGroup
func (*ResourceManager) Lock ¶
func (this *ResourceManager) Lock() error
func (*ResourceManager) ReleaseAllocatedResources ¶
func (this *ResourceManager) ReleaseAllocatedResources()
ReleaseAllocatedResources 释放订单中涉及的资源
func (*ResourceManager) Unlock ¶
func (this *ResourceManager) Unlock() error
func (*ResourceManager) Validate ¶
func (this *ResourceManager) Validate() error
type SkuMergedProduct ¶
type SkuMergedProduct struct { eel.EntityBase TotalCount int TotalWeight float64 TotalPrice float64 PoolProduct *product.PoolProduct }
Source Files ¶
- allocate_resource_service.go
- coupon_resource.go
- coupon_resource_allocator.go
- group_resource_service.go
- imoney_resource.go
- imoney_resource_allocator.go
- init.go
- merge_same_sku_product_service.go
- parse_resource_service.go
- product_resource.go
- product_resource_allocator.go
- resource.go
- resource_group.go
- resource_manager.go
- sku_merged_product.go
Click to show internal directories.
Click to hide internal directories.