diff --git a/internal/biz/wechat_notify_consume.go b/internal/biz/wechat_notify_consume.go index ce6d4b1..9b3da66 100644 --- a/internal/biz/wechat_notify_consume.go +++ b/internal/biz/wechat_notify_consume.go @@ -21,9 +21,9 @@ func (j *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req * return nil } - req.PlainText.StockCreatorMchid = "1676203838" - req.PlainText.StockID = "20215869" - req.PlainText.CouponID = "96059179220" + //req.PlainText.StockCreatorMchid = "1676203838" + //req.PlainText.StockID = "20215869" + //req.PlainText.CouponID = "96059179220" orderWechat, err := j.OrderWechatRepo.GetByMSCId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID) if err != nil { diff --git a/internal/data/mixrepoimpl/cmb.go b/internal/data/mixrepoimpl/cmb.go index fb57e48..3ed841f 100644 --- a/internal/data/mixrepoimpl/cmb.go +++ b/internal/data/mixrepoimpl/cmb.go @@ -5,12 +5,14 @@ import ( "encoding/json" "errors" "fmt" + "github.com/go-kratos/kratos/v2/log" "net/http" "net/url" "time" v1 "voucher/api/v1" "voucher/internal/biz/bo" "voucher/internal/biz/mixrepos" + "voucher/internal/biz/vo" "voucher/internal/conf" "voucher/internal/pkg/cmb" "voucher/internal/pkg/helper" @@ -213,8 +215,11 @@ func (s *CmbMixRepoImpl) Request(ctx context.Context, req *v1.CmbRequest, uri st "Content-Type": []string{"application/x-www-form-urlencoded"}, } - _, bodyBytes, err := request.Post(ctx, uri+"?"+uv.Encode(), nil, request.WithHeaders(h)) + r := uri + "?" + uv.Encode() + + _, bodyBytes, err := request.Post(ctx, r, nil, request.WithHeaders(h)) if err != nil { + log.Errorf("请求掌上生活报错,url=%s,err=%v", r, err) return nil, err } @@ -223,6 +228,11 @@ func (s *CmbMixRepoImpl) Request(ctx context.Context, req *v1.CmbRequest, uri st return nil, err } + if response.RespCode != vo.CmbResponseStatusSuccess.GetValue() { + log.Errorf("请求掌上生活返回报错,url=%s,err=%s", r, response.RespMsg) + return nil, fmt.Errorf(response.RespMsg) + } + return response, nil }