230 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			230 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package game
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"testing"
 | |
| 	"time"
 | |
| )
 | |
| 
 | |
| func TestGetGameOsInfo(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 
 | |
| 	req := CreateGetGameOsInfoReq()
 | |
| 
 | |
| 	resp, err := client.GetGameOsInfo(req)
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 
 | |
| 	fmt.Println(resp.Code, resp.Msg, resp.Data.OsList, resp.Data.OsRelList2)
 | |
| }
 | |
| 
 | |
| func TestGetGameInfo(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	resp, err := client.GetGameInfo(CreateGetGameInfoByIdReq(797, 1))
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	fmt.Println(resp.Code, resp.Msg, resp.Data.GameHomeShortImage)
 | |
| }
 | |
| 
 | |
| func TestChannelInfo(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	req := CreateChannelInfoReq()
 | |
| 	req.ChannelKey = "GRSDK"
 | |
| 	resp, err := client.GetChannelInfo(req)
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	fmt.Println(resp)
 | |
| }
 | |
| 
 | |
| func TestLoginInfoById(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	req := CreateGetLoginInfoByIdReq(7349, "1.0.0")
 | |
| 	info, err := client.GetLoginInfoById(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	fmt.Println(info)
 | |
| }
 | |
| 
 | |
| func TestGetProtocolByGameId(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	req := CreateGetProtocolByGameIdRep()
 | |
| 	req.GameId = 8088
 | |
| 	req.GameVersion = "1.1.0"
 | |
| 	req.Type = 1
 | |
| 	info, err := client.GetProtocolByGameId(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	fmt.Println(info)
 | |
| }
 | |
| 
 | |
| func TestGetGameSimpleList(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	req := CreateGetGameSimpleListReq("8071,8062", "")
 | |
| 	info, err := client.GetGameSimpleList(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	fmt.Println(info)
 | |
| }
 | |
| 
 | |
| func TestGetGameServerV2(t *testing.T) {
 | |
| 	client, newErr := NewClient()
 | |
| 	if newErr != nil {
 | |
| 		panic(newErr)
 | |
| 	}
 | |
| 	req := CreateGetServerV2Request("n2", "", "")
 | |
| 	info, err := client.GetGameServerV2(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	fmt.Println(info)
 | |
| }
 | |
| 
 | |
| func TestGetGameCompany(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 	}
 | |
| 	req := CreateGetGameCompanyReq("ascq")
 | |
| 	gameCompany, err := client.GetGameCompany(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	fmt.Println(gameCompany)
 | |
| 	fmt.Println(gameCompany.Data.System)
 | |
| }
 | |
| 
 | |
| func TestIsBlockOutIos(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 	}
 | |
| 	isBlockOutIosReq := CreateIsBlockOutIosReq("ec63860282", 4570, "116.26.129.38", "", 0, 0)
 | |
| 	isBlockOutIos, err := client.GetIsBlockOutIos(isBlockOutIosReq)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(isBlockOutIos)
 | |
| }
 | |
| 
 | |
| // 获取游戏全局配置
 | |
| func TestGetConfig(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 	}
 | |
| 	getConfigReq := CreateGetConfigReq("overlord_act_config")
 | |
| 	isBlockOutIos, err := client.GetConfig(getConfigReq)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(isBlockOutIos)
 | |
| }
 | |
| 
 | |
| // 获取实名黑名单
 | |
| func TestGetRealAuthBlackList(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 	}
 | |
| 	getRealAuthBlackListReq := CreateGetRealAuthBlackListReq()
 | |
| 	isBlockOutIos, err := client.GetRealAuthBlackList(getRealAuthBlackListReq)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(isBlockOutIos)
 | |
| }
 | |
| 
 | |
| // 获取游戏实名参数
 | |
| func TestGetGameRealAuthInfo(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 	}
 | |
| 	getGameRealAuthInfoReq := CreateGetGameRealAuthInfoReq(7081)
 | |
| 	isBlockOutIos, err := client.GetGameRealAuthInfo(getGameRealAuthInfoReq)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(isBlockOutIos)
 | |
| }
 | |
| 
 | |
| func TestGetGameVersion(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	req := CreateGetGameVersionReq(8071, "1.0.6")
 | |
| 	resp, err := client.GetGameVersion(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(resp)
 | |
| }
 | |
| 
 | |
| func TestClient_GetProtocolByCompany(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	req := CreateGetProtocolByCompanyRep()
 | |
| 	req.Company = "GR"
 | |
| 	req.Type = 0
 | |
| 	resp, err := client.GetProtocolByCompany(req)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(resp.Code, resp.Msg, resp.Data.Content)
 | |
| }
 | |
| 
 | |
| // 测试踢人
 | |
| func TestKickUser(t *testing.T) {
 | |
| 	client, err := NewClient()
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 	} // CreateKickUserReq
 | |
| 	getRealAuthBlackListReq := CreateKickUserReq(8677, "wzcqtest", "8676", time.Now().Unix())
 | |
| 	kickUserResp, err := client.KickUser(getRealAuthBlackListReq)
 | |
| 	if err != nil {
 | |
| 		t.Error(err)
 | |
| 		return
 | |
| 	}
 | |
| 	t.Log(kickUserResp)
 | |
| }
 |