优化后台修改玩家信息(钱包等)没有更新缓存的问题
This commit is contained in:
@@ -14,6 +14,7 @@ use support\think\Db;
|
||||
use app\api\controller\BaseController;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use app\api\cache\UserCache;
|
||||
|
||||
/**
|
||||
* 平台 v1 游戏接口
|
||||
@@ -297,6 +298,12 @@ class GameController extends BaseController
|
||||
return $this->fail('操作失败:' . $e->getMessage(), ReturnCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 出于安全:删除该玩家相关缓存,后续 API 调用按需重建
|
||||
UserCache::deleteUser($player->id);
|
||||
if ($player->username !== '') {
|
||||
UserCache::deletePlayerByUsername($player->username);
|
||||
}
|
||||
|
||||
$recordArr = $record->toArray();
|
||||
$recordArr['dice_player'] = ['id' => (int) $player->id, 'username' => $player->username ?? '', 'phone' => $player->phone ?? ''];
|
||||
return $this->success($recordArr);
|
||||
|
||||
Reference in New Issue
Block a user