feat: 初次启动
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
+5
-5
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user