@@ -28,12 +28,15 @@ func NewGetDeviceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
|||||||
|
|
||||||
func (l *GetDeviceListLogic) GetDeviceList() (resp *types.GetDeviceListResponse, err error) {
|
func (l *GetDeviceListLogic) GetDeviceList() (resp *types.GetDeviceListResponse, err error) {
|
||||||
userInfo := l.ctx.Value(constant.CtxKeyUser).(*user.User)
|
userInfo := l.ctx.Value(constant.CtxKeyUser).(*user.User)
|
||||||
scopeHelper := newFamilyScopeHelper(l.ctx, l.svcCtx)
|
// 只查当前用户自己的设备(不查家庭组其他成员的设备)
|
||||||
scopeUserIds, err := scopeHelper.resolveScopedUserIds(userInfo.Id)
|
// 原始代码(保留以供对照):
|
||||||
if err != nil {
|
// scopeHelper := newFamilyScopeHelper(l.ctx, l.svcCtx)
|
||||||
return nil, err
|
// scopeUserIds, err := scopeHelper.resolveScopedUserIds(userInfo.Id)
|
||||||
}
|
// if err != nil {
|
||||||
list, count, err := l.svcCtx.UserModel.QueryDeviceListByUserIds(l.ctx, scopeUserIds)
|
// return nil, err
|
||||||
|
// }
|
||||||
|
// list, count, err := l.svcCtx.UserModel.QueryDeviceListByUserIds(l.ctx, scopeUserIds)
|
||||||
|
list, count, err := l.svcCtx.UserModel.QueryDeviceList(l.ctx, userInfo.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user