query1 order

This commit is contained in:
ziming 2025-10-17 19:31:24 +08:00
parent 396e53e9fc
commit 2238f24820
2 changed files with 18 additions and 4 deletions

View File

@ -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)

View File

@ -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 {