package mtwm import ( "fmt" "net/url" "testing" "time" "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/utils" ) func TestOnFinancialMsg(t *testing.T) { msg := &mtwmapi.CallbackMsg{ Cmd: "orderRefund", Data: url.Values{}, } msg.Data.Set("timestamp", utils.Int64ToStr(time.Now().Unix())) msg.Data.Set("order_id", "33762863167364867") msg.Data.Set("notify_type", "agree") msg.Data.Set("money", "23.56") food := []map[string]interface{}{ map[string]interface{}{ "app_food_code": "123", "food_name": "商品1", "sku_id": "123", "refund_price": 3.14, "count": 2, "box_num": 1, "box_price": 1, }, map[string]interface{}{ "app_food_code": "124", "food_name": "商品2", "sku_id": "124", "refund_price": 3.15, "count": 2, "box_num": 1, "box_price": 1, }, } msg.Data.Set("food", string(utils.MustMarshal(food))) res := OnFinancialMsg(msg) fmt.Println(res) }