syn notice
This commit is contained in:
parent
19a3ecc0df
commit
5bc5bf77dd
|
|
@ -265,3 +265,22 @@ func (v *VoucherBiz) UpdateOrderStatus(ctx context.Context, orderId uint64, stat
|
||||||
|
|
||||||
return fmt.Errorf("notice 未知券状态,orderId:%d,statuText:%s", orderId, status.GetText())
|
return fmt.Errorf("notice 未知券状态,orderId:%d,statuText:%s", orderId, status.GetText())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *VoucherBiz) QueryOrder(ctx context.Context, orderNo string) (string, error) {
|
||||||
|
|
||||||
|
order, err3 := v.OrderRepo.GetByOrderNo(ctx, orderNo)
|
||||||
|
if err3 != nil {
|
||||||
|
return "", err3
|
||||||
|
}
|
||||||
|
|
||||||
|
if order == nil || order.ID == 0 {
|
||||||
|
return "", fmt.Errorf("订单不存在:%s", orderNo)
|
||||||
|
}
|
||||||
|
|
||||||
|
status, err := v.WechatCpnRepo.Query(ctx, order)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("orderNo:%s,订单状态:%s,微信查询返回状态:%s", orderNo, order.Status.GetText(), status.GetText()), nil
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ func NewHTTPServer(
|
||||||
})
|
})
|
||||||
|
|
||||||
srv.Route("/voucher/").GET("notifyRetry/{id}", cmb.NotifyRetry)
|
srv.Route("/voucher/").GET("notifyRetry/{id}", cmb.NotifyRetry)
|
||||||
|
srv.Route("/voucher/").GET("query/{order_no}", cmb.QueryOrder)
|
||||||
|
|
||||||
v1.RegisterCmbHTTPServer(srv, cmb)
|
v1.RegisterCmbHTTPServer(srv, cmb)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"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"
|
||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
|
http2 "net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
v1 "voucher/api/v1"
|
v1 "voucher/api/v1"
|
||||||
"voucher/internal/biz"
|
"voucher/internal/biz"
|
||||||
|
|
@ -72,3 +73,20 @@ func (this *CmbService) NotifyRetry(ctx http.Context) error {
|
||||||
|
|
||||||
return this.VoucherBiz.PushNotifyRetryDelayMQ(ctx, 1, orderNotifyId)
|
return this.VoucherBiz.PushNotifyRetryDelayMQ(ctx, 1, orderNotifyId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *CmbService) QueryOrder(ctx http.Context) error {
|
||||||
|
|
||||||
|
orderNo := ctx.Vars().Get("order_no")
|
||||||
|
if orderNo == "" {
|
||||||
|
return fmt.Errorf("orderNo is empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
str, err := this.VoucherBiz.QueryOrder(ctx, orderNo)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx.JSON(http2.StatusOK, map[string]interface{}{
|
||||||
|
"data": str,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue