|
%% ---------------------------------------------------------
|
|
%% Author: xyao
|
|
%% Email: jiexiaowen@gmail.com
|
|
%% Created: 2012-5-4
|
|
%% Description: 日 ,周,目标 ets
|
|
%% --------------------------------------------------------
|
|
|
|
-define(COUNTER_KEY, "mod_counter").
|
|
|
|
-define(DEFAULT_SUB_MODULE, 0). %% 默认模块子id设为0
|
|
-define(DEFAULT_OTHER, []). %% 默认other扩展数据
|
|
-define(DEFAULT_COUNT, 0). %% 默认数量(请勿改动)
|
|
|
|
%% 终生次数记录
|
|
-record(ets_counter, {
|
|
id = {0,0}, %% {模块id, 模块子id, 类型}
|
|
count = 0, %% 数量
|
|
other = [], %% 扩展数据
|
|
refresh_time = 0 %% 最后修改时间
|
|
}).
|
|
|
|
-record(base_counter, {
|
|
module = 0, %% 所属模块id
|
|
sub_module = 0, %% 模块子id
|
|
id = 0, %% 次数id
|
|
limit = 0, %% 上限
|
|
about = <<>> %% 描述(无用字段,仅为方便查看含义)
|
|
}).
|
|
|
|
%% 终生次数记录
|
|
-define(sql_counter_role_sel_all, <<"SELECT `module`, `sub_module`, `type`, `count`, `other`, `refresh_time` FROM `counter` WHERE role_id=~p">>).
|
|
-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)">>).
|
|
-define(sql_counter_role_upd_batch, <<"REPLACE INTO `counter` (`role_id`, `module`, `sub_module`, `type`, `count`, `other`, `refresh_time`) VALUES ~s">>).
|
|
-define(sql_counter_role_clear, <<"delete from `counter` where `role_id` = ~p">>).
|
|
-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">>).
|
|
-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)">>).
|
|
%%%---------------------------------------------------------------------
|
|
%%% 常量定义
|
|
%%%---------------------------------------------------------------------
|
|
|
|
-define (COUNT_ID_417_DOWNLOAD_FIGT, 1). %% 下载礼包
|