作者 陈志颖

feat:增加退货领域服务

@@ -29,3 +29,11 @@ func CreateCancelOrderService(options map[string]interface{}) (service.CancelOrd @@ -29,3 +29,11 @@ func CreateCancelOrderService(options map[string]interface{}) (service.CancelOrd
29 } 29 }
30 return domainService.NewCancelOrderService(transactionContext) 30 return domainService.NewCancelOrderService(transactionContext)
31 } 31 }
  32 +
  33 +func CreateReturnGoodsService(options map[string]interface{}) (service.ReturnGoodsService, error) {
  34 + var transactionContext *pgTransaction.TransactionContext
  35 + if value, ok := options["transactionContext"]; ok {
  36 + transactionContext = value.(*pgTransaction.TransactionContext)
  37 + }
  38 + return domainService.NewReturnGoodsService(transactionContext)
  39 +}
  1 +package service
  2 +
  3 +import (
  4 + coreDomain "github.com/linmadan/egglib-go/core/domain"
  5 + "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain"
  6 +)
  7 +
  8 +type ReturnGoodsService interface {
  9 + coreDomain.DomainEventPublisher
  10 + Return(orderId int64) (*domain.Order, error)
  11 +}
  1 +package domainService
  2 +
  3 +import (
  4 + "fmt"
  5 + coreDomain "github.com/linmadan/egglib-go/core/domain"
  6 + "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain"
  7 +
  8 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  9 +)
  10 +
  11 +type ReturnGoodsService struct {
  12 + coreDomain.BaseEventPublisher
  13 + transactionContext *pgTransaction.TransactionContext
  14 +}
  15 +
  16 +func (service *ReceivingGoodsService) Return(orderId int64) (*domain.Order, error) {
  17 + return nil, nil
  18 +}
  19 +
  20 +func NewReturnGoodsService(transactionContext *pgTransaction.TransactionContext) (*ReturnGoodsService, error) {
  21 + if transactionContext == nil {
  22 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  23 + } else {
  24 + return &ReturnGoodsService{
  25 + transactionContext: transactionContext,
  26 + }, nil
  27 + }
  28 +}