타이니그램 컨텐츠 서버 디자인

🔷 선물하기

  1. 선물리스트
    • UT_GiftList 테이블추가
    • Column : user_Idx, ItemIDX, Count, gift_count_last_update_date
  2. 선물하기 횟수 서버관리
    • GetGiftList 요청시 Row가 없다면 Insert
    • GiftCount -> item으로 구분 짓고 UT_GiftList에서 관리 ST_Item -> Idx = 5로 유료재화 타입으로 지정
    • 선물 가능 횟수 리셋 (일일)
      • 선물 리스트 요청시 UT_GiftList -> last_update_date ? <= Today
  3. 선물구매 (다이아)
  4. 선물하기 횟수 구매(다이아)

🔷 랭킹

Redis 활용 Sorted Set

AT_RankSeason 테이블 생성 idx, season_start_time, season_end_time, season_reward_flag

Collection = relation_rank_{0}_{1} = {0} idx, {1}MemberIDX = 상수(1~7) (주차별 적용 TTL값 30일 지정 자동삭제) Key = UserIDX Value = relationPoint - 주마다 초기화 ST_Define -> RANK_SEASON_DAY, RANK_CHECK_TIME

  1. 호감도
  2. 멤버별 랭킹보드 (7개)
  3. 주마다 초기화

🔷 랭킹집계

  1. 1주일 주기
    • 랭킹집계
    • 보상우편 발송

🔷 Protocol


1️⃣ GetTinygramInfo 타이니그램 정보 요청 * 선물리스트와 선물가능횟수 데이터 요청

Request DESC : 서버는 itemtype = 5는 last_update_date 체크후 gift_count초기화가 이뤄지지 않았으면 일일충전량(7개)초기화 후 데이터를 보내준다.

{
	"id": "eae7c783",
	"method" : 1000,
	"params" : {},
	"sess" : "ce3ad94c7971c62a7de3718b2fde66f31463e1a0e1122865a0801583"
}

Response DESC : 클라이언트는 itemtype = 5 는 선물 가능 횟수이므로 별도 처리한다.

{
	"id": "eae7c783",
	"result":
    {
        "tinygram_gift_info" :
        [
            {
                "type" : 5,
                "idx" : 5,
                "cnt" : 7
            },
            {
                "type" : 50,
                "idx" : 12,
                "cnt" : 35
            },
            {
                "type" : 50,
                "idx" : 35,
                "cnt" : 124
            }
        ]
	},
	"server_time" : 1648091997
}
* Response Data 
	1. 각 맴버별 랭킹 순위 1~10위
	2. 현재 유저 멤버별 호감도 
	3. 선물 가능 횟수




2️⃣ Request(method: ) 맴버별 1~10순위와 자신의 랭킹정보 요청

params : memberIdx (1~7)

Request DESC : 멤버IDX에 해당하는 1~10위까지 랭킹 유저 정보와 현재 플레이어의 정보를 요청

{
	"id": "eae7c783",
	"method" : 1000,
	"params" : { 
		"member_idx" : 3,
	},
	"sess" : "ce3ad94c7971c62a7de3718b2fde66f31463e1a0e1122865a0801583"
}

Response

{
	"id": "eae7c783",
	"result":
    {
        "member_idx" : 1,
        "rank" : 
        [
            {
                "rank" : 1, 
                "nick" : "1등유저",
                "score" : 100
            },
            {
                "rank" : 2, 
                "nick" : "2등유저",
                "score" : 80
            }	
        ],
        "mine" :
        {
            "rank" : 213213,
            "score" : 12
        }
    },
	"server_time" : 1648091997
}




2️⃣ SendGift 선물보내기 Request member_idx = 멤버idx item = 선물하는 아이템 정보

{
	"id": "eae7c783",
	"method" : 1000,
	"params" : { 
        "member_idx" : 1,
        "item" : 
        {
            "type" : 50,
    		"idx" : 50,
            "cnt" : 10
        }
	},
	"sess" : "ce3ad94c7971c62a7de3718b2fde66f31463e1a0e1122865a0801583"
}

Response 랭크 집계시간 확인 선물 가능시간 체크

MemberIDX = 선물을 받은 멤버IDX mine = 선물 보내기 이후 누적 스코어 정보 item = 소진한 아이템 정보

{
	"id": "eae7c783",
	"result":
    {
        "member_idx" : 1,
        "mine" : {
            "rank" : 213213,
            "score" : 12
        },
        "item" :
        {
                "type" : 5,
                "idx" : 5,
                "cnt" : 7
        }
	},
	"server_time" : 1648091997
}




3️⃣ BuyGift 선물구매 Request idx = ST_Item -> Idx

{
	"id": "eae7c783",
	"method" : 1000,
	"params" : { 
		"idx" : 1,
		"cnt" : 10
	},
	"sess" : "ce3ad94c7971c62a7de3718b2fde66f31463e1a0e1122865a0801583"
}

Response idx = ST_Item -> Idx 구매한 아이템 idx totalCnt = 구매성공후 누적 아이템 갯수

{
	"id": "eae7c783",
	"result":
    {
        "item" :
        {
                "type" : 5,
                "idx" : 5,
                "cnt" : 7
        },
        "user" :
        {
            "cash" : 10,
            "free_cash" : 5
        }
    },
	"server_time" : 1648091997
}




4️⃣ BuyGiftChance 선물하기 횟수 구매 Request DESC : 구매하려는 갯수를 요청

{
	"id": "eae7c783",
	"method" : 1000,
	"params" : { 
		"cnt" : 3,
	},
	"sess" : "ce3ad94c7971c62a7de3718b2fde66f31463e1a0e1122865a0801583"
}

Response DESC : 서버는 재화확인후 차감

구매성공이후 누적 선물가능횟수 전송

{
	"id": "eae7c783",
	"result":
    {
        //카운트 정보
        "item" : 
        {
            "idx" : 5,
            "type" : 5,
            "cnt" : 7
        }
	},
	"server_time" : 1648091997
}