package uinapp import ( "fmt" "gitrosy.jxc4.com/baseapi/utils" "gitrosy.jxc4.com/jx-callback/globals" "testing" "time" ) var ( api = NewUinappApi(appId, appKey, appSecret, masterSecret) ios = "22d3c42f10cab7765c04ee5aee5ba068" android = "747bda2a61059284405e32a575a03c8f" ) func TestGetToken(t *testing.T) { err := api.GetUinAppToken() globals.SugarLogger.Debug("result := %v", err) } func TestCidSend(t *testing.T) { err := api.SendMsgByUinApp(map[string]interface{}{ "request_id": "12345237568ydfd2", "settings": map[string]interface{}{ "ttl": 7200000, }, "audience": map[string]interface{}{ "cid": []string{"808ba3cebba05782f82063d590b738a3"}, }, "push_message": map[string]interface{}{ "transmission": "{'type':'new','title':'火车南站店','content':'老板,您来新订单了,请尽快接单!'}", }, "push_channel": map[string]interface{}{ "android": map[string]interface{}{ "ups": map[string]interface{}{ "notification": map[string]interface{}{ "title": "火车南站店", "body": "老板,你有新订单了请及时查看(美团#1号订单)", "click_type": "startapp", // 写 startapp "notify_id": 1132345, // 每次通知需要不一样 范围:0-2147483647 }, "options": map[string]interface{}{ "XM": map[string]interface{}{ "/extra.channel_id": "小米的渠道ID", // 订单类填写:108892,消息通知类填写:108898 }, "HW": map[string]interface{}{ "/message/android/category": "填写华为侧的category取值", // 订单类填写:WORK,消息通知类填写:IM }, "OP": map[string]interface{}{ "/channel_id": "填写OPPO平台登记的渠道ID", // 订单类填写:10110,消息通知类填写:10111 }, "VV": map[string]interface{}{ "/category": "填写对应的ID", // 订单类填写:ORDER,消息通知类填写:IM }, }, }, }, "ios": map[string]interface{}{ "type": "notify", "payload": "{'type':'new','title':'火车南站店','content':'老板,您来新订单了,请尽快接单!'}", "aps": map[string]interface{}{ "alert": map[string]interface{}{ "title": "火车南站店", "body": "新订单", }, "content-available": 0, "sound": "自定义铃声,设置为包含后缀名的完整文件名,示例值:ring.mp3", "category": "在客户端通知栏触发特定的action和button显示", }, "auto_badge": "+1", "multimedia": []map[string]interface{}{ { "url": "https://xxx", "type": 1, "only_wifi": false}, }, }, }, }) fmt.Println(err) } func TestTime(t *testing.T) { timestamp := utils.Int64ToStr(time.Now().UnixNano() / 1e6) fmt.Println(timestamp) }