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 800 B

1 viikko sitten
1 viikko sitten
1 viikko sitten
12345678910111213141516171819202122232425262728
  1. package api
  2. import (
  3. "context"
  4. "egg-im/internal/business/app"
  5. "egg-im/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. }