public function createCache()
 {
     $cachePath = config('PARAMS_PATH') . '/gameservers';
     if (!file_exists($cachePath)) {
         mkdir($cachePath, 0777, true);
     }
     $allGames = $this->getAll();
     createPhpArr($allGames, $cachePath . '/games.conf.php');
 }
 public function createCache()
 {
     $this->_modelGames = $this->getGlobal('model/Games', 'Model_Games');
     $allGames = $this->_modelGames->getAll();
     $cachePath = config('PARAMS_PATH') . '/gameservers';
     if (!file_exists($cachePath)) {
         mkdir($cachePath, 0777, true);
     }
     foreach ($allGames as $key => $val) {
         $servers = $this->select("select * from {$this->tName()} where game_mark='{$val['mark']}'", 'id');
         if (count($servers)) {
             createPhpArr($servers, $cachePath . "/{$val['mark']}.conf.php");
         }
     }
 }
 /**
  * 创建用户缓存,用于解决用户列表
  */
 public function createCache()
 {
     $allUsers = $this->getAll();
     $idToVuserList = array();
     $idToUserList = array();
     foreach ($allUsers as $val) {
         $idToVuserList[$val['id']] = $val['vuser'];
         $idToUserList[$val['id']] = $val['user'];
     }
     $cachePath = config('PARAMS_PATH') . '/adminuser';
     if (!file_exists($cachePath)) {
         mkdir($cachePath, 0777, true);
     }
     createPhpArr($idToVuserList, $cachePath . '/id_vuser.conf.php');
     createPhpArr($idToUserList, $cachePath . '/id_user.conf.php');
     createPhpArr($allUsers, $cachePath . '/all_user.conf.php');
     return true;
 }
 /**
  * 保存角色act
  * @param key
  * @param act
  * @param module
  */
 public function saveRoleAct()
 {
     $role = $this->getR('key');
     $userAct = $this->getR('act');
     $module = $this->getR('module');
     $actList = params("act/{$module}");
     $rbacEveryOne = config('RBAC_EVERYONE');
     //所有用户
     $rbacOnly = config('RBAC_ONLY');
     //登陆用户
     foreach ($actList as $key => &$val) {
         if ($val == $rbacEveryOne || $val == $rbacOnly) {
             //如果为登陆或是所有用户,那么就跳过
             continue;
         }
         if (empty($val)) {
             //防止错误.
             $val = array();
         } else {
             $val = explode(',', $val);
         }
         if ($userAct[$key]) {
             //如果选中此模块
             if (in_array($role, $val)) {
                 //在这个里面就不管了.
                 $val = implode(',', $val);
                 continue;
             }
             array_push($val, $role);
         } else {
             //未选中引模块
             $key = array_search($role, $val);
             if (false === $key) {
                 $val = implode(',', $val);
                 continue;
                 //表示没有找到此KEY,可以跳过当即前循环
             }
             unset($val[$key]);
         }
         $val = implode(',', $val);
     }
     createPhpArr($actList, config('PARAMS_PATH') . "/act/{$module}.conf.php");
     return array('status' => 1, 'info' => '修改角色权限成功', 'data' => null, 'url' => url('setup/prem/RoleIndex'));
 }