Skip to main content
Version: 5.11.6

GetMyGuildGoodsV3

public BackendReturnObject GetMyGuildGoodsV3();

Description

Looks up the details of goods in my guild.

Example

Synchronous

Backend.Guild.GetMyGuildGoodsV3();

Asynchronous

Backend.Guild.GetMyGuildGoodsV3((callback) => 
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Guild.GetMyGuildGoodsV3, (callback) => 
{
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

Error cases

When you do not belong to the guild
statusCode : 412
errorCode : PreconditionFailed

GetReturnValuetoJSON

{
// Goods history
goods:{
// Total amount of contribution + use of goods 1
totalGoods1Amount:
{ N: "0" },
// List of users who contributed/used goods 1
goods1UserList:
{ L: [
{
M:{
// Time when the goods are first contributed or used
inDate:{
S: "2018-11-29T02:03:36.816Z"
},
// User nickname
nickname:{
S: "id19"
},
// Total amount of used goods(exists only for guild masters)
usingTotalAmount:{
N: "-1"
},
// Total amount of contributed goods
totalAmount:{
N: "1"
},
// Time of last contribution or use
updatedAt: {
S: "2019-07-10T07:02:39.223Z"
}
}
}
] },
// Total amount of contribution + use of goods 2
totalGoods2Amount:
{ N: "0" },
// List of users who contributed/used goods 2
goods2UserList:
{ L:[ ] },
// Total amount of contribution + use of goods 3
totalGoods3Amount:
{ N: "0" },
// List of users who contributed/used goods 3
goods3UserList:
{ L:[ ] },
// Total amount of contribution + use of goods 4
totalGoods4Amount:
{ N: "0" },
// List of users who contributed/used goods 4
goods4UserList:
{ L:[ ] },
// Total amount of contribution + use of goods 5
totalGoods5Amount:
{ N: "0" },
// List of users who contributed/used goods 5
goods5UserList:
{ L:[ ] },
admin: // Increase and decrease the history of goods edited in the console
{M:
{ goods1: // Edit history of goods 1
{M:
{
"usingTotalAmount":{"N":"-100"},
"totalAmount":{"N":"1000"},
"updatedAt":{"S":"2021-07-26T03:12:16.317Z"}
}
}
}
{ goods2: // Edit history of goods 2
{M:
{
"usingTotalAmount":{"N":"-300"},
"totalAmount":{"N":"50"},
"updatedAt":{"S":"2021-07-22T01:14:33.426Z"}
}
}
}
},
}
}
}

Sample code

public class GoodsItem
{
public int totalGoodsAmount;
public List<GoodsUserItem> userList = new List<GoodsUserItem>();
public override string ToString()
{
string userString = string.Empty;
for(int i = 0; i < userList.Count; i++)
{
userString += userList[i].ToString() + "\n";
}
return $"[totalGoodsAmount : {totalGoodsAmount}]\n" +
$"{userString}\n";
}
}

public class GoodsUserItem
{
public int usingTotalAmount;
public int totalAmount;
public string inDate;
public string nickname;
public string updatedAt;
public override string ToString()
{
return $"\tnickname : {nickname}\n" +
$"\tinDate : {inDate}\n" +
$"\ttotalAmount : {totalAmount}\n" +
$"\tusingTotalAmount : {usingTotalAmount}\n" +
$"\tupdatedAt : {updatedAt}\n";
}
}
public void GetMyGuildGoodsV3()
{
var bro = Backend.Guild.GetMyGuildGoodsV3();

if(!bro.IsSuccess())
return;

Dictionary<string, GoodsItem> goodsDictionary = new Dictionary<string, GoodsItem>();

var goodsJson = bro.GetFlattenJSON()["goods"];
foreach(var column in goodsJson.Keys)
{
if(column.Contains("totalGoods"))
{
GoodsItem goodsItem = new GoodsItem();

goodsItem.totalGoodsAmount = int.Parse(goodsJson[column].ToString());

string goodsNum = column.Replace("totalGoods", "");
goodsNum = goodsNum.Replace("Amount", "");

string goodsName = "goods" + goodsNum + "UserList";

LitJson.JsonData userListJson = goodsJson[goodsName];
for(int i = 0; i < userListJson.Count; i++)
{
GoodsUserItem user = new GoodsUserItem();

user.inDate = userListJson[i]["inDate"].ToString();
user.nickname = userListJson[i]["nickname"].ToString();
if(userListJson[i].ContainsKey("usingTotalAmount"))
{
user.usingTotalAmount = int.Parse(userListJson[i]["usingTotalAmount"].ToString());
}
user.totalAmount = int.Parse(userListJson[i]["totalAmount"].ToString());
user.updatedAt = userListJson[i]["updatedAt"].ToString();

goodsItem.userList.Add(user);
}
goodsDictionary.Add("goods" + goodsNum, goodsItem);
}
}

foreach(var dic in goodsDictionary)
{
Debug.Log($"-----{dic.Key}------\n" +
$"{dic.Value.ToString()}\n");
}
}