當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserCache::deleteAllUserCache方法代碼示例

本文整理匯總了PHP中UserCache::deleteAllUserCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserCache::deleteAllUserCache方法的具體用法?PHP UserCache::deleteAllUserCache怎麽用?PHP UserCache::deleteAllUserCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserCache的用法示例。


在下文中一共展示了UserCache::deleteAllUserCache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exeGetUserInfo

 /**
  * API:獲取解鎖關卡基本信息
  *
  * @access public
  * @param 無
  * @return JsonView 響應json
  */
 public function exeGetUserInfo()
 {
     $requestParam = $this->getAllParameters();
     Logger::debug('requestParam:' . print_r($requestParam, true));
     $requestJsonParam = $this->getDecodedJsonRequest();
     Logger::debug('requestJsonParam:' . print_r($requestJsonParam, true));
     // 獲取用戶表信息
     UserCache::deleteAllUserCache($requestParam['user_id']);
     $userInfo = UserCache::getAllUserCache($requestParam['user_id']);
     if (!$userInfo) {
         $userInfo = self::iniUserInfo($requestParam['user_id']);
     }
     // 檢測體力
     $checkThewArr['n_thew'] = $userInfo['n_thew'];
     $checkThewArr['n_refresh_time'] = $userInfo['n_refresh_time'];
     $checkArr = self::refreshThew($checkThewArr);
     if ($checkArr) {
         UserModel::update($checkArr, $user = array('n_id' => $requestParam['user_id']), $pdo);
         UserCache::setByKey($requestParam['user_id'], 'n_thew', $checkArr['n_thew']);
         UserCache::setByKey($requestParam['user_id'], 'n_refresh_time', $checkArr['n_refresh_time']);
         $userInfo['n_thew'] = $checkArr['n_thew'];
         $userInfo['n_refresh_time'] = $checkArr['n_refresh_time'];
     }
     $nowTime = time();
     // 生成緩存
     $newSessionKey = Util::generateSessionKey($requestParam['user_id']);
     $oldSessionKey = $requestParam['session_key'];
     Logger::debug('SessionKey1:' . $oldSessionKey);
     Logger::debug('SessionKey2:' . $newSessionKey);
     UserCache::setByKey($requestParam['user_id'], Constants::PREVIOUS_SESSION_KEY, $oldSessionKey);
     UserCache::setByKey($requestParam['user_id'], Constants::CURRENT_SESSION_KEY, $newSessionKey);
     //UserCache::setByKey($user_id, 'userInfo', $userInfo);
     $messageArr = CharacterAction::getAllMessage($requestParam['user_id']);
     $messageArr['bullent'] = SystemAction::getBulletin();
     $messageArr['big_message'] = SystemAction::getBigMessage();
     $messageArr['s_login_info'] = $userInfo['s_login_info'];
     $messageArr['user_info']['s_name'] = $userInfo['s_name'];
     $messageArr['user_info']['n_level'] = $userInfo['n_level'];
     $messageArr['user_info']['f_experience'] = $userInfo['f_experience'];
     $messageArr['user_info']['n_coin'] = $userInfo['n_coin'];
     $messageArr['user_info']['n_diamond'] = $userInfo['n_diamond'];
     $messageArr['user_info']['n_soul'] = $userInfo['n_soul'];
     //$messageArr['user_info']['n_reward'] = $userInfo['n_reward'];
     $messageArr['user_info']['n_head'] = $userInfo['n_head'];
     $messageArr['user_info']['n_thew'] = $userInfo['n_thew'];
     $messageArr['user_info']['n_refresh_time'] = $userInfo['n_refresh_time'];
     $messageArr['user_info']['server_time'] = $nowTime;
     $messageArr['user_info']['time_num'] = Constants::REFRESH_THEW_TIME;
     $messageArr['user_info']['n_battle'] = $userInfo['n_battle'];
     //$messageArr['user_info']['s_role_info'] = $userInfo['s_role_info'];
     //$messageArr['user_info']['s_general_info'] = $userInfo['s_general_info'];
     $messageArr['role_id'] = $userInfo['s_role_info'][0];
     $messageArr['item'] = $userInfo['s_item_info'];
     $messageArr['id'] = $requestParam['user_id'];
     //$messageArr = $userInfo;
     $messageArr['session_key'] = $newSessionKey;
     $view = new JsonView();
     return $this->getViewByJson($view, $messageArr, 1, "system/get_bulletin");
 }
開發者ID:YYLP,項目名稱:y_game,代碼行數:66,代碼來源:UserAction.class.php

示例2: getWorldRank

 /**
  * API:獲取世界排行
  *
  * @access public
  * @param 無
  * @return JsonView 響應json
  */
 public function getWorldRank($user_id)
 {
     UserCache::deleteAllUserCache(Constants::WORLD_RANK);
     //$rankArr = UserCache::getAllUserCache( Constants::WORLD_RANK );
     $friendList = FriendAction::getFriend($user_id);
     if (!$rankArr) {
         //$worldRank = rankModel::selectlimit( $wheres = "",$limit = array( "page" => 1, "limit" => Constants::WORLD_RANKY_MAX_NUM ), $columns = array( "n_id", 'n_battle', 'n_max_checkpoint' ) );
         $worldRank = RankModel::getRank(Constants::WORLD_RANKY_MAX_NUM);
         foreach ($worldRank as $key => $value) {
             $result['max_checkpoint'] = $value['n_max_checkpoint'];
             $result['battle'] = $value['n_battle'];
             $result['n_id'] = $value['n_id'];
             $rankArr[$value['n_id']] = $result;
         }
         //echo "<pre>";var_dump($worldRank);exit;
         UserCache::setAllUserCache(Constants::WORLD_RANK, $rankArr);
     }
     // uasort($rankArr, function($a, $b) {
     //     $al = $a['max_checkpoint'];
     //     $bl = $b['max_checkpoint'];
     //     if ($al == $bl)
     //     {
     //         $al2 = $a['battle'];
     //         $bl2 = $b['battle'];
     //         return ($al2 > $bl2) ? -1 : 1;
     //     }
     //     return ($al > $bl) ? -1 : 1;
     // });
     $rankArr = array_slice($rankArr, 0, Constants::WORLD_RANKY_MAX_NUM);
     //echo "<pre>";
     foreach ($rankArr as $key => $value) {
         $now_id = $value['n_id'];
         $userInfo = UserCache::getAllUserCache($now_id);
         if (!$userInfo['n_id'] || !$userInfo['n_head'] || !$userInfo['s_name'] || !$userInfo['n_sex'] || !$userInfo['n_level'] || !$userInfo['n_max_checkpoint']) {
             $userInfo = UserAction::iniUserInfo($now_id);
         }
         //var_dump($userInfo);echo "<br />";
         $rankInfo['id'] = $userInfo['n_id'];
         $rankInfo['head'] = $userInfo['n_head'];
         $rankInfo['name'] = $userInfo['s_name'];
         $rankInfo['sex'] = $userInfo['n_sex'];
         $rankInfo['level'] = $userInfo['n_level'];
         $rankInfo['checkpoint'] = $userInfo['n_max_checkpoint'];
         $rankInfo['battle'] = $value['battle'];
         // 好友列表加入緩存後此處需要修改
         //$rankInfo['friend_type'] = FriendModel::isFriend( $user_id, $now_id );
         if ($friendList && in_array($now_id, $friendList)) {
             $rankInfo['friend_type'] = 1;
         } else {
             $rankInfo['friend_type'] = 0;
         }
         $worldRankInfo[$key + 1] = $rankInfo;
     }
     return $worldRankInfo;
 }
開發者ID:YYLP,項目名稱:y_game,代碼行數:62,代碼來源:RankAction.class.php


注:本文中的UserCache::deleteAllUserCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。