From 73a0321d99769dc0d00a5cf12bae31e0ba557c00 Mon Sep 17 00:00:00 2001 From: ziming Date: Thu, 29 May 2025 17:05:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=9B=9E=E8=B0=83=E6=B6=88?= =?UTF-8?q?=E8=B4=B9=E6=8E=A5=E6=94=B6=E6=B6=88=E6=81=AF=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/data/wechatrepoimpl/cpn.go | 30 ++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/internal/data/wechatrepoimpl/cpn.go b/internal/data/wechatrepoimpl/cpn.go index c1ab450..c212f61 100644 --- a/internal/data/wechatrepoimpl/cpn.go +++ b/internal/data/wechatrepoimpl/cpn.go @@ -88,7 +88,11 @@ func (c *CpnRepoImpl) Order(ctx context.Context, order *bo.OrderBo) (string, err if err != nil { - return "", c.bodyErr(ctx, result) + if result.Response.Body != nil { + return "", c.bodyErr(ctx, result) + } + + return "", err } return *resp.CouponId, nil @@ -112,7 +116,11 @@ func (c *CpnRepoImpl) Query(ctx context.Context, orderWechat *bo.OrderBo) (vo.Or resp, result, err := svc.QueryCoupon(ctx, req) if err != nil { - return 0, c.bodyErr(ctx, result) + if result.Response.Body != nil { + return 0, c.bodyErr(ctx, result) + } + + return 0, err } return CpnStatus(*resp.Status).GetStatus() @@ -139,7 +147,11 @@ func (c *CpnRepoImpl) QueryProduct(ctx context.Context, stockCreatorMchId, stock if err != nil { - return nil, c.bodyErr(ctx, result) + if result.Response.Body != nil { + return nil, c.bodyErr(ctx, result) + } + + return nil, err } return response, nil @@ -160,7 +172,11 @@ func (c *CpnRepoImpl) QueryCallback(ctx context.Context) (*cashcoupons.Callback, if err != nil { - return nil, c.bodyErr(ctx, result) + if result.Response.Body != nil { + return nil, c.bodyErr(ctx, result) + } + + return nil, err } return response, nil @@ -183,7 +199,11 @@ func (c *CpnRepoImpl) SetCallback(ctx context.Context, url string) (*cashcoupons if err != nil { - return nil, c.bodyErr(ctx, result) + if result.Response.Body != nil { + return nil, c.bodyErr(ctx, result) + } + + return nil, err } return response, nil