%%%-------------------------------------------------------------------
%% @Description: 源能转盘
%% author   :ljy
%% time     :21/3/8
%%--------------------------------------------------------------------

%% 玩家抽奖数据
-record(role_turntable_info, {
    score = 0,         % 积分
    lucky = 0,         % 源能值
    free_times = 0,    % 已使用的免费次数
    swap_list = []     % [{id, times}]
}).



%% 积分兑换表
-record(base_turntable_point_reward, {
    sub_id = 0,      % 活动id
    id  =  0,        % 奖励id
    reward = 0,      % 奖励
    limit = 0,       % 兑换限量
    points = 0       % 所需积分
}).

%% 转盘奖励表
-record(base_turntable_reward, {
    sub_id = 0,      % 活动id
    id = 0,          % 奖励id
    reward = [],     % 奖励
    weights = [],    % 权重
    is_tv = 0,       % 是否有传闻
    tag = []         % 标签
}).

%% -----------------SQL----------------------
-define (SQL_SELECT_TURNTABLE_LOTTERY_RECORD,
    <<"SELECT name, goods_id, num FROM turntable_lottery_record where sub_type = ~p ORDER BY id desc limit 30">>).

-define (SQL_INSERT_TURNTABLE_RECORD,
    <<"INSERT INTO turntable_lottery_record(`sub_type`, `name`, `goods_id`, `num`) values ~ts">>).

-define(SQL_TURNTABLE_RECORD_VALUES, "(~p, '~ts', ~p, ~p)").

-define(SELECT_ACT_TURNTABLE_ROLES,
    <<"SELECT `id` FROM `player_low` WHERE `lv` >= ~p ">>).

%% 查询定制活动保存的数据
-define(SELECT_ACT_TURNTABLE_DATA,
    <<"select `act_data` from `custom_act_data` where `rid`=~p and `type`=~p and `subtype`=~p">>).

-define (SQL_DELETE_TURNTABLE_RECORD,
    <<"DELETE FROM turntable_lottery_record where sub_type = ~p">>).