GetGuildCurrency
public BackndGuildGoodsReturnObject GetGuildCurrency(string guildIndate);
GetReturnValueByGuildGoods
If an error occurred, null is returned.
BackndDirectMessageReturnObject bro = Backnd.Guild.GetGuildCurrency("guildIndate");
Debug.Log(bro.GetReturnValueByGuildGoods().ToString());
BackndGuildGoodsItem
public class BackndGuildGoodsItem
{
public string[] totalGoodsAmount = new string[10] {
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0"
};
public List<BackndGuildGoodsPlayerItem>[] goodsPlayerList = new List<BackndGuildGoodsPlayerItem>[10] {
null, null, null, null, null, null, null, null, null, null
};
}
public class BackndGuildGoodsPlayerItem
{
public string usingTotalAmount = "0";
public string totalAmount = "0";
public string inDate = string.Empty;
public string nickname = string.Empty;
public string updatedAt = string.Empty;
}
Parameter
Value | Type | Description |
---|---|---|
guildIndate | string | inDate of guild to be searched |
Description
Searches the goods history of the guild with the guildIndate.
Example
Synchronous
Backnd.Guild.GetGuildCurrency("guildIndate");
Asynchronous
Backnd.Guild.GetGuildCurrency("guildIndate", (callback) =>
{
// Post-process
});
Return cases
Success cases
When the lookup is successful
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
Error cases
When the user calls the InDate of a non-existent guild
statusCode : 404
errorCode : NotFoundException
When the InDate is not entered
statusCode : 404
errorCode : NotFoundException
GetReturnValuetoJSON
{
// Goods history
goods:{
// Time of update
updatedAt :
{ S: "2018-11-29T02:03:36.816Z"},
// 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:[ ] },
}
}
}
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 GetGuildCurrency()
{
var bro = Backnd.Guild.GetGuildCurrency("2021-12-16T08:51:00.706Z");
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";
BACKND.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");
}
}