Files
baseapi/platformapi/uinapp/uin_app_test.go
richboo111 f85f429c6a 1
2023-07-06 15:03:44 +08:00

88 lines
2.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package uinapp
import (
"fmt"
"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 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)
}