Skip to content

Commit

Permalink
WIP:
Browse files Browse the repository at this point in the history
  • Loading branch information
AvantLiu committed Sep 22, 2021
1 parent 1898ebe commit f80b160
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 71 deletions.
62 changes: 0 additions & 62 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion apps/dgiot_gb26875/priv/swagger/swagger_gb26875.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"description": ""
}
},
"summary": "解码",
"summary": "编码",
"tags": [
"gb26875"
]
Expand Down
2 changes: 1 addition & 1 deletion apps/dgiot_gb26875/src/handler/dgiot_gb26875_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ do_request(get_decoder, #{<<"buff">> := Buff}, _Context, _Req) ->
do_request(post_encoder, Body, _Context, _Req) ->
io:format("Body ~p~n", [Body]),
R = dgiot_gb26875_decoder:to_frame(Body),
{ok, R};
{ok, #{<<"buff">> => dgiot_utils:binary_to_hex(R)}};


%% PumpTemplet 概要: 新增报告模板 描述:新增报告模板
Expand Down
4 changes: 2 additions & 2 deletions apps/dgiot_http/etc/dgiot_http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ umeng.appkey = 5f8bfc1780455950e4ad0482
umeng.masterkey = ilkx2mnd2ec9u0t4h77qnx0bopy46bso

#微信公众号
wechat.appid = wx15f5652fads254
wechat.secret = 4a28e7ddfsd44efd8fa46adsffdsde7de
wechat.appid = wxb37f3990d2424ea0
wechat.secret = 0c8b9e229ebe48c6878727a9d2e0263d
4 changes: 2 additions & 2 deletions apps/dgiot_http/src/wechat/dgiot_wechat.erl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ post_sns(UserName, Password, OpenId) ->
{error, <<OpenId/binary, " is bind ", Name/binary>>};
_ ->
case dgiot_parse:login(UserName, Password) of
{ok, #{<<"objectId">> := _UserId, <<"tag">> := #{<<"wechat">> := #{<<"openid">> := OPENID}}}} when size(OPENID) > 0 ->
{error, <<UserName/binary, "is bind">>};
%% {ok, #{<<"objectId">> := _UserId, <<"tag">> := #{<<"wechat">> := #{<<"openid">> := OPENID}}}} when size(OPENID) > 0 ->
%% {error, <<UserName/binary, "is bind">>};
{ok, #{<<"objectId">> := UserId, <<"tag">> := Tag, <<"username">> := Name}} ->
dgiot_parse:update_object(<<"_User">>, UserId, #{<<"tag">> => Tag#{<<"wechat">> => #{<<"openid">> => OpenId}}}),
{ok, UserInfo} = dgiot_parse_handler:create_session(UserId, dgiot_auth:ttl(), Name),
Expand Down
10 changes: 9 additions & 1 deletion apps/dgiot_modbus/src/dgiot_modbus_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ init(?TYPE, ChannelId, #{
<<"product">> := Products,
<<"dtutype">> := Dtutype
} = _Args) ->
[{ProdcutId, App} | _] = get_app(Products),
{ProdcutId, App} =
case get_app(Products) of
[{ProdcutId1, App1} | _] ->
{ProdcutId1, App1};
[] ->
{<<>>, <<>>};
_ ->
{<<>>, <<>>}
end,
{Header, Len} = get_header(Regular),
State = #state{
id = ChannelId,
Expand Down
4 changes: 2 additions & 2 deletions apps/dgiot_shouyincheng/src/dgiot_shouyincheng_tcp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ get_deviceid(ProdcutId, DevAddr) ->

create_device(DeviceId, ProductId, DTUMAC, DTUIP, Dtutype) ->
case dgiot_parse:get_object(<<"Product">>, ProductId) of
{ok, #{<<"ACL">> := Acl, <<"devType">> := DevType}} ->
{ok, #{<<"ACL">> := Acl, <<"devType">> := DevType,<<"name">> := ProductName}} ->
case dgiot_parse:get_object(<<"Device">>, DeviceId) of
{ok, #{<<"devaddr">> := _GWAddr}} ->
dgiot_parse:update_object(<<"Device">>, DeviceId, #{<<"ip">> => DTUIP, <<"status">> => <<"ONLINE">>});
_ ->
dgiot_device:create_device(#{
<<"devaddr">> => DTUMAC,
<<"name">> => <<Dtutype/binary, DTUMAC/binary>>,
<<"name">> => <<ProductName/binary, DTUMAC/binary>>,
<<"ip">> => DTUIP,
<<"isEnable">> => true,
<<"product">> => ProductId,
Expand Down

0 comments on commit f80b160

Please sign in to comment.