golang-im聊天
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

29 行
794 B

  1. package api
  2. import (
  3. "context"
  4. "gim/internal/business/app"
  5. "gim/pkg/pb"
  6. )
  7. type BusinessIntServer struct{}
  8. func (*BusinessIntServer) Auth(ctx context.Context, req *pb.AuthReq) (*pb.Empty, error) {
  9. return &pb.Empty{}, app.AuthApp.Auth(ctx, req.UserId, req.DeviceId, req.Token)
  10. }
  11. func (*BusinessIntServer) GetUser(ctx context.Context, req *pb.GetUserReq) (*pb.GetUserResp, error) {
  12. user, err := app.UserApp.Get(ctx, req.UserId)
  13. return &pb.GetUserResp{User: user}, err
  14. }
  15. func (*BusinessIntServer) GetUsers(ctx context.Context, req *pb.GetUsersReq) (*pb.GetUsersResp, error) {
  16. var userIds = make([]int64, 0, len(req.UserIds))
  17. for k := range req.UserIds {
  18. userIds = append(userIds, k)
  19. }
  20. users, err := app.UserApp.GetByIds(ctx, userIds)
  21. return &pb.GetUsersResp{Users: users}, err
  22. }