This commit is contained in:
ziming 2025-05-20 15:36:52 +08:00
parent ef81c198cf
commit 0a15c6d7b0
2 changed files with 27 additions and 23 deletions

View File

@ -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 {

View File

@ -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 {