Error code standardization

test-errcode
skiffer-git 2 years ago
parent 8ecdcbfc0a
commit 954e01c951

@ -16,7 +16,7 @@ func (s *friendServer) GetBlacks(ctx context.Context, req *pbFriend.GetBlacksReq
if err := check.Access(ctx, req.UserID); err != nil {
return nil, err
}
blacks, err := s.BlackInterface.FindOwnerBlacks(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
blacks, total, err := s.BlackInterface.FindOwnerBlacks(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
return nil, err
}
@ -29,6 +29,7 @@ func (s *friendServer) GetBlacks(ctx context.Context, req *pbFriend.GetBlacksReq
resp.Blacks = append(resp.Blacks, b)
blackIDList = append(blackIDList, black.BlockUserID)
}
resp.Total = int32(total)
return resp, nil
}

@ -190,11 +190,11 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
}
oldNickname := ""
if req.UserInfo.Nickname != "" {
u, err := s.Take(ctx, req.UserInfo.UserID)
u, err := s.Find(ctx, []string{req.UserInfo.UserID})
if err != nil {
return nil, err
}
oldNickname = u.Nickname
oldNickname = u[0].Nickname
}
user, err := convert.NewPBUser(req.UserInfo).Convert()
if err != nil {
@ -274,12 +274,12 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
resp := pbUser.GetUsersResp{}
var err error
if req.UserID != "" {
u, err := s.Take(ctx, req.UserID)
u, err := s.Find(ctx, []string{req.UserID})
if err != nil {
return nil, err
}
resp.Total = 1
u1, err := convert.NewDBUser(u).Convert()
u1, err := convert.NewDBUser(u[0]).Convert()
if err != nil {
return nil, err
}

@ -7,9 +7,9 @@ import (
)
type UserInterface interface {
//获取指定用户的信息 如果有记录未找到 也返回错误
Find(ctx context.Context, userIDs []string) (users []*relation.User, err error)
Create(ctx context.Context, users []*relation.User) error
Take(ctx context.Context, userID string) (user *relation.User, err error)
Update(ctx context.Context, users []*relation.User) (err error)
UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error)
GetByName(ctx context.Context, userName string, showNumber, pageNumber int32) (users []*relation.User, count int64, err error)

Loading…
Cancel
Save