mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-04 21:27:39 +08:00
commit
9a490cfc8e
@ -79,7 +79,10 @@ do_check(AuthResult, Password, ProductID, DeviceAddr, DeviceId, Ip) ->
|
||||
{ok, #{<<"productSecret">> := Password} = Product} ->
|
||||
case dgiot_device:lookup(DeviceId) of
|
||||
{ok, _} ->
|
||||
pass;
|
||||
Body = #{
|
||||
<<"status">> => <<"ONLINE">>},
|
||||
dgiot_device:online(DeviceId),
|
||||
dgiot_parse:update_object(<<"Device">>, DeviceId, Body);
|
||||
_ ->
|
||||
case Product of
|
||||
#{<<"ACL">> := Acl, <<"name">> := Name, <<"devType">> := DevType, <<"dynamicReg">> := true} ->
|
||||
|
@ -173,11 +173,6 @@ get_deviceid(ProdcutId, DevAddr) ->
|
||||
create_device(DeviceId, ProductId, DTUMAC, DTUIP, Dtutype) ->
|
||||
case dgiot_product:lookup_prod(ProductId) of
|
||||
{ok, #{<<"ACL">> := Acl, <<"devType">> := DevType}} ->
|
||||
case dgiot_parse:get_object(<<"Device">>, DeviceId) of
|
||||
{ok, #{<<"devaddr">> := _GWAddr}} ->
|
||||
dgiot_parse:update_object(<<"Device">>, DeviceId, #{<<"ip">> => DTUIP, <<"status">> => <<"ONLINE">>}),
|
||||
dgiot_task:save_pnque(ProductId, DTUMAC, ProductId, DTUMAC);
|
||||
_ ->
|
||||
dgiot_device:create_device(#{
|
||||
<<"devaddr">> => DTUMAC,
|
||||
<<"name">> => <<Dtutype/binary, DTUMAC/binary>>,
|
||||
@ -190,8 +185,7 @@ create_device(DeviceId, ProductId, DTUMAC, DTUIP, Dtutype) ->
|
||||
<<"brand">> => Dtutype,
|
||||
<<"devModel">> => DevType
|
||||
}),
|
||||
dgiot_task:save_pnque(ProductId, DTUMAC, ProductId, DTUMAC)
|
||||
end,
|
||||
dgiot_task:save_pnque(ProductId, DTUMAC, ProductId, DTUMAC),
|
||||
Productname =
|
||||
case dgiot_parse:get_object(<<"Product">>, ProductId) of
|
||||
{ok, #{<<"name">> := Productname1}} ->
|
||||
|
Loading…
Reference in New Issue
Block a user