mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-02 12:18:30 +08:00
feat: menu.json
This commit is contained in:
parent
dbf3a2a2e8
commit
32314dd111
@ -128,7 +128,7 @@ get_control(ProductId) ->
|
||||
end.
|
||||
|
||||
update_properties(ProductId, Product) ->
|
||||
io:format("~s ~p ProductId = ~p.~n", [?FILE, ?LINE, ProductId]),
|
||||
%% io:format("~s ~p ProductId = ~p.~n", [?FILE, ?LINE, ProductId]),
|
||||
PropertiesTpl = dgiot_dlink:get_json(<<"properties_tpl">>),
|
||||
case dgiot_product:lookup_prod(ProductId) of
|
||||
{ok, #{<<"thing">> := #{<<"properties">> := Props} = Thing}} ->
|
||||
@ -141,8 +141,7 @@ update_properties(ProductId, Product) ->
|
||||
NewThing = Thing#{
|
||||
<<"properties">> => NewProperties
|
||||
},
|
||||
Message = dgiot_parse:update_object(<<"Product">>, ProductId, #{<<"thing">> => NewThing}),
|
||||
io:format("~s ~p Message = ~p.~n", [?FILE, ?LINE, Message]),
|
||||
dgiot_parse:update_object(<<"Product">>, ProductId, #{<<"thing">> => NewThing}),
|
||||
dgiot_data:insert(?DGIOT_PRODUCT, ProductId, Product#{<<"thing">> => NewThing});
|
||||
_Error ->
|
||||
[]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -88,7 +88,19 @@ do_request(get_protocol, _Body, _Context, _Req) ->
|
||||
%% OperationId:dlinkjson
|
||||
%% 请求:GET /iotapi/dlinkjson
|
||||
do_request(get_dlinkjson, #{<<"type">> := <<"swaggerTree">>}, _Context, _Req) ->
|
||||
{ok, SwaggerTree} = dgiot_swagger:tree(),
|
||||
{ok, Swagger} = dgiot_swagger:tree(),
|
||||
{file, Here} = code:is_loaded(?MODULE),
|
||||
Dir = filename:dirname(filename:dirname(Here)),
|
||||
FileName = <<"swagger.json">>,
|
||||
SwaggerFile = dgiot_httpc:url_join([Dir, "/priv/json/", dgiot_utils:to_list(FileName)]),
|
||||
case dgiot_data:get(swaggerTree) of
|
||||
not_find ->
|
||||
file:write_file(SwaggerFile, jsx:encode(Swagger)),
|
||||
dgiot_data:insert(swaggerTree, <<"swaggerTree">>);
|
||||
_ ->
|
||||
pass
|
||||
end,
|
||||
SwaggerTree = dgiot_dlink:get_json(<<"swaggerTree">>),
|
||||
{200, SwaggerTree};
|
||||
|
||||
do_request(get_dlinkjson, #{<<"type">> := <<"Table">>}, _Context, _Req) ->
|
||||
|
Loading…
Reference in New Issue
Block a user