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
+4 -193
View File
@@ -1,64 +1,5 @@
basePath: /
definitions:
authapi.loginReq:
properties:
account:
description: 账号或邮箱
type: string
channel:
description: 渠道码(可选,用户无商区码时写入)
type: string
devID:
description: 设备唯一标示(可选)
type: string
password:
description: 明文密码
type: string
required:
- account
- password
type: object
authapi.registerReq:
properties:
accountNo:
description: 账号
type: string
agentInviteCode:
description: 邀请人的邀请码(可选)
type: string
channel:
description: 渠道码(可选,用户无商区码时写入)
type: string
devID:
description: 设备唯一标示(可选)
type: string
email:
description: 邮箱
type: string
password:
description: 明文密码
type: string
required:
- accountNo
- email
- password
type: object
authapi.resetPasswordReq:
properties:
accountNo:
description: 账号
type: string
email:
description: 邮箱
type: string
newPassword:
description: 新密码
type: string
required:
- accountNo
- email
- newPassword
type: object
authapi.updateProfileReq:
properties:
avatar:
@@ -67,34 +8,13 @@ definitions:
introduction:
description: 简介(可选)
type: string
newPassword:
description: 新密码明文(修改密码时必填)
type: string
nickName:
description: 新昵称(可选)
type: string
oldPassword:
description: 旧密码明文(修改密码时必填)
type: string
privacyMode:
description: 隐私模式:true-开启,false-关闭(可选)
type: boolean
type: object
authser.GuestLoginReq:
properties:
channel:
description: 渠道码(可选,用户无商区码时写入 DistrictCode)
type: string
devID:
description: 设备唯一标示(必填)
type: string
deviceId:
description: 备用设备ID(可选,写入 DevV2)
type: string
mac:
description: 设备 Mac(可选)
type: string
type: object
authser.LoginResp:
properties:
accountNo:
@@ -113,9 +33,6 @@ definitions:
inviteCode:
description: 邀请码
type: string
isNewUser:
description: 本次是否新建游客
type: boolean
isRegister:
description: 是否已注册
type: boolean
@@ -142,8 +59,6 @@ definitions:
type: string
status:
$ref: '#/definitions/pubdef.UserStatus'
token:
type: string
type:
allOf:
- $ref: '#/definitions/pubdef.UserType'
@@ -3144,7 +3059,7 @@ paths:
- 应用列表
/api/app/auth/getInfo:
get:
description: 通过 token 获取最新用户信息,包含金币余额、VIP状态等
description: 按请求头 X-User-Agent 中的 devID 识别用户,返回最新用户信息,包含金币余额、VIP状态等
produces:
- application/json
responses:
@@ -3159,64 +3074,12 @@ paths:
summary: 获取当前用户信息
tags:
- 用户认证
/api/app/auth/guest:
post:
consumes:
- application/json
description: 按设备ID创建或找回游客账号;请求头可带 Authorization 复用已有游客会话。需传 X-User-Agent
parameters:
- description: 游客登录参数
in: body
name: param
required: true
schema:
$ref: '#/definitions/authser.GuestLoginReq'
produces:
- application/json
responses:
"200":
description: 成功
schema:
$ref: '#/definitions/authser.LoginResp'
"400":
description: 失败
schema:
type: string
summary: 游客登录
tags:
- 用户认证
/api/app/auth/login:
post:
consumes:
- application/json
description: 账号或邮箱均可作为登录凭证
parameters:
- description: 登录参数
in: body
name: param
required: true
schema:
$ref: '#/definitions/authapi.loginReq'
produces:
- application/json
responses:
"200":
description: 登录成功,返回 token 及用户基本信息
schema:
$ref: '#/definitions/authser.LoginResp'
"400":
description: 失败
schema:
type: string
summary: 登录
tags:
- 用户认证
/api/app/auth/profile:
post:
consumes:
- application/json
description: 用户信息通过 token 获取,无需传账号;nickName、avatar、introduction、oldPassword+newPassword
均为可选,至少提供一项。修改密码时旧密码和新密码必须同时提供。
description: 按请求头 X-User-Agent 中的 devID 识别用户;nickName、avatar、introduction、privacyMode
均为可选,至少提供一项。
parameters:
- description: 修改资料参数
in: body
@@ -3235,59 +3098,7 @@ paths:
description: 失败
schema:
type: string
summary: 修改用户资料(头像 / 简介 / 密码,可任意组合)
tags:
- 用户认证
/api/app/auth/register:
post:
consumes:
- application/json
description: 传入账号、邮箱、明文密码。请求头带游客 Authorization 时升级该游客为普通用户,否则新建用户
parameters:
- description: 注册参数
in: body
name: param
required: true
schema:
$ref: '#/definitions/authapi.registerReq'
produces:
- application/json
responses:
"200":
description: 注册成功,返回 token 及用户基本信息
schema:
$ref: '#/definitions/authser.LoginResp'
"400":
description: 失败
schema:
type: string
summary: 注册
tags:
- 用户认证
/api/app/auth/resetPassword:
post:
consumes:
- application/json
description: 通过账号和邮箱双重校验后重置密码,两者必须同时匹配同一用户
parameters:
- description: 找回密码参数
in: body
name: param
required: true
schema:
$ref: '#/definitions/authapi.resetPasswordReq'
produces:
- application/json
responses:
"200":
description: 成功
schema:
type: string
"400":
description: 失败
schema:
type: string
summary: 找回密码
summary: 修改用户资料(昵称 / 头像 / 简介 / 隐私模式,可任意组合)
tags:
- 用户认证
/api/app/coin/buy: