73 lines
1.9 KiB
Go
73 lines
1.9 KiB
Go
package uinapp
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/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 TestSendMsgAndroid(t *testing.T) {
|
|
api.SendMsgByUinApp(SendMsgReq{
|
|
RequestId: utils.Int64ToStr(time.Now().UnixNano()),
|
|
GroupName: "",
|
|
Audience: AudienceCid{CId: []string{android}},
|
|
Settings: SendMsgSetting{},
|
|
PushMessage: PushMessageDetail{
|
|
Notification: PushMessageDetailNotification{
|
|
Title: "测试消息推送[个推推送消息参数]",
|
|
Body: "吃早饭了没得[个推推送消息参数]",
|
|
BigText: "这是个什么东西[个推推送消息参数]",
|
|
BigImage: "",
|
|
Logo: "",
|
|
LogoUrl: "",
|
|
ChannelId: "",
|
|
ChannelName: "",
|
|
ChannelLevel: 0,
|
|
ClickType: "startapp",
|
|
Intent: "",
|
|
Url: "",
|
|
Payload: "",
|
|
NotifyId: 0,
|
|
RingName: "",
|
|
BadgeAddNum: 0,
|
|
ThreadId: "",
|
|
},
|
|
},
|
|
PushChannel: PushChannelDetail{
|
|
//Ios: IosApsDetail{},
|
|
Android: AndroidPushChannelDetail{Ups: AndroidPushChannelUps{
|
|
Notification: AndroidPushChannelNotification{
|
|
Title: "测试消息推送[厂商推送消息参数]",
|
|
Body: "吃早饭了没得[厂商推送消息参数]",
|
|
ClickType: "startapp",
|
|
Intent: "",
|
|
Url: "",
|
|
NotifyId: 0,
|
|
},
|
|
Transmission: "",
|
|
Revoke: struct {
|
|
OldTaskId string `json:"old_task_id"`
|
|
}{},
|
|
Options: struct {
|
|
Constraint string `json:"constraint"`
|
|
Key string `json:"key"`
|
|
Value interface{} `json:"value"`
|
|
}{},
|
|
}},
|
|
Mp: MpPushChannelDetail{},
|
|
},
|
|
})
|
|
}
|