This commit is contained in:
苏尹岚
2021-04-21 14:35:48 +08:00
parent be93f2d9c8
commit d23bba1392
4 changed files with 56 additions and 5 deletions

View File

@@ -2,7 +2,6 @@ package mtunionapi
import ( import (
"encoding/json" "encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
@@ -40,10 +39,8 @@ func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err e
return nil, err return nil, err
} }
mapData := utils.URLValues2Map(values) mapData := utils.URLValues2Map(values)
fmt.Println("1111111111111111111", mapData)
for k, _ := range mapData { for k, _ := range mapData {
json.Unmarshal([]byte(k), &call) json.Unmarshal([]byte(k), &call)
} }
fmt.Println("2222222222222222222", utils.Format4Output(call, true))
return call, err return call, err
} }

View File

@@ -28,7 +28,7 @@ func init() {
} }
func TestMiniCode(t *testing.T) { func TestMiniCode(t *testing.T) {
result, err := api.MiniCode(4, strings.ToLower("EFA9876238FC11EB9101525400C36BDA")) result, err := api.MiniCode(4, strings.ToLower("12521"))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -36,7 +36,7 @@ func TestMiniCode(t *testing.T) {
} }
func TestGenerateLink(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 { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@@ -12,6 +12,10 @@ const (
MtUnionOrderTypeHF = 5 //话费订单 MtUnionOrderTypeHF = 5 //话费订单
MtUnionOrderTypeSG = 6 //闪购订单 MtUnionOrderTypeSG = 6 //闪购订单
MtUnionOrderStatusPay = "1" //已付款
MtUnionOrderStatusFinished = "8" //已完成
MtUnionOrderStatusCanceled = "9" //已退款或风控
defaultPageSize = 50 defaultPageSize = 50
) )
@@ -78,3 +82,45 @@ func (a *API) CouponList(orderType int, startTime, endTime int64, page int, sid
} }
return couponListResult, err 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
}

View File

@@ -20,3 +20,11 @@ func TestCouponList(t *testing.T) {
} }
t.Log(utils.Format4Output(result, false)) 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))
}