feat: 为用户设备添加 DeviceNo 字段并实现 ID 混淆,同时在迁移脚本中新增 ID 重建逻辑。
Build docker and publish / build (20.15.1) (push) Has been cancelled
Build docker and publish / build (20.15.1) (push) Has been cancelled
This commit is contained in:
@@ -35,6 +35,11 @@ func (l *GetUserDetailLogic) GetUserDetail(req *types.GetDetailRequest) (*types.
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "get user detail error: %v", err.Error())
|
||||
}
|
||||
tool.DeepCopy(&resp, userInfo)
|
||||
for i, d := range userInfo.UserDevices {
|
||||
if i < len(resp.UserDevices) {
|
||||
resp.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
if referCode := strings.TrimSpace(resp.ReferCode); referCode != "" {
|
||||
resp.ShareLink = logicCommon.NewInviteLinkResolver(l.ctx, l.svcCtx).ResolveInviteLink(referCode)
|
||||
}
|
||||
|
||||
@@ -163,6 +163,13 @@ func (l *GetUserListLogic) GetUserList(req *types.GetUserListRequest) (*types.Ge
|
||||
}
|
||||
u.AuthMethods = authMethods
|
||||
|
||||
// 填充 DeviceNo
|
||||
for i, d := range item.UserDevices {
|
||||
if i < len(u.UserDevices) {
|
||||
u.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
|
||||
if relation, ok := relationMap[item.Id]; ok {
|
||||
u.FamilyJoined = true
|
||||
u.FamilyId = relation.FamilyId
|
||||
|
||||
@@ -34,8 +34,14 @@ func (l *GetUserSubscribeDevicesLogic) GetUserSubscribeDevices(req *types.GetUse
|
||||
}
|
||||
userRespList := make([]types.UserDevice, 0)
|
||||
tool.DeepCopy(&userRespList, list)
|
||||
for i, d := range list {
|
||||
if i < len(userRespList) {
|
||||
userRespList[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
return &types.GetUserSubscribeDevicesResponse{
|
||||
Total: total,
|
||||
List: userRespList,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user