From d23bba1392ddc3d216ac554e8fd61ddaed42d1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 21 Apr 2021 14:35:48 +0800 Subject: [PATCH] aa --- platformapi/mtunionapi/callback.go | 3 -- platformapi/mtunionapi/mtunionapi_test.go | 4 +- platformapi/mtunionapi/order.go | 46 +++++++++++++++++++++++ platformapi/mtunionapi/order_test.go | 8 ++++ 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/platformapi/mtunionapi/callback.go b/platformapi/mtunionapi/callback.go index 2a8dd81f..0bc40e25 100644 --- a/platformapi/mtunionapi/callback.go +++ b/platformapi/mtunionapi/callback.go @@ -2,7 +2,6 @@ package mtunionapi import ( "encoding/json" - "fmt" "git.rosy.net.cn/baseapi/utils" "io/ioutil" "net/http" @@ -40,10 +39,8 @@ func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err e return nil, err } mapData := utils.URLValues2Map(values) - fmt.Println("1111111111111111111", mapData) for k, _ := range mapData { json.Unmarshal([]byte(k), &call) } - fmt.Println("2222222222222222222", utils.Format4Output(call, true)) return call, err } diff --git a/platformapi/mtunionapi/mtunionapi_test.go b/platformapi/mtunionapi/mtunionapi_test.go index c3dbfeea..4214fb92 100644 --- a/platformapi/mtunionapi/mtunionapi_test.go +++ b/platformapi/mtunionapi/mtunionapi_test.go @@ -28,7 +28,7 @@ func init() { } func TestMiniCode(t *testing.T) { - result, err := api.MiniCode(4, strings.ToLower("EFA9876238FC11EB9101525400C36BDA")) + result, err := api.MiniCode(4, strings.ToLower("12521")) if err != nil { t.Fatal(err) } @@ -36,7 +36,7 @@ func TestMiniCode(t *testing.T) { } func TestGenerateLink(t *testing.T) { - result, err := api.GenerateLink(2, 1, strings.ToLower("EFA9876238FC11EB9101525400C36BDA")) + result, err := api.GenerateLink(2, 1, strings.ToLower("12521")) if err != nil { t.Fatal(err) } diff --git a/platformapi/mtunionapi/order.go b/platformapi/mtunionapi/order.go index 68c290dd..fa884491 100644 --- a/platformapi/mtunionapi/order.go +++ b/platformapi/mtunionapi/order.go @@ -12,6 +12,10 @@ const ( MtUnionOrderTypeHF = 5 //话费订单 MtUnionOrderTypeSG = 6 //闪购订单 + MtUnionOrderStatusPay = "1" //已付款 + MtUnionOrderStatusFinished = "8" //已完成 + MtUnionOrderStatusCanceled = "9" //已退款或风控 + defaultPageSize = 50 ) @@ -78,3 +82,45 @@ func (a *API) CouponList(orderType int, startTime, endTime int64, page int, sid } return couponListResult, err } + +type RtnotifyResult struct { + Coupon []struct { + Sequence string `json:"sequence"` + Orderid string `json:"orderid"` + Price string `json:"price"` + Profit string `json:"profit"` + Usetime string `json:"usetime"` + } `json:"coupon"` + Order struct { + Smstitle string `json:"smstitle"` + UID string `json:"uid"` + Total string `json:"total"` + Quantity string `json:"quantity"` + Orderid string `json:"orderid"` + Dealid string `json:"dealid"` + Modtime string `json:"modtime"` + Direct string `json:"direct"` + Paytime string `json:"paytime"` + Sid string `json:"sid"` + Status int `json:"status"` + } `json:"order"` + Refund []struct { + Quantity string `json:"quantity"` + Refundtime string `json:"refundtime"` + Money string `json:"money"` + Orderid string `json:"orderid"` + Profit string `json:"profit"` + } `json:"refund"` +} + +func (a *API) Rtnotify(oid, orderType string) (rtnotifyResult *RtnotifyResult, err error) { + result, err := a.AccessAPI2("api/rtnotify", false, map[string]interface{}{ + "oid": oid, + "type": orderType, + "full": 1, + }) + if err == nil { + utils.Map2StructByJson(result, &rtnotifyResult, false) + } + return rtnotifyResult, err +} diff --git a/platformapi/mtunionapi/order_test.go b/platformapi/mtunionapi/order_test.go index 1162533a..39a143bb 100644 --- a/platformapi/mtunionapi/order_test.go +++ b/platformapi/mtunionapi/order_test.go @@ -20,3 +20,11 @@ func TestCouponList(t *testing.T) { } t.Log(utils.Format4Output(result, false)) } + +func TestRtnotify(t *testing.T) { + result, err := api.Rtnotify("63962962989562895", "6") + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(result, false)) +}