Compare commits

..

3 Commits

Author SHA1 Message Date
ed92f62a40 完善文档信息 2025-08-04 16:51:11 +08:00
ff98b783df 区分环境 2025-08-04 16:34:29 +08:00
774bf79897 fix 配置文件 2025-08-04 16:06:01 +08:00
2 changed files with 11 additions and 9 deletions

View File

@ -5,8 +5,9 @@
## api接口 ## api接口
### 1. 批量推送消息 ### 1. 批量推送消息
url: "/api/push?env=prod|dev" url: "/api/push"
method: POST method: POST
body: body:

View File

@ -86,15 +86,16 @@ read_body(Req, AccData) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
handle_request("POST", "/api/push", GetParams, Notifications) -> handle_request("POST", "/api/prod_push", _, Notifications) ->
Profile = case maps:get(<<"env">>, GetParams, <<"prod">>) of {ok, Pid} = dimension_apn_worker:start_link(apns_prod),
<<"prod">> ->
apns_prod;
<<"dev">> ->
apns_dev
end,
{ok, Pid} = dimension_apn_worker:start_link(Profile),
dimension_apn_worker:push(Pid, Notifications), dimension_apn_worker:push(Pid, Notifications),
{ok, 200, dimension_utils:json_data(<<"success">>)};
handle_request("POST", "/api/push", _, Notifications) ->
{ok, Pid} = dimension_apn_worker:start_link(apns_dev),
dimension_apn_worker:push(Pid, Notifications),
{ok, 200, dimension_utils:json_data(<<"success">>)}; {ok, 200, dimension_utils:json_data(<<"success">>)};
handle_request(_, Path, _, _) -> handle_request(_, Path, _, _) ->