You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wt-game/test/point_test.go

33 lines
1.5 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package test
import (
"fmt"
"gitea.weitiangame.com/sdk/wt-game/point"
"go.uber.org/zap"
"testing"
)
var logger, _ = zap.NewProduction()
var pointSdk = point.New("your-client-id", logger).Debug().Curl()
// TestOrderSign 测试订单签名
func TestPoint(t *testing.T) {
event, err := pointSdk.Event(map[string]interface{}{
"name": "charge", // 事件名,固定为 charge
"user_id": "your-user-id", // 必需。用户 ID。必须和 SDK 的 setUser 接口传递的 userId 一样,并且该用户已经通过 SDK 接口进行过推送
"type": "track", // 必需。数据类型,请确保传入的值为 track
"properties": map[string]interface{}{
"ip": "8.8.8.8", // 可选。充值用户的 IP
"order_id": "100000", // 可选。长度大于 0 并小于等于 256。订单 ID。
"amount": 100, // 必需。大于 0 并小于等于 100000000000。充值金额。单位分即无论什么币种都需要乘以 100
"virtual_currency_amount": 100, //获赠虚拟币数量,必传,可为 0
"currency_type": "CNY", // 可选。货币类型。国际通行三字母表示法,为空时默认 CNY。参考人民币 CNY美元 USD欧元 EUR
"product": "item1", // 可选。长度大于 0 并小于等于 256。商品名称
"payment": "alipay", // 可选。长度大于 0 并小于等于 256。充值渠道
},
})
fmt.Println(event)
fmt.Println(err)
}