init comment and post service
This commit is contained in:
parent
bc506fd090
commit
53f9231a6a
8
Makefile
8
Makefile
|
@ -21,7 +21,7 @@ fmt: # 格式優化
|
||||||
|
|
||||||
.PHONY: gen-rpc
|
.PHONY: gen-rpc
|
||||||
gen-rpc: # 建立 rpc code
|
gen-rpc: # 建立 rpc code
|
||||||
$(GO_CTL_NAME) rpc protoc ./generate/protobuf/feed.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=.
|
$(GO_CTL_NAME) rpc protoc ./generate/protobuf/tweeting.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=.
|
||||||
go mod tidy
|
go mod tidy
|
||||||
@echo "Generate core-api files successfully"
|
@echo "Generate core-api files successfully"
|
||||||
|
|
||||||
|
@ -49,5 +49,9 @@ build-docker:
|
||||||
|
|
||||||
gen-mongo-model: # 建立 rpc 資料庫
|
gen-mongo-model: # 建立 rpc 資料庫
|
||||||
# 只產生 Model 剩下的要自己撰寫,連欄位名稱也是
|
# 只產生 Model 剩下的要自己撰寫,連欄位名稱也是
|
||||||
goctl model mongo -t AutoId --dir ./internal/model/mongo --style $(GO_ZERO_STYLE)
|
goctl model mongo -c no -t post --dir ./internal/model/mongo --style $(GO_ZERO_STYLE)
|
||||||
|
goctl model mongo -c no -t comment --dir ./internal/model/mongo --style $(GO_ZERO_STYLE)
|
||||||
|
goctl model mongo -t tags --dir ./internal/model/mongo --style $(GO_ZERO_STYLE)
|
||||||
|
goctl model mongo -t post_likes --dir ./internal/model/mongo --style $(GO_ZERO_STYLE)
|
||||||
|
goctl model mongo -t comment_likes --dir ./internal/model/mongo --style $(GO_ZERO_STYLE)
|
||||||
@echo "Generate mongo model files successfully"
|
@echo "Generate mongo model files successfully"
|
|
@ -0,0 +1,6 @@
|
||||||
|
Name: tweeting.rpc
|
||||||
|
ListenOn: 0.0.0.0:8080
|
||||||
|
Etcd:
|
||||||
|
Hosts:
|
||||||
|
- 127.0.0.1:2379
|
||||||
|
Key: tweeting.rpc
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package feed;
|
package tweeting;
|
||||||
option go_package="./feed";
|
option go_package="./tweeting";
|
||||||
|
|
||||||
// 基本回應
|
// 基本回應
|
||||||
message OKResp {}
|
message OKResp {}
|
4
go.mod
4
go.mod
|
@ -4,7 +4,7 @@ go 1.22.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/zeromicro/go-zero v1.7.0
|
github.com/zeromicro/go-zero v1.7.0
|
||||||
google.golang.org/grpc v1.65.0
|
google.golang.org/grpc v1.66.0
|
||||||
google.golang.org/protobuf v1.34.2
|
google.golang.org/protobuf v1.34.2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ require (
|
||||||
go.uber.org/multierr v1.9.0 // indirect
|
go.uber.org/multierr v1.9.0 // indirect
|
||||||
go.uber.org/zap v1.24.0 // indirect
|
go.uber.org/zap v1.24.0 // indirect
|
||||||
golang.org/x/net v0.27.0 // indirect
|
golang.org/x/net v0.27.0 // indirect
|
||||||
golang.org/x/oauth2 v0.20.0 // indirect
|
golang.org/x/oauth2 v0.21.0 // indirect
|
||||||
golang.org/x/sys v0.22.0 // indirect
|
golang.org/x/sys v0.22.0 // indirect
|
||||||
golang.org/x/term v0.22.0 // indirect
|
golang.org/x/term v0.22.0 // indirect
|
||||||
golang.org/x/text v0.16.0 // indirect
|
golang.org/x/text v0.16.0 // indirect
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewCountLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CountLi
|
||||||
}
|
}
|
||||||
|
|
||||||
// CountLike 取得讚/不讚評論數量
|
// CountLike 取得讚/不讚評論數量
|
||||||
func (l *CountLikeLogic) CountLike(in *feed.LikeCountReq) (*feed.LikeCountResp, error) {
|
func (l *CountLikeLogic) CountLike(in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.LikeCountResp{}, nil
|
return &tweeting.LikeCountResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewDeleteCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteComment 刪除評論
|
// DeleteComment 刪除評論
|
||||||
func (l *DeleteCommentLogic) DeleteComment(in *feed.DeleteCommentReq) (*feed.OKResp, error) {
|
func (l *DeleteCommentLogic) DeleteComment(in *tweeting.DeleteCommentReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewGetCommentsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCo
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetComments 查詢評論
|
// GetComments 查詢評論
|
||||||
func (l *GetCommentsLogic) GetComments(in *feed.GetCommentsReq) (*feed.GetCommentsResp, error) {
|
func (l *GetCommentsLogic) GetComments(in *tweeting.GetCommentsReq) (*tweeting.GetCommentsResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.GetCommentsResp{}, nil
|
return &tweeting.GetCommentsResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewGetLikeStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLikeStatus 取得讚/不讚評論狀態
|
// GetLikeStatus 取得讚/不讚評論狀態
|
||||||
func (l *GetLikeStatusLogic) GetLikeStatus(in *feed.LikeReq) (*feed.OKResp, error) {
|
func (l *GetLikeStatusLogic) GetLikeStatus(in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewLikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeC
|
||||||
}
|
}
|
||||||
|
|
||||||
// LikeComment 點讚/取消讚 評論
|
// LikeComment 點讚/取消讚 評論
|
||||||
func (l *LikeCommentLogic) LikeComment(in *feed.LikeReq) (*feed.OKResp, error) {
|
func (l *LikeCommentLogic) LikeComment(in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewLikeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeList
|
||||||
}
|
}
|
||||||
|
|
||||||
// LikeList 取得讚/不讚評論列表
|
// LikeList 取得讚/不讚評論列表
|
||||||
func (l *LikeListLogic) LikeList(in *feed.LikeListReq) (*feed.LikeListResp, error) {
|
func (l *LikeListLogic) LikeList(in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.LikeListResp{}, nil
|
return &tweeting.LikeListResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewNewCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NewCom
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewComment 發表評論
|
// NewComment 發表評論
|
||||||
func (l *NewCommentLogic) NewComment(in *feed.CommentPostReq) (*feed.OKResp, error) {
|
func (l *NewCommentLogic) NewComment(in *tweeting.CommentPostReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package commentservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewUpdateCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upd
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateComment 更新評論
|
// UpdateComment 更新評論
|
||||||
func (l *UpdateCommentLogic) UpdateComment(in *feed.UpdateCommentReq) (*feed.OKResp, error) {
|
func (l *UpdateCommentLogic) UpdateComment(in *tweeting.UpdateCommentReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewCountLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CountLi
|
||||||
}
|
}
|
||||||
|
|
||||||
// CountLike 取得讚/不讚數量
|
// CountLike 取得讚/不讚數量
|
||||||
func (l *CountLikeLogic) CountLike(in *feed.LikeCountReq) (*feed.LikeCountResp, error) {
|
func (l *CountLikeLogic) CountLike(in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.LikeCountResp{}, nil
|
return &tweeting.LikeCountResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewDeletePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePost 刪除貼文
|
// DeletePost 刪除貼文
|
||||||
func (l *DeletePostLogic) DeletePost(in *feed.DeletePostsReq) (*feed.OKResp, error) {
|
func (l *DeletePostLogic) DeletePost(in *tweeting.DeletePostsReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewGetLikeStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLikeStatus 取得讚/不讚狀態
|
// GetLikeStatus 取得讚/不讚狀態
|
||||||
func (l *GetLikeStatusLogic) GetLikeStatus(in *feed.LikeReq) (*feed.OKResp, error) {
|
func (l *GetLikeStatusLogic) GetLikeStatus(in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewLikeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeList
|
||||||
}
|
}
|
||||||
|
|
||||||
// LikeList 取得讚/不讚列表
|
// LikeList 取得讚/不讚列表
|
||||||
func (l *LikeListLogic) LikeList(in *feed.LikeListReq) (*feed.LikeListResp, error) {
|
func (l *LikeListLogic) LikeList(in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.LikeListResp{}, nil
|
return &tweeting.LikeListResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like 點讚/取消讚 貼文
|
// Like 點讚/取消讚 貼文
|
||||||
func (l *LikeLogic) Like(in *feed.LikeReq) (*feed.OKResp, error) {
|
func (l *LikeLogic) Like(in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewListPostsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListPos
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPosts 查詢貼文
|
// ListPosts 查詢貼文
|
||||||
func (l *ListPostsLogic) ListPosts(in *feed.QueryPostsReq) (*feed.ListPostsResp, error) {
|
func (l *ListPostsLogic) ListPosts(in *tweeting.QueryPostsReq) (*tweeting.ListPostsResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.ListPostsResp{}, nil
|
return &tweeting.ListPostsResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewNewPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NewPostLo
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPost 新增貼文
|
// NewPost 新增貼文
|
||||||
func (l *NewPostLogic) NewPost(in *feed.NewPostReq) (*feed.PostResp, error) {
|
func (l *NewPostLogic) NewPost(in *tweeting.NewPostReq) (*tweeting.PostResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.PostResp{}, nil
|
return &tweeting.PostResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postservicelogic
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
@ -24,8 +24,8 @@ func NewUpdatePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePost 更新貼文
|
// UpdatePost 更新貼文
|
||||||
func (l *UpdatePostLogic) UpdatePost(in *feed.UpdatePostReq) (*feed.OKResp, error) {
|
func (l *UpdatePostLogic) UpdatePost(in *tweeting.UpdatePostReq) (*tweeting.OKResp, error) {
|
||||||
// todo: add your logic here and delete this line
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
return &feed.OKResp{}, nil
|
return &tweeting.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
// Code generated by goctl. DO NOT EDIT.
|
// Code generated by goctl. DO NOT EDIT.
|
||||||
// Source: feed.proto
|
// Source: tweeting.proto
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/logic/commentservice"
|
"app-cloudep-feed-service/internal/logic/commentservice"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommentServiceServer struct {
|
type CommentServiceServer struct {
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
feed.UnimplementedCommentServiceServer
|
tweeting.UnimplementedCommentServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCommentServiceServer(svcCtx *svc.ServiceContext) *CommentServiceServer {
|
func NewCommentServiceServer(svcCtx *svc.ServiceContext) *CommentServiceServer {
|
||||||
|
@ -23,49 +23,49 @@ func NewCommentServiceServer(svcCtx *svc.ServiceContext) *CommentServiceServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewComment 發表評論
|
// NewComment 發表評論
|
||||||
func (s *CommentServiceServer) NewComment(ctx context.Context, in *feed.CommentPostReq) (*feed.OKResp, error) {
|
func (s *CommentServiceServer) NewComment(ctx context.Context, in *tweeting.CommentPostReq) (*tweeting.OKResp, error) {
|
||||||
l := commentservicelogic.NewNewCommentLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewNewCommentLogic(ctx, s.svcCtx)
|
||||||
return l.NewComment(in)
|
return l.NewComment(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetComments 查詢評論
|
// GetComments 查詢評論
|
||||||
func (s *CommentServiceServer) GetComments(ctx context.Context, in *feed.GetCommentsReq) (*feed.GetCommentsResp, error) {
|
func (s *CommentServiceServer) GetComments(ctx context.Context, in *tweeting.GetCommentsReq) (*tweeting.GetCommentsResp, error) {
|
||||||
l := commentservicelogic.NewGetCommentsLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewGetCommentsLogic(ctx, s.svcCtx)
|
||||||
return l.GetComments(in)
|
return l.GetComments(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteComment 刪除評論
|
// DeleteComment 刪除評論
|
||||||
func (s *CommentServiceServer) DeleteComment(ctx context.Context, in *feed.DeleteCommentReq) (*feed.OKResp, error) {
|
func (s *CommentServiceServer) DeleteComment(ctx context.Context, in *tweeting.DeleteCommentReq) (*tweeting.OKResp, error) {
|
||||||
l := commentservicelogic.NewDeleteCommentLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewDeleteCommentLogic(ctx, s.svcCtx)
|
||||||
return l.DeleteComment(in)
|
return l.DeleteComment(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateComment 更新評論
|
// UpdateComment 更新評論
|
||||||
func (s *CommentServiceServer) UpdateComment(ctx context.Context, in *feed.UpdateCommentReq) (*feed.OKResp, error) {
|
func (s *CommentServiceServer) UpdateComment(ctx context.Context, in *tweeting.UpdateCommentReq) (*tweeting.OKResp, error) {
|
||||||
l := commentservicelogic.NewUpdateCommentLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewUpdateCommentLogic(ctx, s.svcCtx)
|
||||||
return l.UpdateComment(in)
|
return l.UpdateComment(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LikeComment 點讚/取消讚 評論
|
// LikeComment 點讚/取消讚 評論
|
||||||
func (s *CommentServiceServer) LikeComment(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) {
|
func (s *CommentServiceServer) LikeComment(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
l := commentservicelogic.NewLikeCommentLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewLikeCommentLogic(ctx, s.svcCtx)
|
||||||
return l.LikeComment(in)
|
return l.LikeComment(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLikeStatus 取得讚/不讚評論狀態
|
// GetLikeStatus 取得讚/不讚評論狀態
|
||||||
func (s *CommentServiceServer) GetLikeStatus(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) {
|
func (s *CommentServiceServer) GetLikeStatus(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
l := commentservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx)
|
||||||
return l.GetLikeStatus(in)
|
return l.GetLikeStatus(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LikeList 取得讚/不讚評論列表
|
// LikeList 取得讚/不讚評論列表
|
||||||
func (s *CommentServiceServer) LikeList(ctx context.Context, in *feed.LikeListReq) (*feed.LikeListResp, error) {
|
func (s *CommentServiceServer) LikeList(ctx context.Context, in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) {
|
||||||
l := commentservicelogic.NewLikeListLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewLikeListLogic(ctx, s.svcCtx)
|
||||||
return l.LikeList(in)
|
return l.LikeList(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CountLike 取得讚/不讚評論數量
|
// CountLike 取得讚/不讚評論數量
|
||||||
func (s *CommentServiceServer) CountLike(ctx context.Context, in *feed.LikeCountReq) (*feed.LikeCountResp, error) {
|
func (s *CommentServiceServer) CountLike(ctx context.Context, in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) {
|
||||||
l := commentservicelogic.NewCountLikeLogic(ctx, s.svcCtx)
|
l := commentservicelogic.NewCountLikeLogic(ctx, s.svcCtx)
|
||||||
return l.CountLike(in)
|
return l.CountLike(in)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
// Code generated by goctl. DO NOT EDIT.
|
// Code generated by goctl. DO NOT EDIT.
|
||||||
// Source: feed.proto
|
// Source: tweeting.proto
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/logic/postservice"
|
"app-cloudep-feed-service/internal/logic/postservice"
|
||||||
"app-cloudep-feed-service/internal/svc"
|
"app-cloudep-feed-service/internal/svc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PostServiceServer struct {
|
type PostServiceServer struct {
|
||||||
svcCtx *svc.ServiceContext
|
svcCtx *svc.ServiceContext
|
||||||
feed.UnimplementedPostServiceServer
|
tweeting.UnimplementedPostServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer {
|
func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer {
|
||||||
|
@ -23,49 +23,49 @@ func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPost 新增貼文
|
// NewPost 新增貼文
|
||||||
func (s *PostServiceServer) NewPost(ctx context.Context, in *feed.NewPostReq) (*feed.PostResp, error) {
|
func (s *PostServiceServer) NewPost(ctx context.Context, in *tweeting.NewPostReq) (*tweeting.PostResp, error) {
|
||||||
l := postservicelogic.NewNewPostLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewNewPostLogic(ctx, s.svcCtx)
|
||||||
return l.NewPost(in)
|
return l.NewPost(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePost 刪除貼文
|
// DeletePost 刪除貼文
|
||||||
func (s *PostServiceServer) DeletePost(ctx context.Context, in *feed.DeletePostsReq) (*feed.OKResp, error) {
|
func (s *PostServiceServer) DeletePost(ctx context.Context, in *tweeting.DeletePostsReq) (*tweeting.OKResp, error) {
|
||||||
l := postservicelogic.NewDeletePostLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewDeletePostLogic(ctx, s.svcCtx)
|
||||||
return l.DeletePost(in)
|
return l.DeletePost(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePost 更新貼文
|
// UpdatePost 更新貼文
|
||||||
func (s *PostServiceServer) UpdatePost(ctx context.Context, in *feed.UpdatePostReq) (*feed.OKResp, error) {
|
func (s *PostServiceServer) UpdatePost(ctx context.Context, in *tweeting.UpdatePostReq) (*tweeting.OKResp, error) {
|
||||||
l := postservicelogic.NewUpdatePostLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewUpdatePostLogic(ctx, s.svcCtx)
|
||||||
return l.UpdatePost(in)
|
return l.UpdatePost(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPosts 查詢貼文
|
// ListPosts 查詢貼文
|
||||||
func (s *PostServiceServer) ListPosts(ctx context.Context, in *feed.QueryPostsReq) (*feed.ListPostsResp, error) {
|
func (s *PostServiceServer) ListPosts(ctx context.Context, in *tweeting.QueryPostsReq) (*tweeting.ListPostsResp, error) {
|
||||||
l := postservicelogic.NewListPostsLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewListPostsLogic(ctx, s.svcCtx)
|
||||||
return l.ListPosts(in)
|
return l.ListPosts(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like 點讚/取消讚 貼文
|
// Like 點讚/取消讚 貼文
|
||||||
func (s *PostServiceServer) Like(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) {
|
func (s *PostServiceServer) Like(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
l := postservicelogic.NewLikeLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewLikeLogic(ctx, s.svcCtx)
|
||||||
return l.Like(in)
|
return l.Like(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLikeStatus 取得讚/不讚狀態
|
// GetLikeStatus 取得讚/不讚狀態
|
||||||
func (s *PostServiceServer) GetLikeStatus(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) {
|
func (s *PostServiceServer) GetLikeStatus(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) {
|
||||||
l := postservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx)
|
||||||
return l.GetLikeStatus(in)
|
return l.GetLikeStatus(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LikeList 取得讚/不讚列表
|
// LikeList 取得讚/不讚列表
|
||||||
func (s *PostServiceServer) LikeList(ctx context.Context, in *feed.LikeListReq) (*feed.LikeListResp, error) {
|
func (s *PostServiceServer) LikeList(ctx context.Context, in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) {
|
||||||
l := postservicelogic.NewLikeListLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewLikeListLogic(ctx, s.svcCtx)
|
||||||
return l.LikeList(in)
|
return l.LikeList(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CountLike 取得讚/不讚數量
|
// CountLike 取得讚/不讚數量
|
||||||
func (s *PostServiceServer) CountLike(ctx context.Context, in *feed.LikeCountReq) (*feed.LikeCountResp, error) {
|
func (s *PostServiceServer) CountLike(ctx context.Context, in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) {
|
||||||
l := postservicelogic.NewCountLikeLogic(ctx, s.svcCtx)
|
l := postservicelogic.NewCountLikeLogic(ctx, s.svcCtx)
|
||||||
return l.CountLike(in)
|
return l.CountLike(in)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"app-cloudep-feed-service/gen_result/pb/feed"
|
"app-cloudep-feed-service/gen_result/pb/tweeting"
|
||||||
"app-cloudep-feed-service/internal/config"
|
"app-cloudep-feed-service/internal/config"
|
||||||
commentserviceServer "app-cloudep-feed-service/internal/server/commentservice"
|
commentserviceServer "app-cloudep-feed-service/internal/server/commentservice"
|
||||||
postserviceServer "app-cloudep-feed-service/internal/server/postservice"
|
postserviceServer "app-cloudep-feed-service/internal/server/postservice"
|
||||||
|
@ -17,7 +17,7 @@ import (
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
)
|
)
|
||||||
|
|
||||||
var configFile = flag.String("f", "etc/feed.yaml", "the config file")
|
var configFile = flag.String("f", "etc/tweeting.yaml", "the config file")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -27,8 +27,8 @@ func main() {
|
||||||
ctx := svc.NewServiceContext(c)
|
ctx := svc.NewServiceContext(c)
|
||||||
|
|
||||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||||
feed.RegisterPostServiceServer(grpcServer, postserviceServer.NewPostServiceServer(ctx))
|
tweeting.RegisterPostServiceServer(grpcServer, postserviceServer.NewPostServiceServer(ctx))
|
||||||
feed.RegisterCommentServiceServer(grpcServer, commentserviceServer.NewCommentServiceServer(ctx))
|
tweeting.RegisterCommentServiceServer(grpcServer, commentserviceServer.NewCommentServiceServer(ctx))
|
||||||
|
|
||||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||||
reflection.Register(grpcServer)
|
reflection.Register(grpcServer)
|
Loading…
Reference in New Issue