add: anowflake email kafka, refa: redis connectg

This commit is contained in:
wwweww
2026-02-25 01:16:13 +08:00
parent fdbcde13b2
commit 300058ad01
67 changed files with 3596 additions and 139 deletions
@@ -0,0 +1,33 @@
package logic
import (
"context"
"juwan-backend/app/snowflake/rpc/internal/svc"
"juwan-backend/app/snowflake/rpc/snowflake"
"github.com/zeromicro/go-zero/core/logx"
)
type NextIdLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewNextIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NextIdLogic {
return &NextIdLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *NextIdLogic) NextId(_ *snowflake.NextIdReq) (*snowflake.NextIdResp, error) {
id, err := l.svcCtx.Generator.NextID()
if err != nil {
l.Error("generator.NextID", "err", err)
return nil, err
}
return &snowflake.NextIdResp{Id: id}, nil
}