model_v2_test.go 584 字节
package getuiV2

import (
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
	"testing"
)

func TestNewMapData(t *testing.T) {
	m := NewMapData()
	m.AddFiled("user.id", 1)
	m.AddFiled("user.name", "tip")
	m.AddFiled("user.sex", true)

	m.AddFiled("address.lon", 59.2156461)
	m.AddFiled("address.lat", 23.1245648)
	m.AddFiled("phone", "18860183050")

	notification := m.GetFiledMap("notification")
	notification["title"] = "xxx"
	notification["body"] = "body"
	m.SetFieldMap(notification, "url", "http://")
	m.SetFieldMap(notification, "options", nil)

	t.Log(common.AssertJson(m.Data))
}