查询公会
查询公会列表的 API。
URL 确认
此 API 使用 service-api.playnanoo.com 域名。
API 信息
- URL:
https://service-api.playnanoo.com/guild/v20230101/search - Method:
PUT - 需要认证: 是
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| table_code | string | 必填 | 表代码 |
| sort_condition | string | 必填 | 排序条件 (random, point, indate) |
| sort_type | string | 必填 | 排序类型 (asc, desc) |
| auto_join | string | 必填 | 自动加入筛选 (Y, N) |
| limit | int | 必填 | 要查询的公会数 |
DeviceInfo 继承
此 API 的 Req 类继承自 DeviceInfo。DeviceInfo 的所有属性将自动包含。
响应数据
Res 类
| 字段 | 类型 | 说明 |
|---|---|---|
| Items | List\<SearchItemModel> | 公会列表 |
SearchItemModel 结构
| 字段 | 类型 | 说明 |
|---|---|---|
| TableCode | string | 表代码 |
| Uid | string | 公会唯一 ID |
| Name | string | 公会名称 |
| Point | double | 公会积分 |
| MasterUuid | string | 会长 UUID |
| MasterNickname | string | 会长昵称 |
| Country | string | 国家代码 |
| MemberCount | int | 当前成员数 |
| MemberLimit | int | 成员限制数 |
| AutoJoin | string | 自动加入 |
| ExtraData | string | 附加数据 |
| InDate | string | 公会创建日期 |
Unity C# 实现
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class GuildSearch
{
static string path = "https://service-api.playnanoo.com/guild/v20230101/search";
[Serializable]
public class Req : DeviceInfo
{
public string table_code;
public string sort_condition;
public string sort_type;
public string auto_join;
public int limit;
public IEnumerator Send(
string tableCode,
string sortCondition, //random : 랜덤검색, point : 포인트, indate : 등록일자
string sortType, // asc : 오름차순, desc : 내림차순
bool autoJoin,
int limit,
Action<Res> onSuccess,
Action<BaseResponse> onError
)
{
if (!string.IsNullOrEmpty(tableCode)) this.table_code = tableCode;
if (!string.IsNullOrEmpty(sortCondition)) this.sort_condition = sortCondition;
if (!string.IsNullOrEmpty(sortType)) this.sort_type = sortType;
this.auto_join = autoJoin ? "Y" : "N";
this.limit = limit;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public List<SearchItemModel> Items;
}
[Serializable]
public class SearchItemModel
{
public string TableCode;
public string Uid;
public string Name;
public double Point;
public string MasterUuid;
public string MasterNickname;
public string Country;
public int MemberCount;
public int MemberLimit;
public string AutoJoin;
public string ExtraData;
public string InDate;
}
}
使用示例
public void SearchGuilds()
{
GuildSearch.Req req = new GuildSearch.Req();
StartCoroutine(req.Send(
tableCode: "guild_table",
sortCondition: "point",
sortType: "desc",
autoJoin: true,
limit: 10,
onSuccess: res =>
{
foreach (var item in res.Items)
{
Debug.Log($"Uid: {item.Uid}, Name: {item.Name}");
Debug.Log($"Point: {item.Point}, MemberCount: {item.MemberCount}/{item.MemberLimit}");
Debug.Log($"Master: {item.MasterNickname}");
}
},
onError: (error) =>
{
Debug.LogError($"길드 조회 실패: [{error.ErrorCode}] {error.Message}");
}
));
}