wechatNotify

This commit is contained in:
李子铭 2025-03-17 14:10:58 +08:00
parent 70b3b82dcf
commit 323691d061
2 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,8 @@ func NewHTTPServer(
return ctx.String(http2.StatusOK, "pong")
})
r.POST("wechatNotify", voucherService.WechatNotify)
cmb := r.Group("/cmb")
v1 := cmb.Group("/v1")

View File

@ -3,9 +3,23 @@ package service
import (
"context"
"encoding/json"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/transport/http"
"io"
"voucher/internal/biz/bo"
)
func (v *VoucherService) WechatNotify(ctx http.Context) error {
bodyBytes, err := io.ReadAll(ctx.Request().Body)
if err != nil {
return err
}
log.Warnf("bodyBytes: %s", bodyBytes)
return ctx.JSON(200, "ok")
}
func (v *VoucherService) WechatUseNotifyConsumer(ctx context.Context, tag, msg string) error {
var req *bo.WechatVoucherNotifyBo