/** * 获得Redis的连接对象 */ public static function getObj($paramArr) { $options = array('serverName' => 'Default'); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!$serverName) { return false; } return API_Redis::getLink($serverName); #获得redis对象 }
/** * 获得队列 列表详情,不弹出,只是查看 */ public static function range($paramArr) { $options = array('serverName' => 'ResysQ', 'key' => false, 'offset' => 0, 'len' => 2); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!is_numeric($offset) || !is_numeric($len) || empty($key) || empty($serverName)) { return false; } $redis = API_Redis::getLink($serverName); $data = array(); $data = $redis->lRange($key, $offset, $len); return $data; }
/** * 显示验证码 */ public static function showImage($paramArr) { $options = array('token' => 0, 'numCnt' => 4, 'width' => 100, 'height' => 40, 'type' => 1, 'plex' => 5); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); if (!$token && LJL_Api::$_globalVars['_COOKIE'] && isset(LJL_Api::$_globalVars['_COOKIE']["ip_ck"])) { $token = LJL_Api::$_globalVars['_COOKIE']["ip_ck"]; } if (!$token) { #不返回了,直接生成 ip_ck cookie 值 $token = API_Item_Base_Page::createIpCk(array('setCookie' => 1)); // return false; } #获得唯一的用户码 $uniqCode = API_Item_Security_Algos::getUniqueCode(); $text = self::getAuthCode($uniqCode, $numCnt); #将数据数据到Redis $redis = API_Redis::getLink(self::$server); #获得redis对象 $key = self::$keyPre . $token; $redis->setex($key, 3600, $text); //最长1小时的缓存周期 #输出图片 $param = array('token' => $token, 'width' => $width, 'height' => $height, 'numCnt' => $numCnt, 'text' => $text); switch ($type) { case 2: self::getCodeColorImage($param); #黑白 break; case 3: require_once LJL_API_ROOT . "/Item/Security/Captchas/GifCode.php"; getGifCode($param); break; case 4: require_once LJL_API_ROOT . "/Item/Security/Captchas/GgCode.php"; getAuthImage($param); break; case 5: require_once LJL_API_ROOT . "/Item/Security/Captchas/code_math.php"; $param['redis'] = $redis; $param['key'] = $key; getMathCode($param); break; case 6: require_once LJL_API_ROOT . "/Item/Security/Captchas/CaptchaBuilderInterface.php"; require_once LJL_API_ROOT . "/Item/Security/Captchas/PhraseBuilderInterface.php"; require_once LJL_API_ROOT . "/Item/Security/Captchas/CaptchaBuilder.php"; require_once LJL_API_ROOT . "/Item/Security/Captchas/PhraseBuilder.php"; require_once LJL_API_ROOT . "/Item/Security/Captchas/captchaBuilderFunc.php"; $param['plex'] = $plex; getCaptchaBuilder($param); break; case 1: default: self::getCodeSimpleImage($param); #彩色 break; } exit; }