protected function _exec()
 {
     $heros = $this->getParam('heros', 'array');
     $needMore = $this->getParam('more', 'bool');
     $characterMgr = new CharacterAccountManager();
     $user_clan_mgr = new UserClanManager();
     $clan_mgr = new ClanManager();
     $result = array();
     foreach ($heros as $heroId) {
         $heroInfo = $characterMgr->getCharacterAccount($heroId);
         //item 信息
         if ($needMore === TRUE) {
             $item_mgr = new UserGameItemManager($heroId);
             $items = $item_mgr->getItemList();
             $heroInfo['items'] = $items;
         }
         if (!empty($heroInfo)) {
             $user_clan_info = $user_clan_mgr->getUserClanInfo($heroId);
             if (!empty($user_clan_info)) {
                 $clanInfo = $clan_mgr->getClanInfo($user_clan_info['clan_id']);
                 $clanInfo['clanUser'] = $user_clan_info;
                 $heroInfo['clan'] = $clanInfo;
             }
             array_push($result, $heroInfo);
         }
     }
     return array("heros" => $result);
 }
 protected function _exec()
 {
     $specId = $this->getParam('specId', 'string');
     $battletype = $this->getParam('battletype', 'string');
     $characterId = $this->getParam('heroid', 'int');
     $isHelp = $this->getParam('isHelp', 'bool');
     //power
     $hero_mgr = new CharacterAccountManager();
     $hero_info = $hero_mgr->getCharacterAccount($characterId);
     $new_hero_info = StaticFunction::resetCurPower($hero_info);
     $cur_power = $new_hero_info['power'];
     if ($cur_power < StaticFunction::$power_battle_cost) {
         $this->throwException("power is not enough ,cur power = {$cur_power} ");
     } else {
         $heroChange = array('power' => $cur_power - StaticFunction::$power_battle_cost, 'powertime' => $new_hero_info['powertime']);
         $hero_mgr->updateUserStatus($characterId, $heroChange);
         $battleMgr = new BattleManager();
         $battleMgr->setBattleCache($characterId, $specId, $battletype, 0);
         if ($isHelp === TRUE) {
             $item_mgr = new UserGameItemManager($characterId);
             $item_mgr->subItem("80002", 1);
             $item_mgr->checkReduceItemCount();
             $item_mgr->commitToDB();
         }
         return $heroChange;
     }
 }
 protected function _exec()
 {
     $itemId = $this->getParam('itemId', 'int');
     $characterId = $this->getParam('heroid', 'int');
     $itemDef = get_xml_def($itemId);
     if (empty($itemDef)) {
         $this->throwException("itemId is not item {$itemId}");
     }
     $itemMgr = new UserGameItemManager($characterId);
     $itemMgr->subItem($itemId, 1);
     $hero_mgr = new CharacterAccountManager();
     $hero_account = $hero_mgr->getCharacterAccount($characterId);
     $new_hero_info = StaticFunction::resetCurPower($hero_account);
     $cur_power = $new_hero_info['power'];
     if ($itemId == "80000") {
         $heroChange = array('power' => $cur_power + 50, 'powertime' => $new_hero_info['powertime']);
     } else {
         if ($itemId == "80001") {
             $heroChange = array('power' => StaticFunction::getTotalPower(StaticFunction::expToGrade($new_hero_info['exp']), StaticFunction::expToVip($new_hero_info['vip'])), 'powertime' => $new_hero_info['powertime']);
         }
     }
     $hero_mgr->updateUserStatus($characterId, $heroChange);
     $itemMgr->commitToDB();
     $heroChange['item_id'] = $itemId;
     return $heroChange;
 }
 public function getClanInfo($dataid)
 {
     $key = array('data_id' => $dataid);
     $result = $this->getFromDb($dataid, $key);
     if (!empty($result)) {
         require_once GAMELIB . '/model/CharacterAccountManager.class.php';
         $accout_mgr = new CharacterAccountManager();
         $adminHero = $accout_mgr->getCharacterAccount($result['adminId']);
         $result['admin'] = $adminHero;
     }
     return $result;
 }
 protected function _exec()
 {
     $gameuid = $this->getParam('gameuid', 'int');
     $specId = $this->getParam('specId', 'string');
     $battletype = $this->getParam('battletype', 'string');
     $heroId = $this->getParam('heroid', 'int');
     $rewards = $this->getParam('battlerewards', 'array');
     $battleStar = $this->getParam('battleStar', 'int');
     $battleMgr = new BattleManager();
     $cacheInfo = $battleMgr->getBattleCache($heroId);
     if (!empty($cacheInfo)) {
         $cacheInfoArr = explode(":", $cacheInfo);
         if ($cacheInfoArr[2] == 1) {
             $this->throwException("battle has get rewards");
         }
     }
     $battleMgr->setBattleCache($heroId, $specId, $battletype, 1);
     $heroMgr = new CharacterAccountManager();
     $itemMgr = new UserGameItemManager($heroId);
     foreach ($rewards as $oneReward) {
         if ($oneReward['item_id'] == 'coin') {
             $userMgr = new UserAccountManager();
             $userMgr->updateUserCoin($gameuid, $oneReward['count']);
         } else {
             if ($oneReward['item_id'] == 'exp') {
                 $heroMgr->updateUserExperience($heroId, $oneReward['count']);
             } else {
                 $itemMgr->addItem($oneReward['item_id'], $oneReward['count']);
                 $itemMgr->commitToDB();
             }
         }
     }
     //Elite Ordinary
     if ($battleStar > 0 && $battleStar <= 3) {
         if ($battletype == "Ordinary") {
             $newItemId = $specId;
         } else {
             $newItemId = 100000 + intval($specId);
         }
         $itemInfo = $itemMgr->getItem($newItemId);
         if (empty($itemInfo)) {
             $itemMgr->addItem($newItemId, $battleStar);
         } else {
             $oldC = $itemInfo['count'];
             if ($oldC < $battleStar) {
                 $itemMgr->addItem($newItemId, $battleStar - $oldC);
             }
         }
         $itemMgr->commitToDB();
     }
     return TRUE;
 }
 protected function _exec()
 {
     $characteruid = $this->getParam('characteruid', 'string');
     $result = array();
     //item 信息
     $item_mgr = new UserGameItemManager($characteruid);
     $items = $item_mgr->getItemList();
     $heroInfo['items'] = $items;
     //vip
     $vip_mgr = new CharacterAccountManager();
     $vipInfo = $vip_mgr->getVipCache($characteruid);
     $heroInfo['vipData'] = $vipInfo;
     //rate
     $rate_mgr = new RatingHeroManager();
     $heroInfo['heroRate'] = $rate_mgr->getHeroRate($characteruid);
     $result['topHeroRate'] = $rate_mgr->getTop();
     $heroInfo['heroRateTime'] = $rate_mgr->getRatingRewardTime($characteruid);
     $clan_rate_mgr = new RatingClanManager();
     $result['topClanRate'] = $clan_rate_mgr->getTop();
     $heroInfo['clanRateTime'] = $clan_rate_mgr->getRatingRewardTime($characteruid);
     $bossMgr = new ClanBossManager();
     $heroInfo['bossData'] = $bossMgr->getCurClanBoss();
     //clan
     $user_clan_mgr = new UserClanManager();
     $user_clan_info = $user_clan_mgr->getUserClanInfo($characteruid);
     if (!empty($user_clan_info)) {
         require_once GAMELIB . '/model/ClanManager.class.php';
         $clan_mgr = new ClanManager();
         $clan_info = $clan_mgr->getClanInfo($user_clan_info['clan_id']);
         $membersArr = array();
         $clanmembers = explode(",", $clan_info['members']);
         foreach ($clanmembers as $memberId) {
             $simclaninfo = $user_clan_mgr->getUserClanInfo($memberId);
             if (!empty($simclaninfo)) {
                 array_push($membersArr, $simclaninfo);
             }
         }
         array_push($membersArr, $user_clan_mgr->getUserClanInfo($clan_info['adminId']));
         $clan_info['membersArr'] = $membersArr;
         $clanTalk = $clan_mgr->getClanTalk($user_clan_info['clan_id']);
         if (!empty($clanTalk)) {
             $clan_info['talk'] = $clanTalk;
         }
         $heroInfo['clanRate'] = $clan_rate_mgr->getClanRate($user_clan_info['clan_id']);
         $clan_info['clanUser'] = $user_clan_info;
         $heroInfo['clan'] = $clan_info;
     }
     $result['hero_info'] = $heroInfo;
     return $result;
 }
 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;
 }
 protected function _exec()
 {
     $characterId = $this->getParam('heroid', 'int');
     $skillArr = $this->getParam('skill', 'array');
     $itemMgr = new UserGameItemManager($characterId);
     foreach ($skillArr as $skillId) {
         $skill = $itemMgr->getItem($skillId);
         if (empty($skill) || $skill['count'] <= 0) {
             $this->throwException("hero {$characterId} do not have the skill {$skillId}");
         }
     }
     $new_skill_str = implode(":", $skillArr);
     $characterMgr = new CharacterAccountManager();
     $characterMgr->updateUserStatus($characterId, array("skills" => $new_skill_str));
     return array("stats" => TRUE);
 }
 protected function _exec()
 {
     $gameuid = $this->getParam('gameuid', 'int');
     $specId = $this->getParam('specId', 'string');
     $battletype = $this->getParam('battletype', 'string');
     $heroId = $this->getParam('heroid', 'int');
     $rewards = $this->getParam('battlerewards', 'array');
     $itemMgr = new UserGameItemManager($heroId);
     $hero_mgr = new CharacterAccountManager();
     $hero_info = $hero_mgr->getCharacterAccount($heroId);
     $new_hero_info = StaticFunction::resetCurPower($hero_info);
     $totalPower = StaticFunction::getTotalPower(StaticFunction::expToGrade($hero_info['exp']), StaticFunction::expToVip($hero_info['vip']));
     $cur_power = $new_hero_info['power'];
     if ($cur_power < StaticFunction::$power_battle_cost) {
         $this->throwException("power is not enough ,cur power = {$cur_power} , totalpower = {$totalPower} , oldpower = {$heroId}");
     } else {
         $heroChange = array('power' => $cur_power - StaticFunction::$power_battle_cost, 'powertime' => $new_hero_info['powertime']);
         if ($battletype == "Ordinary") {
             $newItemId = $specId;
         } else {
             $newItemId = 100000 + intval($specId);
         }
         $itemInfo = $itemMgr->getItem($newItemId);
         if ($itemInfo['count'] < 3) {
             $this->throwException("this battle spec id {$newItemId} do not have 3 star");
         }
         $itemMgr->subItem("80003", 1);
         foreach ($rewards as $oneReward) {
             if ($oneReward['item_id'] == 'coin') {
                 $userMgr = new UserAccountManager();
                 $userMgr->updateUserCoin($gameuid, $oneReward['count']);
             } else {
                 if ($oneReward['item_id'] == 'exp') {
                     $heroChange['exp'] = $oneReward['count'];
                 } else {
                     $itemMgr->addItem($oneReward['item_id'], $oneReward['count']);
                 }
             }
         }
         $itemMgr->commitToDB();
         $hero_mgr->updateUserStatus($heroId, $heroChange);
         return TRUE;
     }
     return FALSE;
 }
 protected function _exec()
 {
     $characterId = $this->getParam('heroid', 'int');
     $clanID = $this->getParam('clanId', 'int');
     $userClanMgr = new UserClanManager();
     $userclaninfo = $userClanMgr->getUserClanInfo($characterId);
     if (empty($userclaninfo) || $userclaninfo['bossTime'] > time()) {
         $this->throwException("hero has attack boss today ");
     }
     $bossMgr = new ClanBossManager();
     $boosInfo = $bossMgr->getCurClanBoss();
     $curTime = $boosInfo['Date'];
     //power
     $hero_mgr = new CharacterAccountManager();
     $hero_info = $hero_mgr->getCharacterAccount($characterId);
     $new_hero_info = StaticFunction::resetCurPower($hero_info);
     $cur_power = $new_hero_info['power'];
     if ($cur_power < StaticFunction::$power_battle_cost) {
         $this->throwException("power is not enough ,cur power = {$cur_power} ");
     } else {
         $heroChange = array('power' => $cur_power - StaticFunction::$power_battle_cost, 'powertime' => $new_hero_info['powertime']);
         $rateMgr = new RatingClanManager();
         $clanRateInfo = $rateMgr->getClanRate($clanID);
         if (empty($clanRateInfo)) {
             $newclanRate = array('id' => $clanID, 'date' => $curTime, 'level' => 1, 'kills' => 0);
             $rateMgr->addNewClanRate($clanID, $newclanRate);
         } else {
             if ($clanRateInfo['date'] == $curTime) {
                 $newclanRate = $clanRateInfo;
             } else {
                 $newclanRate = array('id' => $clanID, 'date' => $curTime, 'level' => 1, 'kills' => 0);
                 $rateMgr->updateClanRate($clanID, $newclanRate);
             }
         }
         $battleMgr = new BattleManager();
         $battleMgr->setBattleCache($characterId, $curTime, 1, 0);
         $hero_mgr->updateUserStatus($characterId, $heroChange);
         //bossTime
         $userclaninfo['bossTime'] = strtotime("next day");
         $userClanMgr->updateUserClan($userclaninfo);
         $heroChange['clanRateInfo'] = $newclanRate;
         $heroChange['bossData'] = $boosInfo;
         return $heroChange;
     }
 }
 protected function _exec()
 {
     $gameuid = $this->getParam('gameuid', 'int');
     $name = $this->getParam('name', 'string');
     $itemId = $this->getParam('itemId', 'int');
     $characterId = $this->getParam('characterId', 'int');
     $characterDef = get_xml_def($itemId);
     if (empty($characterDef) || intval($itemId / 10000) != 1) {
         $this->throwException("itemId is not character {$itemId}", GameStatusCode::DATA_ERROR);
     }
     $HeroCost = StaticFunction::$heroCost;
     $user_mgr = new UserAccountManager();
     $user_account = $user_mgr->getUserAccount($gameuid);
     if ($characterId >= count($HeroCost)) {
         $this->throwException("character id not enough characterId: {$characterId} ", GameStatusCode::DATA_ERROR);
     }
     $costcoin = $HeroCost[$characterId]["coin"];
     if ($costcoin > $user_account["coin"]) {
         $this->throwException("user  not enough coin: {$costcoin} ", GameStatusCode::DATA_ERROR);
     }
     $change = array('coin' => -$costcoin);
     $costgem = $HeroCost[$characterId]["gem"];
     if ($costgem > $user_account["gem"]) {
         $this->throwException("user  not enough gem: {$costgem} ", GameStatusCode::DATA_ERROR);
     }
     $change['gem'] = -$costgem;
     $new_CharacterId = intval($gameuid * 10 + $characterId);
     $character_mgr = new CharacterAccountManager();
     $character_info = $character_mgr->getCharacterAccount($new_CharacterId);
     if (!empty($character_info)) {
         $this->throwException("character id is exist characterId: {$new_CharacterId} ", GameStatusCode::DATA_ERROR);
     }
     $character_info = $character_mgr->createCharacterAccount($new_CharacterId, $name, $itemId);
     $itemMgr = new UserGameItemManager($new_CharacterId);
     $initItems = InitUser::$item_arr[$itemId];
     foreach ($initItems as $v) {
         $itemMgr->addItem($v['item_id'], $v['count']);
     }
     $itemMgr->commitToDB();
     $user_mgr->updateUserStatus($gameuid, $change);
     return array("character" => $character_info, "change" => $change);
 }
 protected function _exec()
 {
     $gameuid = $this->getParam('gameuid', 'int');
     $heroid = $this->getParam('heroid', 'int');
     $name = $this->getParam('name', 'string');
     $user_clan_mgr = new UserClanManager();
     $clanInfo = $user_clan_mgr->getUserClanInfo($heroid);
     if (!empty($clanInfo)) {
         $this->throwException("user {$heroid} already have clan ");
     }
     $account_mgr = new UserAccountManager();
     $account_info = $account_mgr->getUserAccount($gameuid);
     if ($account_info['gem'] < 20) {
         $this->throwException("user {$gameuid} not enough gem to buy Clan ");
     }
     $clan_mgr = new ClanManager();
     $result = $clan_mgr->creatClan($heroid, $name);
     $user_clan_info = $user_clan_mgr->creatUserClan($heroid, $result['data_id']);
     $account_mgr->updateUserMoney($gameuid, 20);
     $hero_mgr = new CharacterAccountManager();
     $result['admin'] = $hero_mgr->getCharacterAccount($heroid);
     $result['membersArr'] = array($user_clan_info);
     return array('clan' => $result);
 }
 protected function _exec()
 {
     $enemyId = $this->getParam('enemyId', 'string');
     $characterId = $this->getParam('heroid', 'int');
     $hero_mgr = new CharacterAccountManager();
     $hero_info = $hero_mgr->getCharacterAccount($characterId);
     $vipLevel = StaticFunction::expToVip($hero_info['vip']);
     $vipDATA = StaticFunction::$VipList[$vipLevel];
     $maxPkCOUNT = $vipDATA['pkAddCount'];
     $cacheInfo = $hero_mgr->getVipCache($characterId);
     $usedCount = 0;
     if (!empty($cacheInfo) && $cacheInfo['time'] > time()) {
         $usedCount = $cacheInfo['pkAddCount'];
         $newCacheInfo = $cacheInfo;
     } else {
         $newCacheInfo['time'] = strtotime(date("Y-m-d", strtotime("+1 day")));
     }
     $newCacheInfo['pkAddCount'] = $usedCount + 1;
     if ($maxPkCOUNT <= $usedCount) {
         $this->throwException("pk too much used {$usedCount} , total = {$maxPkCOUNT}");
     } else {
         $new_hero_info = StaticFunction::resetCurPower($hero_info);
         $cur_power = $new_hero_info['power'];
         if ($cur_power < StaticFunction::$power_battle_cost) {
             $this->throwException("power is not enough ,cur power = {$cur_power} ");
         } else {
             $heroChange = array('power' => $cur_power - StaticFunction::$power_battle_cost, 'powertime' => $new_hero_info['powertime']);
             $hero_mgr->updateUserStatus($characterId, $heroChange);
             $hero_mgr->setVipCache($characterId, $newCacheInfo);
             $battleMgr = new BattleManager();
             $battleMgr->setBattleCache($characterId, $enemyId, 2, 0);
             $heroChange['vipCache'] = $newCacheInfo;
             return $heroChange;
         }
     }
 }
 protected function _exec()
 {
     $payLog = LogFactory::getLogger(array('prefix' => LogFactory::LOG_MODULE_PLATFORM, 'log_dir' => APP_ROOT . '/log/payment/', 'archive' => ILogger::ARCHIVE_YEAR_MONTH, 'log_level' => 1));
     $gameuid = $this->getParam("gameuid", 'int');
     $heroId = $this->getParam("heroid", 'int');
     $receipt = $this->getParam("receipt", 'array');
     $receipt_str = $this->getParam("receiptStr", 'string');
     $buytype = $this->getParam("buytype", 'string');
     $projectName = $this->getParam("projectName", 'string');
     $account = $this->user_account_mgr->getUserAccount($gameuid);
     $payLog->writeInfo($projectName . "||" . $gameuid . " || gem:" . $account['gem'] . " || coin:" . $account['coin'] . " || " . json_encode($receipt));
     if (empty($receipt)) {
         return array('status' => 'error');
     }
     $new_rec = array();
     foreach ($receipt as $key => $value) {
         $new_rec[$key] = $value;
     }
     $signature = $new_rec['signature'];
     $signed_data = $new_rec["signedData"];
     $keyStr = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGq+mkH8cFacOY9UoWyi1tmAxa55pdmTpoexuMVKbOjbpsY8jwzBOxTO3VBsu7HSibYDTrn79t0uFj0YMsQ/wGK1sO/Ab08DlGEYqV7m5+QsqMcAtQ8UNUER+sGnQxnzTmr3Uq9izMkk69NXzkZRaO5lp8f4gbfRx3KT2JweWihjOyFhWdlWmHRBAJE81Wn2iFJzNGNr50XIC4VDOlt+ljcUD3vu9bZmqmgMryKwn4WtxV2o4UwT5RehpyGHAyQ6YX2jmDSfoR6z2UgajCedxGK5bfmnPZXj75DC4P08O+SlBCGhEq62o/I0sDNtdWdSVnb+HM7IcqqaEMEd6taZEwIDAQAB";
     if ($projectName == "sunnyfarm") {
         $keyStr = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhbYkJPFMzSfJIU4GT66e7swkLlTxAuNcwn/fIXTa4MU0qCwq3OAMc8rO4elYXvBNMUqVabV/Qs1uGFQE7okMvyBs2SogwQ/FC4QFMTR6PDsDuVLnzah3tH1eIbUtmQPUX/3q4MW/XuThHGQHLjNV15v6WiwrYqwD7+XOqDl5xtbLkb3vwP9srpQqK/2A3pSvvQInqyJ051Eljwed5BqtgmDN1bA/UJKFEB3oCTEZaaAcTqXZojmzly5VQyP0leXzXsjbqMnm4YD9cgn63NzI7SauG7a/RlIN0YP1DmV9I5nLtKgg16KuKmgVWk0B29z+xONV8RR/PxJ1Zv1v1BsewwIDAQAB";
     }
     $KEY_PREFIX = "-----BEGIN PUBLIC KEY-----\n";
     $KEY_SUFFIX = '-----END PUBLIC KEY-----';
     $pub_key = $KEY_PREFIX . chunk_split($keyStr, 64, "\n") . $KEY_SUFFIX;
     $pub_k = openssl_get_publickey($pub_key);
     $r = openssl_verify($signed_data, base64_decode($signature), $pub_k);
     if ($r !== 1 && $buytype != "localTest") {
         $payLog->writeError($gameuid . " || " . $r);
         return array('status' => 'error');
     }
     $signed_data = json_decode($signed_data, true);
     $new_request_order = array();
     foreach ($signed_data as $key => $value) {
         $new_request_order[$key] = $value;
     }
     $tradeManager = new TradeLogManager();
     $cached_orders = $tradeManager->getOrderCache($gameuid);
     if (empty($cached_orders)) {
         $cached_orders = array();
     }
     $purchase_state = $new_request_order['purchaseState'];
     $purchasetime = $new_request_order['purchaseTime'];
     $product_id = $new_request_order['productId'];
     $transactionid = $new_request_order['orderId'];
     $notification_id = "t" . $new_request_order['orderId'];
     if (empty($transactionid)) {
         return array('status' => 'error');
     }
     if (in_array($notification_id, $cached_orders)) {
         return array('status' => 'error');
     }
     $rewards = InitUser::$treasure_activity;
     if ($purchase_state == 0) {
         $hero_mgr = new CharacterAccountManager();
         $heroInfo = $hero_mgr->getCharacterAccount($heroId);
         $rewardInfo = $rewards[$product_id];
         //			if (intval($rewards['time']) > time()){
         //				$item = $this->addReward($gameuid,$rewardInfo);
         //			}
         $treasuretype = $rewardInfo['type'];
         if (!empty($rewardInfo)) {
             $change[$treasuretype] = $rewardInfo['count'];
             $herochange['vip'] = $heroInfo['vip'] + $rewardInfo['vip'];
         } else {
             $this->throwException("wrong product_id :" . $product_id . "type : {$treasuretype}", GameStatusCode::PARAMETER_ERROR);
         }
         $this->user_account_mgr->updateUserStatus($gameuid, $change);
         $hero_mgr->updateUserStatus($heroId, $herochange);
     }
     $tradeinfo = array();
     $tradeinfo['gameuid'] = $gameuid;
     $tradeinfo['product_id'] = $product_id;
     $tradeinfo['platform'] = "andriod";
     $tradeinfo['orderId'] = $transactionid;
     $tradeinfo['purchaseState'] = $purchase_state;
     $tradeinfo['purchasetime'] = $purchasetime;
     $tradeinfo['status'] = 1;
     $tradeManager->insert($tradeinfo);
     array_push($cached_orders, $notification_id);
     $tradeManager->setOrderCache($gameuid, $cached_orders);
     $new_account = $this->user_account_mgr->getUserAccount($gameuid);
     $payLog->writeInfo($gameuid . " || " . $treasuretype . " || " . $new_account[$treasuretype]);
     return array("boughtName" => $product_id);
 }