From 5d1ff1bdde7b981fb8434e3db6baf3cd9a024e59 Mon Sep 17 00:00:00 2001 From: ziming Date: Wed, 28 Jan 2026 09:36:30 +0800 Subject: [PATCH] query order --- internal/server/http.go | 1 + test/bank_multi_activity_test.go | 13 +++++++++++++ test/coupon.go | 18 +++++++++--------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/internal/server/http.go b/internal/server/http.go index ac4c16e..c265340 100644 --- a/internal/server/http.go +++ b/internal/server/http.go @@ -46,6 +46,7 @@ func NewHTTPServer( srv.Route("/voucher/").POST("notifyRetry/{id}", cmb.NotifyRetry) // 查询订单状态及微信状态 srv.Route("/voucher/").POST("queryOrder/{order_no}/{phone}/{is_notice}", cmb.QueryOrder) + srv.Route("/voucher/").GET("query-order/{order_no}/{phone}/{is_notice}", cmb.QueryOrder) // 查询商品 srv.Route("/voucher/").POST("queryStock/{product_no}", cmb.QueryStock) // 注册商品tag到刚哥那边 diff --git a/test/bank_multi_activity_test.go b/test/bank_multi_activity_test.go index b61358c..057fcca 100644 --- a/test/bank_multi_activity_test.go +++ b/test/bank_multi_activity_test.go @@ -55,6 +55,19 @@ func Test_MarketingQuery(t *testing.T) { //不行的,需要是在自己appid下的才能查到 } +func Test_QixingNotifyDataDecodeString(t *testing.T) { + + content := `eyJzdW1tYXJ5Ijoi5Luj6YeR5Yi45qC46ZSA6YCa55+lIiwiYXNzb2NpYXRlZF9kYXRhIjoiY291cG9uIiwiZXZlbnRfdHlwZSI6IkNPVVBPTi5VU0UiLCJjcmVhdGVfdGltZSI6IjIwMjUtMTItMjRUMTk6NDg6NDYrMDg6MDAiLCJwbGFpbl90ZXh0Ijp7InN0b2NrX2NyZWF0b3JfbWNoaWQiOiIxNzE1MzQ5NTc4Iiwic3RvY2tfaWQiOiIyMTQzODg1MSIsImNvdXBvbl9pZCI6IjE0NDQ2MTIyOTg5MCIsInNpbmdsZWl0ZW1fZGlzY291bnRfb2ZmIjpudWxsLCJkaXNjb3VudF90byI6bnVsbCwiY291cG9uX25hbWUiOiLpk7booYzljaHlpJrnrJTnq4vlh48iLCJzdGF0dXMiOiJVU0VEIiwiZGVzY3JpcHRpb24iOiIiLCJjcmVhdGVfdGltZSI6IjIwMjUtMTItMThUMTU6NDQ6NTIrMDg6MDAiLCJjb3Vwb25fdHlwZSI6Ik5PUk1BTCIsIm5vX2Nhc2giOmZhbHNlLCJhdmFpbGFibGVfYmVnaW5fdGltZSI6IjIwMjUtMTItMThUMDA6MDA6MDArMDg6MDAiLCJhdmFpbGFibGVfZW5kX3RpbWUiOiIyMDI2LTAxLTE2VDIzOjU5OjU5KzA4OjAwIiwic2luZ2xlaXRlbSI6ZmFsc2UsIm5vcm1hbF9jb3Vwb25faW5mb3JtYXRpb24iOnsiY291cG9uX2Ftb3VudCI6MzAwLCJ0cmFuc2FjdGlvbl9taW5pbXVtIjoxODAwfSwiY29uc3VtZV9pbmZvcm1hdGlvbiI6eyJjb25zdW1lX3RpbWUiOiIyMDI1LTEyLTI0VDE5OjQ4OjQ2KzA4OjAwIiwiY29uc3VtZV9tY2hpZCI6IjEyNzQ5Mzg2MDEiLCJ0cmFuc2FjdGlvbl9pZCI6IjQyMDAwMDI5MTcyMDI1MTIyNDgzODQ2MTg0MzgiLCJjb25zdW1lX2Ftb3VudCI6MzAwLCJnb29kc19kZXRhaWwiOm51bGx9fSwicmVzb3VyY2VfdHlwZSI6ImVuY3J5cHQtcmVzb3VyY2UiLCJvcmlnaW5hbF90eXBlIjoiY291cG9uIiwiaWQiOiI4NzkxZTMyZS0zYjFiLTViNDktYTNiNi1mYzY0YTc5NTVlZjEifQ==` + + b, err := base64.StdEncoding.DecodeString(content) + if err != nil { + t.Errorf("base64.StdEncoding.DecodeString() error = %v", err) + return + } + + t.Log(string(b)) +} + func Test_QixingNotifyData(t *testing.T) { //wxBody := `{"id":"4ab2699d-e91d-5460-9810-25fd6d4c69a5","create_time":"2025-12-08T17:54:24+08:00","resource_type":"encrypt-resource","event_type":"COUPON.USE","summary":"代金券核销通知","original_type":"coupon","associated_data":"coupon","plain_text":{"stock_creator_mchid":"1652465541","stock_id":"21386484","coupon_id":"142388354994","coupon_name":"银行卡多笔立减","description":"","status":"SENDED","create_time":"2025-12-08T17:50:48+08:00","coupon_type":"NORMAL","no_cash":false,"singleitem":false,"business_type":"","consume_information":{"consume_time":"2025-12-08T17:54:24+08:00","consume_mchid":"1274938601","transaction_id":"4200002996202512083063051834","consume_amount":16}}}` diff --git a/test/coupon.go b/test/coupon.go index 9b8d40a..64cc2d4 100644 --- a/test/coupon.go +++ b/test/coupon.go @@ -57,12 +57,12 @@ func SendCoupon() { } req := cashcoupons.SendCouponRequest{ - OutRequestNo: core.String("FZQM1948534036766040066"), // {CouponId:129623470711} + OutRequestNo: core.String("LQ2011991700944699394"), // {CouponId:129623470711} // 微信为发券方商户分配的公众账号ID,接口传入的所有appid应该为公众号的appid(在mp.weixin.qq.com申请的),不能为APP的appid(在open.weixin.qq.com申请的)。 Appid: core.String("wxd27e255810842ba8"), - Openid: core.String("o3dEt5cA8jt3Kz5wNzAO6-3YQHsE"), - StockId: core.String("21104160"), - StockCreatorMchid: core.String("1715349578"), + Openid: core.String("o3dEt5b_1lFtKc-aAT3tiYjJIGwk"), + StockId: core.String("21502886"), + StockCreatorMchid: core.String("1652465541"), } fmt.Printf("\nreq:%+v", req) @@ -102,9 +102,9 @@ func QueryCoupon() { return } - appId := "wx619991cc795028f5" - openId := "oSNb4fulXAleiammvWXnz1pRghAE" - couponId := "142388354994" + appId := "wxd27e255810842ba8" + openId := "o3dEt5Wq3v-bEBXXkzvIlMgMh7Kc" + couponId := "149248300483" req := cashcoupons.QueryCouponRequest{ CouponId: core.String(couponId), @@ -157,8 +157,8 @@ func QueryProduct() { } req := cashcoupons.QueryStockRequest{ - StockId: core.String("21386505"), - StockCreatorMchid: core.String("1715349578"), + StockId: core.String("21502886"), + StockCreatorMchid: core.String("1652465541"), } svc := cashcoupons.StockApiService{Client: client}