上赛季记录查询
用于查询特定玩家上赛季排行榜记录的 API。
URL 确认
此 API 使用 service-api.playnanoo.com 域名。
API 信息
- URL:
https://service-api.playnanoo.com/leaderboard/v20240301/show/prev - Method:
PUT - 需要认证: 是
DeviceInfo 继承
此 API 的 Req 类继承自 DeviceInfo。DeviceInfo 的所有属性会自动包含。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| uid | string | 必填 | 表代码 |
| record_id | string | 必填 | 记录 ID(玩家标识符) |
| rotation_count | int | 必填 | 赛季编号(要查询的上赛季) |
响应数据
Res 类
| 字段 | 类型 | 说明 |
|---|---|---|
| Rank | int | 玩家排名 |
| RotationCount | int | 赛季编号 |
| RecordId | string | 记录 ID |
| Score | int | 分数 |
| ExtraData | string | 附加数据(JSON 字符串) |
Unity C# 实现
BaseResponse 类
所有 API 响应的基类。
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
字段说明:
ErrorCode:错误代码Message:错误信息WithdrawalKey:账号处于注销等待状态时,用于恢复的密钥(仅注销等待中的账号提供)BlockKey:账号被封禁时提供的密钥(仅被封禁的账号提供)
上赛季记录查询类
using System;
using System.Collections;
using UnityEngine.Networking;
public class PlayerShowPrev
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/show/prev";
[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_id;
public int rotation_count;
public IEnumerator Send(string table_code, string recordId, int rotaionCount, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
if (!string.IsNullOrEmpty(recordId)) this.record_id = recordId;
this.rotation_count = rotaionCount;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public int Rank;
public int RotationCount;
public string RecordId;
public int Score;
public string ExtraData;
}
}
使用示例
public void ShowPreviousSeasonRecord()
{
PlayerShowPrev.Req req = new PlayerShowPrev.Req();
StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordId: "player_001",
rotaionCount: 1, // 이전 시즌 번호
onSuccess: res =>
{
Debug.Log("이전 시즌 기록 조회 성공");
Debug.Log($"순위: {res.Rank}");
Debug.Log($"점수: {res.Score}");
Debug.Log($"시즌: {res.RotationCount}");
// ExtraData가 있는 경우 파싱
if (!string.IsNullOrEmpty(res.ExtraData))
{
Debug.Log($"추가 데이터: {res.ExtraData}");
}
},
onError: error =>
{
Debug.LogError($"이전 시즌 기록 조회 실패: [{error.ErrorCode}] {error.Message}");
}
));
}
上赛季查询
可以通过 rotation_count 指定特定的上赛季。rotation_count=1 表示上一个赛季。
赛季记录
上赛季的记录为只读,无法修改。赛季结束后,该赛季的数据将被保留。