This commit is contained in:
ziming 2025-05-21 11:54:35 +08:00
parent 13cd99300f
commit ddab078e1f
7 changed files with 5 additions and 25 deletions

1
go.sum
View File

@ -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/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/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 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/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.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=

View File

@ -1,18 +1,14 @@
package service package service
import ( import (
"context"
"fmt" "fmt"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/transport/http" "github.com/go-kratos/kratos/v2/transport/http"
"github.com/robfig/cron" "github.com/robfig/cron"
http2 "net/http" http2 "net/http"
"strconv" "strconv"
v1 "voucher/api/v1" v1 "voucher/api/v1"
"voucher/internal/biz" "voucher/internal/biz"
"voucher/internal/biz/bo"
"voucher/internal/biz/mixrepos" "voucher/internal/biz/mixrepos"
"voucher/internal/biz/vo"
"voucher/internal/biz/wechatrepo" "voucher/internal/biz/wechatrepo"
"voucher/internal/conf" "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 { func (this *CmbService) NotifyRetry(ctx http.Context) error {
id := ctx.Vars().Get("id") id := ctx.Vars().Get("id")
if id == "" { if id == "" {

View File

@ -14,7 +14,7 @@ func (c *CmbService) QueryProductSuccess(ctx context.Context, bizReply *v1.CmbQu
replyBizContent, _ := json.Marshal(bizReply) 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) { 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) 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) { func (c *CmbService) QueryProduct(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) {

View File

@ -12,7 +12,7 @@ func (c *CmbService) QuerySuccess(ctx context.Context, bizReply *v1.CmbQueryRepl
replyBizContent, _ := json.Marshal(bizReply) 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) { 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) 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) { func (c *CmbService) Query(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) {