作者 陈志颖

feat:增加退货领域服务

... ... @@ -29,3 +29,11 @@ func CreateCancelOrderService(options map[string]interface{}) (service.CancelOrd
}
return domainService.NewCancelOrderService(transactionContext)
}
func CreateReturnGoodsService(options map[string]interface{}) (service.ReturnGoodsService, error) {
var transactionContext *pgTransaction.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pgTransaction.TransactionContext)
}
return domainService.NewReturnGoodsService(transactionContext)
}
... ...
package service
import (
coreDomain "github.com/linmadan/egglib-go/core/domain"
"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain"
)
type ReturnGoodsService interface {
coreDomain.DomainEventPublisher
Return(orderId int64) (*domain.Order, error)
}
... ...
package domainService
import (
"fmt"
coreDomain "github.com/linmadan/egglib-go/core/domain"
"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type ReturnGoodsService struct {
coreDomain.BaseEventPublisher
transactionContext *pgTransaction.TransactionContext
}
func (service *ReceivingGoodsService) Return(orderId int64) (*domain.Order, error) {
return nil, nil
}
func NewReturnGoodsService(transactionContext *pgTransaction.TransactionContext) (*ReturnGoodsService, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &ReturnGoodsService{
transactionContext: transactionContext,
}, nil
}
}
... ...