Exemple #1
0
 public function indexAction()
 {
     $tMO = new CenterModel();
     $tList = $tMO->field('cities,provinces')->where('cities <> \'\'')->group('cities')->fList();
     foreach ($tList as $tRow) {
         $tCities = $tRow['cities'];
         $tData = Tool_Fnc::weather_juhe($tCities);
         if (!$tData) {
             $tData = Tool_Fnc::weather_juhe($tRow['provinces']);
         }
         $tSql = 'update ' . $tMO->table . ' set today_weather = \'' . $tData['today_weather'] . '\',tomorrow_weather = \'' . $tData['tomorrow_weather'] . '\' where cities = \'' . $tCities . '\'';
         $tMO->exec($tSql);
     }
     exit;
 }