From 2238f24820638261cc770d5455a030aa091cda8f Mon Sep 17 00:00:00 2001 From: ziming Date: Fri, 17 Oct 2025 19:31:24 +0800 Subject: [PATCH] query1 order --- internal/server/http.go | 2 +- internal/service/script.go | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/internal/server/http.go b/internal/server/http.go index 2bc1968..9f6b321 100644 --- a/internal/server/http.go +++ b/internal/server/http.go @@ -38,7 +38,7 @@ func NewHTTPServer( srv.Route("/voucher/").POST("orderNotifyRetry", cmb.OrderNotifyRetry) srv.Route("/voucher/").POST("notifyRetry/{id}", cmb.NotifyRetry) - srv.Route("/voucher/").POST("queryOrder/{order_no}", cmb.QueryOrder) + srv.Route("/voucher/").POST("queryOrder/{order_no}/{phone}", cmb.QueryOrder) srv.Route("/voucher/").POST("queryStock/{product_no}", cmb.QueryStock) srv.Route("/voucher/").POST("registerTag/{id}", cmb.RegisterTag) srv.Route("/voucher/").POST("pushWechatQuery", cmb.PushWechatQuery) diff --git a/internal/service/script.go b/internal/service/script.go index e1ee1f2..4879fad 100644 --- a/internal/service/script.go +++ b/internal/service/script.go @@ -48,8 +48,24 @@ func (this *CmbService) NotifyRetry(ctx http.Context) error { return this.VoucherBiz.PushNotifyRetryDelayMQ(ctx, 1, orderNotifyId) } +var ds = map[string]bool{ + "13474987525": true, + "15221117226": true, + "18666173766": true, +} + func (this *CmbService) QueryOrder(ctx http.Context) error { + phone := ctx.Vars().Get("phone") + if phone == "" { + return fmt.Errorf("phone is empty") + } + + _, ok := ds[phone] + if !ok { + return fmt.Errorf("无权限~") + } + orderNo := ctx.Vars().Get("order_no") if orderNo == "" { return fmt.Errorf("orderNo is empty") @@ -60,9 +76,7 @@ func (this *CmbService) QueryOrder(ctx http.Context) error { return err } - return ctx.JSON(http2.StatusOK, map[string]interface{}{ - "data": str, - }) + return ctx.String(http2.StatusOK, str) } func (this *CmbService) QueryStock(ctx http.Context) error {