Table of Contents
5.3 手机号密码登录【参数校验通过,待业务联调】
POST /tieup/api/v1/auth/login
请求体:
{
"phone": "13800000000",
"password": "password"
}
请求参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
phone |
string | 是 | 中国大陆 11 位手机号 |
password |
string | 是 | 6 到 64 位密码 |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
access_token |
string | APP Access Token |
refresh_token |
string | APP Refresh Token |
expires_in |
integer | Access Token 有效时长,单位秒 |
user |
object | 当前用户完整资料对象,字段定义与注册接口一致 |
user.profile_completion_step |
integer | 当前资料完善步骤:0=未上传头像,1=已上传头像但核心资料未完善,2=核心资料已完善 |
user.current_identity |
string | 当前使用端:fan=粉丝端,artist=艺人端 |
user.available_identities |
array | 当前账号可切换的使用端列表 |
响应示例:
{
"code": 200,
"message": "成功",
"data": {
"access_token": "app_access_token",
"refresh_token": "app_refresh_token",
"expires_in": 7200,
"user": {
"id": 10001,
"rong_user_id": "tieup_fan_10001",
"group_code": "tieup",
"channel_code": "appstore",
"phone": "13800138000",
"nickname": "Tieup用户",
"avatar": "https://cdn.example.com/avatar.png",
"profile_completion_step": 2,
"gender": 2,
"age": 24,
"province_code": null,
"province_name": null,
"city_code": null,
"city_name": null,
"district_code": null,
"district_name": null,
"signature": "保持热爱",
"status": 1,
"is_idol": 2,
"candy_balance": "1000.00",
"online_status": 1,
"current_identity": "fan",
"available_identities": [
"fan"
]
}
}
}
业务规则:
- 密码使用服务端哈希校验,不返回
password_hash。 - 登录成功后更新
last_login_at、last_login_ip、last_active_at。 -
status = 2禁用、status = 3最终注销的账号禁止登录;status = 4注销中的账号在 7 天冷静期内登录会自动恢复为正常。 - 当
tieup_user.is_idol = 1且存在tieup_artist档案时,available_identities追加artist。 - 登录接口按
channel_code + phone做 Redis 限流,默认 60 秒最多 10 次;短信验证码校验同样限定当前请求渠道,不能跨渠道消费验证码。 -
user.profile_completion_step按当前资料实时计算;资料不满足条件时会随登录响应回退,不表示历史上是否完成过引导。 - 测试状态:已完成代码实现和 PHP 语法检查,待登录链路联调。