跳转到主要内容

批量使用物品

一次性使用邮箱中的多个物品。

URL确认

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

API信息

  • URL: https://service-api.playnanoo.com/inbox/v20220901/consume/multi
  • Method: PUT
  • 需要认证: 是

请求参数

参数类型必填说明
item_keysarray必填要使用的物品密钥数组

响应数据

Res类

字段类型说明
itemsFSerializeItems[]已使用的物品列表

FSerializeItems 结构

字段类型说明
item_codeFString道具 代码
item_countint32道具 数量

代码示例

void UMyGame::ConsumeMultipleInboxItems(const TArray<FString>& ItemKeys)
{
// item_keys 배열 생성
TArray<TSharedPtr<FJsonValue>> ItemKeysArray;
for (const FString& Key : ItemKeys)
{
ItemKeysArray.Add(MakeShareable(new FJsonValueString(Key)));
}

// 플레이어 정보가 포함된 요청 바디 생성
TSharedPtr<FJsonObject> Body = FPlayNANOOHelper::CreateRequestBody();
Body->SetArrayField(TEXT("item_keys"), ItemKeysArray);

// JSON 문자열 변환
FString JsonBody = FPlayNANOOHelper::ToJsonString(Body);

// HTTP 요청
TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(TEXT("https://service-api.playnanoo.com/inbox/v20220901/consume/multi"));
Request->SetVerb(TEXT("PUT"));
FPlayNANOOHelper::SetCommonHeaders(Request, true); // 인증 토큰 포함
Request->SetContentAsString(JsonBody);

Request->OnProcessRequestComplete().BindLambda(
[](FHttpRequestPtr Req, FHttpResponsePtr Res, bool bSuccess)
{
if (bSuccess && Res.IsValid())
{
UE_LOG(LogTemp, Log, TEXT("우편함 다중 아이템 소비 성공"));
}
});

Request->ProcessRequest();
}
道具 Key 数组

item_keys是邮箱物品列表查询API返回的物品唯一密钥数组。