42 lines
770 B
Go
42 lines
770 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"juwan-backend/app/user/rpc/internal/svc"
|
|
"juwan-backend/app/user/rpc/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type GetUserInfoLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
|
|
return &GetUserInfoLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *GetUserInfoLogic) GetUserInfo(in *pb.GetUserInfoReq) (*pb.GetUserInfoResp, error) {
|
|
users := map[int64]string{
|
|
1: "WangHuahua",
|
|
2: "LiKunkun",
|
|
}
|
|
|
|
nikename := "Unknow"
|
|
if name, ok := users[in.Id]; ok {
|
|
nikename = name
|
|
}
|
|
|
|
return &pb.GetUserInfoResp{
|
|
Id: in.Id,
|
|
Nickname: nikename,
|
|
}, nil
|
|
}
|