fix
This commit is contained in:
parent
1ad849c058
commit
e7ef3350f0
@ -3,6 +3,9 @@ iot
|
||||
|
||||
An OTP application
|
||||
|
||||
## erlang client sdk
|
||||
https://github.com/emqx/emqtt
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
%% 主机定义
|
||||
-record(host, {
|
||||
%% ID
|
||||
id :: binary(),
|
||||
host_id :: binary(),
|
||||
%% 名称
|
||||
name :: binary(),
|
||||
%% 型号
|
||||
@ -104,7 +104,7 @@
|
||||
%% 终端设备表
|
||||
-record(terminal, {
|
||||
%% 设备ID
|
||||
id :: binary(),
|
||||
terminal_id :: binary(),
|
||||
%% 关联主机
|
||||
host_id :: binary(),
|
||||
%% 名称
|
||||
@ -132,7 +132,7 @@
|
||||
%% 微服务表
|
||||
-record(microservice, {
|
||||
%% ID, 基于UUID生成
|
||||
id :: binary(),
|
||||
service_id :: binary(),
|
||||
%% 关联主机
|
||||
host_id :: binary(),
|
||||
%% 名称
|
||||
|
||||
@ -11,14 +11,15 @@
|
||||
-include("iot.hrl").
|
||||
|
||||
%% API
|
||||
-export([]).
|
||||
-export([handle/2]).
|
||||
|
||||
handle(<<"server.register">>, Msg = #{<<"c_id">> := ClientId, <<"r">> := PubKey,
|
||||
<<"m">> := #{<<"cpu_core">> := CpuCore, <<"memory">> := Memory, <<"disk">> := Disk, <<"boot_time">> := BootTime, <<"efka_version">> := EfkaVersion, <<"kernel_arch">> := KernelArch, <<"ipv4_1">> := Ip1, <<"ipv4_2">> := Ip2}}) ->
|
||||
lager:debug("[iot_message_handler] get server register message: ~p", [Msg]),
|
||||
|
||||
Aes = iot_util:rand_bytes(16),
|
||||
Host = #host{
|
||||
id = ClientId,
|
||||
host_id = ClientId,
|
||||
aes = Aes,
|
||||
metric = #host_metric{
|
||||
%% cpu相关
|
||||
|
||||
@ -18,7 +18,7 @@ insert_hosts() ->
|
||||
lists:foreach(fun(Id0) ->
|
||||
%Id0 = iot_util:rand_bytes(16),
|
||||
Host = #host{
|
||||
id = integer_to_binary(Id0),
|
||||
host_id = integer_to_binary(Id0),
|
||||
name = <<"N1000_0001">>,
|
||||
model = <<"N1000">>,
|
||||
cell_id = <<"公共教学楼"/utf8>>
|
||||
|
||||
@ -47,7 +47,7 @@ get_status_stat() ->
|
||||
|
||||
insert(Id, HostId, Name, ProductId, VendorId, Model, CellId) ->
|
||||
Terminal = #terminal{
|
||||
id = Id,
|
||||
terminal_id = Id,
|
||||
name = Name,
|
||||
product_id = ProductId,
|
||||
vendor_id = VendorId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user