public function getModifiedTime($key, $cacheConf) { return time(); $now = time(); if (empty($key)) { return $now; } $expire = 0; if (empty($cacheConf['cacheTime'])) { if (!empty($cacheConf['memoryTime'])) { $expire = $cacheConf['memoryTime']; } } else { $expire = $cacheConf['cacheTime']; } $modifiedTime = CacheConnecter::get('httpcache', $key); if (empty($modifiedTime)) { if (!empty($expire)) { CacheConnecter::set('httpcache', $key, $now, $expire); } return $now; } return $modifiedTime; }
public function getLoginType($uid) { $logintype = CacheConnecter::get('passport', "logintype:" . $uid); if ($logintype == "" || $logintype == false) { $passportinfo = $this->getInfoWithUid($uid); if ($passportinfo['username'] == "QL") { $logintype = 'qq'; } elseif ($passportinfo['username'] == "WL") { $logintype = 'wb'; } elseif ($passportinfo['username'] == "FL") { $logintype = 'fb'; } elseif ($passportinfo['username'] == "TL") { $logintype = 'tt'; } else { $logintype = 'phone'; } } return $logintype; }
public function getUserInfo($uids) { if (!is_array($uids)) { $uids = array($uids); } $UserHonor = new UserHonor(); $data = array(); $cacheData = CacheConnecter::get('userinfo', $uids); #$honorcacheData = $UserHonor->getUserHonorLevel($uids); $cacheIds = array(); if (is_array($cacheData)) { foreach ($cacheData as $onecachedata) { $cacheIds[] = $onecachedata['uid']; } } else { $cacheData = array(); } $dbIds = array_diff($uids, $cacheIds); $dbData = array(); if (!empty($dbIds)) { $result = array(); $idlist = implode(',', $dbIds); $db = DbConnecter::connectMysql('share_user'); $sql = "select * from userinfo where uid in({$idlist})"; $st = $db->prepare($sql); $st->execute(); $tmpDbData = $st->fetchAll(PDO::FETCH_ASSOC); $db = null; foreach ($tmpDbData as $onedbdata) { $dbData[$onedbdata['uid']] = $onedbdata; CacheConnecter::set('userinfo', $onedbdata['uid'], $onedbdata, 2592000); } } foreach ($uids as $uid) { if (in_array($uid, $dbIds)) { $data[$uid] = @$dbData[$uid]; } else { $data[$uid] = $cacheData[$uid]; } } $currentuid = @$_SESSION['uid']; $result = array(); foreach ($data as $one) { if (empty($one)) { continue; } $one = $this->formatUserBaseInfo($one); if (isset($_SERVER['visitorappversion']) && $_SERVER['visitorappversion'] >= 168000000) { if (empty($remarks[$one['uid']])) { $remarks[$one['uid']] = ""; } $one['remarkname'] = $remarks[$one['uid']]; } else { if (!empty($remarks[$one['uid']])) { $one['nickname'] = $remarks[$one['uid']]; } } #$one['userhonorlevel'] = $honorcacheData[$one['uid']]; $one['constellation'] = $this->getConstellationByBirthday($one['birthday']); if ($currentuid != $one['uid']) { $tmpsign = $one['sign']; $tmpsign = str_replace(" ", '', $tmpsign); if (preg_match("/\\d{7}/", $tmpsign)) { $one['sign'] = $_SERVER['disposeqqcontent'][$one['uid'] % 3]; } } $one['age'] = getAgeFromBirthDay($one['birthday']); $result[$one['uid']] = $one; } return $result; }