35 lines
746 B
Go
35 lines
746 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"juwan-backend/app/users/rpc/internal/svc"
|
|
"juwan-backend/app/users/rpc/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type LogoutLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewLogoutLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LogoutLogic {
|
|
return &LogoutLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *LogoutLogic) Logout(in *pb.LogoutReq) (*pb.LogoutResp, error) {
|
|
// todo: add your logic here and delete this line
|
|
err := l.svcCtx.JwtManager.Logout(l.ctx, in.UserId)
|
|
if err != nil {
|
|
logx.WithContext(l.ctx).Errorf("Logout failed: %s", err.Error())
|
|
return nil, err
|
|
}
|
|
return &pb.LogoutResp{}, nil
|
|
}
|