From ddab078e1fdfb25af1671d29ea13c054d1a74c34 Mon Sep 17 00:00:00 2001 From: ziming Date: Wed, 21 May 2025 11:54:35 +0800 Subject: [PATCH] kg --- go.sum | 1 + internal/service/cmb.go | 21 ------------------- internal/service/{voucher.go => consumer.go} | 0 internal/service/{cmb_mock.go => mock.go} | 0 internal/service/{cmb_order.go => order.go} | 0 .../service/{cmb_product.go => product.go} | 4 ++-- internal/service/{cmb_query.go => query.go} | 4 ++-- 7 files changed, 5 insertions(+), 25 deletions(-) rename internal/service/{voucher.go => consumer.go} (100%) rename internal/service/{cmb_mock.go => mock.go} (100%) rename internal/service/{cmb_order.go => order.go} (100%) rename internal/service/{cmb_product.go => product.go} (92%) rename internal/service/{cmb_query.go => query.go} (90%) diff --git a/go.sum b/go.sum index 2a25cba..40bef10 100644 --- a/go.sum +++ b/go.sum @@ -133,6 +133,7 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= diff --git a/internal/service/cmb.go b/internal/service/cmb.go index a1f6459..42aefd4 100644 --- a/internal/service/cmb.go +++ b/internal/service/cmb.go @@ -1,18 +1,14 @@ package service import ( - "context" "fmt" - "github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/transport/http" "github.com/robfig/cron" http2 "net/http" "strconv" v1 "voucher/api/v1" "voucher/internal/biz" - "voucher/internal/biz/bo" "voucher/internal/biz/mixrepos" - "voucher/internal/biz/vo" "voucher/internal/biz/wechatrepo" "voucher/internal/conf" ) @@ -43,23 +39,6 @@ func NewCmbService( } } -func (c *CmbService) GetResponse(ctx context.Context, replyBizContent []byte) (*v1.CmbReply, error) { - - req := &bo.CmbResponseBo{ - RespCode: vo.CmbResponseStatusSuccess.GetValue(), - RespMsg: "成功", - BizContent: string(replyBizContent), - } - - reply, err := c.CmbMixRepo.GetResponse(ctx, req) - if err != nil { - log.Errorf("build cmb response fail: %v", err) - return nil, err - } - - return reply, nil -} - func (this *CmbService) NotifyRetry(ctx http.Context) error { id := ctx.Vars().Get("id") if id == "" { diff --git a/internal/service/voucher.go b/internal/service/consumer.go similarity index 100% rename from internal/service/voucher.go rename to internal/service/consumer.go diff --git a/internal/service/cmb_mock.go b/internal/service/mock.go similarity index 100% rename from internal/service/cmb_mock.go rename to internal/service/mock.go diff --git a/internal/service/cmb_order.go b/internal/service/order.go similarity index 100% rename from internal/service/cmb_order.go rename to internal/service/order.go diff --git a/internal/service/cmb_product.go b/internal/service/product.go similarity index 92% rename from internal/service/cmb_product.go rename to internal/service/product.go index 3595509..8b319bc 100644 --- a/internal/service/cmb_product.go +++ b/internal/service/product.go @@ -14,7 +14,7 @@ func (c *CmbService) QueryProductSuccess(ctx context.Context, bizReply *v1.CmbQu replyBizContent, _ := json.Marshal(bizReply) - return c.GetResponse(ctx, replyBizContent) + return c.VoucherBiz.GetResponse(ctx, replyBizContent) } func (c *CmbService) QueryProductFail(ctx context.Context, err error) (*v1.CmbReply, error) { @@ -35,7 +35,7 @@ func (c *CmbService) QueryProductFail(ctx context.Context, err error) (*v1.CmbRe replyBizContent, _ := json.Marshal(bizReply) - return c.GetResponse(ctx, replyBizContent) + return c.VoucherBiz.GetResponse(ctx, replyBizContent) } func (c *CmbService) QueryProduct(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) { diff --git a/internal/service/cmb_query.go b/internal/service/query.go similarity index 90% rename from internal/service/cmb_query.go rename to internal/service/query.go index 88577a9..2412950 100644 --- a/internal/service/cmb_query.go +++ b/internal/service/query.go @@ -12,7 +12,7 @@ func (c *CmbService) QuerySuccess(ctx context.Context, bizReply *v1.CmbQueryRepl replyBizContent, _ := json.Marshal(bizReply) - return c.GetResponse(ctx, replyBizContent) + return c.VoucherBiz.GetResponse(ctx, replyBizContent) } func (c *CmbService) QueryFail(ctx context.Context, err error) (*v1.CmbReply, error) { @@ -27,7 +27,7 @@ func (c *CmbService) QueryFail(ctx context.Context, err error) (*v1.CmbReply, er replyBizContent, _ := json.Marshal(bizReply) - return c.GetResponse(ctx, replyBizContent) + return c.VoucherBiz.GetResponse(ctx, replyBizContent) } func (c *CmbService) Query(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) {