fix: unify user ID type to string and rename service to users-api

This commit is contained in:
zetaloop
2026-04-22 22:03:49 +08:00
parent 59256897e9
commit b3db04c9cc
11 changed files with 59 additions and 28 deletions
@@ -6,6 +6,8 @@ package user
import (
"context"
"errors"
"strconv"
"juwan-backend/app/users/rpc/usercenter"
"juwan-backend/common/utils/contextj"
@@ -31,14 +33,18 @@ func NewUnfollowUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Unfo
}
func (l *UnfollowUserLogic) UnfollowUser(req *types.UnfollowUserReq) (resp *types.EmptyResp, err error) {
// todo: add your logic here and delete this line
userId, err := contextj.UserIDFrom(l.ctx)
if err != nil {
return nil, errors.New("unauthorized")
}
targetId, err := strconv.ParseInt(req.Id, 10, 64)
if err != nil {
return nil, errors.New("invalid user id")
}
_, err = l.svcCtx.UserRpc.DelUserFollows(l.ctx, &usercenter.DelUserFollowsReq{
Id: req.Id,
Id: targetId,
UserId: userId,
})
if err != nil {