Compare commits

..

2 Commits

Author SHA1 Message Date
0dec0c9fcf fix 2025-08-04 17:59:18 +08:00
eaa7df3bae 增加对正式环境的支持 2025-08-04 16:57:43 +08:00
2 changed files with 9 additions and 11 deletions

View File

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

View File

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