跳转到主要内容

删除玩家

用于从排行榜中删除特定玩家记录的 API。

URL 确认

此 API 使用 service-api.playnanoo.com 域名。

API 信息

  • URL: https://service-api.playnanoo.com/leaderboard/v20240301/delete
  • Method: PUT
  • 需要认证: 是
DeviceInfo 继承

此 API 的 Req 类继承自 DeviceInfo。DeviceInfo 的所有属性会自动包含。

请求参数

参数类型必填说明
uidstring必填表代码
record_idstring必填要删除的记录 ID(玩家标识符)

响应数据

Res 类

字段类型说明
Statusstring处理状态

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 PlayerDelete
{
static string path = "https://service-api.playnanoo.com/leaderboard/v20240301/delete";

[Serializable]
public class Req : DeviceInfo
{
public string uid;
public string record_id;

public IEnumerator Send(string table_code, string recordId, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(table_code)) this.uid = table_code;
if (!string.IsNullOrEmpty(recordId)) this.record_id = recordId;

yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}

[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}

使用示例

public void DeletePlayerRecord()
{
PlayerDelete.Req req = new PlayerDelete.Req();

StartCoroutine(req.Send(
table_code: "my_leaderboard_table",
recordId: "player_001",
onSuccess: res =>
{
Debug.Log("플레이어 기록 삭제 성공");
Debug.Log($"상태: {res.Status}");
},
onError: error =>
{
Debug.LogError($"플레이어 기록 삭제 실패: [{error.ErrorCode}] {error.Message}");
}
));
}
删除注意事项

已删除的记录无法恢复。建议在删除前务必经过确认流程。