firest commit

This commit is contained in:
wwweww
2026-02-21 22:48:40 +08:00
commit 55e8053e07
1034 changed files with 99049 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
package config
import "github.com/zeromicro/go-zero/zrpc"
type Config struct {
zrpc.RpcServerConf
DB struct {
UserDB string
}
}
@@ -0,0 +1,41 @@
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
}
@@ -0,0 +1,29 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// Source: user.proto
package server
import (
"context"
"juwan-backend/app/user/rpc/internal/logic"
"juwan-backend/app/user/rpc/internal/svc"
"juwan-backend/app/user/rpc/pb"
)
type UsercenterServer struct {
svcCtx *svc.ServiceContext
pb.UnimplementedUsercenterServer
}
func NewUsercenterServer(svcCtx *svc.ServiceContext) *UsercenterServer {
return &UsercenterServer{
svcCtx: svcCtx,
}
}
func (s *UsercenterServer) GetUserInfo(ctx context.Context, in *pb.GetUserInfoReq) (*pb.GetUserInfoResp, error) {
l := logic.NewGetUserInfoLogic(ctx, s.svcCtx)
return l.GetUserInfo(in)
}
@@ -0,0 +1,13 @@
package svc
import "juwan-backend/app/user/rpc/internal/config"
type ServiceContext struct {
Config config.Config
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
}
}