コード例 #1
0
 /**
  * @param $GameId
  * @param $SteamGameSchemaFromAPI
  *
  * @return bool
  */
 public function parseAndSaveStatSchema($GameId, $SteamGameSchemaFromAPI)
 {
     if (!$GameId) {
         return false;
     }
     foreach ($SteamGameSchemaFromAPI as $stat) {
         if (empty($stat)) {
             continue;
         }
         $SteamGameStat = SteamGameStat::firstOrNew(['steam_game_id' => $GameId, 'name' => $stat->name]);
         if (!empty($stat->displayName)) {
             $SteamGameStat->display_name = $stat->displayName;
         } else {
             $SteamGameStat->display_name = null;
         }
         $SteamGameStat->save();
     }
     return true;
 }
コード例 #2
0
 /**
  * @param $GameId
  * @param $SteamGameAchievementsFromAPI
  *
  * @return bool
  */
 private function parseAndSaveStats($GameId, $SteamGameAchievementsFromAPI)
 {
     foreach ($SteamGameAchievementsFromAPI as $stat) {
         if (empty($stat)) {
             continue;
         }
         $SteamStat = SteamGameStat::firstOrNew(['steam_game_id' => $GameId, 'name' => $stat->name]);
         if (!empty($stat->value)) {
             $SteamStat->value = $stat->value;
         }
         $SteamStat->save();
     }
     return true;
 }