package mtwmapi

import (
	"fmt"
	"net/url"
	"testing"

	"git.rosy.net.cn/baseapi/utils"
)

func TestGetRefundSkuDetailFromMsg(t *testing.T) {
	data, _ := url.ParseQuery(`
	/mtwm/orderPartialRefund?timestamp=1556595759&reason=%E5%BA%97%E9%93%BA%E5%A4%AA%E5%BF%99%E4%BA%86%21%E5%AE%A2%E5%AE%98%E6%88%91%E6%80%95%E6%82%A8%E7%AD%89%E7%9A%84%E5%A4%AA%E4%B9%85&food=%5B%7B%22app_food_code%22%3A%2231458%22%2C%22box_num%22%3A0%2C%22box_price%22%3A0%2C%22count%22%3A1%2C%22food_name%22%3A%22%E9%B2%9C%E7%AB%B9%E7%AC%8B%EF%BC%88%E9%B8%A1%E5%A9%86%E7%AC%8B%EF%BC%89%5B%E6%9C%AA%E6%B3%A1%E6%B0%B4%5D%E7%BA%A6250g%2F%E4%BB%BD%22%2C%22food_price%22%3A7.97%2C%22origin_food_price%22%3A7.97%2C%22refund_price%22%3A7.97%2C%22sku_id%22%3A%2231458%22%2C%22spec%22%3A%22250g%22%7D%5D&money=7.97&is_appeal=0&pictures=&notify_type=agree&app_id=589&order_id=67413510345111009&res_type=2&sig=0cef69f37b4a0e924ac4119c3d75117b	
	`)
	msg := &CallbackMsg{
		FormData: data,
	}
	result := api.GetRefundSkuDetailFromMsg(msg)
	t.Log(utils.Format4Output(result, false))
}

func TestSplice(t *testing.T) {
	var params = map[string]interface{}{}
	var statuss []int
	params["statuss"] = "[20]"
	utils.UnmarshalUseNumber([]byte(params["statuss"].(string)), &statuss)
	fmt.Println(statuss)
}
