protected function _exec() { $platform_uid = $this->getParam('uid', 'string'); $mapping_handler = new UidGameuidMapManager(); $gameuid = $mapping_handler->getGameuid($platform_uid); $is_newer = FALSE; $characterArr = array(); if ($gameuid === false) { if ($this->logger->isDebugEnabled()) { $this->logger->writeDebug("can not map platform uid[{$platform_uid}], create new user."); } require_once FRAMEWORK . '/database/FarmIDSequence.class.php'; $sequence_handler = new FarmIDSequence(); $gameuid = $sequence_handler->creatId(); if ($this->logger->isDebugEnabled()) { $this->logger->writeDebug("generated new garmuid[{$gameuid}]"); } $GLOBALS['gameuid'] = $gameuid; //创建uid,gameuid的对照关系 $mapping_handler->createMapping($platform_uid, $gameuid); $this->init($gameuid); //统计信息 $is_newer = TRUE; } else { $characterMgr = new CharacterAccountManager(); $characterIndex = 0; while ($characterIndex < 10) { $characterId = intval($gameuid * 10 + $characterIndex); $character_info = $characterMgr->getCharacterAccount($characterId); if (empty($character_info)) { break; } else { array_push($characterArr, $character_info); } $characterIndex++; } } $GLOBALS['gameuid'] = $gameuid; $user_account = $this->user_account_mgr->getUserAccount($gameuid); if ($user_account['gameuid'] == "" || empty($user_account['gameuid'])) { $this->logger->writeDebug("ERROR GAMEUID " . $user_account['gameuid'] . " UID IS {$platform_uid}"); } $user_account['user_characters'] = $characterArr; $result['HeroCost'] = StaticFunction::$heroCost; $result['is_new'] = $is_newer; $result["user_account"] = $user_account; return $result; }
function isofficial($gameuid) { $result = false; if (defined("OFFICIAL_UID")) { $official_uid = OFFICIAL_UID; if (!empty($official_uid)) { require_once GAMELIB . '/model/UidGameuidMapManager.class.php'; $map_mgr = new UidGameuidMapManager(); $official_gameuid = $map_mgr->getGameuid($official_uid); if ($official_gameuid == $gameuid) { $result = true; } } } return $result; }
<?php error_reporting(100); set_time_limit(0); if (!defined('APP_ROOT')) { define('APP_ROOT', realpath(dirname(__FILE__))); } if (!defined('GAMELIB')) { define('GAMELIB', APP_ROOT . '/libgame'); } if (!defined('FRAMEWORK')) { define('FRAMEWORK', APP_ROOT . '/framework'); } require_once GAMELIB . '/config/GameConfig.class.php'; require_once FRAMEWORK . '/log/LogFactory.class.php'; require_once FRAMEWORK . '/db/RequestFactory.class.php'; require_once GAMELIB . '/GameConstants.php'; require_once GAMELIB . '/model/ManagerBase.class.php'; require_once GAMELIB . '/model/UserAccountManager.class.php'; require_once GAMELIB . '/model/UidGameuidMapManager.class.php'; require_once GAMELIB . '/model/XmlManager.class.php'; require_once GAMELIB . '/model/UserGameItemManager.class.php'; require_once GAMELIB . '/model/UidGameuidMapManager.class.php'; $uid = $_GET['uid']; $mapping_handler = new UidGameuidMapManager(); $mapping_handler->deleteMapping($uid); echo "ok";