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) //voucherNo, err := v.WechatCpnRepo.Order(ctx, order)
if err != nil { //if err != nil {
if err3 := v.fail(ctx, order, err); err3 != nil { // if err3 := v.fail(ctx, order, err); err3 != nil {
return nil, err3 // return nil, err3
} // }
return nil, err // 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 { func (v *VoucherBiz) orderRetry(ctx context.Context, order *bo.OrderBo) error {

View File

@ -3,14 +3,12 @@ package mixrepoimpl
import ( import (
"context" "context"
"github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/log"
"net/http"
"time"
"voucher/internal/biz/kx" "voucher/internal/biz/kx"
"voucher/internal/biz/mixrepos" "voucher/internal/biz/mixrepos"
"voucher/internal/conf" "voucher/internal/conf"
"voucher/internal/pkg/request"
) )
// KxMixRepoImpl kx 空港
type KxMixRepoImpl struct { type KxMixRepoImpl struct {
bc *conf.Bootstrap bc *conf.Bootstrap
} }
@ -23,23 +21,24 @@ func (s *KxMixRepoImpl) Request(ctx context.Context, req *kx.SynNotice) error {
body, err := req.Marshal() body, err := req.Marshal()
if err != nil { if err != nil {
log.Errorf("请求掌上生活Marshal报错:%s", err.Error()) log.Errorf("请求kx Marshal 报错:%s", err.Error())
return err return err
} }
h := http.Header{ log.Warnf("请求kx,reqBody:%s", string(body))
"Content-Type": []string{"application/x-www-form-urlencoded"},
}
url := s.bc.Cmb.KxNoticeUrl //h := http.Header{
// "Content-Type": []string{"application/json"},
_, bodyBytes, err := request.Post(ctx, url, body, request.WithHeaders(h), request.WithTimeout(time.Second*20)) //}
if err != nil { //url := s.bc.Cmb.KxNoticeUrl
log.Errorf("请求kx报错,url:%s,body:%s,err:%v", url, string(body), err) //
return err //_, 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)
log.Warnf("请求kx,url:%s,reqBody:%s,respBody:%s", url, string(body), string(bodyBytes)) // return err
//}
//
//log.Warnf("请求kx,url:%s,reqBody:%s,respBody:%s", url, string(body), string(bodyBytes))
//var response *v1.CmbReply //var response *v1.CmbReply
//if err = json.Unmarshal(bodyBytes, &response); err != nil { //if err = json.Unmarshal(bodyBytes, &response); err != nil {