105 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			105 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package userlive
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"testing"
 | 
						|
	"time"
 | 
						|
)
 | 
						|
 | 
						|
// 踢人
 | 
						|
func TestBan(t *testing.T) {
 | 
						|
	client, err := NewClient()
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	req := CreateBanReq(BanReqParam{
 | 
						|
		ActionTime:  time.Now().Unix(),
 | 
						|
		TriggerType: triggerTypeLogin,
 | 
						|
		Ip:          "127.0.0.1",
 | 
						|
		GameId:      8654,
 | 
						|
		UserName:    "aq36604627",
 | 
						|
		Uid:         632308087,
 | 
						|
		ServerId:    123,
 | 
						|
		RoleId:      "123",
 | 
						|
		BundleId:    "asdfas",
 | 
						|
		GameName:    "fasdf",
 | 
						|
		GameVersion: "fasdf",
 | 
						|
		SdkVersion:  "fasdf",
 | 
						|
		Os:          "fasd",
 | 
						|
		OsVersion:   "faf",
 | 
						|
		InApp:       "fasdf",
 | 
						|
		Ua:          "fasdfas",
 | 
						|
		NetworkType: "fasdfa",
 | 
						|
		IsVirtual:   "-1",
 | 
						|
		Cpu:         "cpu",
 | 
						|
		DeviceModel: "dfasdf",
 | 
						|
		Baseband:    "fasdfa",
 | 
						|
		Resolution:  "fasdfa",
 | 
						|
		Battery:     "fasdf",
 | 
						|
		LongId:      "fasdf",
 | 
						|
		OriginImei:  "fasdf",
 | 
						|
		Imei:        "fasdf",
 | 
						|
		OriginOaid:  "fasdf",
 | 
						|
		Oaid:        "fasdf",
 | 
						|
		AndroidId:   "fasdf",
 | 
						|
		Idfa:        "fsdf",
 | 
						|
		Idfv:        "fasdf",
 | 
						|
		DeviceId:    "fasdf",
 | 
						|
	})
 | 
						|
 | 
						|
	resp, err := client.CreateBanReq(req)
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	fmt.Println(resp.Code, resp.Msg, resp.Data)
 | 
						|
}
 | 
						|
 | 
						|
// 添加封禁规则
 | 
						|
func TestAddBanRuleCache(t *testing.T) {
 | 
						|
	client, err := NewClient()
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	req := CreateAddBanRuleCacheReq(RuleInfo{
 | 
						|
		Id:        21,
 | 
						|
		Phone:     "13247173568",
 | 
						|
		UserName:  "gr24616919",
 | 
						|
		IdCard:    "",
 | 
						|
		DeviceId:  "device_id1",
 | 
						|
		LongId:    "long_id1",
 | 
						|
		IsVirtual: 0,
 | 
						|
		EndTime:   "2029-01-01",
 | 
						|
	})
 | 
						|
 | 
						|
	resp, err := client.CreateAddBanRuleCacheReq(req)
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	fmt.Println(resp.Code, resp.Msg, resp.Data)
 | 
						|
}
 | 
						|
 | 
						|
// 删除封禁规则
 | 
						|
func TestRemoveBanRuleCache(t *testing.T) {
 | 
						|
	client, err := NewClient()
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	infos := []RuleInfo{{
 | 
						|
		Id:        21,
 | 
						|
		Phone:     "13247173568",
 | 
						|
		UserName:  "gr24616919",
 | 
						|
		IdCard:    "",
 | 
						|
		DeviceId:  "device_id1",
 | 
						|
		LongId:    "long_id1",
 | 
						|
		IsVirtual: 0,
 | 
						|
		EndTime:   "2029-01-01",
 | 
						|
	}}
 | 
						|
	req := CreateRemoveBanRuleCacheReq(RemoveBanRuleCacheReqParam{Rules: infos})
 | 
						|
 | 
						|
	resp, err := client.CreateRemoveBanRuleCacheReq(req)
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	fmt.Println(resp.Code, resp.Msg, resp.Data)
 | 
						|
}
 |