function getRankLogAction() { $ServerId = trim($this->request->ServerId); $oCharacter = new Lm_Character(); $ServerList = @(include __APP_ROOT_DIR__ . "/etc/Server.php"); $ServerInfo = $ServerList[$ServerId]; if ($ServerInfo['ServerId']) { $filename = $ServerInfo['AppId'] . '/' . $ServerInfo['PartnerId'] . '/' . $ServerInfo['ServerId'] . '/' . date('Y-m-d', time()) . '/accbrief58.log'; $logurl = '/gamelog/'; $filename = $logurl . $filename; echo $filename . "\n"; $file = fopen($filename, 'r'); if ($file) { $succeed = 0; $fail = 0; $count = 0; $oCharacter->truncateUserCharacterRankList(); while ($content = fgets($file, filesize($filename))) { $count++; $arr = explode(",", $content); if (is_numeric($arr[0])) { $CharacterInfoUser = $oCharacter->getCharacterInfoByUser($arr[0], $ServerInfo['ServerId']); $CharacterInfoName = $oCharacter->getCharacterInfoByCharacter(iconv('GBK', 'UTF-8', htmlspecialchars(trim($arr[1]))), $ServerInfo['ServerId']); if (count($CharacterInfoUser) < 1 || count($CharacterInfoName) < 1) { $Character['UserId'] = trim($arr[0]); $Character['CharacterName'] = iconv('GBK', 'UTF-8', htmlspecialchars(trim($arr[1]))); $Character['ServerId'] = $ServerInfo['ServerId']; $Character['AppId'] = $ServerInfo['AppId']; $Character['PartnerId'] = $ServerInfo['PartnerId']; $Character['CharacterLevel'] = 1; $Character['CharacterCreateTime'] = trim($arr[10]); $insertLog = $oCharacter->CreateCharacter($Character); echo "insert:" . $insertLog . "\n"; } else { $updateLog = $oCharacter->updateCharacterInfo($arr[0], $ServerInfo['ServerId'], array("CharacterLevel" => $arr[4], "Comment" => json_encode(array('FightingCapacity' => $arr[2], 'Capacity' => $arr[3], 'PKPoint' => $arr[9])), "CharacterName" => iconv('GBK', 'UTF-8', htmlspecialchars(trim($arr[1]))))); echo "update:" . $updateLog . "\n"; } $Uarr = array('UserId' => $arr[0], 'ServerId' => $ServerId, 'CharacterName' => iconv('GBK', 'UTF-8', htmlspecialchars(trim($arr[1]))), 'FightingCapacity' => $arr[2], 'Capacity' => $arr[3], 'CharacterLevel' => $arr[4], 'PKPoint' => $arr[9]); $insert = $oCharacter->insertUserCharacterRankList($Uarr); echo "insertRank:" . $insert . "\n"; if ($insert) { $succeed++; } else { $fail++; } } else { continue; } } } echo $succeed . "-" . $fail; fclose($file); //根据战斗力和生命值 将用户排名写入配置文件 $oCharacter->getUserByFightRank(); $oCharacter->getUserByLiveRank(); $oCharacter->getUserByPKPoint(); } }