diff --git a/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl b/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl index 98a9c17..c1e640a 100644 --- a/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl +++ b/apps/iot/src/endpoint/iot_jinzhi_endpoint.erl @@ -94,7 +94,8 @@ handle_call(_Request, _From, State = #state{}) -> {stop, Reason :: term(), NewState :: #state{}}). handle_cast({forward, LocationCode, DynamicLocationCode, EventType, Params}, State = #state{id = Id, timer_map = TimerMap, pri_key = PriKey, url = Url}) -> ReqBody = format_event(LocationCode, DynamicLocationCode, EventType, Params, PriKey), - catch do_post(Url, Id, ReqBody), + Res = catch do_post(Url, Id, ReqBody), + lager:debug("[iot_jinzhi_endpoint] format_data: ~p, post result: ~p", [ReqBody, Res]), TimerRef = erlang:start_timer(?RETRY_INTERVAL, self(), {repost_ticker, Id, ReqBody}), {noreply, State#state{id = Id + 1, timer_map = maps:put(Id, TimerRef, TimerMap)}}. @@ -106,6 +107,7 @@ handle_cast({forward, LocationCode, DynamicLocationCode, EventType, Params}, Sta {noreply, NewState :: #state{}, timeout() | hibernate} | {stop, Reason :: term(), NewState :: #state{}}). handle_info({ack, Id, Body, RespBody}, State = #state{timer_map = TimerMap, logger_pid = LoggerPid}) -> + lager:debug("[iot_jinzhi_endpoint] get ack: ~p", [Body]), %% 记录日志 iot_logger:write(LoggerPid, [Body, RespBody]), case maps:take(Id, TimerMap) of