summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/map/query')
-rw-r--r-- | src/map/query/map_load.erl | 16 | ||||
-rw-r--r-- | src/map/query/map_update.erl | 16 |
2 files changed, 14 insertions, 18 deletions
diff --git a/src/map/query/map_load.erl b/src/map/query/map_load.erl index 2df9ca1..dde2fab 100644 --- a/src/map/query/map_load.erl +++ b/src/map/query/map_load.erl @@ -3,8 +3,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --include("../../../include/yaws_api.hrl"). - -record ( input, @@ -34,9 +32,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec parse_input (binary()) -> input(). -parse_input (Req) -> - JSONReqMap = jiffy:decode(Req, [return_maps]), +-spec parse_input (shr_query:type()) -> input(). +parse_input (Query) -> + JSONReqMap = shr_query:get_params(Query), PlayerID = maps:get(<<"pid">>, JSONReqMap), SessionToken = maps:get(<<"stk">>, JSONReqMap), MapID = maps:get(<<"mid">>, JSONReqMap), @@ -87,9 +85,9 @@ generate_reply (QueryState) -> Output. --spec handle (binary()) -> binary(). -handle (Req) -> - Input = parse_input(Req), +-spec handle (shr_query:type()) -> binary(). +handle (Query) -> + Input = parse_input(Query), case authenticate_user(Input) of ok -> shr_security:lock_queries(Input#input.player_id), @@ -107,5 +105,5 @@ out(A) -> { content, "application/json; charset=UTF-8", - handle(A#arg.clidata) + handle(shr_query:new(A)) }. diff --git a/src/map/query/map_update.erl b/src/map/query/map_update.erl index 0989933..b6e36c2 100644 --- a/src/map/query/map_update.erl +++ b/src/map/query/map_update.erl @@ -3,8 +3,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --include("../../../include/yaws_api.hrl"). - -record ( input, @@ -37,9 +35,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec parse_input (binary()) -> input(). -parse_input (Req) -> - JSONReqMap = jiffy:decode(Req, [return_maps]), +-spec parse_input (shr_query:type()) -> input(). +parse_input (Query) -> + JSONReqMap = shr_query:get_params(Query), PlayerID = maps:get(<<"pid">>, JSONReqMap), SessionToken = maps:get(<<"stk">>, JSONReqMap), MapID = maps:get(<<"mid">>, JSONReqMap), @@ -166,9 +164,9 @@ commit_update (QueryState, Input) -> generate_reply () -> jiffy:encode([shr_okay:generate()]). --spec handle (binary()) -> binary(). -handle (Req) -> - Input = parse_input(Req), +-spec handle (shr_query:type()) -> binary(). +handle (Query) -> + Input = parse_input(Query), case authenticate_user(Input) of ok -> shr_security:lock_queries(Input#input.player_id), @@ -188,5 +186,5 @@ out(A) -> { content, "application/json; charset=UTF-8", - handle(A#arg.clidata) + handle(shr_query:new(A)) }. |