优化验证token接口-暂时不验证token有效性

This commit is contained in:
2026-04-23 09:43:10 +08:00
parent 0a1109c109
commit 3b687489a0
2 changed files with 22 additions and 127 deletions

View File

@@ -20,23 +20,14 @@ return [
// token 会话缓存过期时间(秒)
'session_expire_seconds' => intval(env('PLAYX_SESSION_EXPIRE_SECONDS', '3600')),
/**
* 为 true 时:/api/v1/playx/verify-token 仅本地校验(查 token 表 + mall_playx_user_asset不请求 PlayX。
* 联调/无 PlayX 环境可开;上线对接 PlayX 后请设为 false 并配置 api.base_url
* 为 true 时verifyToken 不向 PlayX 请求;当前实现为联调占位——不校验请求中的 token
* 每次签发新 session用户标识见 verify_token_local_default_*(待对方提供校验接口后请设为 false 并走远程校验)
*/
'verify_token_local_only' => filter_var(env('PLAYX_VERIFY_TOKEN_LOCAL_ONLY', '1'), FILTER_VALIDATE_BOOLEAN),
/**
* 联调占位(待对方提供 token 校验接口后删除或清空verify_token_local_only 为 true 时,
* 若请求中的 token 与此字符串完全一致则视为有效合作方 JWT写入 mall_session
* 生产环境务必置空或通过环境变量覆盖为空。
*/
'dev_verify_token_exact' => strval(env(
'PLAYX_DEV_VERIFY_TOKEN_EXACT',
'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0bXlyIiwiYXV0aCI6IlJPTEVfTUVNQkVSIiwibWVyY2hhbnQiOiJwbHgiLCJ1c2VyX2Z1bGxuYW1lIjoiQW5uYSIsImN1cnJlbmN5IjoiTVlSIiwibGFuZ3VhZ2UiOiJ6aC1DTiIsInZpcCI6ZmFsc2UsImV4cCI6MTc3NjkzODI4N30.XVvNcnBcAEqdxqoNRmygkl826bLUfwH2xyBE8wiSTOSeJjv99DHKJOAgsE4ukJ-M_t1hPbraz9GO4qvOszOeDg'
)),
/** 命中 dev_verify_token_exact 时写入 session 的展示用户名(空则取 JWT user_fullname 或 sub */
'dev_verify_session_username' => strval(env('PLAYX_DEV_VERIFY_SESSION_USERNAME', 'yangyang123')),
/** 命中 dev_verify_token_exact 时写入 session 的 user_id空则取 JWT sub */
'dev_verify_session_user_id' => strval(env('PLAYX_DEV_VERIFY_SESSION_USER_ID', '')),
/** verify_token_local_only 为 true 时写入 mall_session 的 playx 用户标识 */
'verify_token_local_default_user_id' => strval(env('PLAYX_VERIFY_TOKEN_LOCAL_DEFAULT_USER_ID', 'testmyr')),
/** verify_token_local_only 为 true 时写入 mall_session 的展示用户名 */
'verify_token_local_default_username' => strval(env('PLAYX_VERIFY_TOKEN_LOCAL_DEFAULT_USERNAME', 'yangyang123')),
// PlayX API 配置(商城调用 PlayX 时使用)
'api' => [
'base_url' => strval(env('PLAYX_API_BASE_URL', '')),