源战役
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

41 строка
1.8 KiB

1 месяц назад
  1. %% ---------------------------------------------------------
  2. %% Author: xyao
  3. %% Email: jiexiaowen@gmail.com
  4. %% Created: 2012-5-4
  5. %% Description: 手动变更
  6. %% --------------------------------------------------------
  7. -define(COUNTER_GLOBAL_KEY, "mod_global_counter").
  8. -define(DEFAULT_SUB_MODULE, 0). %% 默认模块子id设为0
  9. -define(DEFAULT_OTHER, []). %% 默认other扩展数据
  10. %% 终生次数记录
  11. -record(ets_global_counter, {
  12. id = {0,0}, %% {模块id, 模块子id, 类型}
  13. count = 0, %% 数量
  14. other = [], %% 扩展数据
  15. refresh_time = 0, %% 最后修改时间
  16. first_time = 0 %% 第一次记录时间
  17. }).
  18. -record(base_global_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_global_sel_all,
  27. <<"SELECT `module`, `sub_module`, `type`, `count`, `other`, `refresh_time`, `first_time` FROM `counter_global`">>).
  28. -define(sql_counter_global_upd,
  29. <<"REPLACE INTO `counter_global` (`module`, `sub_module`, `type`, `count`, `other`, `refresh_time`, `first_time`) VALUES (~p, ~p, ~p, ~p, '~s', ~p, ~p)">>).
  30. -define(sql_counter_global_clear,
  31. <<"delete from `counter_global` WHERE module = ~p and sub_module = ~p and type = ~p">>).
  32. -define(sql_counter_global_sel,
  33. <<"SELECT `count`, `refresh_time`, `other`, `first_time` FROM `counter_global` WHERE module = ~p and sub_module = ~p and type = ~p">>).