diff --git a/internal/biz/order.go b/internal/biz/order.go index d021a34..aa25955 100644 --- a/internal/biz/order.go +++ b/internal/biz/order.go @@ -111,15 +111,20 @@ func (v *VoucherBiz) order(ctx context.Context, req *bo.OrderCreateReqBo, produc } // 真实发放 - voucherNo, err := v.WechatCpnRepo.Order(ctx, order) - if err != nil { - if err3 := v.fail(ctx, order, err); err3 != nil { - return nil, err3 - } - return nil, err + //voucherNo, err := v.WechatCpnRepo.Order(ctx, order) + //if err != nil { + // if err3 := v.fail(ctx, order, err); err3 != nil { + // return nil, err3 + // } + // return nil, err + //} + + voucherNo := order.OrderNo + if err = v.success(ctx, order, voucherNo); err != nil { + return order, err } - return order, v.success(ctx, order, voucherNo) + return order, nil } func (v *VoucherBiz) orderRetry(ctx context.Context, order *bo.OrderBo) error { diff --git a/internal/data/mixrepoimpl/kx.go b/internal/data/mixrepoimpl/kx.go index 28dcb58..9e3aa4d 100644 --- a/internal/data/mixrepoimpl/kx.go +++ b/internal/data/mixrepoimpl/kx.go @@ -3,14 +3,12 @@ package mixrepoimpl import ( "context" "github.com/go-kratos/kratos/v2/log" - "net/http" - "time" "voucher/internal/biz/kx" "voucher/internal/biz/mixrepos" "voucher/internal/conf" - "voucher/internal/pkg/request" ) +// KxMixRepoImpl kx 空港 type KxMixRepoImpl struct { bc *conf.Bootstrap } @@ -23,23 +21,24 @@ func (s *KxMixRepoImpl) Request(ctx context.Context, req *kx.SynNotice) error { body, err := req.Marshal() if err != nil { - log.Errorf("请求掌上生活Marshal报错:%s", err.Error()) + log.Errorf("请求kx Marshal 报错:%s", err.Error()) return err } - h := http.Header{ - "Content-Type": []string{"application/x-www-form-urlencoded"}, - } + log.Warnf("请求kx,reqBody:%s", string(body)) - url := s.bc.Cmb.KxNoticeUrl - - _, bodyBytes, err := request.Post(ctx, url, body, request.WithHeaders(h), request.WithTimeout(time.Second*20)) - if err != nil { - log.Errorf("请求kx报错,url:%s,body:%s,err:%v", url, string(body), err) - return err - } - - log.Warnf("请求kx,url:%s,reqBody:%s,respBody:%s", url, string(body), string(bodyBytes)) + //h := http.Header{ + // "Content-Type": []string{"application/json"}, + //} + //url := s.bc.Cmb.KxNoticeUrl + // + //_, bodyBytes, err := request.Post(ctx, url, body, request.WithHeaders(h), request.WithTimeout(time.Second*20)) + //if err != nil { + // log.Errorf("请求kx报错,url:%s,body:%s,err:%v", url, string(body), err) + // return err + //} + // + //log.Warnf("请求kx,url:%s,reqBody:%s,respBody:%s", url, string(body), string(bodyBytes)) //var response *v1.CmbReply //if err = json.Unmarshal(bodyBytes, &response); err != nil {