切换主体
This commit is contained in:
parent
a7f41d1c27
commit
9c465d1f52
|
|
@ -2,9 +2,7 @@ package biz
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"gorm.io/gorm"
|
|
||||||
errPb "voucher/api/err"
|
errPb "voucher/api/err"
|
||||||
"voucher/internal/biz/bo"
|
"voucher/internal/biz/bo"
|
||||||
"voucher/internal/biz/vo"
|
"voucher/internal/biz/vo"
|
||||||
|
|
@ -19,10 +17,6 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip string, req
|
||||||
|
|
||||||
order, err := this.getOrder(ctx, req)
|
order, err := this.getOrder(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// 系统订单不存在
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +51,6 @@ func (this *VoucherBiz) getOrder(ctx context.Context, req *bo.WechatVoucherNotif
|
||||||
}
|
}
|
||||||
|
|
||||||
order, err := this.OrderRepo.GetByCouponId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID)
|
order, err := this.OrderRepo.GetByCouponId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("订单查询错误 error: %w", err)
|
return nil, fmt.Errorf("订单查询错误 error: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@ package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
"github.com/go-kratos/kratos/v2/transport/http"
|
"github.com/go-kratos/kratos/v2/transport/http"
|
||||||
|
"gorm.io/gorm"
|
||||||
"io"
|
"io"
|
||||||
http2 "net/http"
|
http2 "net/http"
|
||||||
"voucher/internal/biz"
|
"voucher/internal/biz"
|
||||||
|
|
@ -73,6 +75,11 @@ func (srv *NotifyService) Notify(ctx http.Context) error {
|
||||||
headerJson, _ := json.Marshal(headers)
|
headerJson, _ := json.Marshal(headers)
|
||||||
log.Errorf("微信回调通知[%s],consumer处理失败:%s\nheaders:%s\nbody:%s\n解析数据:%+v", mchId, err.Error(), headerJson, string(bodyBytes), response)
|
log.Errorf("微信回调通知[%s],consumer处理失败:%s\nheaders:%s\nbody:%s\n解析数据:%+v", mchId, err.Error(), headerJson, string(bodyBytes), response)
|
||||||
|
|
||||||
|
// 系统订单不存在
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return ctx.JSON(http2.StatusOK, nil)
|
||||||
|
}
|
||||||
|
|
||||||
return ctx.JSON(http2.StatusBadRequest, map[string]string{
|
return ctx.JSON(http2.StatusBadRequest, map[string]string{
|
||||||
"code": "FAIL",
|
"code": "FAIL",
|
||||||
"message": err.Error(),
|
"message": err.Error(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue