| 
									
										
										
										
											2024-09-12 14:27:03 +08:00
										 |  |  | package game | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"fmt" | 
					
						
							|  |  |  | 	"testing" | 
					
						
							| 
									
										
										
										
											2025-08-29 17:12:22 +08:00
										 |  |  | 	"time" | 
					
						
							| 
									
										
										
										
											2024-09-12 14:27:03 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:33 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | func TestGetGameInfo(t *testing.T) { | 
					
						
							|  |  |  | 	client, err := NewClient() | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		panic(err) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2025-07-25 17:20:51 +08:00
										 |  |  | 	resp, err := client.GetGameInfo(CreateGetGameInfoByIdReq(797, 1)) | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:33 +08:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		panic(err) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2025-07-25 17:20:51 +08:00
										 |  |  | 	fmt.Println(resp.Code, resp.Msg, resp.Data.GameHomeShortImage) | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:33 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2025-04-27 17:43:54 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-05-02 21:28:24 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-05-28 17:57:52 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-05-29 12:09:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-05-30 16:32:43 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-06-10 19:46:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-07-10 11:42:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // 获取游戏全局配置
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-07-10 15:45:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // 获取实名黑名单
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-07-10 18:05:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-10 18:26:12 +08:00
										 |  |  | // 获取游戏实名参数
 | 
					
						
							| 
									
										
										
										
											2025-07-10 18:05:09 +08:00
										 |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-07-25 17:20:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-08-15 17:41:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-08-29 17:12:22 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // 测试踢人
 | 
					
						
							|  |  |  | func TestKickUser(t *testing.T) { | 
					
						
							|  |  |  | 	client, err := NewClient() | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		t.Error(err) | 
					
						
							|  |  |  | 	} // CreateKickUserReq
 | 
					
						
							| 
									
										
										
										
											2025-08-29 18:31:51 +08:00
										 |  |  | 	getRealAuthBlackListReq := CreateKickUserReq(8677, "wzcqtest", "8676", time.Now().Unix()) | 
					
						
							| 
									
										
										
										
											2025-08-29 17:12:22 +08:00
										 |  |  | 	kickUserResp, err := client.KickUser(getRealAuthBlackListReq) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		t.Error(err) | 
					
						
							|  |  |  | 		return | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	t.Log(kickUserResp) | 
					
						
							|  |  |  | } |