feat: 初次启动

This commit is contained in:
Blizzard
2026-04-27 21:23:13 +08:00
parent e515f6a287
commit bb8ad4d515
148 changed files with 8602 additions and 5678 deletions
+8 -2
View File
@@ -1,6 +1,12 @@
Name: plant.rpc
ListenOn: 0.0.0.0:8080
Log:
Encoding: plain
ListenOn: 0.0.0.0:9014
Etcd:
Hosts:
- 127.0.0.1:2379
- 192.168.100.127:2379
Key: plant.rpc
DB:
DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local
+3
View File
@@ -4,4 +4,7 @@ import "github.com/zeromicro/go-zero/zrpc"
type Config struct {
zrpc.RpcServerConf
DB struct {
DataSource string
}
}
@@ -24,8 +24,8 @@ func NewAddCarePlanLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCa
}
// 养护
func (l *AddCarePlanLogic) AddCarePlan(in *plant.AddCarePlanReq) (*plant.AddCarePlanResp, error) {
func (l *AddCarePlanLogic) AddCarePlan(in *plant.AddCarePlanReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.AddCarePlanResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewAddCareRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Add
}
}
func (l *AddCareRecordLogic) AddCareRecord(in *plant.AddCareRecordReq) (*plant.AddCareRecordResp, error) {
func (l *AddCareRecordLogic) AddCareRecord(in *plant.AddCareRecordReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.AddCareRecordResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewAddGrowthRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *A
}
}
func (l *AddGrowthRecordLogic) AddGrowthRecord(in *plant.AddGrowthRecordReq) (*plant.AddGrowthRecordResp, error) {
func (l *AddGrowthRecordLogic) AddGrowthRecord(in *plant.AddGrowthRecordReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.AddGrowthRecordResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewCommentPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Comme
}
}
func (l *CommentPostLogic) CommentPost(in *plant.CommentPostReq) (*plant.CommentPostResp, error) {
func (l *CommentPostLogic) CommentPost(in *plant.CommentPostReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.CommentPostResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewCreateExchangeOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext
}
}
func (l *CreateExchangeOrderLogic) CreateExchangeOrder(in *plant.CreateExchangeOrderReq) (*plant.CreateExchangeOrderResp, error) {
func (l *CreateExchangeOrderLogic) CreateExchangeOrder(in *plant.CreateExchangeOrderReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.CreateExchangeOrderResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,9 +23,9 @@ func NewCreatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
}
}
// 植物
func (l *CreatePlantLogic) CreatePlant(in *plant.CreatePlantReq) (*plant.CreatePlantResp, error) {
// 我的植物
func (l *CreatePlantLogic) CreatePlant(in *plant.CreatePlantReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.CreatePlantResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -24,8 +24,8 @@ func NewCreatePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
}
// 社区
func (l *CreatePostLogic) CreatePost(in *plant.CreatePostReq) (*plant.CreatePostResp, error) {
func (l *CreatePostLogic) CreatePost(in *plant.CreatePostReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.CreatePostResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewCreateTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
}
}
func (l *CreateTopicLogic) CreateTopic(in *plant.CreateTopicReq) (*plant.CreateTopicResp, error) {
func (l *CreateTopicLogic) CreateTopic(in *plant.CreateTopicReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.CreateTopicResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewCreateWikiClassLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
}
}
func (l *CreateWikiClassLogic) CreateWikiClass(in *plant.CreateWikiClassReq) (*plant.CreateWikiClassResp, error) {
func (l *CreateWikiClassLogic) CreateWikiClass(in *plant.CreateWikiClassReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.CreateWikiClassResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewDeletePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
}
}
func (l *DeletePlantLogic) DeletePlant(in *plant.DeletePlantReq) (*plant.DeletePlantResp, error) {
func (l *DeletePlantLogic) DeletePlant(in *plant.IdsReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.DeletePlantResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewDeletePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete
}
}
func (l *DeletePostLogic) DeletePost(in *plant.DeletePostReq) (*plant.DeletePostResp, error) {
func (l *DeletePostLogic) DeletePost(in *plant.IdsReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.DeletePostResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewDeleteTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delet
}
}
func (l *DeleteTopicLogic) DeleteTopic(in *plant.DeleteTopicReq) (*plant.DeleteTopicResp, error) {
func (l *DeleteTopicLogic) DeleteTopic(in *plant.IdsReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.DeleteTopicResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewGetBadgeConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
}
}
func (l *GetBadgeConfigListLogic) GetBadgeConfigList(in *plant.GetBadgeConfigListReq) (*plant.GetBadgeConfigListResp, error) {
func (l *GetBadgeConfigListLogic) GetBadgeConfigList(in *plant.BadgeConfigListReq) (*plant.BadgeConfigListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetBadgeConfigListResp{}, nil
return &plant.BadgeConfigListResp{}, nil
}
@@ -24,8 +24,8 @@ func NewGetExchangeItemListLogic(ctx context.Context, svcCtx *svc.ServiceContext
}
// 兑换
func (l *GetExchangeItemListLogic) GetExchangeItemList(in *plant.GetExchangeItemListReq) (*plant.GetExchangeItemListResp, error) {
func (l *GetExchangeItemListLogic) GetExchangeItemList(in *plant.ExchangeItemListReq) (*plant.ExchangeItemListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetExchangeItemListResp{}, nil
return &plant.ExchangeItemListResp{}, nil
}
@@ -24,8 +24,8 @@ func NewGetLevelConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext)
}
// 配置
func (l *GetLevelConfigListLogic) GetLevelConfigList(in *plant.GetLevelConfigListReq) (*plant.GetLevelConfigListResp, error) {
func (l *GetLevelConfigListLogic) GetLevelConfigList(in *plant.PageReq) (*plant.LevelConfigListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetLevelConfigListResp{}, nil
return &plant.LevelConfigListResp{}, nil
}
@@ -23,8 +23,8 @@ func NewGetPlantDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
}
}
func (l *GetPlantDetailLogic) GetPlantDetail(in *plant.GetPlantDetailReq) (*plant.GetPlantDetailResp, error) {
func (l *GetPlantDetailLogic) GetPlantDetail(in *plant.IdReq) (*plant.PlantDetailResp, error) {
// todo: add your logic here and delete this line
return &plant.GetPlantDetailResp{}, nil
return &plant.PlantDetailResp{}, nil
}
@@ -23,8 +23,8 @@ func NewGetPlantListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetP
}
}
func (l *GetPlantListLogic) GetPlantList(in *plant.GetPlantListReq) (*plant.GetPlantListResp, error) {
func (l *GetPlantListLogic) GetPlantList(in *plant.PlantListReq) (*plant.PlantListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetPlantListResp{}, nil
return &plant.PlantListResp{}, nil
}
@@ -23,8 +23,8 @@ func NewGetPostDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
}
}
func (l *GetPostDetailLogic) GetPostDetail(in *plant.GetPostDetailReq) (*plant.GetPostDetailResp, error) {
func (l *GetPostDetailLogic) GetPostDetail(in *plant.IdReq) (*plant.PostDetailResp, error) {
// todo: add your logic here and delete this line
return &plant.GetPostDetailResp{}, nil
return &plant.PostDetailResp{}, nil
}
@@ -23,8 +23,8 @@ func NewGetPostListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPo
}
}
func (l *GetPostListLogic) GetPostList(in *plant.GetPostListReq) (*plant.GetPostListResp, error) {
func (l *GetPostListLogic) GetPostList(in *plant.PostListReq) (*plant.PostListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetPostListResp{}, nil
return &plant.PostListResp{}, nil
}
@@ -24,8 +24,8 @@ func NewGetTopicListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetT
}
// 话题
func (l *GetTopicListLogic) GetTopicList(in *plant.Empty) (*plant.GetTopicListResp, error) {
func (l *GetTopicListLogic) GetTopicList(in *plant.IdReq) (*plant.TopicListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetTopicListResp{}, nil
return &plant.TopicListResp{}, nil
}
@@ -24,8 +24,8 @@ func NewGetUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
}
// 用户Profile
func (l *GetUserProfileLogic) GetUserProfile(in *plant.GetUserProfileReq) (*plant.GetUserProfileResp, error) {
func (l *GetUserProfileLogic) GetUserProfile(in *plant.GetProfileReq) (*plant.PlantUserProfile, error) {
// todo: add your logic here and delete this line
return &plant.GetUserProfileResp{}, nil
return &plant.PlantUserProfile{}, nil
}
@@ -23,8 +23,8 @@ func NewGetWikiClassListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
}
}
func (l *GetWikiClassListLogic) GetWikiClassList(in *plant.Empty) (*plant.GetWikiClassListResp, error) {
func (l *GetWikiClassListLogic) GetWikiClassList(in *plant.IdReq) (*plant.WikiClassListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetWikiClassListResp{}, nil
return &plant.WikiClassListResp{}, nil
}
@@ -23,8 +23,8 @@ func NewGetWikiDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
}
}
func (l *GetWikiDetailLogic) GetWikiDetail(in *plant.GetWikiDetailReq) (*plant.GetWikiDetailResp, error) {
func (l *GetWikiDetailLogic) GetWikiDetail(in *plant.IdReq) (*plant.WikiDetailResp, error) {
// todo: add your logic here and delete this line
return &plant.GetWikiDetailResp{}, nil
return &plant.WikiDetailResp{}, nil
}
@@ -24,8 +24,8 @@ func NewGetWikiListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWi
}
// 百科
func (l *GetWikiListLogic) GetWikiList(in *plant.GetWikiListReq) (*plant.GetWikiListResp, error) {
func (l *GetWikiListLogic) GetWikiList(in *plant.WikiListReq) (*plant.WikiListResp, error) {
// todo: add your logic here and delete this line
return &plant.GetWikiListResp{}, nil
return &plant.WikiListResp{}, nil
}
@@ -1,30 +0,0 @@
package logic
import (
"context"
"sundynix-micro-go/app/plant/rpc/internal/svc"
"sundynix-micro-go/app/plant/rpc/plant"
"github.com/zeromicro/go-zero/core/logx"
)
type IncrUserCounterLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewIncrUserCounterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IncrUserCounterLogic {
return &IncrUserCounterLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *IncrUserCounterLogic) IncrUserCounter(in *plant.IncrUserCounterReq) (*plant.IncrUserCounterResp, error) {
// todo: add your logic here and delete this line
return &plant.IncrUserCounterResp{}, nil
}
@@ -23,8 +23,8 @@ func NewLikePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikePost
}
}
func (l *LikePostLogic) LikePost(in *plant.LikePostReq) (*plant.LikePostResp, error) {
func (l *LikePostLogic) LikePost(in *plant.LikePostReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.LikePostResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -9,22 +9,22 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type ToggleStarLogic struct {
type ToggleWikiStarLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewToggleStarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleStarLogic {
return &ToggleStarLogic{
func NewToggleWikiStarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleWikiStarLogic {
return &ToggleWikiStarLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ToggleStarLogic) ToggleStar(in *plant.ToggleStarReq) (*plant.ToggleStarResp, error) {
func (l *ToggleWikiStarLogic) ToggleWikiStar(in *plant.ToggleStarReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.ToggleStarResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewUpdatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Updat
}
}
func (l *UpdatePlantLogic) UpdatePlant(in *plant.UpdatePlantReq) (*plant.UpdatePlantResp, error) {
func (l *UpdatePlantLogic) UpdatePlant(in *plant.UpdatePlantReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.UpdatePlantResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -23,8 +23,8 @@ func NewUpdateUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext)
}
}
func (l *UpdateUserProfileLogic) UpdateUserProfile(in *plant.UpdateUserProfileReq) (*plant.UpdateUserProfileResp, error) {
func (l *UpdateUserProfileLogic) UpdateUserProfile(in *plant.UpdateProfileReq) (*plant.CommonResp, error) {
// todo: add your logic here and delete this line
return &plant.UpdateUserProfileResp{}, nil
return &plant.CommonResp{}, nil
}
@@ -24,154 +24,149 @@ func NewPlantServiceServer(svcCtx *svc.ServiceContext) *PlantServiceServer {
}
// 用户Profile
func (s *PlantServiceServer) GetUserProfile(ctx context.Context, in *plant.GetUserProfileReq) (*plant.GetUserProfileResp, error) {
func (s *PlantServiceServer) GetUserProfile(ctx context.Context, in *plant.GetProfileReq) (*plant.PlantUserProfile, error) {
l := logic.NewGetUserProfileLogic(ctx, s.svcCtx)
return l.GetUserProfile(in)
}
func (s *PlantServiceServer) UpdateUserProfile(ctx context.Context, in *plant.UpdateUserProfileReq) (*plant.UpdateUserProfileResp, error) {
func (s *PlantServiceServer) UpdateUserProfile(ctx context.Context, in *plant.UpdateProfileReq) (*plant.CommonResp, error) {
l := logic.NewUpdateUserProfileLogic(ctx, s.svcCtx)
return l.UpdateUserProfile(in)
}
func (s *PlantServiceServer) IncrUserCounter(ctx context.Context, in *plant.IncrUserCounterReq) (*plant.IncrUserCounterResp, error) {
l := logic.NewIncrUserCounterLogic(ctx, s.svcCtx)
return l.IncrUserCounter(in)
}
// 植物
func (s *PlantServiceServer) CreatePlant(ctx context.Context, in *plant.CreatePlantReq) (*plant.CreatePlantResp, error) {
// 我的植物
func (s *PlantServiceServer) CreatePlant(ctx context.Context, in *plant.CreatePlantReq) (*plant.CommonResp, error) {
l := logic.NewCreatePlantLogic(ctx, s.svcCtx)
return l.CreatePlant(in)
}
func (s *PlantServiceServer) UpdatePlant(ctx context.Context, in *plant.UpdatePlantReq) (*plant.UpdatePlantResp, error) {
func (s *PlantServiceServer) UpdatePlant(ctx context.Context, in *plant.UpdatePlantReq) (*plant.CommonResp, error) {
l := logic.NewUpdatePlantLogic(ctx, s.svcCtx)
return l.UpdatePlant(in)
}
func (s *PlantServiceServer) DeletePlant(ctx context.Context, in *plant.DeletePlantReq) (*plant.DeletePlantResp, error) {
func (s *PlantServiceServer) DeletePlant(ctx context.Context, in *plant.IdsReq) (*plant.CommonResp, error) {
l := logic.NewDeletePlantLogic(ctx, s.svcCtx)
return l.DeletePlant(in)
}
func (s *PlantServiceServer) GetPlantList(ctx context.Context, in *plant.GetPlantListReq) (*plant.GetPlantListResp, error) {
func (s *PlantServiceServer) GetPlantList(ctx context.Context, in *plant.PlantListReq) (*plant.PlantListResp, error) {
l := logic.NewGetPlantListLogic(ctx, s.svcCtx)
return l.GetPlantList(in)
}
func (s *PlantServiceServer) GetPlantDetail(ctx context.Context, in *plant.GetPlantDetailReq) (*plant.GetPlantDetailResp, error) {
func (s *PlantServiceServer) GetPlantDetail(ctx context.Context, in *plant.IdReq) (*plant.PlantDetailResp, error) {
l := logic.NewGetPlantDetailLogic(ctx, s.svcCtx)
return l.GetPlantDetail(in)
}
// 养护
func (s *PlantServiceServer) AddCarePlan(ctx context.Context, in *plant.AddCarePlanReq) (*plant.AddCarePlanResp, error) {
func (s *PlantServiceServer) AddCarePlan(ctx context.Context, in *plant.AddCarePlanReq) (*plant.CommonResp, error) {
l := logic.NewAddCarePlanLogic(ctx, s.svcCtx)
return l.AddCarePlan(in)
}
func (s *PlantServiceServer) AddCareRecord(ctx context.Context, in *plant.AddCareRecordReq) (*plant.AddCareRecordResp, error) {
func (s *PlantServiceServer) AddCareRecord(ctx context.Context, in *plant.AddCareRecordReq) (*plant.CommonResp, error) {
l := logic.NewAddCareRecordLogic(ctx, s.svcCtx)
return l.AddCareRecord(in)
}
func (s *PlantServiceServer) AddGrowthRecord(ctx context.Context, in *plant.AddGrowthRecordReq) (*plant.AddGrowthRecordResp, error) {
func (s *PlantServiceServer) AddGrowthRecord(ctx context.Context, in *plant.AddGrowthRecordReq) (*plant.CommonResp, error) {
l := logic.NewAddGrowthRecordLogic(ctx, s.svcCtx)
return l.AddGrowthRecord(in)
}
// 百科
func (s *PlantServiceServer) GetWikiList(ctx context.Context, in *plant.GetWikiListReq) (*plant.GetWikiListResp, error) {
func (s *PlantServiceServer) GetWikiList(ctx context.Context, in *plant.WikiListReq) (*plant.WikiListResp, error) {
l := logic.NewGetWikiListLogic(ctx, s.svcCtx)
return l.GetWikiList(in)
}
func (s *PlantServiceServer) GetWikiDetail(ctx context.Context, in *plant.GetWikiDetailReq) (*plant.GetWikiDetailResp, error) {
func (s *PlantServiceServer) GetWikiDetail(ctx context.Context, in *plant.IdReq) (*plant.WikiDetailResp, error) {
l := logic.NewGetWikiDetailLogic(ctx, s.svcCtx)
return l.GetWikiDetail(in)
}
func (s *PlantServiceServer) GetWikiClassList(ctx context.Context, in *plant.Empty) (*plant.GetWikiClassListResp, error) {
func (s *PlantServiceServer) GetWikiClassList(ctx context.Context, in *plant.IdReq) (*plant.WikiClassListResp, error) {
l := logic.NewGetWikiClassListLogic(ctx, s.svcCtx)
return l.GetWikiClassList(in)
}
func (s *PlantServiceServer) CreateWikiClass(ctx context.Context, in *plant.CreateWikiClassReq) (*plant.CreateWikiClassResp, error) {
func (s *PlantServiceServer) CreateWikiClass(ctx context.Context, in *plant.CreateWikiClassReq) (*plant.CommonResp, error) {
l := logic.NewCreateWikiClassLogic(ctx, s.svcCtx)
return l.CreateWikiClass(in)
}
func (s *PlantServiceServer) ToggleStar(ctx context.Context, in *plant.ToggleStarReq) (*plant.ToggleStarResp, error) {
l := logic.NewToggleStarLogic(ctx, s.svcCtx)
return l.ToggleStar(in)
func (s *PlantServiceServer) ToggleWikiStar(ctx context.Context, in *plant.ToggleStarReq) (*plant.CommonResp, error) {
l := logic.NewToggleWikiStarLogic(ctx, s.svcCtx)
return l.ToggleWikiStar(in)
}
// 社区
func (s *PlantServiceServer) CreatePost(ctx context.Context, in *plant.CreatePostReq) (*plant.CreatePostResp, error) {
func (s *PlantServiceServer) CreatePost(ctx context.Context, in *plant.CreatePostReq) (*plant.CommonResp, error) {
l := logic.NewCreatePostLogic(ctx, s.svcCtx)
return l.CreatePost(in)
}
func (s *PlantServiceServer) GetPostList(ctx context.Context, in *plant.GetPostListReq) (*plant.GetPostListResp, error) {
l := logic.NewGetPostListLogic(ctx, s.svcCtx)
return l.GetPostList(in)
}
func (s *PlantServiceServer) GetPostDetail(ctx context.Context, in *plant.GetPostDetailReq) (*plant.GetPostDetailResp, error) {
l := logic.NewGetPostDetailLogic(ctx, s.svcCtx)
return l.GetPostDetail(in)
}
func (s *PlantServiceServer) DeletePost(ctx context.Context, in *plant.DeletePostReq) (*plant.DeletePostResp, error) {
func (s *PlantServiceServer) DeletePost(ctx context.Context, in *plant.IdsReq) (*plant.CommonResp, error) {
l := logic.NewDeletePostLogic(ctx, s.svcCtx)
return l.DeletePost(in)
}
func (s *PlantServiceServer) CommentPost(ctx context.Context, in *plant.CommentPostReq) (*plant.CommentPostResp, error) {
func (s *PlantServiceServer) GetPostList(ctx context.Context, in *plant.PostListReq) (*plant.PostListResp, error) {
l := logic.NewGetPostListLogic(ctx, s.svcCtx)
return l.GetPostList(in)
}
func (s *PlantServiceServer) GetPostDetail(ctx context.Context, in *plant.IdReq) (*plant.PostDetailResp, error) {
l := logic.NewGetPostDetailLogic(ctx, s.svcCtx)
return l.GetPostDetail(in)
}
func (s *PlantServiceServer) CommentPost(ctx context.Context, in *plant.CommentPostReq) (*plant.CommonResp, error) {
l := logic.NewCommentPostLogic(ctx, s.svcCtx)
return l.CommentPost(in)
}
func (s *PlantServiceServer) LikePost(ctx context.Context, in *plant.LikePostReq) (*plant.LikePostResp, error) {
func (s *PlantServiceServer) LikePost(ctx context.Context, in *plant.LikePostReq) (*plant.CommonResp, error) {
l := logic.NewLikePostLogic(ctx, s.svcCtx)
return l.LikePost(in)
}
// 话题
func (s *PlantServiceServer) GetTopicList(ctx context.Context, in *plant.Empty) (*plant.GetTopicListResp, error) {
func (s *PlantServiceServer) GetTopicList(ctx context.Context, in *plant.IdReq) (*plant.TopicListResp, error) {
l := logic.NewGetTopicListLogic(ctx, s.svcCtx)
return l.GetTopicList(in)
}
func (s *PlantServiceServer) CreateTopic(ctx context.Context, in *plant.CreateTopicReq) (*plant.CreateTopicResp, error) {
func (s *PlantServiceServer) CreateTopic(ctx context.Context, in *plant.CreateTopicReq) (*plant.CommonResp, error) {
l := logic.NewCreateTopicLogic(ctx, s.svcCtx)
return l.CreateTopic(in)
}
func (s *PlantServiceServer) DeleteTopic(ctx context.Context, in *plant.DeleteTopicReq) (*plant.DeleteTopicResp, error) {
func (s *PlantServiceServer) DeleteTopic(ctx context.Context, in *plant.IdsReq) (*plant.CommonResp, error) {
l := logic.NewDeleteTopicLogic(ctx, s.svcCtx)
return l.DeleteTopic(in)
}
// 配置
func (s *PlantServiceServer) GetLevelConfigList(ctx context.Context, in *plant.GetLevelConfigListReq) (*plant.GetLevelConfigListResp, error) {
l := logic.NewGetLevelConfigListLogic(ctx, s.svcCtx)
return l.GetLevelConfigList(in)
}
func (s *PlantServiceServer) GetBadgeConfigList(ctx context.Context, in *plant.GetBadgeConfigListReq) (*plant.GetBadgeConfigListResp, error) {
l := logic.NewGetBadgeConfigListLogic(ctx, s.svcCtx)
return l.GetBadgeConfigList(in)
}
// 兑换
func (s *PlantServiceServer) GetExchangeItemList(ctx context.Context, in *plant.GetExchangeItemListReq) (*plant.GetExchangeItemListResp, error) {
func (s *PlantServiceServer) GetExchangeItemList(ctx context.Context, in *plant.ExchangeItemListReq) (*plant.ExchangeItemListResp, error) {
l := logic.NewGetExchangeItemListLogic(ctx, s.svcCtx)
return l.GetExchangeItemList(in)
}
func (s *PlantServiceServer) CreateExchangeOrder(ctx context.Context, in *plant.CreateExchangeOrderReq) (*plant.CreateExchangeOrderResp, error) {
func (s *PlantServiceServer) CreateExchangeOrder(ctx context.Context, in *plant.CreateExchangeOrderReq) (*plant.CommonResp, error) {
l := logic.NewCreateExchangeOrderLogic(ctx, s.svcCtx)
return l.CreateExchangeOrder(in)
}
// 配置
func (s *PlantServiceServer) GetLevelConfigList(ctx context.Context, in *plant.PageReq) (*plant.LevelConfigListResp, error) {
l := logic.NewGetLevelConfigListLogic(ctx, s.svcCtx)
return l.GetLevelConfigList(in)
}
func (s *PlantServiceServer) GetBadgeConfigList(ctx context.Context, in *plant.BadgeConfigListReq) (*plant.BadgeConfigListResp, error) {
l := logic.NewGetBadgeConfigListLogic(ctx, s.svcCtx)
return l.GetBadgeConfigList(in)
}
+39 -3
View File
@@ -1,13 +1,49 @@
package svc
import "sundynix-micro-go/app/plant/rpc/internal/config"
import (
plantModel "sundynix-micro-go/app/plant/model"
"sundynix-micro-go/app/plant/rpc/internal/config"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
type ServiceContext struct {
Config config.Config
DB *gorm.DB
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{})
if err != nil {
logx.Errorf("连接数据库失败: %v", err)
panic(err)
}
if err := db.AutoMigrate(
&plantModel.SundynixPlantUserProfile{},
&plantModel.SundynixMyPlant{},
&plantModel.SundynixCarePlan{},
&plantModel.SundynixCareRecord{},
&plantModel.SundynixCareTask{},
&plantModel.SundynixGrowthRecord{},
&plantModel.SundynixWiki{},
&plantModel.SundynixWikiClass{},
&plantModel.SundynixPost{},
&plantModel.SundynixPostComment{},
&plantModel.SundynixPostLike{},
&plantModel.SundynixPostTopic{},
&plantModel.SundynixUserStar{},
&plantModel.SundynixExchangeItem{},
&plantModel.SundynixExchangeOrder{},
&plantModel.SundynixLevelConfig{},
&plantModel.SundynixBadgeConfig{},
&plantModel.SundynixUserBadge{},
&plantModel.SundynixAiChatHistory{},
); err != nil {
logx.Errorf("数据库迁移失败: %v", err)
}
return &ServiceContext{Config: c, DB: db}
}
+180 -103
View File
@@ -4,8 +4,29 @@ package plant;
option go_package = "./plant";
// ========== 通用 ==========
message CommonResp {
int64 code = 1;
string msg = 2;
}
message IdReq {
string id = 1;
}
message IdsReq {
repeated string ids = 1;
}
message PageReq {
int32 current = 1;
int32 pageSize = 2;
}
// ========== 用户Profile ==========
message UserProfile {
message PlantUserProfile {
string id = 1;
string userId = 2;
string nickName = 3;
@@ -23,22 +44,18 @@ message UserProfile {
int64 photoCount = 15;
}
message GetUserProfileReq { string userId = 1; }
message GetUserProfileResp { UserProfile profile = 1; }
message UpdateUserProfileReq {
message GetProfileReq {
string userId = 1;
}
message UpdateProfileReq {
string userId = 1;
string nickName = 2;
string avatarId = 3;
}
message UpdateUserProfileResp {}
message IncrUserCounterReq {
string userId = 1;
string field = 2; // care_count, water_count, etc.
int64 delta = 3;
}
message IncrUserCounterResp {}
// ========== 我的植物 ==========
message PlantInfo {
string id = 1;
string userId = 2;
@@ -65,7 +82,6 @@ message CreatePlantReq {
string plantingMaterial = 8;
repeated string imgIds = 9;
}
message CreatePlantResp { string id = 1; }
message UpdatePlantReq {
string id = 1;
@@ -76,35 +92,36 @@ message UpdatePlantReq {
string potSize = 6;
string sunlight = 7;
string plantingMaterial = 8;
repeated string imgIds = 9;
}
message UpdatePlantResp {}
message DeletePlantReq { repeated string ids = 1; }
message DeletePlantResp {}
message GetPlantListReq {
message PlantListReq {
string userId = 1;
int32 current = 2;
int32 pageSize = 3;
string name = 4;
}
message GetPlantListResp {
message PlantListResp {
repeated PlantInfo list = 1;
int64 total = 2;
}
message GetPlantDetailReq { string id = 1; }
message GetPlantDetailResp { PlantInfo plant = 1; }
message PlantDetailResp {
PlantInfo plant = 1;
repeated CarePlanInfo carePlans = 2;
repeated GrowthRecordInfo growthRecords = 3;
}
// ========== 养护计划 ==========
// ========== 养护 ==========
message CarePlanInfo {
string id = 1;
string userId = 2;
string plantId = 3;
string name = 4;
string icon = 5;
string targetAction = 6;
int32 period = 7;
string plantId = 2;
string name = 3;
string icon = 4;
string targetAction = 5;
int32 period = 6;
}
message AddCarePlanReq {
@@ -115,7 +132,8 @@ message AddCarePlanReq {
string targetAction = 5;
int32 period = 6;
}
message AddCarePlanResp { string id = 1; }
// ========== 养护记录 ==========
message AddCareRecordReq {
string userId = 1;
@@ -124,7 +142,15 @@ message AddCareRecordReq {
string action = 4;
string note = 5;
}
message AddCareRecordResp {}
// ========== 成长记录 ==========
message GrowthRecordInfo {
string id = 1;
string plantId = 2;
string content = 3;
int64 createdAt = 4;
}
message AddGrowthRecordReq {
string userId = 1;
@@ -132,9 +158,9 @@ message AddGrowthRecordReq {
string content = 3;
repeated string imgIds = 4;
}
message AddGrowthRecordResp {}
// ========== 百科 ==========
message WikiInfo {
string id = 1;
string name = 2;
@@ -143,41 +169,52 @@ message WikiInfo {
string genus = 5;
int32 difficulty = 6;
int32 isHot = 7;
int64 createdAt = 8;
string growthHabit = 8;
string lightIntensity = 9;
string optimalTempPeriod = 10;
int64 createdAt = 11;
}
message GetWikiListReq {
message WikiListReq {
int32 current = 1;
int32 pageSize = 2;
string name = 3;
string classId = 4;
int32 isHot = 5;
}
message GetWikiListResp {
message WikiListResp {
repeated WikiInfo list = 1;
int64 total = 2;
}
message GetWikiDetailReq { string id = 1; }
message GetWikiDetailResp { WikiInfo wiki = 1; }
message WikiDetailResp {
WikiInfo wiki = 1;
}
message WikiClassInfo {
string id = 1;
string name = 2;
string ossId = 3;
}
message GetWikiClassListResp { repeated WikiClassInfo list = 1; }
message CreateWikiClassReq { string name = 1; string ossId = 2; }
message CreateWikiClassResp { string id = 1; }
message WikiClassListResp {
repeated WikiClassInfo list = 1;
}
message CreateWikiClassReq {
string name = 1;
string icon = 2;
}
message ToggleStarReq {
string userId = 1;
string targetId = 2;
string type = 3;
}
message ToggleStarResp { bool starred = 1; }
// ========== 社区 ==========
// ========== 社区帖子 ==========
message PostInfo {
string id = 1;
string userId = 2;
@@ -199,24 +236,32 @@ message CreatePostReq {
repeated string imgIds = 5;
string topicId = 6;
}
message CreatePostResp { string id = 1; }
message GetPostListReq {
message PostListReq {
int32 current = 1;
int32 pageSize = 2;
string keyword = 3;
string topicId = 4;
string userId = 5;
}
message GetPostListResp {
message PostListResp {
repeated PostInfo list = 1;
int64 total = 2;
}
message GetPostDetailReq { string id = 1; }
message GetPostDetailResp { PostInfo post = 1; }
message PostDetailResp {
PostInfo post = 1;
repeated PostCommentInfo comments = 2;
}
message DeletePostReq { repeated string ids = 1; }
message DeletePostResp {}
message PostCommentInfo {
string id = 1;
string userId = 2;
string content = 3;
string parentId = 4;
int64 createdAt = 5;
}
message CommentPostReq {
string userId = 1;
@@ -224,27 +269,58 @@ message CommentPostReq {
string content = 3;
string parentId = 4;
}
message CommentPostResp {}
message LikePostReq {
string userId = 1;
string postId = 2;
}
message LikePostResp { bool liked = 1; }
// ========== 话题 ==========
message TopicInfo {
string id = 1;
string name = 2;
int32 postCount = 3;
}
message GetTopicListResp { repeated TopicInfo list = 1; }
message CreateTopicReq { string name = 1; }
message CreateTopicResp { string id = 1; }
message DeleteTopicReq { repeated string ids = 1; }
message DeleteTopicResp {}
message TopicListResp {
repeated TopicInfo list = 1;
}
message CreateTopicReq {
string name = 1;
string icon = 2;
string desc = 3;
}
// ========== 兑换商城 ==========
message ExchangeItemInfo {
string id = 1;
string name = 2;
string desc = 3;
string imgId = 4;
int64 cost = 5;
int32 stock = 6;
}
message ExchangeItemListReq {
int32 current = 1;
int32 pageSize = 2;
}
message ExchangeItemListResp {
repeated ExchangeItemInfo list = 1;
int64 total = 2;
}
message CreateExchangeOrderReq {
string userId = 1;
string itemId = 2;
}
// ========== 配置 ==========
message LevelConfigInfo {
string id = 1;
int32 level = 2;
@@ -252,8 +328,10 @@ message LevelConfigInfo {
int64 minSunlight = 4;
string perks = 5;
}
message GetLevelConfigListReq { int32 current = 1; int32 pageSize = 2; }
message GetLevelConfigListResp { repeated LevelConfigInfo list = 1; int64 total = 2; }
message LevelConfigListResp {
repeated LevelConfigInfo list = 1;
}
message BadgeConfigInfo {
string id = 1;
@@ -266,63 +344,62 @@ message BadgeConfigInfo {
int64 threshold = 8;
int64 rewardSunlight = 9;
}
message GetBadgeConfigListReq { int32 current = 1; int32 pageSize = 2; string dimension = 3; }
message GetBadgeConfigListResp { repeated BadgeConfigInfo list = 1; int64 total = 2; }
// ========== 兑换 ==========
message ExchangeItemInfo {
string id = 1;
string name = 2;
string desc = 3;
int64 cost = 4;
int32 stock = 5;
message BadgeConfigListReq {
int32 current = 1;
int32 pageSize = 2;
string dimension = 3;
}
message GetExchangeItemListReq { int32 current = 1; int32 pageSize = 2; }
message GetExchangeItemListResp { repeated ExchangeItemInfo list = 1; int64 total = 2; }
message CreateExchangeOrderReq { string userId = 1; string itemId = 2; }
message CreateExchangeOrderResp { string id = 1; }
// ========== 通用 ==========
message Empty {}
message BadgeConfigListResp {
repeated BadgeConfigInfo list = 1;
int64 total = 2;
}
// ========== 服务定义 ==========
service PlantService {
// 用户Profile
rpc GetUserProfile(GetUserProfileReq) returns (GetUserProfileResp);
rpc UpdateUserProfile(UpdateUserProfileReq) returns (UpdateUserProfileResp);
rpc IncrUserCounter(IncrUserCounterReq) returns (IncrUserCounterResp);
// 植物
rpc CreatePlant(CreatePlantReq) returns (CreatePlantResp);
rpc UpdatePlant(UpdatePlantReq) returns (UpdatePlantResp);
rpc DeletePlant(DeletePlantReq) returns (DeletePlantResp);
rpc GetPlantList(GetPlantListReq) returns (GetPlantListResp);
rpc GetPlantDetail(GetPlantDetailReq) returns (GetPlantDetailResp);
rpc GetUserProfile(GetProfileReq) returns (PlantUserProfile);
rpc UpdateUserProfile(UpdateProfileReq) returns (CommonResp);
// 我的植物
rpc CreatePlant(CreatePlantReq) returns (CommonResp);
rpc UpdatePlant(UpdatePlantReq) returns (CommonResp);
rpc DeletePlant(IdsReq) returns (CommonResp);
rpc GetPlantList(PlantListReq) returns (PlantListResp);
rpc GetPlantDetail(IdReq) returns (PlantDetailResp);
// 养护
rpc AddCarePlan(AddCarePlanReq) returns (AddCarePlanResp);
rpc AddCareRecord(AddCareRecordReq) returns (AddCareRecordResp);
rpc AddGrowthRecord(AddGrowthRecordReq) returns (AddGrowthRecordResp);
rpc AddCarePlan(AddCarePlanReq) returns (CommonResp);
rpc AddCareRecord(AddCareRecordReq) returns (CommonResp);
rpc AddGrowthRecord(AddGrowthRecordReq) returns (CommonResp);
// 百科
rpc GetWikiList(GetWikiListReq) returns (GetWikiListResp);
rpc GetWikiDetail(GetWikiDetailReq) returns (GetWikiDetailResp);
rpc GetWikiClassList(Empty) returns (GetWikiClassListResp);
rpc CreateWikiClass(CreateWikiClassReq) returns (CreateWikiClassResp);
rpc ToggleStar(ToggleStarReq) returns (ToggleStarResp);
rpc GetWikiList(WikiListReq) returns (WikiListResp);
rpc GetWikiDetail(IdReq) returns (WikiDetailResp);
rpc GetWikiClassList(IdReq) returns (WikiClassListResp);
rpc CreateWikiClass(CreateWikiClassReq) returns (CommonResp);
rpc ToggleWikiStar(ToggleStarReq) returns (CommonResp);
// 社区
rpc CreatePost(CreatePostReq) returns (CreatePostResp);
rpc GetPostList(GetPostListReq) returns (GetPostListResp);
rpc GetPostDetail(GetPostDetailReq) returns (GetPostDetailResp);
rpc DeletePost(DeletePostReq) returns (DeletePostResp);
rpc CommentPost(CommentPostReq) returns (CommentPostResp);
rpc LikePost(LikePostReq) returns (LikePostResp);
rpc CreatePost(CreatePostReq) returns (CommonResp);
rpc DeletePost(IdsReq) returns (CommonResp);
rpc GetPostList(PostListReq) returns (PostListResp);
rpc GetPostDetail(IdReq) returns (PostDetailResp);
rpc CommentPost(CommentPostReq) returns (CommonResp);
rpc LikePost(LikePostReq) returns (CommonResp);
// 话题
rpc GetTopicList(Empty) returns (GetTopicListResp);
rpc CreateTopic(CreateTopicReq) returns (CreateTopicResp);
rpc DeleteTopic(DeleteTopicReq) returns (DeleteTopicResp);
// 配置
rpc GetLevelConfigList(GetLevelConfigListReq) returns (GetLevelConfigListResp);
rpc GetBadgeConfigList(GetBadgeConfigListReq) returns (GetBadgeConfigListResp);
rpc GetTopicList(IdReq) returns (TopicListResp);
rpc CreateTopic(CreateTopicReq) returns (CommonResp);
rpc DeleteTopic(IdsReq) returns (CommonResp);
// 兑换
rpc GetExchangeItemList(GetExchangeItemListReq) returns (GetExchangeItemListResp);
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CreateExchangeOrderResp);
rpc GetExchangeItemList(ExchangeItemListReq) returns (ExchangeItemListResp);
rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CommonResp);
// 配置
rpc GetLevelConfigList(PageReq) returns (LevelConfigListResp);
rpc GetBadgeConfigList(BadgeConfigListReq) returns (BadgeConfigListResp);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+123 -150
View File
@@ -14,112 +14,90 @@ import (
)
type (
AddCarePlanReq = plant.AddCarePlanReq
AddCarePlanResp = plant.AddCarePlanResp
AddCareRecordReq = plant.AddCareRecordReq
AddCareRecordResp = plant.AddCareRecordResp
AddGrowthRecordReq = plant.AddGrowthRecordReq
AddGrowthRecordResp = plant.AddGrowthRecordResp
BadgeConfigInfo = plant.BadgeConfigInfo
CarePlanInfo = plant.CarePlanInfo
CommentPostReq = plant.CommentPostReq
CommentPostResp = plant.CommentPostResp
CreateExchangeOrderReq = plant.CreateExchangeOrderReq
CreateExchangeOrderResp = plant.CreateExchangeOrderResp
CreatePlantReq = plant.CreatePlantReq
CreatePlantResp = plant.CreatePlantResp
CreatePostReq = plant.CreatePostReq
CreatePostResp = plant.CreatePostResp
CreateTopicReq = plant.CreateTopicReq
CreateTopicResp = plant.CreateTopicResp
CreateWikiClassReq = plant.CreateWikiClassReq
CreateWikiClassResp = plant.CreateWikiClassResp
DeletePlantReq = plant.DeletePlantReq
DeletePlantResp = plant.DeletePlantResp
DeletePostReq = plant.DeletePostReq
DeletePostResp = plant.DeletePostResp
DeleteTopicReq = plant.DeleteTopicReq
DeleteTopicResp = plant.DeleteTopicResp
Empty = plant.Empty
ExchangeItemInfo = plant.ExchangeItemInfo
GetBadgeConfigListReq = plant.GetBadgeConfigListReq
GetBadgeConfigListResp = plant.GetBadgeConfigListResp
GetExchangeItemListReq = plant.GetExchangeItemListReq
GetExchangeItemListResp = plant.GetExchangeItemListResp
GetLevelConfigListReq = plant.GetLevelConfigListReq
GetLevelConfigListResp = plant.GetLevelConfigListResp
GetPlantDetailReq = plant.GetPlantDetailReq
GetPlantDetailResp = plant.GetPlantDetailResp
GetPlantListReq = plant.GetPlantListReq
GetPlantListResp = plant.GetPlantListResp
GetPostDetailReq = plant.GetPostDetailReq
GetPostDetailResp = plant.GetPostDetailResp
GetPostListReq = plant.GetPostListReq
GetPostListResp = plant.GetPostListResp
GetTopicListResp = plant.GetTopicListResp
GetUserProfileReq = plant.GetUserProfileReq
GetUserProfileResp = plant.GetUserProfileResp
GetWikiClassListResp = plant.GetWikiClassListResp
GetWikiDetailReq = plant.GetWikiDetailReq
GetWikiDetailResp = plant.GetWikiDetailResp
GetWikiListReq = plant.GetWikiListReq
GetWikiListResp = plant.GetWikiListResp
IncrUserCounterReq = plant.IncrUserCounterReq
IncrUserCounterResp = plant.IncrUserCounterResp
LevelConfigInfo = plant.LevelConfigInfo
LikePostReq = plant.LikePostReq
LikePostResp = plant.LikePostResp
PlantInfo = plant.PlantInfo
PostInfo = plant.PostInfo
ToggleStarReq = plant.ToggleStarReq
ToggleStarResp = plant.ToggleStarResp
TopicInfo = plant.TopicInfo
UpdatePlantReq = plant.UpdatePlantReq
UpdatePlantResp = plant.UpdatePlantResp
UpdateUserProfileReq = plant.UpdateUserProfileReq
UpdateUserProfileResp = plant.UpdateUserProfileResp
UserProfile = plant.UserProfile
WikiClassInfo = plant.WikiClassInfo
WikiInfo = plant.WikiInfo
AddCarePlanReq = plant.AddCarePlanReq
AddCareRecordReq = plant.AddCareRecordReq
AddGrowthRecordReq = plant.AddGrowthRecordReq
BadgeConfigInfo = plant.BadgeConfigInfo
BadgeConfigListReq = plant.BadgeConfigListReq
BadgeConfigListResp = plant.BadgeConfigListResp
CarePlanInfo = plant.CarePlanInfo
CommentPostReq = plant.CommentPostReq
CommonResp = plant.CommonResp
CreateExchangeOrderReq = plant.CreateExchangeOrderReq
CreatePlantReq = plant.CreatePlantReq
CreatePostReq = plant.CreatePostReq
CreateTopicReq = plant.CreateTopicReq
CreateWikiClassReq = plant.CreateWikiClassReq
ExchangeItemInfo = plant.ExchangeItemInfo
ExchangeItemListReq = plant.ExchangeItemListReq
ExchangeItemListResp = plant.ExchangeItemListResp
GetProfileReq = plant.GetProfileReq
GrowthRecordInfo = plant.GrowthRecordInfo
IdReq = plant.IdReq
IdsReq = plant.IdsReq
LevelConfigInfo = plant.LevelConfigInfo
LevelConfigListResp = plant.LevelConfigListResp
LikePostReq = plant.LikePostReq
PageReq = plant.PageReq
PlantDetailResp = plant.PlantDetailResp
PlantInfo = plant.PlantInfo
PlantListReq = plant.PlantListReq
PlantListResp = plant.PlantListResp
PlantUserProfile = plant.PlantUserProfile
PostCommentInfo = plant.PostCommentInfo
PostDetailResp = plant.PostDetailResp
PostInfo = plant.PostInfo
PostListReq = plant.PostListReq
PostListResp = plant.PostListResp
ToggleStarReq = plant.ToggleStarReq
TopicInfo = plant.TopicInfo
TopicListResp = plant.TopicListResp
UpdatePlantReq = plant.UpdatePlantReq
UpdateProfileReq = plant.UpdateProfileReq
WikiClassInfo = plant.WikiClassInfo
WikiClassListResp = plant.WikiClassListResp
WikiDetailResp = plant.WikiDetailResp
WikiInfo = plant.WikiInfo
WikiListReq = plant.WikiListReq
WikiListResp = plant.WikiListResp
PlantService interface {
// 用户Profile
GetUserProfile(ctx context.Context, in *GetUserProfileReq, opts ...grpc.CallOption) (*GetUserProfileResp, error)
UpdateUserProfile(ctx context.Context, in *UpdateUserProfileReq, opts ...grpc.CallOption) (*UpdateUserProfileResp, error)
IncrUserCounter(ctx context.Context, in *IncrUserCounterReq, opts ...grpc.CallOption) (*IncrUserCounterResp, error)
// 植物
CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CreatePlantResp, error)
UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*UpdatePlantResp, error)
DeletePlant(ctx context.Context, in *DeletePlantReq, opts ...grpc.CallOption) (*DeletePlantResp, error)
GetPlantList(ctx context.Context, in *GetPlantListReq, opts ...grpc.CallOption) (*GetPlantListResp, error)
GetPlantDetail(ctx context.Context, in *GetPlantDetailReq, opts ...grpc.CallOption) (*GetPlantDetailResp, error)
GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*PlantUserProfile, error)
UpdateUserProfile(ctx context.Context, in *UpdateProfileReq, opts ...grpc.CallOption) (*CommonResp, error)
// 我的植物
CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CommonResp, error)
UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*CommonResp, error)
DeletePlant(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetPlantList(ctx context.Context, in *PlantListReq, opts ...grpc.CallOption) (*PlantListResp, error)
GetPlantDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PlantDetailResp, error)
// 养护
AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*AddCarePlanResp, error)
AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*AddCareRecordResp, error)
AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*AddGrowthRecordResp, error)
AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*CommonResp, error)
AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*CommonResp, error)
AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*CommonResp, error)
// 百科
GetWikiList(ctx context.Context, in *GetWikiListReq, opts ...grpc.CallOption) (*GetWikiListResp, error)
GetWikiDetail(ctx context.Context, in *GetWikiDetailReq, opts ...grpc.CallOption) (*GetWikiDetailResp, error)
GetWikiClassList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetWikiClassListResp, error)
CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CreateWikiClassResp, error)
ToggleStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*ToggleStarResp, error)
GetWikiList(ctx context.Context, in *WikiListReq, opts ...grpc.CallOption) (*WikiListResp, error)
GetWikiDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiDetailResp, error)
GetWikiClassList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiClassListResp, error)
CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CommonResp, error)
ToggleWikiStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*CommonResp, error)
// 社区
CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CreatePostResp, error)
GetPostList(ctx context.Context, in *GetPostListReq, opts ...grpc.CallOption) (*GetPostListResp, error)
GetPostDetail(ctx context.Context, in *GetPostDetailReq, opts ...grpc.CallOption) (*GetPostDetailResp, error)
DeletePost(ctx context.Context, in *DeletePostReq, opts ...grpc.CallOption) (*DeletePostResp, error)
CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommentPostResp, error)
LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*LikePostResp, error)
CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CommonResp, error)
DeletePost(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
GetPostList(ctx context.Context, in *PostListReq, opts ...grpc.CallOption) (*PostListResp, error)
GetPostDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PostDetailResp, error)
CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommonResp, error)
LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*CommonResp, error)
// 话题
GetTopicList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetTopicListResp, error)
CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CreateTopicResp, error)
DeleteTopic(ctx context.Context, in *DeleteTopicReq, opts ...grpc.CallOption) (*DeleteTopicResp, error)
// 配置
GetLevelConfigList(ctx context.Context, in *GetLevelConfigListReq, opts ...grpc.CallOption) (*GetLevelConfigListResp, error)
GetBadgeConfigList(ctx context.Context, in *GetBadgeConfigListReq, opts ...grpc.CallOption) (*GetBadgeConfigListResp, error)
GetTopicList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*TopicListResp, error)
CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CommonResp, error)
DeleteTopic(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error)
// 兑换
GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error)
CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error)
GetExchangeItemList(ctx context.Context, in *ExchangeItemListReq, opts ...grpc.CallOption) (*ExchangeItemListResp, error)
CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CommonResp, error)
// 配置
GetLevelConfigList(ctx context.Context, in *PageReq, opts ...grpc.CallOption) (*LevelConfigListResp, error)
GetBadgeConfigList(ctx context.Context, in *BadgeConfigListReq, opts ...grpc.CallOption) (*BadgeConfigListResp, error)
}
defaultPlantService struct {
@@ -134,154 +112,149 @@ func NewPlantService(cli zrpc.Client) PlantService {
}
// 用户Profile
func (m *defaultPlantService) GetUserProfile(ctx context.Context, in *GetUserProfileReq, opts ...grpc.CallOption) (*GetUserProfileResp, error) {
func (m *defaultPlantService) GetUserProfile(ctx context.Context, in *GetProfileReq, opts ...grpc.CallOption) (*PlantUserProfile, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetUserProfile(ctx, in, opts...)
}
func (m *defaultPlantService) UpdateUserProfile(ctx context.Context, in *UpdateUserProfileReq, opts ...grpc.CallOption) (*UpdateUserProfileResp, error) {
func (m *defaultPlantService) UpdateUserProfile(ctx context.Context, in *UpdateProfileReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.UpdateUserProfile(ctx, in, opts...)
}
func (m *defaultPlantService) IncrUserCounter(ctx context.Context, in *IncrUserCounterReq, opts ...grpc.CallOption) (*IncrUserCounterResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.IncrUserCounter(ctx, in, opts...)
}
// 植物
func (m *defaultPlantService) CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CreatePlantResp, error) {
// 我的植物
func (m *defaultPlantService) CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.CreatePlant(ctx, in, opts...)
}
func (m *defaultPlantService) UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*UpdatePlantResp, error) {
func (m *defaultPlantService) UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.UpdatePlant(ctx, in, opts...)
}
func (m *defaultPlantService) DeletePlant(ctx context.Context, in *DeletePlantReq, opts ...grpc.CallOption) (*DeletePlantResp, error) {
func (m *defaultPlantService) DeletePlant(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.DeletePlant(ctx, in, opts...)
}
func (m *defaultPlantService) GetPlantList(ctx context.Context, in *GetPlantListReq, opts ...grpc.CallOption) (*GetPlantListResp, error) {
func (m *defaultPlantService) GetPlantList(ctx context.Context, in *PlantListReq, opts ...grpc.CallOption) (*PlantListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetPlantList(ctx, in, opts...)
}
func (m *defaultPlantService) GetPlantDetail(ctx context.Context, in *GetPlantDetailReq, opts ...grpc.CallOption) (*GetPlantDetailResp, error) {
func (m *defaultPlantService) GetPlantDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PlantDetailResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetPlantDetail(ctx, in, opts...)
}
// 养护
func (m *defaultPlantService) AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*AddCarePlanResp, error) {
func (m *defaultPlantService) AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.AddCarePlan(ctx, in, opts...)
}
func (m *defaultPlantService) AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*AddCareRecordResp, error) {
func (m *defaultPlantService) AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.AddCareRecord(ctx, in, opts...)
}
func (m *defaultPlantService) AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*AddGrowthRecordResp, error) {
func (m *defaultPlantService) AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.AddGrowthRecord(ctx, in, opts...)
}
// 百科
func (m *defaultPlantService) GetWikiList(ctx context.Context, in *GetWikiListReq, opts ...grpc.CallOption) (*GetWikiListResp, error) {
func (m *defaultPlantService) GetWikiList(ctx context.Context, in *WikiListReq, opts ...grpc.CallOption) (*WikiListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetWikiList(ctx, in, opts...)
}
func (m *defaultPlantService) GetWikiDetail(ctx context.Context, in *GetWikiDetailReq, opts ...grpc.CallOption) (*GetWikiDetailResp, error) {
func (m *defaultPlantService) GetWikiDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiDetailResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetWikiDetail(ctx, in, opts...)
}
func (m *defaultPlantService) GetWikiClassList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetWikiClassListResp, error) {
func (m *defaultPlantService) GetWikiClassList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*WikiClassListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetWikiClassList(ctx, in, opts...)
}
func (m *defaultPlantService) CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CreateWikiClassResp, error) {
func (m *defaultPlantService) CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.CreateWikiClass(ctx, in, opts...)
}
func (m *defaultPlantService) ToggleStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*ToggleStarResp, error) {
func (m *defaultPlantService) ToggleWikiStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.ToggleStar(ctx, in, opts...)
return client.ToggleWikiStar(ctx, in, opts...)
}
// 社区
func (m *defaultPlantService) CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CreatePostResp, error) {
func (m *defaultPlantService) CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.CreatePost(ctx, in, opts...)
}
func (m *defaultPlantService) GetPostList(ctx context.Context, in *GetPostListReq, opts ...grpc.CallOption) (*GetPostListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetPostList(ctx, in, opts...)
}
func (m *defaultPlantService) GetPostDetail(ctx context.Context, in *GetPostDetailReq, opts ...grpc.CallOption) (*GetPostDetailResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetPostDetail(ctx, in, opts...)
}
func (m *defaultPlantService) DeletePost(ctx context.Context, in *DeletePostReq, opts ...grpc.CallOption) (*DeletePostResp, error) {
func (m *defaultPlantService) DeletePost(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.DeletePost(ctx, in, opts...)
}
func (m *defaultPlantService) CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommentPostResp, error) {
func (m *defaultPlantService) GetPostList(ctx context.Context, in *PostListReq, opts ...grpc.CallOption) (*PostListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetPostList(ctx, in, opts...)
}
func (m *defaultPlantService) GetPostDetail(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*PostDetailResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetPostDetail(ctx, in, opts...)
}
func (m *defaultPlantService) CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.CommentPost(ctx, in, opts...)
}
func (m *defaultPlantService) LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*LikePostResp, error) {
func (m *defaultPlantService) LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.LikePost(ctx, in, opts...)
}
// 话题
func (m *defaultPlantService) GetTopicList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetTopicListResp, error) {
func (m *defaultPlantService) GetTopicList(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*TopicListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetTopicList(ctx, in, opts...)
}
func (m *defaultPlantService) CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CreateTopicResp, error) {
func (m *defaultPlantService) CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.CreateTopic(ctx, in, opts...)
}
func (m *defaultPlantService) DeleteTopic(ctx context.Context, in *DeleteTopicReq, opts ...grpc.CallOption) (*DeleteTopicResp, error) {
func (m *defaultPlantService) DeleteTopic(ctx context.Context, in *IdsReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.DeleteTopic(ctx, in, opts...)
}
// 配置
func (m *defaultPlantService) GetLevelConfigList(ctx context.Context, in *GetLevelConfigListReq, opts ...grpc.CallOption) (*GetLevelConfigListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetLevelConfigList(ctx, in, opts...)
}
func (m *defaultPlantService) GetBadgeConfigList(ctx context.Context, in *GetBadgeConfigListReq, opts ...grpc.CallOption) (*GetBadgeConfigListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetBadgeConfigList(ctx, in, opts...)
}
// 兑换
func (m *defaultPlantService) GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error) {
func (m *defaultPlantService) GetExchangeItemList(ctx context.Context, in *ExchangeItemListReq, opts ...grpc.CallOption) (*ExchangeItemListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetExchangeItemList(ctx, in, opts...)
}
func (m *defaultPlantService) CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error) {
func (m *defaultPlantService) CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CommonResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.CreateExchangeOrder(ctx, in, opts...)
}
// 配置
func (m *defaultPlantService) GetLevelConfigList(ctx context.Context, in *PageReq, opts ...grpc.CallOption) (*LevelConfigListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetLevelConfigList(ctx, in, opts...)
}
func (m *defaultPlantService) GetBadgeConfigList(ctx context.Context, in *BadgeConfigListReq, opts ...grpc.CallOption) (*BadgeConfigListResp, error) {
client := plant.NewPlantServiceClient(m.cli.Conn())
return client.GetBadgeConfigList(ctx, in, opts...)
}