数据缓存处理

This commit is contained in:
2025-12-24 17:17:06 +08:00
parent 2fb87137dd
commit 25635b0e46
2 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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')