示例#1
0
 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;
 }
示例#2
0
 public function setLoginType($uid, $logintype)
 {
     if ($logintype == "") {
         return false;
     }
     CacheConnecter::set('passport', "logintype:" . $uid, $logintype, -1);
     return true;
 }
示例#3
0
 public function setModifiedTime($cacheAction, $params, $time, $expire)
 {
     if (empty($params)) {
         return false;
     }
     $key = $this->getKey($cacheAction, $params);
     CacheConnecter::set('httpcache', $key, $time, $expire);
 }