19cc7a778c
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`. - Added new API server implementations for objectstory, player, and shop services. - Introduced configuration files for new APIs in `etc/*.yaml`. - Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`. - Removed unused user update handler and user API files. - Added utility functions for context management and HTTP header parsing. - Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
44 lines
1006 B
Go
44 lines
1006 B
Go
// Code scaffolded by goctl. Safe to edit.
|
|
// goctl 1.9.2
|
|
|
|
package community
|
|
|
|
import (
|
|
"context"
|
|
|
|
"juwan-backend/app/community/api/internal/svc"
|
|
"juwan-backend/app/community/api/internal/types"
|
|
communitypb "juwan-backend/app/community/rpc/pb"
|
|
"juwan-backend/common/utils/contextj"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type LikeCommentLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
// 点赞评论
|
|
func NewLikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeCommentLogic {
|
|
return &LikeCommentLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *LikeCommentLogic) LikeComment(req *types.PathId) (resp *types.EmptyResp, err error) {
|
|
uid, err := contextj.UserIDFrom(l.ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
_, err = l.svcCtx.CommunityRpc.AddCommentLikes(l.ctx, &communitypb.AddCommentLikesReq{CommentId: req.Id, UserId: uid})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &types.EmptyResp{}, nil
|
|
|
|
}
|