Страница 8 из 55
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Пн апр 25, 2016 4:25 pm
serghei
Smolalex писал(а):Кажется в app_openweather.class.php закралась ошибка.
В
public function get_setting(&$out)
вместо
$out["script"] = gg('ow_setting.countTime');
должно быть
$out["script"] = gg('ow_setting.updScript');
После этой замены модуль вылечился и МД ожило. До этого работало 2 недели
и встало.Я уже думал демо версия закончилась.Огромное спасибо!
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Вт апр 26, 2016 3:54 pm
ivannag
mr_kulepetov писал(а):ivannag, Rad81, попробуйте вручную добавить таблицы (не в INNODB, а в MYISAM) в БД.
Перед добавлением дропните таблицы запросами drop table if exists
Запросы такие:
.....
P.S. Обязательно удалите класс Ya_weather (погода от Яндекса).
Спасибо большое за совет, но я только учусь, и метод, который Вы предложили слишком сложен...)))
Пока проблему решил следующим образом: на рабочем компе подсмотрел все значения свойств для объекта ow_setting и заполнил их в ручную... погода работает, прогноз получает, свойства остальных объектов заполняет.... единственное когда захожу в само приложение 2-й и более раз или пытаюсь обновить погоду кнопочкой сверху выскакивает куда ошибок...
Warning: date() expects parameter 2 to be long, string given in C:\_majordomo\htdocs\modules\app_openweather\app_openweather.class.php on line 246
Warning: date() expects parameter 2 to be long, string given in C:\_majordomo\htdocs\modules\app_openweather\app_openweather.class.php on line 247
Warning: gmdate() expects parameter 2 to be long, string given in C:\_majordomo\htdocs\modules\app_openweather\app_openweather.class.php on line 248
Warning: date() expects parameter 2 to be long, string given in C:\_majordomo\htdocs\modules\app_openweather\app_openweather.class.php on line 298
Warning: date() expects parameter 2 to be long, string given in C:\_majordomo\htdocs\modules\app_openweather\app_openweather.class.php on line 299
Warning: gmdate() expects parameter 2 to be long, string given in C:\_majordomo\htdocs\modules\app_openweather\app_openweather.class.php on line 300
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Ср апр 27, 2016 10:07 am
serghei
У меня было тоже самое.Попробуйте посмотреть в файле C:\majordomo\htdocs\modules\app_openweather\app_openweater.class.php что написано в 487 строке и замените на
ow_setting.updScript У меня вылечилось.
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Чт апр 28, 2016 9:35 am
ученик
Никак не победить установку модуля в автоматическом режиме
а как модуль ручками проставить?
в папке /var/www/modules/app_openweather
есть файл
app_openweather.class.php
в папке /var/www/templates/app_openweather
action_admin.html
action_usual.html
app_openweather.html
get_cityId.html
help.html
setting.html
view_weather.html
пытаюсь в браузере набрать IP сервера/templates/app_openweather/action_admin.html
пишет что не хватает прав
видимо где то еще надо дописать а где непонятно
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Чт апр 28, 2016 4:04 pm
Sandr
Пожелание к автору - было бы здорово ввести возможность округления значений температуры
например в настройках "Округлять температуру до" 0; 1; цифры после запятой
Мне например не нужны сотые градуса!
пока сделал так - добавил свойство ow_setting.round_temp
$rT = gg('ow_setting.round_temp');
и прописал round ( "температура", $rT) в функции get_weather
Код: Выделить всё
/**
* Получение погоды по ID города
* @param int $cityID ID города
*/
public function get_weather($cityID)
{
$rT = gg('ow_setting.round_temp');
$weather = app_openweather::GetJsonWeatherDataByCityID($cityID);
$curWeather = self::GetCurrentWeatherDataByCityID($cityID);
if ($weather->cod == "404" || $curWeather->cod == "404")
{
DebMes($weather->message);
return;
}
$fact = $curWeather->main;
$date = date("d.m.Y G:i:s T Y", $curWeather->dt);
sg('ow_fact.temperature', round($fact->temp,$rT));
sg('ow_fact.weather_type', $curWeather->weather[0]->description);
sg('ow_fact.wind_direction', $curWeather->wind->deg);
sg('ow_fact.wind_speed',$curWeather->wind->speed);
sg('ow_fact.humidity', $fact->humidity);
sg('ow_fact.pressure', $fact->pressure);
sg('ow_fact.pressure_mmhg', app_openweather::ConvertPressure($fact->pressure, "hpa", "mmhg", 2));
sg('ow_fact.image', $curWeather->weather[0]->icon);
sg('ow_fact.clouds', $curWeather->clouds->all);
sg('ow_fact.rain', isset($fact->rain) ? $fact->rain : '');
sg('ow_city.data_update', $date);
$sunInfo = $this->GetSunInfoByCityID($cityID);
if ($sunInfo)
{
$sunRise = $sunInfo["sunrise"];
$sunSet = $sunInfo["sunset"];
$dayLength = $sunSet - $sunRise;
sg('ow_fact.sunrise', $sunRise);
sg('ow_fact.sunset', $sunSet);
sg('ow_fact.day_length', $dayLength);
sg('ow_fact.transit', $sunInfo["transit"]);
sg('ow_fact.civil_twilight_begin', $sunInfo["civil_twilight_begin"]);
sg('ow_fact.civil_twilight_end', $sunInfo["civil_twilight_end"]);
}
$i = 0;
foreach($weather->list as $day)
{
$date = date("d.m.Y", $day->dt);
sg('ow_day'.$i.'.date', $date);
sg('ow_day'.$i.'.temperature', round(app_openweather::GetCurrTemp($day->temp),$rT));
sg('ow_day'.$i.'.temp_morn', round($day->temp->morn,$rT));
sg('ow_day'.$i.'.temp_day', round($day->temp->day,$rT));
sg('ow_day'.$i.'.eve', round($day->temp->eve,$rT));
sg('ow_day'.$i.'.temp_night', round($day->temp->night,$rT));
sg('ow_day'.$i.'.temp_min', round($day->temp->min,$rT));
sg('ow_day'.$i.'.temp_max', round($day->temp->max,$rT));
sg('ow_day'.$i.'.weather_type', $day->weather[0]->description);
sg('ow_day'.$i.'.wind_direction', $day->deg);
sg('ow_day'.$i.'.wind_speed', $day->speed);
sg('ow_day'.$i.'.humidity', $day->humidity);
sg('ow_day'.$i.'.pressure', $day->pressure);
sg('ow_day'.$i.'.pressure_mmhg', app_openweather::ConvertPressure($day->pressure, "hpa", "mmhg", 2));
sg('ow_day'.$i.'.image', $day->weather[0]->icon);
sg('ow_day'.$i.'.clouds', $day->clouds);
sg('ow_day'.$i.'.rain', isset($day->rain) ? $day->rain : 0);
sg('ow_day'.$i.'.snow', isset($day->snow) ? $day->snow : 0);
$curTimeStamp = strtotime('+' . $i . ' day', time());
$sunInfo = $this->GetSunInfoByCityID($cityID, $curTimeStamp);
if ($sunInfo)
{
$sunRise = $sunInfo["sunrise"];
$sunSet = $sunInfo["sunset"];
$dayLength = $sunSet - $sunRise;
sg('ow_day'.$i.'.sunrise', $sunRise);
sg('ow_day'.$i.'.sunset', $sunSet);
sg('ow_day'.$i.'.day_length', $dayLength);
sg('ow_day'.$i.'.transit', $sunInfo["transit"]);
sg('ow_day'.$i.'.civil_twilight_begin', $sunInfo["civil_twilight_begin"]);
sg('ow_day'.$i.'.civil_twilight_end', $sunInfo["civil_twilight_end"]);
}
$i++;
}
runScript(gg('ow_setting.updScript'));
}
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Чт апр 28, 2016 6:06 pm
ivannag
serghei писал(а):У меня было тоже самое.Попробуйте посмотреть в файле C:\majordomo\htdocs\modules\app_openweather\app_openweater.class.php что написано в 487 строке и замените на
ow_setting.updScript У меня вылечилось.
Спасибо за совет, но увы ничего не изменилось... хотя оно не критично для меня... главное работает...)
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Чт апр 28, 2016 10:37 pm
Sandr
Вот еще пожелание к автору:
Добавьте плз ConditionsCodes в свойства
так как штатных иконок очень малая вариативность (всего по 9 шт на день и ночь)
а вот
коды позволяют количество иконок расширить
пара строчек
Код: Выделить всё
sg('ow_fact.condCode', $curWeather->weather[0]->id);
sg('ow_day'.$i.'.condCode', $day->weather[0]->id);
не сильно перегрузят модуль
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Пн май 16, 2016 10:28 pm
chuk3
Всем доброго!
В связи с тем что яндекс зарубил XML решил перейти на OpenWeatherMap, через обновления поставил модуль и началась веселуха, в onNewHour ничего не добавилось, страна и город не выбираются, после получаса простоя упало всё, дважды удалял и ставил, эффект тот же. Система Win7.
Куда копать?
Спасибо заранее за помощь.
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Вт май 17, 2016 8:56 am
adzam
Работаю с погодой от OpenWeatherMap уже пол года.
Никаких глюков не наблюдаю.
установил стандартно из маркета.
Правда давно не обновлялся, может это связано с обновлениями?
Re: Модуль - Погода от OpenWeatherMap
Добавлено: Вт май 17, 2016 9:28 am
m-malva
LutsenkoDenis писал(а):
Ок. я его вообще от туда уберу скорее всего.
верим и ждем
Код: Выделить всё
// END openweather module//START openweather module
$updateTime = gg('ow_setting.updateTime');
if($updateTime > 0)
{
$count = gg('ow_setting.countTime');
if($count >= $updateTime)
{
include_once(DIR_MODULES . 'app_openweather/app_openweather.class.php');
$app_openweather = new app_openweather();
$app_openweather->get_weather(gg('ow_city.id'));
sg('ow_setting.countTime', 1);
}
else
{
$count++;
sg('ow_setting.countTime', $count);
}
}