golang-im聊天
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

business_int.go 985 B

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