【cs服务】
1、新增用户角色列表获取
This commit is contained in:
		
							parent
							
								
									b282de0a2f
								
							
						
					
					
						commit
						d3f303e20c
					
				@ -34,3 +34,9 @@ func (client *Client) GetUserInfo(req *GetUserInfoRequest) (resp *GetUserInfoRes
 | 
			
		||||
	err = client.DoAction(req, resp)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (client *Client) GetCsUserRoleList(req *GetUserRoleListRequest) (resp *GetUserRoleListResponse, err error) {
 | 
			
		||||
	resp = CreateGetUserRoleListResponse()
 | 
			
		||||
	err = client.DoAction(req, resp)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -41,3 +41,23 @@ func TestGetUserInfo(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	fmt.Printf(fmt.Sprintf("%v", info))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获取玩家角色列表
 | 
			
		||||
func TestGetUserRoleList(t *testing.T) {
 | 
			
		||||
	client, newErr := NewClient()
 | 
			
		||||
	if newErr != nil {
 | 
			
		||||
		panic(newErr)
 | 
			
		||||
	}
 | 
			
		||||
	req := CreateGetUserRoleListRequest(int64(63610626), int64(2850))
 | 
			
		||||
	info, err := client.GetCsUserRoleList(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Error(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if info.Code != 0 {
 | 
			
		||||
		t.Error("获取玩家角色列表失败")
 | 
			
		||||
		fmt.Printf(fmt.Sprintf("%v", info))
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Printf(fmt.Sprintf("%v", info))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -47,3 +47,40 @@ func CreateGetUserInfoResponse() (response *GetUserInfoResponse) {
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserRoleInfo 玩家角色信息
 | 
			
		||||
type UserRoleInfo struct {
 | 
			
		||||
	Uid      int64  `json:"uid"`
 | 
			
		||||
	RoleName string `json:"role_name"`
 | 
			
		||||
	RoleId   string `json:"role_id"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetUserRoleListRequest struct {
 | 
			
		||||
	*requests.JsonRequest
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetUserRoleListResponse struct {
 | 
			
		||||
	*responses.BaseResponse
 | 
			
		||||
	Code int            `json:"code"`
 | 
			
		||||
	Msg  string         `json:"msg"`
 | 
			
		||||
	Data []UserRoleInfo `json:"data"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func CreateGetUserRoleListRequest(uId int64, gameId int64) (req *GetUserRoleListRequest) {
 | 
			
		||||
	req = &GetUserRoleListRequest{
 | 
			
		||||
		JsonRequest: &requests.JsonRequest{},
 | 
			
		||||
	}
 | 
			
		||||
	req.InitWithApiInfo(HOST, VERSION, "/v1/user/role_list")
 | 
			
		||||
 | 
			
		||||
	req.JsonParams["uid"] = uId
 | 
			
		||||
	req.JsonParams["game_id"] = gameId
 | 
			
		||||
 | 
			
		||||
	req.Method = requests.POST
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
func CreateGetUserRoleListResponse() (response *GetUserRoleListResponse) {
 | 
			
		||||
	response = &GetUserRoleListResponse{
 | 
			
		||||
		BaseResponse: &responses.BaseResponse{},
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user