From: TrillGates Date: Tue, 25 May 2021 09:09:41 +0000 (+0800) Subject: save weather to fzd db. X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=24a58c33c1540431feeb51fd909232f35b94728e;p=protocol_srv.git save weather to fzd db. --- diff --git a/app/src/main/java/com/ic/protocols/protocol_fzd.java b/app/src/main/java/com/ic/protocols/protocol_fzd.java index fd196577..ca9170fd 100644 --- a/app/src/main/java/com/ic/protocols/protocol_fzd.java +++ b/app/src/main/java/com/ic/protocols/protocol_fzd.java @@ -2388,6 +2388,30 @@ public class protocol_fzd { null, wtCode, currentTemp, lowTemp, highTemp, cityName, null, null, date + " " + time ); + //key值可以去看交互文档 + //weather_type,weather_temp + //天气类型就是wtCode + //天气温度就是当前温度currentTemp + //数据库为settings,k-v的形式存储 + //保存当前温度 + //当前天气码保存到数据库中 + //让监听的地方去更新即可 + //插入天气类型 + ContentValues wtCodeValues = new ContentValues(); + wtCodeValues.put(FZDDatabaseHelper.sKey, "weather_type"); + wtCodeValues.put(FZDDatabaseHelper.sValue, wtCode); + mRuntime.getContextProxy().getResolver().insert( + Uri.parse(FZDSettingsProvider.SETTINGS), + wtCodeValues + ); + //插入天气当前温度 + ContentValues tempValues = new ContentValues(); + tempValues.put(FZDDatabaseHelper.sKey, "weather_temp"); + tempValues.put(FZDDatabaseHelper.sValue, currentTemp); + mRuntime.getContextProxy().getResolver().insert( + Uri.parse(FZDSettingsProvider.SETTINGS), + tempValues + ); if (mRuntime.mFZDWeatherCallback != null) { mRuntime.mFZDWeatherCallback.onWeatherInfoLoaded(fzdWeatherInfo); }