修改公会信息
修改公会信息的 API。
URL 确认
此 API 使用 service-api.playnanoo.com 域名。
API 信息
- URL:
https://service-api.playnanoo.com/guild/v20230101/edit - Method:
PUT - 需要认证: 是
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| table_code | string | 必填 | 表代码 |
| uid | string | 必填 | 公会唯一 ID |
| name | string | 必填 | 公会名称 |
| member_limit | int | 必填 | 成员限制数 |
| member_point_type | string | 必填 | 成员积分类型 (keep: 保留积分, delete: 扣除积分) |
| auto_join | string | 必填 | 自动加入 (Y/N) |
| extra_data | string | 必填 | 附加数据 |
DeviceInfo 继承
此 API 的 Req 类继承自 DeviceInfo。DeviceInfo 的所有属性将自动包含。
响应数据
Res 类
| 字段 | 类型 | 说明 |
|---|---|---|
| Status | string | 处理状态 |
Unity C# 实现
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class GuildEdit
{
static string path = "https://service-api.playnanoo.com/guild/v20230101/edit";
[Serializable]
public class Req : DeviceInfo
{
public string table_code;
public string uid;
public string name;
public int member_limit;
public string member_point_type; //길드원 탈퇴시 keep : 포인트유지, delete : 포인트차감
public string auto_join;
public string extra_data;
public IEnumerator Send(
string tableCode,
string uid,
string name,
int memberLimit,
string memberPointType,
bool autoJoin,
string extraData,
Action<Res> onSuccess,
Action<BaseResponse> onError
)
{
if (!string.IsNullOrEmpty(tableCode)) this.table_code = tableCode;
if (!string.IsNullOrEmpty(uid)) this.uid = uid;
if (!string.IsNullOrEmpty(name)) this.name = name;
if (!string.IsNullOrEmpty(memberPointType)) this.member_point_type = memberPointType;
if (!string.IsNullOrEmpty(extraData)) this.extra_data = extraData;
this.auto_join = autoJoin ? "Y" : "N";
this.member_limit = memberLimit;
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 EditGuild()
{
GuildEdit.Req req = new GuildEdit.Req();
StartCoroutine(req.Send(
tableCode: "guild_table",
uid: "guild_uid",
name: "UpdatedGuildName",
memberLimit: 50,
memberPointType: "keep",
autoJoin: false,
extraData: "",
onSuccess: res =>
{
Debug.Log($"Status: {res.Status}");
},
onError: (error) =>
{
Debug.LogError($"길드 수정 실패: [{error.ErrorCode}] {error.Message}");
}
));
}