-define(SQL_VIE_RANK_GET,"SELECT `act`,`rid`,`name`,`server_id`,`server_num`,`vip`,`svip`,`score`,`rtime`,`dtime` FROM `vie_rank` WHERE `dtime` > ~p").
-define(SQL_VIE_RANK_BATCH,"REPLACE INTO `vie_rank`(`act`,`rid`,`name`,`server_id`,`server_num`,`vip`,`svip`,`score`,`rtime`,`dtime`) VALUES ~ts").
-define(SQL_VIE_RANK_INS,<<"REPLACE INTO `vie_rank`(`act`,`rid`,`name`,`server_id`,`server_num`,`vip`,`svip`,`score`,`rtime`,`dtime`) VALUES (~p,~p,'~ts',~p,~p,~p,~p,~p,~p,~p)">>).
-define(SQL_VIE_RANK_BATCH_DEL, <<"DELETE FROM `vie_rank` WHERE `act`=~p AND `rid` IN (~ts)">>).
%% log_vie_rank数据表语句.
-define(SQL_LOG_RANK_BATCH, <<"REPLACE INTO log_vie_rank (`act`,`zone`,`rid`,`name`,`server_id`,`server_num`,`score`,`rank`,`rtime`,`dtime`,`time`) VALUES ~ts">>).
-define(SQL_VIE_RANK_BY_DTIME, <<"DELETE FROM `vie_rank` WHERE `dtime`<~p ">>).

%%榜单管理
-record(vie_rank_mgr, {
	act_map = #{}     %%#{act->#{zone->ranks}}
}).

%%榜单数据
-record(vie_rank, {
	id = 0,
	name = "",
	server_num = 0,
	server_id = 0,
	act = 0,
	vip = 0,
	svip = 0,
	rank = 0,
	score = 0,
	rtime = 0, %%数据更新时间
	dtime = 0  %%数据有效时间  展示期
}).

-define(VIE_RECHARGE, recharge).
-define(VIE_CONSUME,  consume).
-define(VIE_ITEM,     item).