数据缓存处理
This commit is contained in:
@@ -1062,7 +1062,7 @@ class Room extends Model
|
||||
public function join_room($user_id, $room_id, $password) {
|
||||
//房间基础信息先从缓存获取
|
||||
$room = json_decode(Cache::get('room_info_' . $room_id), true);
|
||||
var_dump($room);die;
|
||||
|
||||
if(!$room){
|
||||
$room = db::name('vs_room')->where(['id' => $room_id])->find();
|
||||
$room['is_use_code'] = 0;
|
||||
@@ -1082,7 +1082,7 @@ class Room extends Model
|
||||
|
||||
//房主信息
|
||||
//先从缓存中获取
|
||||
$room_owner = json_decode(Cache::get('room_owner_' . $room_id));
|
||||
$room_owner = json_decode(Cache::get('room_owner_' . $room_id),true);
|
||||
if(!$room_owner){
|
||||
$room_owner = db::name('user')->where('id', $room['user_id'])->field('id as user_id,user_code,sex,nickname,avatar')->find();
|
||||
$room_owner['user_code'] = model('api/Decorate')->user_decorate_detail($room['user_id'],6);
|
||||
|
||||
@@ -192,7 +192,7 @@ class User extends Model
|
||||
{
|
||||
//先从缓存中获取
|
||||
$cache_key = 'user_base_info_'.$uid;
|
||||
$user_info = json_decode(Cache::get($cache_key));
|
||||
$user_info = json_decode(Cache::get($cache_key), true);
|
||||
|
||||
if(!$user_info){
|
||||
$user_info = db::name('user')
|
||||
|
||||
Reference in New Issue
Block a user