Add user get other info api

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-31 00:24:26 +08:00
parent c9775bcd8b
commit 8938fa052b
4 changed files with 84 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ type UserInfoData struct {
type UserInfoPayload struct {
Context context.Context
UserId uuid.UUID
IsOther bool
Data *UserInfoData
}
@@ -63,6 +64,29 @@ func (self *UserServiceImpl) GetUserInfo(payload *UserInfoPayload) (result *User
return
}
if payload.IsOther {
if !userData.AllowPublic {
exception := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).
SetEndpoint(exception.EndpointUserServiceInfo).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorUserNotFound).
SetError(err).
Throw(payload.Context)
result = &UserInfoResult{
Common: shared.CommonResult{
HttpCode: 404,
Exception: exception,
},
Data: nil,
}
return
}
}
exception := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).