app端取消用户注册和token验证,改为按设备ID识别用户

- 删除注册、登录、找回密码、游客登录接口及密码、token 相关代码
- 鉴权中间件不再校验 token,按 X-User-Agent 中的 devID 识别用户,首次访问自动创建,Redis 缓存 10 分钟
- 渠道码改从请求头 channel 读取;修改资料不再支持改密码
- 同步更新 swagger 文档

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-23 16:22:10 +08:00
co-authored by Claude Opus 5.5
parent d6599ae004
commit 4efdbfeffc
10 changed files with 123 additions and 1462 deletions
+14
View File
@@ -12,6 +12,10 @@ const (
FiveMVisit = "bd_visitFmt:%s"
BloomUser = "bd_bloom_user:%d"
AppUserToken = "bd_app_user_token:%d"
appDeviceUserFmt = "app:device:user:%s"
appDeviceUserLockFmt = "app:device:user:lock:%s"
AppDeviceUserExpire = 10 * time.Minute
AppDeviceUserLockExpire = 5 * time.Second
captchaKey = "bd_captcha_mobile_%s"
CaptchaExpire = 5 * time.Minute
replayNonceKey = "bd_replay:nonce:_%s"
@@ -88,6 +92,16 @@ func AppUserTokenKey(userId int64) string {
return fmt.Sprintf(AppUserToken, userId)
}
// AppDeviceUserKey 设备ID到用户ID的缓存
func AppDeviceUserKey(devID string) string {
return fmt.Sprintf(appDeviceUserFmt, devID)
}
// AppDeviceUserLockKey 按设备ID创建用户时的并发锁
func AppDeviceUserLockKey(devID string) string {
return fmt.Sprintf(appDeviceUserLockFmt, devID)
}
func MediaM3U8Key(name string) string {
return fmt.Sprintf(mediaM3U8Fmt, name)
}