feat(用户管理): 添加最后登录时间和会员状态功能
Build docker and publish / build (20.15.1) (push) Successful in 4m57s

- 新增数据库迁移文件添加last_login_time字段
- 在登录逻辑中更新最后登录时间
- 添加FindActiveSubscribesByUserIds方法查询用户订阅状态
- 在用户列表接口中聚合最后登录时间和会员状态信息
- 更新相关API定义和模型结构
- 修复迁移文件版本号冲突问题
- 移除omitempty标签确保字段始终返回
This commit is contained in:
2026-01-05 01:46:39 -08:00
parent 5598181a48
commit 657c2930b1
13 changed files with 279 additions and 76 deletions
+10
View File
@@ -81,6 +81,16 @@ func (l *UserLoginLogic) UserLogin(req *types.UserLoginRequest) (resp *types.Log
return nil, errors.Wrapf(xerr.NewErrCode(xerr.UserPasswordError), "user password")
}
// Update last login time
now := time.Now()
userInfo.LastLoginTime = &now
if err := l.svcCtx.UserModel.Update(l.ctx, userInfo); err != nil {
l.Errorw("failed to update last login time",
logger.Field("user_id", userInfo.Id),
logger.Field("error", err.Error()),
)
}
// Bind device to user if identifier is provided
if req.Identifier != "" {
bindLogic := NewBindDeviceLogic(l.ctx, l.svcCtx)