%%-----------------------------------------------------------------------------
%% @Module  :       investment.hrl
%% @Author  :       J
%% @Email   :       j-som@foxmail.com
%% @Created :       2017-12-18
%% @Description:    投资活动
%%-----------------------------------------------------------------------------
%% 默认初始轮次
-define(INVESTMENT_DEFAULT_ROUND, 1).

%% 投资类型
-define(INVESTMENT_TYPE_1,  1).
-define(INVESTMENT_TYPE_2,  2).

%% 购买的投资信息
-record (investment, {
    type        = 0,           %% 投资类型
    round       = 0,           %% 投资档位
    is_buy      = 0,           %% 是否已购买
    reward_info = [],          %% 领奖状态
    buy_time    = 0            %% 购买时间
}).

%% 配置
-record (base_investment_reward, {
      type
    , level
    , id
    , rewards
    , condition
    }).

-record (base_investment_type, {
    type
    , name
    , level
    , price
    , price_type
    , clear_type        %% 1领完重置|0不重置
    , condition
    }).

%% DB
-define (sql_select_investment_data, <<"SELECT `type`, `lv`, `is_buy`, `reward_info`, `buy_time` FROM `investment_data` WHERE `role_id`= ~p">>).
-define (sql_save_investment_data, <<"REPLACE INTO `investment_data` (`role_id`, `type`, `lv`, `is_buy`, `buy_time`, `reward_info`) VALUES (~p, ~p, ~p, ~p, ~p, '~ts')">>).