@@ -102,7 +102,8 @@ index(#{params := Params}) ->
102102 <<" 10" >> ->
103103 % 血糖
104104 try
105- BloodSugar = erlang :binary_to_float (maps :get (<<" bloodSugar" >>, Params , <<" 0" >>)),
105+ BloodSugar = erlang :list_to_float (erlang :binary_to_list (
106+ maps :get (<<" bloodSugar" >>, Params , <<" 0" >>))),
106107 BTUtcTime = eadm_utils :parse_date_time (maps :get (<<" BTUtcTime" >>, Params , <<" 1970/1/1 00:00:00" >>)),
107108 eadm_pgpool :equery (pool_pg , " insert into lc_watchbs(ptime, bloodsugar)
108109 values($1, $2) on conflict (ptime)
@@ -128,10 +129,10 @@ index(#{params := Params}) ->
128129 <<" 12" >> ->
129130 % 体温数据
130131 try
131- BodyTemperature = erlang : binary_to_float ( maps :get (<<" bodyTemperature" >>, Params , <<" 0" >>) ),
132+ BodyTemperature = maps :get (<<" bodyTemperature" >>, Params , <<" 0" >>),
132133 BTUtcTime = eadm_utils :parse_date_time (maps :get (<<" BTUtcTime" >>, Params , <<" 1970/1/1 00:00:00" >>)),
133134 eadm_pgpool :equery (pool_pg , " insert into lc_watchbt(ptime, bodytemperature)
134- values($1, $2) on conflict (ptime)
135+ values($1, $2::real ) on conflict (ptime)
135136 do update set bodytemperature=excluded.bodytemperature;" , [BTUtcTime , BodyTemperature ]),
136137 #{<<" success" >> => true }
137138 catch
@@ -141,11 +142,11 @@ index(#{params := Params}) ->
141142 <<" 14" >> ->
142143 % 体温数据
143144 try
144- BodyTemperature = erlang : binary_to_float ( maps :get (<<" bodyTemperature" >>, Params , <<" 0" >>) ),
145- WristTemperature = erlang : binary_to_float ( maps :get (<<" wristTemperature" >>, Params , <<" 0" >>) ),
145+ BodyTemperature = maps :get (<<" bodyTemperature" >>, Params , <<" 0" >>),
146+ WristTemperature = maps :get (<<" wristTemperature" >>, Params , <<" 0" >>),
146147 BTUtcTime = eadm_utils :parse_date_time (maps :get (<<" BTUtcTime" >>, Params , <<" 1970/1/1 00:00:00" >>)),
147148 eadm_pgpool :equery (pool_pg , " insert into lc_watchbt(ptime, bodytemperature, wristtemperature)
148- values($1, $2, $3) on conflict (ptime)
149+ values($1, $2::real , $3::real ) on conflict (ptime)
149150 do update set bodytemperature=excluded.bodytemperature,
150151 wristtemperature=excluded.wristtemperature;" ,
151152 [BTUtcTime , BodyTemperature , WristTemperature ]),
@@ -180,7 +181,7 @@ index(#{params := Params}) ->
180181 values($1, $2, $3) on conflict (ptime)
181182 do update set signal=excluded.signal, battery=excluded.battery;" ,
182183 [BTUtcTime , Signal , Battery ]),
183- Steps = maps :get (<<" steps" >>, Params , <<" 0" >>),
184+ Steps = erlang : binary_to_integer ( maps :get (<<" steps" >>, Params , <<" 0" >>) ),
184185 eadm_pgpool :equery (pool_pg , " insert into lc_watchstep(ptime, steps)
185186 values($1, $2) on conflict (ptime)
186187 do update set steps=excluded.steps;" , [BTUtcTime , Steps ]),
0 commit comments