Dockerfile
This commit is contained in:
108
service/sync/default.go
Normal file
108
service/sync/default.go
Normal file
@@ -0,0 +1,108 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
consts "assets/consts/public"
|
||||
"assets/model/entity/sync"
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// BasePlatformService 平台服务基类
|
||||
type BasePlatformService struct {
|
||||
Platform consts.SyncPlatform
|
||||
Config *entity.ChannelConfig
|
||||
}
|
||||
|
||||
// NewBasePlatformService 创建基础平台服务
|
||||
func NewBasePlatformService(platform consts.SyncPlatform, config *entity.ChannelConfig) *BasePlatformService {
|
||||
return &BasePlatformService{
|
||||
Platform: platform,
|
||||
Config: config,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultAssetService 默认资产平台服务(用于未明确定义的平台)
|
||||
type DefaultAssetService struct {
|
||||
*BasePlatformService
|
||||
}
|
||||
|
||||
// NewDefaultAssetService 创建默认资产服务
|
||||
func NewDefaultAssetService(platform consts.SyncPlatform, config *entity.ChannelConfig) *DefaultAssetService {
|
||||
return &DefaultAssetService{
|
||||
BasePlatformService: NewBasePlatformService(platform, config),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DefaultAssetService) SyncAsset(ctx context.Context, assetID *bson.ObjectID) error {
|
||||
// 默认实现,不执行实际同步
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultAssetService) GetAsset(ctx context.Context, assetID *bson.ObjectID) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *DefaultAssetService) UpdateAsset(ctx context.Context, assetID *bson.ObjectID, data interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultAssetService) DeleteAsset(ctx context.Context, assetID *bson.ObjectID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DefaultAssetSkuService 默认资产SKU平台服务
|
||||
type DefaultAssetSkuService struct {
|
||||
*BasePlatformService
|
||||
}
|
||||
|
||||
// NewDefaultAssetSkuService 创建默认资产SKU服务
|
||||
func NewDefaultAssetSkuService(platform consts.SyncPlatform, config *entity.ChannelConfig) *DefaultAssetSkuService {
|
||||
return &DefaultAssetSkuService{
|
||||
BasePlatformService: NewBasePlatformService(platform, config),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DefaultAssetSkuService) SyncAssetSku(ctx context.Context, assetSkuID *bson.ObjectID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultAssetSkuService) GetAssetSku(ctx context.Context, assetSkuID *bson.ObjectID) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *DefaultAssetSkuService) UpdateAssetSku(ctx context.Context, assetSkuID *bson.ObjectID, data interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultAssetSkuService) DeleteAssetSku(ctx context.Context, assetSkuID *bson.ObjectID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DefaultStockService 默认库存平台服务
|
||||
type DefaultStockService struct {
|
||||
*BasePlatformService
|
||||
}
|
||||
|
||||
// NewDefaultStockService 创建默认库存服务
|
||||
func NewDefaultStockService(platform consts.SyncPlatform, config *entity.ChannelConfig) *DefaultStockService {
|
||||
return &DefaultStockService{
|
||||
BasePlatformService: NewBasePlatformService(platform, config),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DefaultStockService) SyncStock(ctx context.Context, stockID *bson.ObjectID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultStockService) GetStock(ctx context.Context, stockID *bson.ObjectID) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *DefaultStockService) UpdateStock(ctx context.Context, stockID *bson.ObjectID, data interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultStockService) DeleteStock(ctx context.Context, stockID *bson.ObjectID) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user