vali 6 éve
szülő
commit
6f1468e9b0

+ 26 - 0
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -954,6 +954,8 @@ class Events
         }
 
         $userInfo['intime'] = date("H:i", $userInfo['intime']);  ///后改为只显示小时分
+        $ut_tmp = self::getUserInfoCache($uid);
+        $userInfo = array_merge($userInfo, ['account_name' => $ut_tmp['account_name'], 'nick_name' => $ut_tmp['nick_name'], 'account_email' => $ut_tmp['account_email'], 'account_phone' => $ut_tmp['account_phone'], 'address' => $ut_tmp['address'], 'remark' => $ut_tmp['remark'], 'label' => self::$global->accountslabel[$ut_tmp['label_id']]['name']]);
         $noticeKf = [
             'message_type' => 'connect',
             'data' => [
@@ -1310,6 +1312,15 @@ class Events
             self::$global->replay = $arr;
         }
 
+        $arr = [];
+        $bq = self::$db->query("select  *  from ws_accountslabel");
+        if ($bq) {
+            foreach ($bq as $val) {
+                $arr[$val['id']] = $val;
+            }
+            self::$global->accountslabel = $arr;
+        }
+
     }
 
     /**
@@ -1839,6 +1850,21 @@ class Events
 
     }
 
+    //缓存获取用户信息
+    public static function getUserInfoCache($uid, $cacheTime = 180)
+    {
+        $uid = intval($uid);
+        $key = 'TmpUserInfo:' . $uid;
+        $cache = self::$redis->hget($key, $uid);
+        if ($cache && $cacheTime) {
+            return json_decode($cache, true);
+        }
+        $date = self::$db->select('*')->from('ws_accounts')->where("id= $uid ")->row();
+        self::$redis->hset($key, $uid, json_encode($date, 256));
+        self::$redis->EXPIRE($key, $cacheTime);
+        return $date;
+    }
+
 
 }