|
|
- %%% @author root <root@localhost.localdomain>
- %%% @copyright (C) 2018, root
- %%% @doc
- %%%
- %%% @end
- %%% Created : 3 Feb 2018 by root <root@localhost.localdomain>
-
- %% 称号操作
- -define(OP_ACTIVE, 1). %% 系统激活
- -define(OP_REMOVE, 2). %% 移除
- -define(OP_REPLACE, 3). %% 顶替
- -define(OP_PROP, 4). %% 道具激活
-
-
- %% 称号状态
- -define(STATUS_UNUSED, 0). %% 没有佩戴
- -define(STATUS_USED, 1). %% 佩戴中
-
- %% 结果
- -define(CODE_FAIL, 0). %% 失败
- -define(CODE_OK, 1). %% 成功
-
- -record(base_designation, {
- id = 0, %% 称号id
- name = "", %% 称号名称
- main_type = 0, %% 1-名人称号,2-成就称号,3情缘称号,4-活动称号
- description = "", %% 描述
- type = 1, %% 默认1,1图片称号,2文字称号
- is_trial = 0, %% 是否可体验 默认是0
- goods_id = 0, %% 道具激活的称号对应的物品ID,默认0
- attr_list = [], %% 属性奖励,格式:[{属性1,数值},{属性2,数值}……]
- resource_id = 0, %% 称号对应的资源ID,文字称号填0
- is_global = 0, %% 全局称号数量,0表示无限制
- color = 0, %% 称号名称显示的颜色,前端使用
- power = 0, %% 战力显示
- access_way = "", %% 获取途径
- access_id = [], %% 获取途径id
- index = 0 %% 排序字段
- ,force_cancel %% 是否可以强制取消
- }).
-
- %% 限时称号体验配置
- -record(base_dsgt_trial, {
- goods_id = 0, %% 物品id
- dsgt_id = 0, %% 称号id
- trial_time = 0, %% 体验时间
- is_overlay = 0 %% 是否可叠加 0|1
- }).
-
- -record(dsgt_status, {
- player_id = 0, %% 玩家id
- %% current_id = 0, %% 玩家当前佩戴的称号id
- dsgt_map = #{}, %% 当前玩家激活的称号列表 id => #designation
- attr = [], %% 当前所有激活称号的属性状态 []
- power = 0 %% 战力
- }).
-
- -record(designation, {
- id = 0, %% 称号id
- status = 0, %% 称号当前状态
- active_time = 0, %% 激活时间戳
- end_time = 0, %% 过期时间
- time = 0, %% 操作时间
- dress_time = 0, %% 穿戴时间
- is_replace = 1 %% 0被顶替 1为顶替 %% 非全局称号默认1,全局称号只有穿戴时是1,被替换时为0
- }).
-
- -record(active_para, {
- id = 0, %% 称号id
- goods_id = 0, %% 物品id
- expire_time = 0, %% 称号持续时长
- is_overlay = 0 %% 是否可叠加
- }).
-
- %% 获取正在佩戴的称号id
- -define(SQL_DSGT_SEL_USED_ID,
- <<"select id from `designation` where player_id=~p and status=1 limit 1">>).
-
- %% 获取玩家所有的称号id
- -define(SQL_DSGT_SEL_ID,
- <<"select id from `designation` where player_id=~p">>).
-
- %% 获取一个称号的佩戴状态和时效时间
- -define(SQL_DSGT_SEL_STATUS,
- <<"select status, endtime from `designation` where player_id=~p and id=~p and is_replace =1">>).
-
- %% Rep更新玩家称号
- -define(SQL_DSGT_REPLACE,
- <<"replace into `designation` set player_id=~p, id=~p, status=~p, active_time=~p, endtime=~p, time=~p,dress_time = ~p,is_replace =~p">>).
-
- %% Up更新玩家称号
- -define(SQL_DSGT_UP,
- <<"update designation set status=~p, active_time=~p, endtime=~p, time = ~p ,dress_time = ~p, is_replace = ~p where player_id = ~p and id=~p ">>).
-
- -define(SQL_DSGT_UP_DRESSTIME,
- <<"update designation set status=~p, active_time=~p, endtime=~p, time = ~p ,dress_time = ~p where player_id = ~p and id=~p ">>).
-
- -define(SQL_DSGT_UPDATE_STATUS,
- <<"update designation set status=~p where player_id = ~p and id=~p">>).
-
- -define(SQL_DSGT_UPDATE_ACTIVE_AND_END_TIME,
- <<"update designation set active_time=~p, endtime=~p, is_replace=~p where player_id=~p and id=~p">>).
-
- %% 删除
- -define(SQL_DSGT_AUTOID_BATCH_DELETE,
- <<"delete from `designation` where player_id=~p and id in (~s) ">>).
-
- %% 获取玩家所有的称号
- -define(SQL_All_DSGT_SELECT,
- <<"select id, status, active_time, endtime, time, dress_time, is_replace from `designation` where player_id=~p ">>).
-
- %获取玩家某条称号
- -define(SQL_ONE_DSGT_SELECT,
- <<"select id, status, active_time, endtime, time,dress_time,is_replace from `designation` where player_id=~p and id =~p">>).
-
- %% 获取所有获得同一个称号的玩家
- -define(SQL_DSGT_PLAYER_SELECT,
- <<"select player_id, active_time, is_replace from `designation` where id=~p">>).
-
- %% 删除玩家的称号
- -define(SQL_DSGT_DELETE,
- <<"delete from `designation` where player_id=~p and id = ~p">>).
-
- %% 只更新使用状态
- -define(SQL_DSGT_STATE_UP,
- << "update designation set status=~p, time = ~p ,dress_time = ~p where player_id = ~p and id=~p">>).
-
- %% 只更新顶替和使用状态
- -define(SQL_DSGT_STATE_ISREPLACE_UP,
- << "update designation set status=~p, time = ~p ,is_replace = ~p where player_id = ~p and id=~p">>).
-
- %% 更新称号结束时间
- -define(SQL_DSGT_UPDATE_ETIME,
- << "update designation set endtime = ~p, time = ~p where id = ~p and player_id in (~s)">>).
-
- %%获取穿戴记录
- -define(SQL_SELECT_LASTDRESS,
- <<"select id from `designation` where player_id=~p and dress_time > 0 and status=1">>).
-
- %获取穿戴历史记录
- -define(SQL_SELECT_DRESS_HISTORY,
- <<"select id,dress_time from `designation` where player_id=~p and id = ~p and dress_time > 0">>).
-
-
-
-
-
-
-
-
-
-
-
|