源战役
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.

41 rivejä
2.2 KiB

4 viikkoa sitten
  1. %% ---------------------------------------------------------
  2. %% Author: xyao
  3. %% Email: jiexiaowen@gmail.com
  4. %% Created: 2012-5-4
  5. %% Description: 日 ,周,目标 ets
  6. %% --------------------------------------------------------
  7. -define(COUNTER_KEY, "mod_counter").
  8. -define(DEFAULT_SUB_MODULE, 0). %% 默认模块子id设为0
  9. -define(DEFAULT_OTHER, []). %% 默认other扩展数据
  10. -define(DEFAULT_COUNT, 0). %% 默认数量(请勿改动)
  11. %% 终生次数记录
  12. -record(ets_counter, {
  13. id = {0,0}, %% {模块id, 模块子id, 类型}
  14. count = 0, %% 数量
  15. other = [], %% 扩展数据
  16. refresh_time = 0 %% 最后修改时间
  17. }).
  18. -record(base_counter, {
  19. module = 0, %% 所属模块id
  20. sub_module = 0, %% 模块子id
  21. id = 0, %% 次数id
  22. limit = 0, %% 上限
  23. about = <<>> %% 描述(无用字段,仅为方便查看含义)
  24. }).
  25. %% 终生次数记录
  26. -define(sql_counter_role_sel_all, <<"SELECT `module`, `sub_module`, `type`, `count`, `other`, `refresh_time` FROM `counter` WHERE role_id=~p">>).
  27. -define(sql_counter_role_upd, <<"REPLACE INTO `counter` (`role_id`, `module`, `sub_module`, `type`, `count`, `other`, `refresh_time`) VALUES (~p, ~p, ~p, ~p, ~p, '~s', ~p)">>).
  28. -define(sql_counter_role_upd_batch, <<"REPLACE INTO `counter` (`role_id`, `module`, `sub_module`, `type`, `count`, `other`, `refresh_time`) VALUES ~s">>).
  29. -define(sql_counter_role_clear, <<"delete from `counter` where `role_id` = ~p">>).
  30. -define(sql_counter_role_sel, <<"SELECT `count`, `refresh_time`, `other` FROM `counter` WHERE role_id=~p and module = ~p and sub_module = ~p and type = ~p">>).
  31. -define(sql_counter_role_sel_count, <<"SELECT `type`, `count` FROM `counter` WHERE role_id=~p and module = ~p and sub_module = ~p and type in (~s)">>).
  32. %%%---------------------------------------------------------------------
  33. %%% 常量定义
  34. %%%---------------------------------------------------------------------
  35. -define (COUNT_ID_417_DOWNLOAD_FIGT, 1). %% 下载礼包