현재 개발자 문서는 SDK 5.11.1 버전 이후로 업데이트 되지 않는 문서입니다.

새로운 기능이 업데이트 되는 NEW 개발자 문서를 이용해 주세요!

뒤끝 SDK Version   

GetMyGuildGoodsV3

public BackendReturnObject GetMyGuildGoodsV3();

설명

내가 속한 길드의 굿즈 내역을 조회합니다.

Example

동기

Backend.Guild.GetMyGuildGoodsV3();

비동기

Backend.Guild.GetMyGuildGoodsV3( ( callback ) => 
{
    // 이후 처리
});

SendQueue

SendQueue.Enqueue(Backend.Guild.GetMyGuildGoodsV3, ( callback ) => 
{
    // 이후 처리
});

ReturnCase

Success cases

조회에 성공한 경우
statusCode : 200
message : Success
returnValue : GetReturnValuetoJSON 참조

Error cases

길드에 속하지 않은 경우
statusCode : 412
errorCode : PreconditionFailed
message : notGuildMember 사전 조건을 만족하지 않습니다.

GetReturnValuetoJSON

{
    // 굿즈 내역
    goods:{
        // 굿즈 1 기부 + 사용 총량
        totalGoods1Amount:
            { N: "0" },
        // 굿즈 1 기부/사용 유저 리스트
        goods1UserList:
            { L: [ 
                {
                    M:{
                        // 처음으로 굿즈 기부 혹은 사용한 시점
                        inDate:{
                            S: "2018-11-29T02:03:36.816Z"
                        },
                        // 유저 닉네임
                        nickname:{
                            S: "id19"
                        },
                        // 사용한 총 굿즈량 (길드 마스터만 존재)
                        usingTotalAmount:{
                            N: "-1"
                        },
                        // 기부한 총 굿즈량
                        totalAmount:{
                            N: "1"
                        },
                        // 마지막 기부 혹은 사용 시점
                        updatedAt: {
                            S: "2019-07-10T07:02:39.223Z"
                        }
                    }
                }
            ] },
        // 굿즈 2 기부 + 사용 총량
        totalGoods2Amount:
            { N: "0" },
        // 굿즈 2 기부/사용 유저 리스트
        goods2UserList:
            { L:[ ] },
        // 굿즈 3 기부 + 사용 총량
        totalGoods3Amount:
            { N: "0" },
        // 굿즈 3 기부/사용 유저 리스트
        goods3UserList:
            { L:[ ] },
        // 굿즈 4 기부 + 사용 총량
        totalGoods4Amount:
            { N: "0" },
        // 굿즈 4 기부/사용 유저 리스트
        goods4UserList:
            { L:[ ] },
        // 굿즈 5 기부 + 사용 총량
        totalGoods5Amount:
            { N: "0" },
        // 굿즈 5 기부/사용 유저 리스트
        goods5UserList:
            { L:[ ] },
       	admin: // 콘솔에서 수정한 굿즈 증감 내역
	{M:
		{ goods1: // 굿즈1의 수정 내역
			{M:
				{
				 "usingTotalAmount":{"N":"-100"},
				 "totalAmount":{"N":"1000"},
				 "updatedAt":{"S":"2021-07-26T03:12:16.317Z"}
				}
			}
		}
		{ goods2: // 굿즈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 = Int32.Parse(goodsJson[column].ToString());

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

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

            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 = Int32.Parse(userListJson[i]["usingTotalAmount"].ToString());
                }
                user.totalAmount = Int32.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");
    }
}

이 문서가 도움이 되었나요?