This commit is contained in:
anlicheng 2024-10-14 20:41:36 +08:00
parent 5a95d64c0e
commit 66f58d3e91
2 changed files with 6 additions and 6 deletions

View File

@ -37,7 +37,7 @@ init(Req0, Opts) ->
end.
%%
handle_request("POST", "/storeInfo", ReqBody) when is_binary(ReqBody) ->
handle_request("POST", "/api/device_info/storeInfo", ReqBody) when is_binary(ReqBody) ->
#{<<"storeInfos">> := StoreInfos} = jiffy:decode(ReqBody, [return_maps]),
lager:debug("[api_handler] get storeInfo: ~p", [StoreInfos]),
@ -46,7 +46,7 @@ handle_request("POST", "/storeInfo", ReqBody) when is_binary(ReqBody) ->
{ok, 200, json_reply(true, <<"接收成功"/utf8>>)};
%%
handle_request("POST", "/equip", ReqBody) ->
handle_request("POST", "/api/device_info/equip", ReqBody) ->
#{<<"equips">> := Equips} = jiffy:decode(ReqBody, [return_maps]),
lager:debug("[api_handler] get equips: ~p", [Equips]),
@ -55,7 +55,7 @@ handle_request("POST", "/equip", ReqBody) ->
{ok, 200, json_reply(true, <<"接收成功"/utf8>>)};
%% 线线
handle_request("POST", "/online", ReqBody) ->
handle_request("POST", "/api/device_info/online", ReqBody) ->
#{<<"equipStatus">> := Equips} = jiffy:decode(ReqBody, [return_maps]),
lager:debug("[api_handler] get online: ~p", [Equips]),
@ -64,7 +64,7 @@ handle_request("POST", "/online", ReqBody) ->
{ok, 200, json_reply(true, <<"接收成功"/utf8>>)};
%%
handle_request("POST", "/runStatus", ReqBody) ->
handle_request("POST", "/api/device_info/runStatus", ReqBody) ->
#{<<"equipRunStatus">> := EquipRunStatus} = jiffy:decode(ReqBody, [return_maps]),
lager:debug("[api_handler] get equipRunStatus: ~p", [EquipRunStatus]),
@ -73,7 +73,7 @@ handle_request("POST", "/runStatus", ReqBody) ->
{ok, 200, json_reply(true, <<"接收成功"/utf8>>)};
%%
handle_request("POST", "/order", ReqBody) ->
handle_request("POST", "/api/device_info/order", ReqBody) ->
%#{<<"equipRunStatus">> := EquipRunStatus} = jiffy:decode(ReqBody, [return_maps]),
lager:debug("[api_handler] get order: ~p", [ReqBody]),

View File

@ -35,7 +35,7 @@ start_http_server() ->
Dispatcher = cowboy_router:compile([
{'_', [
{"/[...]", api_handler, []}
{"/api/[...]", api_handler, []}
]}
]),