当前位置: 首页>>代码示例>>PHP>>正文


PHP UserCache::setAllUserCache方法代码示例

本文整理汇总了PHP中UserCache::setAllUserCache方法的典型用法代码示例。如果您正苦于以下问题:PHP UserCache::setAllUserCache方法的具体用法?PHP UserCache::setAllUserCache怎么用?PHP UserCache::setAllUserCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserCache的用法示例。


在下文中一共展示了UserCache::setAllUserCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: iniUserInfo

 /**
  * API:初始化用户数据
  *
  * @access public
  * @param 无
  * @return JsonView 响应json
  */
 public function iniUserInfo($user_id)
 {
     $userInfo = UserModel::getUserInfo($user_id);
     $userInfo['s_checkpoint_info'] = unserialize($userInfo['s_checkpoint_info']);
     $userInfo['s_role_info'] = unserialize($userInfo['s_role_info']);
     $userInfo['s_general_info'] = unserialize($userInfo['s_general_info']);
     $userInfo['s_item_info'] = unserialize($userInfo['s_item_info']);
     $userInfo['s_task_info'] = unserialize($userInfo['s_task_info']);
     $userInfo['s_achievement_info'] = unserialize($userInfo['s_achievement_info']);
     $userInfo['s_login_info'] = unserialize($userInfo['s_login_info']);
     UserCache::setAllUserCache($user_id, $userInfo);
     return $userInfo;
 }
开发者ID:YYLP,项目名称:y_game,代码行数:20,代码来源:UserAction.class.php


注:本文中的UserCache::setAllUserCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。