源战役
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.5 KiB

  1. %%%------------------------------------
  2. %%% @Module : consume_rank_act.hrl
  3. %%% @Author : fwx
  4. %%% @Created : 2018-1-5
  5. %%% @Description: 充值消费榜活动
  6. %%%------------------------------------
  7. -define(RANK_TYPE_RECHARGE, 381). %% 充值
  8. -define(RANK_TYPE_CONSUME, 382). %% 消费
  9. %% 榜单的角色信息
  10. %% 注意:需要排序的话,使用value、second_value、third_value,不要用其他字段
  11. -record(rank_role, {
  12. role_key = undefined, % 玩家唯一键 {RankType, Roleid}
  13. rank_type = 0, % 榜单类型
  14. sub_type = 0, % 活动子类型
  15. role_id = 0, % 角色id
  16. is_public = 0, % 是否公开金额 0-不公开 1-公开
  17. award_state = [], % 奖励领取状态 0-未领取 1-已领取
  18. value = 0, % 值 (排序值)
  19. second_value = 0, % 保留值
  20. third_value = 0, % 保留值
  21. time = 0, % 时间
  22. rank = 0 % 排名
  23. }).
  24. %% 进程状态
  25. -record(rank_state, {
  26. rank_maps = maps:new(), % {RankType, SubType} => [#rank_role{}|...]
  27. role_maps = maps:new(), % {RankType, SubType} => [#rank_role{}|...]
  28. rank_limit = maps:new() % {RankType, SubType} => Limit
  29. }).
  30. %%-----------------select--------------------%%
  31. -define(sql_rank_role_select, <<"
  32. SELECT
  33. rank_type, sub_type, player_id, is_public, award_state, value, second_value, third_value, time
  34. FROM consume_rank_act">>).
  35. %%-----------------update--------------------%%
  36. -define(sql_rank_role_update,
  37. <<"update `consume_rank_act` set `is_public` = ~p where rank_type = ~p and sub_type = ~p and player_id = ~p">>).
  38. %--------------replace-----------%
  39. -define(sql_rank_role_save, <<"
  40. replace into consume_rank_act(
  41. rank_type, sub_type, player_id, is_public, award_state, value, second_value, third_value, time
  42. ) values(~p, ~p, ~p, ~p, '~s', ~p, ~p, ~p, ~p)">>).
  43. %--------------delete--------------%
  44. -define(sql_rank_role_delete_by_role_id, <<"delete from consume_rank_act
  45. where rank_type = ~p and sub_type = ~p and player_id = ~p">>).
  46. %---------删除活动子类对应数据-----------%
  47. -define(sql_rank_role_clear,
  48. <<"delete from `consume_rank_act` where rank_type = ~p and sub_type = ~p">>).