diff --git a/apps/njau_bot/src/http_handler/api_handler.erl b/apps/njau_bot/src/http_handler/api_handler.erl index 998f386..c63df0c 100644 --- a/apps/njau_bot/src/http_handler/api_handler.erl +++ b/apps/njau_bot/src/http_handler/api_handler.erl @@ -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]), diff --git a/apps/njau_bot/src/njau_bot_app.erl b/apps/njau_bot/src/njau_bot_app.erl index 4e462fe..fc73f3b 100644 --- a/apps/njau_bot/src/njau_bot_app.erl +++ b/apps/njau_bot/src/njau_bot_app.erl @@ -35,7 +35,7 @@ start_http_server() -> Dispatcher = cowboy_router:compile([ {'_', [ - {"/[...]", api_handler, []} + {"/api/[...]", api_handler, []} ]} ]),