62 lines
1.7 KiB
Go
62 lines
1.7 KiB
Go
package uinapp
|
||
|
||
import (
|
||
"fmt"
|
||
"git.rosy.net.cn/jx-callback/globals"
|
||
"testing"
|
||
)
|
||
|
||
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{}{
|
||
"transmission": "厂商透传消息",
|
||
},
|
||
},
|
||
"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)
|
||
}
|