commit e515f6a287accecad10abe7a9833644f97a8c080 Author: Blizzard Date: Mon Apr 27 00:02:18 2026 +0800 init: init refactor diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/app/file/api/etc/file-api.yaml b/app/file/api/etc/file-api.yaml new file mode 100644 index 0000000..853ada6 --- /dev/null +++ b/app/file/api/etc/file-api.yaml @@ -0,0 +1,23 @@ +Name: file-api +Host: 0.0.0.0 +Port: 9002 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# file-rpc 服务配置 +FileRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: file.rpc + +# MinIO +Minio: + Endpoint: 129.28.103.17:3407 + AccessKeyId: qP5QXP3g6Axw1hkwX21Y + AccessKeySecret: sddT6J3S6yDn9m1wfth0pzelPg9KWmbHjMAUF5S9 + BucketName: sundynix-plant + BucketUrl: https://res.sundynix.cn/sundynix-plant + UseSsl: false diff --git a/app/file/api/file.api b/app/file/api/file.api new file mode 100644 index 0000000..b96414c --- /dev/null +++ b/app/file/api/file.api @@ -0,0 +1,60 @@ +syntax = "v1" + +info ( + title: "文件服务API" + desc: "文件上传、删除、查询等HTTP接口" + author: "sundynix" + version: "v1.0.0" +) + +type ( + // 文件信息 + FileInfo { + Id string `json:"id"` + Name string `json:"name"` + Url string `json:"url"` + Tag string `json:"tag"` + Key string `json:"key"` + Suffix string `json:"suffix"` + Md5 string `json:"md5"` + } + // 批量ID请求 + IdsReq { + Ids []string `json:"ids"` + } + // 文件列表查询 + FileListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + } + // 文件ID请求 + FileIdReq { + Id string `path:"id"` + } +) + +// ========== 需要鉴权的接口 ========== +@server ( + prefix: /api/file + group: file + jwt: Auth +) +service file-api { + @doc "上传文件" + @handler UploadFile + post /upload returns (FileInfo) + + @doc "删除文件" + @handler DeleteFile + delete /delete (IdsReq) + + @doc "文件列表" + @handler GetFileList + post /list (FileListReq) + + @doc "获取文件信息" + @handler GetFileById + get /:id (FileIdReq) returns (FileInfo) +} + diff --git a/app/file/api/file.go b/app/file/api/file.go new file mode 100644 index 0000000..b37e311 --- /dev/null +++ b/app/file/api/file.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/file/api/internal/config" + "sundynix-micro-go/app/file/api/internal/handler" + "sundynix-micro-go/app/file/api/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/rest" +) + +var configFile = flag.String("f", "etc/file-api.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + server := rest.MustNewServer(c.RestConf) + defer server.Stop() + + ctx := svc.NewServiceContext(c) + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/app/file/api/internal/config/config.go b/app/file/api/internal/config/config.go new file mode 100644 index 0000000..66082d9 --- /dev/null +++ b/app/file/api/internal/config/config.go @@ -0,0 +1,26 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + rest.RestConf + Auth struct { + AccessSecret string + AccessExpire int64 + } + FileRpc zrpc.RpcClientConf + Minio struct { + Endpoint string + AccessKeyId string + AccessKeySecret string + BucketName string + BucketUrl string + UseSsl bool + } +} diff --git a/app/file/api/internal/handler/file/deleteFileHandler.go b/app/file/api/internal/handler/file/deleteFileHandler.go new file mode 100644 index 0000000..a58ab7f --- /dev/null +++ b/app/file/api/internal/handler/file/deleteFileHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/file/api/internal/logic/file" + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除文件 +func DeleteFileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := file.NewDeleteFileLogic(r.Context(), svcCtx) + err := l.DeleteFile(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/file/api/internal/handler/file/getFileByIdHandler.go b/app/file/api/internal/handler/file/getFileByIdHandler.go new file mode 100644 index 0000000..ad59d98 --- /dev/null +++ b/app/file/api/internal/handler/file/getFileByIdHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/file/api/internal/logic/file" + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 获取文件信息 +func GetFileByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FileIdReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := file.NewGetFileByIdLogic(r.Context(), svcCtx) + resp, err := l.GetFileById(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/file/api/internal/handler/file/getFileListHandler.go b/app/file/api/internal/handler/file/getFileListHandler.go new file mode 100644 index 0000000..237b182 --- /dev/null +++ b/app/file/api/internal/handler/file/getFileListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/file/api/internal/logic/file" + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 文件列表 +func GetFileListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FileListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := file.NewGetFileListLogic(r.Context(), svcCtx) + err := l.GetFileList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/file/api/internal/handler/file/uploadFileHandler.go b/app/file/api/internal/handler/file/uploadFileHandler.go new file mode 100644 index 0000000..d09e6b6 --- /dev/null +++ b/app/file/api/internal/handler/file/uploadFileHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "net/http" + + "sundynix-micro-go/app/file/api/internal/logic/file" + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 上传文件 +func UploadFileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := file.NewUploadFileLogic(r.Context(), svcCtx) + resp, err := l.UploadFile() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/file/api/internal/handler/routes.go b/app/file/api/internal/handler/routes.go new file mode 100644 index 0000000..a68f7b4 --- /dev/null +++ b/app/file/api/internal/handler/routes.go @@ -0,0 +1,46 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package handler + +import ( + "net/http" + + file "sundynix-micro-go/app/file/api/internal/handler/file" + "sundynix-micro-go/app/file/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + // 获取文件信息 + Method: http.MethodGet, + Path: "/:id", + Handler: file.GetFileByIdHandler(serverCtx), + }, + { + // 删除文件 + Method: http.MethodDelete, + Path: "/delete", + Handler: file.DeleteFileHandler(serverCtx), + }, + { + // 文件列表 + Method: http.MethodPost, + Path: "/list", + Handler: file.GetFileListHandler(serverCtx), + }, + { + // 上传文件 + Method: http.MethodPost, + Path: "/upload", + Handler: file.UploadFileHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/file"), + ) +} diff --git a/app/file/api/internal/logic/file/deleteFileLogic.go b/app/file/api/internal/logic/file/deleteFileLogic.go new file mode 100644 index 0000000..bd2669d --- /dev/null +++ b/app/file/api/internal/logic/file/deleteFileLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "context" + + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteFileLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除文件 +func NewDeleteFileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFileLogic { + return &DeleteFileLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteFileLogic) DeleteFile(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/file/api/internal/logic/file/getFileByIdLogic.go b/app/file/api/internal/logic/file/getFileByIdLogic.go new file mode 100644 index 0000000..71810c9 --- /dev/null +++ b/app/file/api/internal/logic/file/getFileByIdLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "context" + + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetFileByIdLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 获取文件信息 +func NewGetFileByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFileByIdLogic { + return &GetFileByIdLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetFileByIdLogic) GetFileById(req *types.FileIdReq) (resp *types.FileInfo, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/app/file/api/internal/logic/file/getFileListLogic.go b/app/file/api/internal/logic/file/getFileListLogic.go new file mode 100644 index 0000000..21aee47 --- /dev/null +++ b/app/file/api/internal/logic/file/getFileListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "context" + + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetFileListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 文件列表 +func NewGetFileListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFileListLogic { + return &GetFileListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetFileListLogic) GetFileList(req *types.FileListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/file/api/internal/logic/file/uploadFileLogic.go b/app/file/api/internal/logic/file/uploadFileLogic.go new file mode 100644 index 0000000..ddab9ee --- /dev/null +++ b/app/file/api/internal/logic/file/uploadFileLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package file + +import ( + "context" + + "sundynix-micro-go/app/file/api/internal/svc" + "sundynix-micro-go/app/file/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UploadFileLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 上传文件 +func NewUploadFileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadFileLogic { + return &UploadFileLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UploadFileLogic) UploadFile() (resp *types.FileInfo, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/app/file/api/internal/svc/serviceContext.go b/app/file/api/internal/svc/serviceContext.go new file mode 100644 index 0000000..994892d --- /dev/null +++ b/app/file/api/internal/svc/serviceContext.go @@ -0,0 +1,38 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package svc + +import ( + "sundynix-micro-go/app/file/api/internal/config" + "sundynix-micro-go/app/file/rpc/fileservice" + + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/zrpc" +) + +type ServiceContext struct { + Config config.Config + FileRpc fileservice.FileService + MinioClient *minio.Client +} + +func NewServiceContext(c config.Config) *ServiceContext { + // 初始化MinIO客户端(上传需要在API层操作) + minioClient, err := minio.New(c.Minio.Endpoint, &minio.Options{ + Creds: credentials.NewStaticV4(c.Minio.AccessKeyId, c.Minio.AccessKeySecret, ""), + Secure: c.Minio.UseSsl, + }) + if err != nil { + logx.Errorf("初始化MinIO客户端失败: %v", err) + panic(err) + } + + return &ServiceContext{ + Config: c, + FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)), + MinioClient: minioClient, + } +} diff --git a/app/file/api/internal/types/types.go b/app/file/api/internal/types/types.go new file mode 100644 index 0000000..18c263c --- /dev/null +++ b/app/file/api/internal/types/types.go @@ -0,0 +1,28 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package types + +type FileIdReq struct { + Id string `path:"id"` +} + +type FileInfo struct { + Id string `json:"id"` + Name string `json:"name"` + Url string `json:"url"` + Tag string `json:"tag"` + Key string `json:"key"` + Suffix string `json:"suffix"` + Md5 string `json:"md5"` +} + +type FileListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` +} + +type IdsReq struct { + Ids []string `json:"ids"` +} diff --git a/app/file/model/oss_model.go b/app/file/model/oss_model.go new file mode 100644 index 0000000..3b28979 --- /dev/null +++ b/app/file/model/oss_model.go @@ -0,0 +1,21 @@ +package model + +import ( + "sundynix-micro-go/common/model" +) + +// SundynixOss OSS文件表 +type SundynixOss struct { + model.BaseModel + Name string `json:"name" gorm:"column:name;comment:文件名"` + Url string `json:"url" gorm:"column:url;comment:文件地址"` + Tag string `json:"tag" gorm:"column:tag;comment:文件标签"` + Key string `json:"key" gorm:"column:key;comment:文件key"` + Suffix string `json:"suffix" gorm:"column:suffix;comment:文件后缀"` + MD5 string `json:"md5" gorm:"column:md5;comment:文件md5"` +} + +// TableName 指定表名 +func (SundynixOss) TableName() string { + return "sundynix_oss" +} diff --git a/app/file/rpc/etc/file.yaml b/app/file/rpc/etc/file.yaml new file mode 100644 index 0000000..df53b97 --- /dev/null +++ b/app/file/rpc/etc/file.yaml @@ -0,0 +1,19 @@ +Name: file.rpc +ListenOn: 0.0.0.0:9102 +Etcd: + Hosts: + - 192.168.100.127:2379 + Key: file.rpc + +# MySQL +DB: + DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local + +# MinIO +Minio: + Endpoint: 129.28.103.17:3407 + AccessKeyId: qP5QXP3g6Axw1hkwX21Y + AccessKeySecret: sddT6J3S6yDn9m1wfth0pzelPg9KWmbHjMAUF5S9 + BucketName: sundynix-plant + BucketUrl: https://res.sundynix.cn/sundynix-plant + UseSsl: false diff --git a/app/file/rpc/file.go b/app/file/rpc/file.go new file mode 100644 index 0000000..8599cc3 --- /dev/null +++ b/app/file/rpc/file.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/file/rpc/file" + "sundynix-micro-go/app/file/rpc/internal/config" + "sundynix-micro-go/app/file/rpc/internal/server" + "sundynix-micro-go/app/file/rpc/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/file.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + file.RegisterFileServiceServer(grpcServer, server.NewFileServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/app/file/rpc/file/file.pb.go b/app/file/rpc/file/file.pb.go new file mode 100644 index 0000000..df26d04 --- /dev/null +++ b/app/file/rpc/file/file.pb.go @@ -0,0 +1,439 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: pb/file.proto + +package file + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CommonResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommonResp) Reset() { + *x = CommonResp{} + mi := &file_pb_file_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommonResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommonResp) ProtoMessage() {} + +func (x *CommonResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_file_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead. +func (*CommonResp) Descriptor() ([]byte, []int) { + return file_pb_file_proto_rawDescGZIP(), []int{0} +} + +func (x *CommonResp) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *CommonResp) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +type FileInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + Tag string `protobuf:"bytes,4,opt,name=tag,proto3" json:"tag,omitempty"` + Key string `protobuf:"bytes,5,opt,name=key,proto3" json:"key,omitempty"` + Suffix string `protobuf:"bytes,6,opt,name=suffix,proto3" json:"suffix,omitempty"` + Md5 string `protobuf:"bytes,7,opt,name=md5,proto3" json:"md5,omitempty"` + CreatedAt int64 `protobuf:"varint,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FileInfo) Reset() { + *x = FileInfo{} + mi := &file_pb_file_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FileInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileInfo) ProtoMessage() {} + +func (x *FileInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_file_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileInfo.ProtoReflect.Descriptor instead. +func (*FileInfo) Descriptor() ([]byte, []int) { + return file_pb_file_proto_rawDescGZIP(), []int{1} +} + +func (x *FileInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *FileInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FileInfo) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *FileInfo) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +func (x *FileInfo) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *FileInfo) GetSuffix() string { + if x != nil { + return x.Suffix + } + return "" +} + +func (x *FileInfo) GetMd5() string { + if x != nil { + return x.Md5 + } + return "" +} + +func (x *FileInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type GetFileByIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFileByIdReq) Reset() { + *x = GetFileByIdReq{} + mi := &file_pb_file_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFileByIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileByIdReq) ProtoMessage() {} + +func (x *GetFileByIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_file_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFileByIdReq.ProtoReflect.Descriptor instead. +func (*GetFileByIdReq) Descriptor() ([]byte, []int) { + return file_pb_file_proto_rawDescGZIP(), []int{2} +} + +func (x *GetFileByIdReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetFileByIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + File *FileInfo `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFileByIdResp) Reset() { + *x = GetFileByIdResp{} + mi := &file_pb_file_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFileByIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileByIdResp) ProtoMessage() {} + +func (x *GetFileByIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_file_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFileByIdResp.ProtoReflect.Descriptor instead. +func (*GetFileByIdResp) Descriptor() ([]byte, []int) { + return file_pb_file_proto_rawDescGZIP(), []int{3} +} + +func (x *GetFileByIdResp) GetFile() *FileInfo { + if x != nil { + return x.File + } + return nil +} + +type GetFilesByIdsReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFilesByIdsReq) Reset() { + *x = GetFilesByIdsReq{} + mi := &file_pb_file_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFilesByIdsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFilesByIdsReq) ProtoMessage() {} + +func (x *GetFilesByIdsReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_file_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFilesByIdsReq.ProtoReflect.Descriptor instead. +func (*GetFilesByIdsReq) Descriptor() ([]byte, []int) { + return file_pb_file_proto_rawDescGZIP(), []int{4} +} + +func (x *GetFilesByIdsReq) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type GetFilesByIdsResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Files []*FileInfo `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFilesByIdsResp) Reset() { + *x = GetFilesByIdsResp{} + mi := &file_pb_file_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFilesByIdsResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFilesByIdsResp) ProtoMessage() {} + +func (x *GetFilesByIdsResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_file_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFilesByIdsResp.ProtoReflect.Descriptor instead. +func (*GetFilesByIdsResp) Descriptor() ([]byte, []int) { + return file_pb_file_proto_rawDescGZIP(), []int{5} +} + +func (x *GetFilesByIdsResp) GetFiles() []*FileInfo { + if x != nil { + return x.Files + } + return nil +} + +var File_pb_file_proto protoreflect.FileDescriptor + +const file_pb_file_proto_rawDesc = "" + + "\n" + + "\rpb/file.proto\x12\x04file\"2\n" + + "\n" + + "CommonResp\x12\x12\n" + + "\x04code\x18\x01 \x01(\x03R\x04code\x12\x10\n" + + "\x03msg\x18\x02 \x01(\tR\x03msg\"\xac\x01\n" + + "\bFileInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x10\n" + + "\x03url\x18\x03 \x01(\tR\x03url\x12\x10\n" + + "\x03tag\x18\x04 \x01(\tR\x03tag\x12\x10\n" + + "\x03key\x18\x05 \x01(\tR\x03key\x12\x16\n" + + "\x06suffix\x18\x06 \x01(\tR\x06suffix\x12\x10\n" + + "\x03md5\x18\a \x01(\tR\x03md5\x12\x1c\n" + + "\tcreatedAt\x18\b \x01(\x03R\tcreatedAt\" \n" + + "\x0eGetFileByIdReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"5\n" + + "\x0fGetFileByIdResp\x12\"\n" + + "\x04file\x18\x01 \x01(\v2\x0e.file.FileInfoR\x04file\"$\n" + + "\x10GetFilesByIdsReq\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\"9\n" + + "\x11GetFilesByIdsResp\x12$\n" + + "\x05files\x18\x01 \x03(\v2\x0e.file.FileInfoR\x05files2\x8b\x01\n" + + "\vFileService\x12:\n" + + "\vGetFileById\x12\x14.file.GetFileByIdReq\x1a\x15.file.GetFileByIdResp\x12@\n" + + "\rGetFilesByIds\x12\x16.file.GetFilesByIdsReq\x1a\x17.file.GetFilesByIdsRespB\bZ\x06./fileb\x06proto3" + +var ( + file_pb_file_proto_rawDescOnce sync.Once + file_pb_file_proto_rawDescData []byte +) + +func file_pb_file_proto_rawDescGZIP() []byte { + file_pb_file_proto_rawDescOnce.Do(func() { + file_pb_file_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_file_proto_rawDesc), len(file_pb_file_proto_rawDesc))) + }) + return file_pb_file_proto_rawDescData +} + +var file_pb_file_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_pb_file_proto_goTypes = []any{ + (*CommonResp)(nil), // 0: file.CommonResp + (*FileInfo)(nil), // 1: file.FileInfo + (*GetFileByIdReq)(nil), // 2: file.GetFileByIdReq + (*GetFileByIdResp)(nil), // 3: file.GetFileByIdResp + (*GetFilesByIdsReq)(nil), // 4: file.GetFilesByIdsReq + (*GetFilesByIdsResp)(nil), // 5: file.GetFilesByIdsResp +} +var file_pb_file_proto_depIdxs = []int32{ + 1, // 0: file.GetFileByIdResp.file:type_name -> file.FileInfo + 1, // 1: file.GetFilesByIdsResp.files:type_name -> file.FileInfo + 2, // 2: file.FileService.GetFileById:input_type -> file.GetFileByIdReq + 4, // 3: file.FileService.GetFilesByIds:input_type -> file.GetFilesByIdsReq + 3, // 4: file.FileService.GetFileById:output_type -> file.GetFileByIdResp + 5, // 5: file.FileService.GetFilesByIds:output_type -> file.GetFilesByIdsResp + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_pb_file_proto_init() } +func file_pb_file_proto_init() { + if File_pb_file_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_file_proto_rawDesc), len(file_pb_file_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pb_file_proto_goTypes, + DependencyIndexes: file_pb_file_proto_depIdxs, + MessageInfos: file_pb_file_proto_msgTypes, + }.Build() + File_pb_file_proto = out.File + file_pb_file_proto_goTypes = nil + file_pb_file_proto_depIdxs = nil +} diff --git a/app/file/rpc/file/file_grpc.pb.go b/app/file/rpc/file/file_grpc.pb.go new file mode 100644 index 0000000..7a12f81 --- /dev/null +++ b/app/file/rpc/file/file_grpc.pb.go @@ -0,0 +1,163 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v7.34.1 +// source: pb/file.proto + +package file + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + FileService_GetFileById_FullMethodName = "/file.FileService/GetFileById" + FileService_GetFilesByIds_FullMethodName = "/file.FileService/GetFilesByIds" +) + +// FileServiceClient is the client API for FileService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type FileServiceClient interface { + // 根据ID获取文件信息 + GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error) + // 根据ID列表批量获取文件信息 + GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error) +} + +type fileServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient { + return &fileServiceClient{cc} +} + +func (c *fileServiceClient) GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFileByIdResp) + err := c.cc.Invoke(ctx, FileService_GetFileById_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileServiceClient) GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFilesByIdsResp) + err := c.cc.Invoke(ctx, FileService_GetFilesByIds_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FileServiceServer is the server API for FileService service. +// All implementations must embed UnimplementedFileServiceServer +// for forward compatibility. +type FileServiceServer interface { + // 根据ID获取文件信息 + GetFileById(context.Context, *GetFileByIdReq) (*GetFileByIdResp, error) + // 根据ID列表批量获取文件信息 + GetFilesByIds(context.Context, *GetFilesByIdsReq) (*GetFilesByIdsResp, error) + mustEmbedUnimplementedFileServiceServer() +} + +// UnimplementedFileServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedFileServiceServer struct{} + +func (UnimplementedFileServiceServer) GetFileById(context.Context, *GetFileByIdReq) (*GetFileByIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetFileById not implemented") +} +func (UnimplementedFileServiceServer) GetFilesByIds(context.Context, *GetFilesByIdsReq) (*GetFilesByIdsResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetFilesByIds not implemented") +} +func (UnimplementedFileServiceServer) mustEmbedUnimplementedFileServiceServer() {} +func (UnimplementedFileServiceServer) testEmbeddedByValue() {} + +// UnsafeFileServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FileServiceServer will +// result in compilation errors. +type UnsafeFileServiceServer interface { + mustEmbedUnimplementedFileServiceServer() +} + +func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer) { + // If the following call panics, it indicates UnimplementedFileServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&FileService_ServiceDesc, srv) +} + +func _FileService_GetFileById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFileByIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServiceServer).GetFileById(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FileService_GetFileById_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServiceServer).GetFileById(ctx, req.(*GetFileByIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _FileService_GetFilesByIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFilesByIdsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServiceServer).GetFilesByIds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FileService_GetFilesByIds_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServiceServer).GetFilesByIds(ctx, req.(*GetFilesByIdsReq)) + } + return interceptor(ctx, in, info, handler) +} + +// FileService_ServiceDesc is the grpc.ServiceDesc for FileService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FileService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "file.FileService", + HandlerType: (*FileServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetFileById", + Handler: _FileService_GetFileById_Handler, + }, + { + MethodName: "GetFilesByIds", + Handler: _FileService_GetFilesByIds_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pb/file.proto", +} diff --git a/app/file/rpc/fileservice/fileService.go b/app/file/rpc/fileservice/fileService.go new file mode 100644 index 0000000..aa0e594 --- /dev/null +++ b/app/file/rpc/fileservice/fileService.go @@ -0,0 +1,52 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: file.proto + +package fileservice + +import ( + "context" + + "sundynix-micro-go/app/file/rpc/file" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + CommonResp = file.CommonResp + FileInfo = file.FileInfo + GetFileByIdReq = file.GetFileByIdReq + GetFileByIdResp = file.GetFileByIdResp + GetFilesByIdsReq = file.GetFilesByIdsReq + GetFilesByIdsResp = file.GetFilesByIdsResp + + FileService interface { + // 根据ID获取文件信息 + GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error) + // 根据ID列表批量获取文件信息 + GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error) + } + + defaultFileService struct { + cli zrpc.Client + } +) + +func NewFileService(cli zrpc.Client) FileService { + return &defaultFileService{ + cli: cli, + } +} + +// 根据ID获取文件信息 +func (m *defaultFileService) GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error) { + client := file.NewFileServiceClient(m.cli.Conn()) + return client.GetFileById(ctx, in, opts...) +} + +// 根据ID列表批量获取文件信息 +func (m *defaultFileService) GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error) { + client := file.NewFileServiceClient(m.cli.Conn()) + return client.GetFilesByIds(ctx, in, opts...) +} diff --git a/app/file/rpc/internal/config/config.go b/app/file/rpc/internal/config/config.go new file mode 100755 index 0000000..7aa9b16 --- /dev/null +++ b/app/file/rpc/internal/config/config.go @@ -0,0 +1,18 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf + DB struct { + DataSource string + } + Minio struct { + Endpoint string + AccessKeyId string + AccessKeySecret string + BucketName string + BucketUrl string + UseSsl bool + } +} diff --git a/app/file/rpc/internal/logic/getFileByIdLogic.go b/app/file/rpc/internal/logic/getFileByIdLogic.go new file mode 100644 index 0000000..d51a797 --- /dev/null +++ b/app/file/rpc/internal/logic/getFileByIdLogic.go @@ -0,0 +1,58 @@ +package logic + +import ( + "context" + + fileModel "sundynix-micro-go/app/file/model" + "sundynix-micro-go/app/file/rpc/file" + "sundynix-micro-go/app/file/rpc/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type GetFileByIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetFileByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFileByIdLogic { + return &GetFileByIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 根据ID获取文件信息 +func (l *GetFileByIdLogic) GetFileById(in *file.GetFileByIdReq) (*file.GetFileByIdResp, error) { + var oss fileModel.SundynixOss + err := l.svcCtx.DB.Where("id = ?", in.Id).First(&oss).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return nil, status.Error(codes.NotFound, "文件不存在") + } + l.Errorf("查询文件失败: %v", err) + return nil, status.Error(codes.Internal, "查询文件失败") + } + + return &file.GetFileByIdResp{ + File: convertOssToProto(&oss), + }, nil +} + +func convertOssToProto(oss *fileModel.SundynixOss) *file.FileInfo { + return &file.FileInfo{ + Id: oss.ID, + Name: oss.Name, + Url: oss.Url, + Tag: oss.Tag, + Key: oss.Key, + Suffix: oss.Suffix, + Md5: oss.MD5, + CreatedAt: oss.CreatedAt.Unix(), + } +} diff --git a/app/file/rpc/internal/logic/getFilesByIdsLogic.go b/app/file/rpc/internal/logic/getFilesByIdsLogic.go new file mode 100644 index 0000000..1529f25 --- /dev/null +++ b/app/file/rpc/internal/logic/getFilesByIdsLogic.go @@ -0,0 +1,48 @@ +package logic + +import ( + "context" + + fileModel "sundynix-micro-go/app/file/model" + "sundynix-micro-go/app/file/rpc/file" + "sundynix-micro-go/app/file/rpc/internal/svc" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetFilesByIdsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetFilesByIdsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFilesByIdsLogic { + return &GetFilesByIdsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 根据ID列表批量获取文件信息 +func (l *GetFilesByIdsLogic) GetFilesByIds(in *file.GetFilesByIdsReq) (*file.GetFilesByIdsResp, error) { + if len(in.Ids) == 0 { + return &file.GetFilesByIdsResp{Files: []*file.FileInfo{}}, nil + } + + var ossList []fileModel.SundynixOss + err := l.svcCtx.DB.Where("id IN ?", in.Ids).Find(&ossList).Error + if err != nil { + l.Errorf("批量查询文件失败: %v", err) + return nil, status.Error(codes.Internal, "批量查询文件失败") + } + + files := make([]*file.FileInfo, 0, len(ossList)) + for _, oss := range ossList { + files = append(files, convertOssToProto(&oss)) + } + + return &file.GetFilesByIdsResp{Files: files}, nil +} diff --git a/app/file/rpc/internal/server/fileServiceServer.go b/app/file/rpc/internal/server/fileServiceServer.go new file mode 100644 index 0000000..3b3118a --- /dev/null +++ b/app/file/rpc/internal/server/fileServiceServer.go @@ -0,0 +1,36 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: file.proto + +package server + +import ( + "context" + + "sundynix-micro-go/app/file/rpc/file" + "sundynix-micro-go/app/file/rpc/internal/logic" + "sundynix-micro-go/app/file/rpc/internal/svc" +) + +type FileServiceServer struct { + svcCtx *svc.ServiceContext + file.UnimplementedFileServiceServer +} + +func NewFileServiceServer(svcCtx *svc.ServiceContext) *FileServiceServer { + return &FileServiceServer{ + svcCtx: svcCtx, + } +} + +// 根据ID获取文件信息 +func (s *FileServiceServer) GetFileById(ctx context.Context, in *file.GetFileByIdReq) (*file.GetFileByIdResp, error) { + l := logic.NewGetFileByIdLogic(ctx, s.svcCtx) + return l.GetFileById(in) +} + +// 根据ID列表批量获取文件信息 +func (s *FileServiceServer) GetFilesByIds(ctx context.Context, in *file.GetFilesByIdsReq) (*file.GetFilesByIdsResp, error) { + l := logic.NewGetFilesByIdsLogic(ctx, s.svcCtx) + return l.GetFilesByIds(in) +} diff --git a/app/file/rpc/internal/svc/serviceContext.go b/app/file/rpc/internal/svc/serviceContext.go new file mode 100644 index 0000000..4a300fe --- /dev/null +++ b/app/file/rpc/internal/svc/serviceContext.go @@ -0,0 +1,47 @@ +package svc + +import ( + fileModel "sundynix-micro-go/app/file/model" + "sundynix-micro-go/app/file/rpc/internal/config" + + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +type ServiceContext struct { + Config config.Config + DB *gorm.DB + MinioClient *minio.Client +} + +func NewServiceContext(c config.Config) *ServiceContext { + // 初始化GORM + db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) + if err != nil { + logx.Errorf("连接数据库失败: %v", err) + panic(err) + } + // 自动迁移 + if err := db.AutoMigrate(&fileModel.SundynixOss{}); err != nil { + logx.Errorf("数据库迁移失败: %v", err) + } + + // 初始化MinIO客户端 + minioClient, err := minio.New(c.Minio.Endpoint, &minio.Options{ + Creds: credentials.NewStaticV4(c.Minio.AccessKeyId, c.Minio.AccessKeySecret, ""), + Secure: c.Minio.UseSsl, + }) + if err != nil { + logx.Errorf("初始化MinIO客户端失败: %v", err) + panic(err) + } + + return &ServiceContext{ + Config: c, + DB: db, + MinioClient: minioClient, + } +} diff --git a/app/file/rpc/pb/file.proto b/app/file/rpc/pb/file.proto new file mode 100644 index 0000000..d1be143 --- /dev/null +++ b/app/file/rpc/pb/file.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package file; + +option go_package = "./file"; + +// ---------- 通用消息 ---------- + +message CommonResp { + int64 code = 1; + string msg = 2; +} + +// ---------- 文件信息 ---------- + +message FileInfo { + string id = 1; + string name = 2; + string url = 3; + string tag = 4; + string key = 5; + string suffix = 6; + string md5 = 7; + int64 createdAt = 8; +} + +// ---------- 请求/响应 ---------- + +message GetFileByIdReq { + string id = 1; +} + +message GetFileByIdResp { + FileInfo file = 1; +} + +message GetFilesByIdsReq { + repeated string ids = 1; +} + +message GetFilesByIdsResp { + repeated FileInfo files = 1; +} + +// ---------- 服务定义 ---------- + +service FileService { + // 根据ID获取文件信息 + rpc GetFileById(GetFileByIdReq) returns (GetFileByIdResp); + // 根据ID列表批量获取文件信息 + rpc GetFilesByIds(GetFilesByIdsReq) returns (GetFilesByIdsResp); +} diff --git a/app/plant/api/etc/plant-api.yaml b/app/plant/api/etc/plant-api.yaml new file mode 100644 index 0000000..ccd366f --- /dev/null +++ b/app/plant/api/etc/plant-api.yaml @@ -0,0 +1,44 @@ +Name: plant-api +Host: 0.0.0.0 +Port: 9004 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# MySQL +DB: + DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local + +# Redis +Cache: + - Host: 127.0.0.1:6379 + Pass: sundynix + Type: node + +# RPC 依赖 +UserRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: user.rpc + +FileRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: file.rpc + +# 百度植物识别 +BaiduImgClassify: + ApiKey: hpBfjwy8ifv3qswYGYjUCNKN + SecretKey: i5aXZdM4XZVuDroBslL0f3uIuwbAyXFS + +# 微信支付 +WechatPay: + MchId: "1735188493" + MchCertificateSerialNumber: "3725BFCA9CA3AF819AEC5D0CB7D3540BBC67F2CF" + MchApiV3Key: "a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6" + PrivateKeyPath: "/Users/blizzard/privateFolder/cert/apiclient_key.pem" + PublicKeyPath: "/Users/blizzard/privateFolder/cert/pub_key.pem" + NotifyUrl: "https://prod.sundynix.cn/api/wechatpay/notify" diff --git a/app/plant/api/internal/config/config.go b/app/plant/api/internal/config/config.go new file mode 100644 index 0000000..980a294 --- /dev/null +++ b/app/plant/api/internal/config/config.go @@ -0,0 +1,39 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + rest.RestConf + Auth struct { + AccessSecret string + AccessExpire int64 + } + DB struct { + DataSource string + } + Cache []struct { + Host string + Pass string + Type string + } + UserRpc zrpc.RpcClientConf + FileRpc zrpc.RpcClientConf + BaiduImgClassify struct { + ApiKey string + SecretKey string + } + WechatPay struct { + MchId string + MchCertificateSerialNumber string + MchApiV3Key string + PrivateKeyPath string + PublicKeyPath string + NotifyUrl string + } +} diff --git a/app/plant/api/internal/handler/ai/aiChatHandler.go b/app/plant/api/internal/handler/ai/aiChatHandler.go new file mode 100644 index 0000000..e4f0a61 --- /dev/null +++ b/app/plant/api/internal/handler/ai/aiChatHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/ai" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// AI问答 +func AiChatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AiChatReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := ai.NewAiChatLogic(r.Context(), svcCtx) + err := l.AiChat(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/ai/getAiChatHistoryHandler.go b/app/plant/api/internal/handler/ai/getAiChatHistoryHandler.go new file mode 100644 index 0000000..f85a869 --- /dev/null +++ b/app/plant/api/internal/handler/ai/getAiChatHistoryHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package ai + +import ( + "net/http" + + "sundynix-micro-go/app/plant/api/internal/logic/ai" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 聊天历史 +func GetAiChatHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := ai.NewGetAiChatHistoryLogic(r.Context(), svcCtx) + err := l.GetAiChatHistory() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/callback/wechatPayCallbackHandler.go b/app/plant/api/internal/handler/callback/wechatPayCallbackHandler.go new file mode 100644 index 0000000..6eb1bd7 --- /dev/null +++ b/app/plant/api/internal/handler/callback/wechatPayCallbackHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package callback + +import ( + "net/http" + + "sundynix-micro-go/app/plant/api/internal/logic/callback" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 微信支付回调 +func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := callback.NewWechatPayCallbackLogic(r.Context(), svcCtx) + err := l.WechatPayCallback() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/config/getBadgeConfigListHandler.go b/app/plant/api/internal/handler/config/getBadgeConfigListHandler.go new file mode 100644 index 0000000..f7cdac2 --- /dev/null +++ b/app/plant/api/internal/handler/config/getBadgeConfigListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/config" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 徽章配置列表 +func GetBadgeConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.BadgeConfigListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := config.NewGetBadgeConfigListLogic(r.Context(), svcCtx) + err := l.GetBadgeConfigList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/config/getLevelConfigListHandler.go b/app/plant/api/internal/handler/config/getLevelConfigListHandler.go new file mode 100644 index 0000000..ff8dd5c --- /dev/null +++ b/app/plant/api/internal/handler/config/getLevelConfigListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/config" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 等级配置列表 +func GetLevelConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.LevelConfigListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := config.NewGetLevelConfigListLogic(r.Context(), svcCtx) + err := l.GetLevelConfigList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/exchange/createExchangeOrderHandler.go b/app/plant/api/internal/handler/exchange/createExchangeOrderHandler.go new file mode 100644 index 0000000..10861b9 --- /dev/null +++ b/app/plant/api/internal/handler/exchange/createExchangeOrderHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package exchange + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/exchange" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 兑换商品 +func CreateExchangeOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ExchangeOrderReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := exchange.NewCreateExchangeOrderLogic(r.Context(), svcCtx) + err := l.CreateExchangeOrder(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/exchange/getExchangeItemListHandler.go b/app/plant/api/internal/handler/exchange/getExchangeItemListHandler.go new file mode 100644 index 0000000..7bbcd4b --- /dev/null +++ b/app/plant/api/internal/handler/exchange/getExchangeItemListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package exchange + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/exchange" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 兑换商品列表 +func GetExchangeItemListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ExchangeItemListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := exchange.NewGetExchangeItemListLogic(r.Context(), svcCtx) + err := l.GetExchangeItemList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/addCarePlanHandler.go b/app/plant/api/internal/handler/myPlant/addCarePlanHandler.go new file mode 100644 index 0000000..5f1bb0a --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/addCarePlanHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 添加养护计划 +func AddCarePlanHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CarePlanReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewAddCarePlanLogic(r.Context(), svcCtx) + err := l.AddCarePlan(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/addCareRecordHandler.go b/app/plant/api/internal/handler/myPlant/addCareRecordHandler.go new file mode 100644 index 0000000..d96f508 --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/addCareRecordHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 添加养护记录 +func AddCareRecordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CareRecordReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewAddCareRecordLogic(r.Context(), svcCtx) + err := l.AddCareRecord(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/addGrowthRecordHandler.go b/app/plant/api/internal/handler/myPlant/addGrowthRecordHandler.go new file mode 100644 index 0000000..a196564 --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/addGrowthRecordHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 添加成长记录 +func AddGrowthRecordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GrowthRecordReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewAddGrowthRecordLogic(r.Context(), svcCtx) + err := l.AddGrowthRecord(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/createPlantHandler.go b/app/plant/api/internal/handler/myPlant/createPlantHandler.go new file mode 100644 index 0000000..839a294 --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/createPlantHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建植物 +func CreatePlantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreatePlantReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewCreatePlantLogic(r.Context(), svcCtx) + err := l.CreatePlant(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/deletePlantHandler.go b/app/plant/api/internal/handler/myPlant/deletePlantHandler.go new file mode 100644 index 0000000..0736fba --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/deletePlantHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除植物 +func DeletePlantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewDeletePlantLogic(r.Context(), svcCtx) + err := l.DeletePlant(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/getMyPlantListHandler.go b/app/plant/api/internal/handler/myPlant/getMyPlantListHandler.go new file mode 100644 index 0000000..fbd1c02 --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/getMyPlantListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 我的植物列表 +func GetMyPlantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PlantListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewGetMyPlantListLogic(r.Context(), svcCtx) + resp, err := l.GetMyPlantList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/getPlantDetailHandler.go b/app/plant/api/internal/handler/myPlant/getPlantDetailHandler.go new file mode 100644 index 0000000..b24e56f --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/getPlantDetailHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 植物详情 +func GetPlantDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdPathReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewGetPlantDetailLogic(r.Context(), svcCtx) + resp, err := l.GetPlantDetail(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/plant/api/internal/handler/myPlant/updatePlantHandler.go b/app/plant/api/internal/handler/myPlant/updatePlantHandler.go new file mode 100644 index 0000000..f08511f --- /dev/null +++ b/app/plant/api/internal/handler/myPlant/updatePlantHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package myPlant + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/myPlant" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新植物 +func UpdatePlantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdatePlantReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := myPlant.NewUpdatePlantLogic(r.Context(), svcCtx) + err := l.UpdatePlant(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/ocr/ocrClassifyHandler.go b/app/plant/api/internal/handler/ocr/ocrClassifyHandler.go new file mode 100644 index 0000000..b78641c --- /dev/null +++ b/app/plant/api/internal/handler/ocr/ocrClassifyHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package ocr + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/ocr" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// OCR植物识别 +func OcrClassifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.OcrReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := ocr.NewOcrClassifyLogic(r.Context(), svcCtx) + err := l.OcrClassify(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/post/commentPostHandler.go b/app/plant/api/internal/handler/post/commentPostHandler.go new file mode 100644 index 0000000..9fac801 --- /dev/null +++ b/app/plant/api/internal/handler/post/commentPostHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/post" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 评论帖子 +func CommentPostHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PostCommentReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := post.NewCommentPostLogic(r.Context(), svcCtx) + err := l.CommentPost(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/post/createPostHandler.go b/app/plant/api/internal/handler/post/createPostHandler.go new file mode 100644 index 0000000..2361063 --- /dev/null +++ b/app/plant/api/internal/handler/post/createPostHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/post" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 发布帖子 +func CreatePostHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreatePostReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := post.NewCreatePostLogic(r.Context(), svcCtx) + err := l.CreatePost(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/post/deletePostHandler.go b/app/plant/api/internal/handler/post/deletePostHandler.go new file mode 100644 index 0000000..c8adfcc --- /dev/null +++ b/app/plant/api/internal/handler/post/deletePostHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/post" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除帖子 +func DeletePostHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := post.NewDeletePostLogic(r.Context(), svcCtx) + err := l.DeletePost(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/post/getPostDetailHandler.go b/app/plant/api/internal/handler/post/getPostDetailHandler.go new file mode 100644 index 0000000..1ccfa1f --- /dev/null +++ b/app/plant/api/internal/handler/post/getPostDetailHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/post" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 帖子详情 +func GetPostDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdPathReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := post.NewGetPostDetailLogic(r.Context(), svcCtx) + err := l.GetPostDetail(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/post/getPostListHandler.go b/app/plant/api/internal/handler/post/getPostListHandler.go new file mode 100644 index 0000000..4f61871 --- /dev/null +++ b/app/plant/api/internal/handler/post/getPostListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/post" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 帖子列表 +func GetPostListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PostListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := post.NewGetPostListLogic(r.Context(), svcCtx) + err := l.GetPostList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/post/likePostHandler.go b/app/plant/api/internal/handler/post/likePostHandler.go new file mode 100644 index 0000000..341236d --- /dev/null +++ b/app/plant/api/internal/handler/post/likePostHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/post" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 点赞帖子 +func LikePostHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := post.NewLikePostLogic(r.Context(), svcCtx) + err := l.LikePost(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/routes.go b/app/plant/api/internal/handler/routes.go new file mode 100644 index 0000000..5a82b7a --- /dev/null +++ b/app/plant/api/internal/handler/routes.go @@ -0,0 +1,285 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package handler + +import ( + "net/http" + + ai "sundynix-micro-go/app/plant/api/internal/handler/ai" + callback "sundynix-micro-go/app/plant/api/internal/handler/callback" + config "sundynix-micro-go/app/plant/api/internal/handler/config" + exchange "sundynix-micro-go/app/plant/api/internal/handler/exchange" + myPlant "sundynix-micro-go/app/plant/api/internal/handler/myPlant" + ocr "sundynix-micro-go/app/plant/api/internal/handler/ocr" + post "sundynix-micro-go/app/plant/api/internal/handler/post" + topic "sundynix-micro-go/app/plant/api/internal/handler/topic" + userProfile "sundynix-micro-go/app/plant/api/internal/handler/userProfile" + wiki "sundynix-micro-go/app/plant/api/internal/handler/wiki" + "sundynix-micro-go/app/plant/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + // AI问答 + Method: http.MethodPost, + Path: "/ai/chat", + Handler: ai.AiChatHandler(serverCtx), + }, + { + // 聊天历史 + Method: http.MethodGet, + Path: "/ai/history", + Handler: ai.GetAiChatHistoryHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 微信支付回调 + Method: http.MethodPost, + Path: "/callback/wechatpay", + Handler: callback.WechatPayCallbackHandler(serverCtx), + }, + }, + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 徽章配置列表 + Method: http.MethodPost, + Path: "/config/badge/list", + Handler: config.GetBadgeConfigListHandler(serverCtx), + }, + { + // 等级配置列表 + Method: http.MethodPost, + Path: "/config/level/list", + Handler: config.GetLevelConfigListHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 兑换商品列表 + Method: http.MethodPost, + Path: "/exchange/list", + Handler: exchange.GetExchangeItemListHandler(serverCtx), + }, + { + // 兑换商品 + Method: http.MethodPost, + Path: "/exchange/order", + Handler: exchange.CreateExchangeOrderHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 植物详情 + Method: http.MethodGet, + Path: "/my/:id", + Handler: myPlant.GetPlantDetailHandler(serverCtx), + }, + { + // 添加养护计划 + Method: http.MethodPost, + Path: "/my/carePlan", + Handler: myPlant.AddCarePlanHandler(serverCtx), + }, + { + // 添加养护记录 + Method: http.MethodPost, + Path: "/my/careRecord", + Handler: myPlant.AddCareRecordHandler(serverCtx), + }, + { + // 创建植物 + Method: http.MethodPost, + Path: "/my/create", + Handler: myPlant.CreatePlantHandler(serverCtx), + }, + { + // 删除植物 + Method: http.MethodDelete, + Path: "/my/delete", + Handler: myPlant.DeletePlantHandler(serverCtx), + }, + { + // 添加成长记录 + Method: http.MethodPost, + Path: "/my/growthRecord", + Handler: myPlant.AddGrowthRecordHandler(serverCtx), + }, + { + // 我的植物列表 + Method: http.MethodPost, + Path: "/my/list", + Handler: myPlant.GetMyPlantListHandler(serverCtx), + }, + { + // 更新植物 + Method: http.MethodPut, + Path: "/my/update", + Handler: myPlant.UpdatePlantHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // OCR植物识别 + Method: http.MethodPost, + Path: "/ocr/classify", + Handler: ocr.OcrClassifyHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 帖子详情 + Method: http.MethodGet, + Path: "/post/:id", + Handler: post.GetPostDetailHandler(serverCtx), + }, + { + // 评论帖子 + Method: http.MethodPost, + Path: "/post/comment", + Handler: post.CommentPostHandler(serverCtx), + }, + { + // 发布帖子 + Method: http.MethodPost, + Path: "/post/create", + Handler: post.CreatePostHandler(serverCtx), + }, + { + // 删除帖子 + Method: http.MethodDelete, + Path: "/post/delete", + Handler: post.DeletePostHandler(serverCtx), + }, + { + // 点赞帖子 + Method: http.MethodPost, + Path: "/post/like", + Handler: post.LikePostHandler(serverCtx), + }, + { + // 帖子列表 + Method: http.MethodPost, + Path: "/post/list", + Handler: post.GetPostListHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 创建话题 + Method: http.MethodPost, + Path: "/topic/create", + Handler: topic.CreateTopicHandler(serverCtx), + }, + { + // 删除话题 + Method: http.MethodDelete, + Path: "/topic/delete", + Handler: topic.DeleteTopicHandler(serverCtx), + }, + { + // 话题列表 + Method: http.MethodGet, + Path: "/topic/list", + Handler: topic.GetTopicListHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 获取用户资料 + Method: http.MethodGet, + Path: "/profile/info", + Handler: userProfile.GetUserProfileHandler(serverCtx), + }, + { + // 更新用户资料 + Method: http.MethodPut, + Path: "/profile/update", + Handler: userProfile.UpdateUserProfileHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 百科详情 + Method: http.MethodGet, + Path: "/wiki/:id", + Handler: wiki.GetWikiDetailHandler(serverCtx), + }, + { + // 创建百科分类 + Method: http.MethodPost, + Path: "/wiki/class/create", + Handler: wiki.CreateWikiClassHandler(serverCtx), + }, + { + // 百科分类列表 + Method: http.MethodGet, + Path: "/wiki/class/list", + Handler: wiki.GetWikiClassListHandler(serverCtx), + }, + { + // 百科列表 + Method: http.MethodPost, + Path: "/wiki/list", + Handler: wiki.GetWikiListHandler(serverCtx), + }, + { + // 收藏/取消收藏百科 + Method: http.MethodPost, + Path: "/wiki/star", + Handler: wiki.ToggleWikiStarHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/plant"), + ) +} diff --git a/app/plant/api/internal/handler/topic/createTopicHandler.go b/app/plant/api/internal/handler/topic/createTopicHandler.go new file mode 100644 index 0000000..5d1c849 --- /dev/null +++ b/app/plant/api/internal/handler/topic/createTopicHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package topic + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/topic" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建话题 +func CreateTopicHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.TopicReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := topic.NewCreateTopicLogic(r.Context(), svcCtx) + err := l.CreateTopic(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/topic/deleteTopicHandler.go b/app/plant/api/internal/handler/topic/deleteTopicHandler.go new file mode 100644 index 0000000..8b62113 --- /dev/null +++ b/app/plant/api/internal/handler/topic/deleteTopicHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package topic + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/topic" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除话题 +func DeleteTopicHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := topic.NewDeleteTopicLogic(r.Context(), svcCtx) + err := l.DeleteTopic(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/topic/getTopicListHandler.go b/app/plant/api/internal/handler/topic/getTopicListHandler.go new file mode 100644 index 0000000..c3a25b8 --- /dev/null +++ b/app/plant/api/internal/handler/topic/getTopicListHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package topic + +import ( + "net/http" + + "sundynix-micro-go/app/plant/api/internal/logic/topic" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 话题列表 +func GetTopicListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := topic.NewGetTopicListLogic(r.Context(), svcCtx) + err := l.GetTopicList() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/userProfile/getUserProfileHandler.go b/app/plant/api/internal/handler/userProfile/getUserProfileHandler.go new file mode 100644 index 0000000..5acb0ca --- /dev/null +++ b/app/plant/api/internal/handler/userProfile/getUserProfileHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package userProfile + +import ( + "net/http" + + "sundynix-micro-go/app/plant/api/internal/logic/userProfile" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 获取用户资料 +func GetUserProfileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := userProfile.NewGetUserProfileLogic(r.Context(), svcCtx) + err := l.GetUserProfile() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/userProfile/updateUserProfileHandler.go b/app/plant/api/internal/handler/userProfile/updateUserProfileHandler.go new file mode 100644 index 0000000..303b48e --- /dev/null +++ b/app/plant/api/internal/handler/userProfile/updateUserProfileHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package userProfile + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/userProfile" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新用户资料 +func UpdateUserProfileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateProfileReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := userProfile.NewUpdateUserProfileLogic(r.Context(), svcCtx) + err := l.UpdateUserProfile(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/wiki/createWikiClassHandler.go b/app/plant/api/internal/handler/wiki/createWikiClassHandler.go new file mode 100644 index 0000000..5892aab --- /dev/null +++ b/app/plant/api/internal/handler/wiki/createWikiClassHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/wiki" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建百科分类 +func CreateWikiClassHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.WikiClassReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := wiki.NewCreateWikiClassLogic(r.Context(), svcCtx) + err := l.CreateWikiClass(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/wiki/getWikiClassListHandler.go b/app/plant/api/internal/handler/wiki/getWikiClassListHandler.go new file mode 100644 index 0000000..62a2607 --- /dev/null +++ b/app/plant/api/internal/handler/wiki/getWikiClassListHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "net/http" + + "sundynix-micro-go/app/plant/api/internal/logic/wiki" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 百科分类列表 +func GetWikiClassListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := wiki.NewGetWikiClassListLogic(r.Context(), svcCtx) + err := l.GetWikiClassList() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/wiki/getWikiDetailHandler.go b/app/plant/api/internal/handler/wiki/getWikiDetailHandler.go new file mode 100644 index 0000000..b58d68d --- /dev/null +++ b/app/plant/api/internal/handler/wiki/getWikiDetailHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/wiki" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 百科详情 +func GetWikiDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdPathReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := wiki.NewGetWikiDetailLogic(r.Context(), svcCtx) + err := l.GetWikiDetail(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/wiki/getWikiListHandler.go b/app/plant/api/internal/handler/wiki/getWikiListHandler.go new file mode 100644 index 0000000..4b408f3 --- /dev/null +++ b/app/plant/api/internal/handler/wiki/getWikiListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/wiki" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 百科列表 +func GetWikiListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.WikiListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := wiki.NewGetWikiListLogic(r.Context(), svcCtx) + err := l.GetWikiList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/handler/wiki/toggleWikiStarHandler.go b/app/plant/api/internal/handler/wiki/toggleWikiStarHandler.go new file mode 100644 index 0000000..83bd5a7 --- /dev/null +++ b/app/plant/api/internal/handler/wiki/toggleWikiStarHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/plant/api/internal/logic/wiki" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 收藏/取消收藏百科 +func ToggleWikiStarHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := wiki.NewToggleWikiStarLogic(r.Context(), svcCtx) + err := l.ToggleWikiStar(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/plant/api/internal/logic/ai/aiChatLogic.go b/app/plant/api/internal/logic/ai/aiChatLogic.go new file mode 100644 index 0000000..7723535 --- /dev/null +++ b/app/plant/api/internal/logic/ai/aiChatLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package ai + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type AiChatLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// AI问答 +func NewAiChatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AiChatLogic { + return &AiChatLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *AiChatLogic) AiChat(req *types.AiChatReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/ai/getAiChatHistoryLogic.go b/app/plant/api/internal/logic/ai/getAiChatHistoryLogic.go new file mode 100644 index 0000000..7f8a8d7 --- /dev/null +++ b/app/plant/api/internal/logic/ai/getAiChatHistoryLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package ai + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" +) + +type GetAiChatHistoryLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 聊天历史 +func NewGetAiChatHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAiChatHistoryLogic { + return &GetAiChatHistoryLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetAiChatHistoryLogic) GetAiChatHistory() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/callback/wechatPayCallbackLogic.go b/app/plant/api/internal/logic/callback/wechatPayCallbackLogic.go new file mode 100644 index 0000000..71471ad --- /dev/null +++ b/app/plant/api/internal/logic/callback/wechatPayCallbackLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package callback + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" +) + +type WechatPayCallbackLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 微信支付回调 +func NewWechatPayCallbackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WechatPayCallbackLogic { + return &WechatPayCallbackLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *WechatPayCallbackLogic) WechatPayCallback() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/config/getBadgeConfigListLogic.go b/app/plant/api/internal/logic/config/getBadgeConfigListLogic.go new file mode 100644 index 0000000..b5cfea9 --- /dev/null +++ b/app/plant/api/internal/logic/config/getBadgeConfigListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetBadgeConfigListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 徽章配置列表 +func NewGetBadgeConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetBadgeConfigListLogic { + return &GetBadgeConfigListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetBadgeConfigListLogic) GetBadgeConfigList(req *types.BadgeConfigListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/config/getLevelConfigListLogic.go b/app/plant/api/internal/logic/config/getLevelConfigListLogic.go new file mode 100644 index 0000000..6e13c4d --- /dev/null +++ b/app/plant/api/internal/logic/config/getLevelConfigListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetLevelConfigListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 等级配置列表 +func NewGetLevelConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLevelConfigListLogic { + return &GetLevelConfigListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetLevelConfigListLogic) GetLevelConfigList(req *types.LevelConfigListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/exchange/createExchangeOrderLogic.go b/app/plant/api/internal/logic/exchange/createExchangeOrderLogic.go new file mode 100644 index 0000000..097a860 --- /dev/null +++ b/app/plant/api/internal/logic/exchange/createExchangeOrderLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package exchange + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateExchangeOrderLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 兑换商品 +func NewCreateExchangeOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateExchangeOrderLogic { + return &CreateExchangeOrderLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateExchangeOrderLogic) CreateExchangeOrder(req *types.ExchangeOrderReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/exchange/getExchangeItemListLogic.go b/app/plant/api/internal/logic/exchange/getExchangeItemListLogic.go new file mode 100644 index 0000000..757ae33 --- /dev/null +++ b/app/plant/api/internal/logic/exchange/getExchangeItemListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package exchange + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetExchangeItemListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 兑换商品列表 +func NewGetExchangeItemListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetExchangeItemListLogic { + return &GetExchangeItemListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetExchangeItemListLogic) GetExchangeItemList(req *types.ExchangeItemListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/myPlant/addCarePlanLogic.go b/app/plant/api/internal/logic/myPlant/addCarePlanLogic.go new file mode 100644 index 0000000..712308a --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/addCarePlanLogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type AddCarePlanLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewAddCarePlanLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCarePlanLogic { + return &AddCarePlanLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *AddCarePlanLogic) AddCarePlan(req *types.CarePlanReq) error { + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + plan := plantModel.SundynixCarePlan{ + UserID: userId, PlantID: req.PlantId, Name: req.Name, + TargetAction: req.TargetAction, Period: req.Period, Icon: req.Icon, + } + if err := l.svcCtx.DB.Create(&plan).Error; err != nil { + return fmt.Errorf("创建养护计划失败") + } + return nil +} diff --git a/app/plant/api/internal/logic/myPlant/addCareRecordLogic.go b/app/plant/api/internal/logic/myPlant/addCareRecordLogic.go new file mode 100644 index 0000000..2d20a85 --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/addCareRecordLogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type AddCareRecordLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewAddCareRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCareRecordLogic { + return &AddCareRecordLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *AddCareRecordLogic) AddCareRecord(req *types.CareRecordReq) error { + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + record := plantModel.SundynixCareRecord{ + UserID: userId, PlantID: req.PlantId, PlanID: req.PlanId, + Name: req.Action, Remark: req.Note, + } + if err := l.svcCtx.DB.Create(&record).Error; err != nil { + return fmt.Errorf("创建养护记录失败") + } + return nil +} diff --git a/app/plant/api/internal/logic/myPlant/addGrowthRecordLogic.go b/app/plant/api/internal/logic/myPlant/addGrowthRecordLogic.go new file mode 100644 index 0000000..d6743f5 --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/addGrowthRecordLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type AddGrowthRecordLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewAddGrowthRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddGrowthRecordLogic { + return &AddGrowthRecordLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *AddGrowthRecordLogic) AddGrowthRecord(req *types.GrowthRecordReq) error { + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + record := plantModel.SundynixGrowthRecord{ + PlantID: req.PlantId, UserID: userId, Content: req.Content, + } + if err := l.svcCtx.DB.Create(&record).Error; err != nil { + return fmt.Errorf("创建成长记录失败") + } + return nil +} diff --git a/app/plant/api/internal/logic/myPlant/createPlantLogic.go b/app/plant/api/internal/logic/myPlant/createPlantLogic.go new file mode 100644 index 0000000..8597f90 --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/createPlantLogic.go @@ -0,0 +1,42 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" + "time" +) + +type CreatePlantLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePlantLogic { + return &CreatePlantLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *CreatePlantLogic) CreatePlant(req *types.CreatePlantReq) error { + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + plantTime, _ := time.Parse("2006-01-02", req.PlantTime) + plant := plantModel.SundynixMyPlant{ + UserID: userId, Name: req.Name, PlantTime: plantTime, Placement: req.Placement, + PotMaterial: req.PotMaterial, PotSize: req.PotSize, Sunlight: req.Sunlight, + PlantingMaterial: req.PlantingMaterial, Status: 1, + } + if err := l.svcCtx.DB.Create(&plant).Error; err != nil { + l.Errorf("创建植物失败: %v", err) + return fmt.Errorf("创建植物失败") + } + if len(req.ImgIds) > 0 { + for _, imgID := range req.ImgIds { + l.svcCtx.DB.Create(&plantModel.SundynixMyPlantOss{MyPlantID: plant.ID, OssID: imgID}) + } + } + return nil +} diff --git a/app/plant/api/internal/logic/myPlant/deletePlantLogic.go b/app/plant/api/internal/logic/myPlant/deletePlantLogic.go new file mode 100644 index 0000000..62495c1 --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/deletePlantLogic.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type DeletePlantLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeletePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletePlantLogic { + return &DeletePlantLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *DeletePlantLogic) DeletePlant(req *types.IdsReq) error { + if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&plantModel.SundynixMyPlant{}).Error; err != nil { + return fmt.Errorf("删除植物失败") + } + // 清理关联数据 + l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCarePlan{}) + l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCareRecord{}) + l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixCareTask{}) + l.svcCtx.DB.Where("plant_id IN ?", req.Ids).Delete(&plantModel.SundynixGrowthRecord{}) + return nil +} diff --git a/app/plant/api/internal/logic/myPlant/getMyPlantListLogic.go b/app/plant/api/internal/logic/myPlant/getMyPlantListLogic.go new file mode 100644 index 0000000..e23a8d7 --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/getMyPlantListLogic.go @@ -0,0 +1,43 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type GetMyPlantListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetMyPlantListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyPlantListLogic { + return &GetMyPlantListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetMyPlantListLogic) GetMyPlantList(req *types.PlantListReq) (resp interface{}, err error) { + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + var plants []plantModel.SundynixMyPlant + var total int64 + db := l.svcCtx.DB.Model(&plantModel.SundynixMyPlant{}).Where("user_id = ?", userId) + if req.Name != "" { + db = db.Where("name LIKE ?", "%"+req.Name+"%") + } + db.Count(&total) + current, pageSize := req.Current, req.PageSize + if current <= 0 { + current = 1 + } + if pageSize <= 0 { + pageSize = 10 + } + if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("created_at DESC").Find(&plants).Error; err != nil { + return nil, fmt.Errorf("查询植物列表失败") + } + return map[string]interface{}{"list": plants, "total": total, "current": current, "size": pageSize}, nil +} diff --git a/app/plant/api/internal/logic/myPlant/getPlantDetailLogic.go b/app/plant/api/internal/logic/myPlant/getPlantDetailLogic.go new file mode 100644 index 0000000..df52ace --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/getPlantDetailLogic.go @@ -0,0 +1,45 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/gorm" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type GetPlantDetailLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetPlantDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPlantDetailLogic { + return &GetPlantDetailLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetPlantDetailLogic) GetPlantDetail(req *types.IdPathReq) (resp interface{}, err error) { + var plant plantModel.SundynixMyPlant + if err := l.svcCtx.DB.Where("id = ?", req.Id).First(&plant).Error; err != nil { + if err == gorm.ErrRecordNotFound { + return nil, fmt.Errorf("植物不存在") + } + return nil, fmt.Errorf("查询植物失败") + } + // 查询关联图片ID + var ossIds []string + l.svcCtx.DB.Model(&plantModel.SundynixMyPlantOss{}).Where("sundynix_my_plant_id = ?", plant.ID).Pluck("sundynix_oss_id", &ossIds) + // 查询养护计划 + var plans []plantModel.SundynixCarePlan + l.svcCtx.DB.Where("plant_id = ?", plant.ID).Find(&plans) + // 查询成长记录 + var records []plantModel.SundynixGrowthRecord + l.svcCtx.DB.Where("plant_id = ?", plant.ID).Order("created_at DESC").Limit(10).Find(&records) + + return map[string]interface{}{ + "plant": plant, "imgIds": ossIds, "carePlans": plans, "growthRecords": records, + }, nil +} diff --git a/app/plant/api/internal/logic/myPlant/updatePlantLogic.go b/app/plant/api/internal/logic/myPlant/updatePlantLogic.go new file mode 100644 index 0000000..5bd7461 --- /dev/null +++ b/app/plant/api/internal/logic/myPlant/updatePlantLogic.go @@ -0,0 +1,52 @@ +// Code scaffolded by goctl. Safe to edit. +package myPlant + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + plantModel "sundynix-micro-go/app/plant/model" +) + +type UpdatePlantLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdatePlantLogic { + return &UpdatePlantLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *UpdatePlantLogic) UpdatePlant(req *types.UpdatePlantReq) error { + updates := map[string]interface{}{} + if req.Name != "" { + updates["name"] = req.Name + } + if req.Status > 0 { + updates["status"] = req.Status + } + if req.Placement != "" { + updates["placement"] = req.Placement + } + if req.PotMaterial != "" { + updates["pot_material"] = req.PotMaterial + } + if req.PotSize != "" { + updates["pot_size"] = req.PotSize + } + if req.Sunlight != "" { + updates["sunlight"] = req.Sunlight + } + if req.PlantingMaterial != "" { + updates["planting_material"] = req.PlantingMaterial + } + if len(updates) > 0 { + if err := l.svcCtx.DB.Model(&plantModel.SundynixMyPlant{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil { + return fmt.Errorf("更新植物失败") + } + } + return nil +} diff --git a/app/plant/api/internal/logic/ocr/ocrClassifyLogic.go b/app/plant/api/internal/logic/ocr/ocrClassifyLogic.go new file mode 100644 index 0000000..13e6792 --- /dev/null +++ b/app/plant/api/internal/logic/ocr/ocrClassifyLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package ocr + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type OcrClassifyLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// OCR植物识别 +func NewOcrClassifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OcrClassifyLogic { + return &OcrClassifyLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *OcrClassifyLogic) OcrClassify(req *types.OcrReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/post/commentPostLogic.go b/app/plant/api/internal/logic/post/commentPostLogic.go new file mode 100644 index 0000000..6eb462b --- /dev/null +++ b/app/plant/api/internal/logic/post/commentPostLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CommentPostLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 评论帖子 +func NewCommentPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentPostLogic { + return &CommentPostLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CommentPostLogic) CommentPost(req *types.PostCommentReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/post/createPostLogic.go b/app/plant/api/internal/logic/post/createPostLogic.go new file mode 100644 index 0000000..f36e9ec --- /dev/null +++ b/app/plant/api/internal/logic/post/createPostLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreatePostLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 发布帖子 +func NewCreatePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePostLogic { + return &CreatePostLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreatePostLogic) CreatePost(req *types.CreatePostReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/post/deletePostLogic.go b/app/plant/api/internal/logic/post/deletePostLogic.go new file mode 100644 index 0000000..b890e91 --- /dev/null +++ b/app/plant/api/internal/logic/post/deletePostLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeletePostLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除帖子 +func NewDeletePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletePostLogic { + return &DeletePostLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeletePostLogic) DeletePost(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/post/getPostDetailLogic.go b/app/plant/api/internal/logic/post/getPostDetailLogic.go new file mode 100644 index 0000000..f5540ec --- /dev/null +++ b/app/plant/api/internal/logic/post/getPostDetailLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetPostDetailLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 帖子详情 +func NewGetPostDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPostDetailLogic { + return &GetPostDetailLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetPostDetailLogic) GetPostDetail(req *types.IdPathReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/post/getPostListLogic.go b/app/plant/api/internal/logic/post/getPostListLogic.go new file mode 100644 index 0000000..1ed7697 --- /dev/null +++ b/app/plant/api/internal/logic/post/getPostListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetPostListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 帖子列表 +func NewGetPostListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPostListLogic { + return &GetPostListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetPostListLogic) GetPostList(req *types.PostListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/post/likePostLogic.go b/app/plant/api/internal/logic/post/likePostLogic.go new file mode 100644 index 0000000..5eb1cf6 --- /dev/null +++ b/app/plant/api/internal/logic/post/likePostLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package post + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type LikePostLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 点赞帖子 +func NewLikePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikePostLogic { + return &LikePostLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *LikePostLogic) LikePost(req *types.IdReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/topic/createTopicLogic.go b/app/plant/api/internal/logic/topic/createTopicLogic.go new file mode 100644 index 0000000..b0b9f6f --- /dev/null +++ b/app/plant/api/internal/logic/topic/createTopicLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package topic + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateTopicLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建话题 +func NewCreateTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTopicLogic { + return &CreateTopicLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateTopicLogic) CreateTopic(req *types.TopicReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/topic/deleteTopicLogic.go b/app/plant/api/internal/logic/topic/deleteTopicLogic.go new file mode 100644 index 0000000..3440080 --- /dev/null +++ b/app/plant/api/internal/logic/topic/deleteTopicLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package topic + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteTopicLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除话题 +func NewDeleteTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTopicLogic { + return &DeleteTopicLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteTopicLogic) DeleteTopic(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/topic/getTopicListLogic.go b/app/plant/api/internal/logic/topic/getTopicListLogic.go new file mode 100644 index 0000000..ccb86ac --- /dev/null +++ b/app/plant/api/internal/logic/topic/getTopicListLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package topic + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" +) + +type GetTopicListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 话题列表 +func NewGetTopicListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTopicListLogic { + return &GetTopicListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetTopicListLogic) GetTopicList() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/userProfile/getUserProfileLogic.go b/app/plant/api/internal/logic/userProfile/getUserProfileLogic.go new file mode 100644 index 0000000..045a19e --- /dev/null +++ b/app/plant/api/internal/logic/userProfile/getUserProfileLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package userProfile + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" +) + +type GetUserProfileLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 获取用户资料 +func NewGetUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProfileLogic { + return &GetUserProfileLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetUserProfileLogic) GetUserProfile() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/userProfile/updateUserProfileLogic.go b/app/plant/api/internal/logic/userProfile/updateUserProfileLogic.go new file mode 100644 index 0000000..5d13c75 --- /dev/null +++ b/app/plant/api/internal/logic/userProfile/updateUserProfileLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package userProfile + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateUserProfileLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 更新用户资料 +func NewUpdateUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserProfileLogic { + return &UpdateUserProfileLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateUserProfileLogic) UpdateUserProfile(req *types.UpdateProfileReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/wiki/createWikiClassLogic.go b/app/plant/api/internal/logic/wiki/createWikiClassLogic.go new file mode 100644 index 0000000..e5a91aa --- /dev/null +++ b/app/plant/api/internal/logic/wiki/createWikiClassLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateWikiClassLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建百科分类 +func NewCreateWikiClassLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateWikiClassLogic { + return &CreateWikiClassLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateWikiClassLogic) CreateWikiClass(req *types.WikiClassReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/wiki/getWikiClassListLogic.go b/app/plant/api/internal/logic/wiki/getWikiClassListLogic.go new file mode 100644 index 0000000..54b7bc0 --- /dev/null +++ b/app/plant/api/internal/logic/wiki/getWikiClassListLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/plant/api/internal/svc" +) + +type GetWikiClassListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 百科分类列表 +func NewGetWikiClassListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWikiClassListLogic { + return &GetWikiClassListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetWikiClassListLogic) GetWikiClassList() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/wiki/getWikiDetailLogic.go b/app/plant/api/internal/logic/wiki/getWikiDetailLogic.go new file mode 100644 index 0000000..ec8131e --- /dev/null +++ b/app/plant/api/internal/logic/wiki/getWikiDetailLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetWikiDetailLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 百科详情 +func NewGetWikiDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWikiDetailLogic { + return &GetWikiDetailLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetWikiDetailLogic) GetWikiDetail(req *types.IdPathReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/wiki/getWikiListLogic.go b/app/plant/api/internal/logic/wiki/getWikiListLogic.go new file mode 100644 index 0000000..1dd4602 --- /dev/null +++ b/app/plant/api/internal/logic/wiki/getWikiListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetWikiListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 百科列表 +func NewGetWikiListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWikiListLogic { + return &GetWikiListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetWikiListLogic) GetWikiList(req *types.WikiListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/logic/wiki/toggleWikiStarLogic.go b/app/plant/api/internal/logic/wiki/toggleWikiStarLogic.go new file mode 100644 index 0000000..5e21447 --- /dev/null +++ b/app/plant/api/internal/logic/wiki/toggleWikiStarLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package wiki + +import ( + "context" + + "sundynix-micro-go/app/plant/api/internal/svc" + "sundynix-micro-go/app/plant/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ToggleWikiStarLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 收藏/取消收藏百科 +func NewToggleWikiStarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleWikiStarLogic { + return &ToggleWikiStarLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ToggleWikiStarLogic) ToggleWikiStar(req *types.IdReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/plant/api/internal/svc/serviceContext.go b/app/plant/api/internal/svc/serviceContext.go new file mode 100644 index 0000000..d5a1c0e --- /dev/null +++ b/app/plant/api/internal/svc/serviceContext.go @@ -0,0 +1,63 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package svc + +import ( + "sundynix-micro-go/app/file/rpc/fileservice" + "sundynix-micro-go/app/plant/api/internal/config" + plantModel "sundynix-micro-go/app/plant/model" + "sundynix-micro-go/app/user/rpc/userservice" + + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/zrpc" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +type ServiceContext struct { + Config config.Config + DB *gorm.DB + UserRpc userservice.UserService + FileRpc fileservice.FileService +} + +func NewServiceContext(c config.Config) *ServiceContext { + 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, + UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)), + FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)), + } +} diff --git a/app/plant/api/internal/types/types.go b/app/plant/api/internal/types/types.go new file mode 100644 index 0000000..1c972ce --- /dev/null +++ b/app/plant/api/internal/types/types.go @@ -0,0 +1,146 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package types + +type AiChatReq struct { + Question string `json:"question"` +} + +type BadgeConfigListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Dimension string `json:"dimension,optional"` +} + +type CarePlanReq struct { + PlantId string `json:"plantId"` + Name string `json:"name"` + Icon string `json:"icon,optional"` + TargetAction string `json:"targetAction"` + Period int `json:"period"` +} + +type CareRecordReq struct { + PlantId string `json:"plantId"` + PlanId string `json:"planId"` + Action string `json:"action"` + Note string `json:"note,optional"` +} + +type CreatePlantReq struct { + Name string `json:"name"` + PlantTime string `json:"plantTime"` + Status int `json:"status,optional"` + Placement string `json:"placement,optional"` + PotMaterial string `json:"potMaterial,optional"` + PotSize string `json:"potSize,optional"` + Sunlight string `json:"sunlight,optional"` + PlantingMaterial string `json:"plantingMaterial,optional"` + ImgIds []string `json:"imgIds,optional"` +} + +type CreatePostReq struct { + Title string `json:"title"` + Content string `json:"content"` + Location string `json:"location,optional"` + ImgIds []string `json:"imgIds,optional"` + TopicId string `json:"topicId,optional"` +} + +type ExchangeItemListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` +} + +type ExchangeOrderReq struct { + ItemId string `json:"itemId"` +} + +type GrowthRecordReq struct { + PlantId string `json:"plantId"` + Content string `json:"content,optional"` + ImgIds []string `json:"imgIds,optional"` +} + +type IdPathReq struct { + Id string `path:"id"` +} + +type IdReq struct { + Id string `json:"id"` +} + +type IdsReq struct { + Ids []string `json:"ids"` +} + +type LevelConfigListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` +} + +type OcrReq struct { + ImageUrl string `json:"imageUrl"` +} + +type PageReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Keyword string `json:"keyword,optional"` +} + +type PlantListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` +} + +type PostCommentReq struct { + PostId string `json:"postId"` + Content string `json:"content"` + ParentId string `json:"parentId,optional"` +} + +type PostListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Keyword string `json:"keyword,optional"` + TopicId string `json:"topicId,optional"` +} + +type TopicReq struct { + Name string `json:"name"` + Icon string `json:"icon,optional"` + Desc string `json:"desc,optional"` +} + +type UpdatePlantReq struct { + Id string `json:"id"` + Name string `json:"name,optional"` + Status int `json:"status,optional"` + Placement string `json:"placement,optional"` + PotMaterial string `json:"potMaterial,optional"` + PotSize string `json:"potSize,optional"` + Sunlight string `json:"sunlight,optional"` + PlantingMaterial string `json:"plantingMaterial,optional"` + ImgIds []string `json:"imgIds,optional"` +} + +type UpdateProfileReq struct { + Nickname string `json:"nickname,optional"` + AvatarId string `json:"avatarId,optional"` +} + +type WikiClassReq struct { + Name string `json:"name"` + Icon string `json:"icon,optional"` +} + +type WikiListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + ClassId string `json:"classId,optional"` + IsHot int `json:"isHot,optional"` +} diff --git a/app/plant/api/plant.api b/app/plant/api/plant.api new file mode 100644 index 0000000..5389b98 --- /dev/null +++ b/app/plant/api/plant.api @@ -0,0 +1,343 @@ +syntax = "v1" + +info ( + title: "植物业务服务API" + desc: "我的植物、百科、社区、OCR、兑换、AI等HTTP接口" + author: "sundynix" + version: "v1.0.0" +) + +type ( + // ---------- 通用 ---------- + IdReq { + Id string `json:"id"` + } + IdPathReq { + Id string `path:"id"` + } + IdsReq { + Ids []string `json:"ids"` + } + PageReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Keyword string `json:"keyword,optional"` + } + // ---------- 我的植物 ---------- + CreatePlantReq { + Name string `json:"name"` + PlantTime string `json:"plantTime"` + Status int `json:"status,optional"` + Placement string `json:"placement,optional"` + PotMaterial string `json:"potMaterial,optional"` + PotSize string `json:"potSize,optional"` + Sunlight string `json:"sunlight,optional"` + PlantingMaterial string `json:"plantingMaterial,optional"` + ImgIds []string `json:"imgIds,optional"` + } + UpdatePlantReq { + Id string `json:"id"` + Name string `json:"name,optional"` + Status int `json:"status,optional"` + Placement string `json:"placement,optional"` + PotMaterial string `json:"potMaterial,optional"` + PotSize string `json:"potSize,optional"` + Sunlight string `json:"sunlight,optional"` + PlantingMaterial string `json:"plantingMaterial,optional"` + ImgIds []string `json:"imgIds,optional"` + } + PlantListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + } + // ---------- 养护计划 ---------- + CarePlanReq { + PlantId string `json:"plantId"` + Name string `json:"name"` + Icon string `json:"icon,optional"` + TargetAction string `json:"targetAction"` + Period int `json:"period"` + } + // ---------- 养护记录 ---------- + CareRecordReq { + PlantId string `json:"plantId"` + PlanId string `json:"planId"` + Action string `json:"action"` + Note string `json:"note,optional"` + } + // ---------- 成长记录 ---------- + GrowthRecordReq { + PlantId string `json:"plantId"` + Content string `json:"content,optional"` + ImgIds []string `json:"imgIds,optional"` + } + // ---------- 百科 ---------- + WikiListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + ClassId string `json:"classId,optional"` + IsHot int `json:"isHot,optional"` + } + WikiClassReq { + Name string `json:"name"` + Icon string `json:"icon,optional"` + } + // ---------- 帖子 ---------- + CreatePostReq { + Title string `json:"title"` + Content string `json:"content"` + Location string `json:"location,optional"` + ImgIds []string `json:"imgIds,optional"` + TopicId string `json:"topicId,optional"` + } + PostListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Keyword string `json:"keyword,optional"` + TopicId string `json:"topicId,optional"` + } + PostCommentReq { + PostId string `json:"postId"` + Content string `json:"content"` + ParentId string `json:"parentId,optional"` + } + // ---------- 话题 ---------- + TopicReq { + Name string `json:"name"` + Icon string `json:"icon,optional"` + Desc string `json:"desc,optional"` + } + // ---------- OCR ---------- + OcrReq { + ImageUrl string `json:"imageUrl"` + } + // ---------- 兑换 ---------- + ExchangeItemListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + } + ExchangeOrderReq { + ItemId string `json:"itemId"` + } + // ---------- AI ---------- + AiChatReq { + Question string `json:"question"` + } + // ---------- 用户资料 ---------- + UpdateProfileReq { + Nickname string `json:"nickname,optional"` + AvatarId string `json:"avatarId,optional"` + } + // ---------- 等级/徽章配置 ---------- + LevelConfigListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + } + BadgeConfigListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Dimension string `json:"dimension,optional"` + } +) + +// ========== 无需鉴权 ========== +@server ( + prefix: /api/plant + group: callback +) +service plant-api { + @doc "微信支付回调" + @handler WechatPayCallback + post /callback/wechatpay +} + +// ========== 需要鉴权 ========== +@server ( + prefix: /api/plant + group: myPlant + jwt: Auth +) +service plant-api { + @doc "创建植物" + @handler CreatePlant + post /my/create (CreatePlantReq) + + @doc "更新植物" + @handler UpdatePlant + put /my/update (UpdatePlantReq) + + @doc "删除植物" + @handler DeletePlant + delete /my/delete (IdsReq) + + @doc "我的植物列表" + @handler GetMyPlantList + post /my/list (PlantListReq) + + @doc "植物详情" + @handler GetPlantDetail + get /my/:id (IdPathReq) + + @doc "添加养护计划" + @handler AddCarePlan + post /my/carePlan (CarePlanReq) + + @doc "添加养护记录" + @handler AddCareRecord + post /my/careRecord (CareRecordReq) + + @doc "添加成长记录" + @handler AddGrowthRecord + post /my/growthRecord (GrowthRecordReq) +} + +@server ( + prefix: /api/plant + group: wiki + jwt: Auth +) +service plant-api { + @doc "百科列表" + @handler GetWikiList + post /wiki/list (WikiListReq) + + @doc "百科详情" + @handler GetWikiDetail + get /wiki/:id (IdPathReq) + + @doc "百科分类列表" + @handler GetWikiClassList + get /wiki/class/list + + @doc "创建百科分类" + @handler CreateWikiClass + post /wiki/class/create (WikiClassReq) + + @doc "收藏/取消收藏百科" + @handler ToggleWikiStar + post /wiki/star (IdReq) +} + +@server ( + prefix: /api/plant + group: post + jwt: Auth +) +service plant-api { + @doc "发布帖子" + @handler CreatePost + post /post/create (CreatePostReq) + + @doc "帖子列表" + @handler GetPostList + post /post/list (PostListReq) + + @doc "帖子详情" + @handler GetPostDetail + get /post/:id (IdPathReq) + + @doc "删除帖子" + @handler DeletePost + delete /post/delete (IdsReq) + + @doc "评论帖子" + @handler CommentPost + post /post/comment (PostCommentReq) + + @doc "点赞帖子" + @handler LikePost + post /post/like (IdReq) +} + +@server ( + prefix: /api/plant + group: topic + jwt: Auth +) +service plant-api { + @doc "话题列表" + @handler GetTopicList + get /topic/list + + @doc "创建话题" + @handler CreateTopic + post /topic/create (TopicReq) + + @doc "删除话题" + @handler DeleteTopic + delete /topic/delete (IdsReq) +} + +@server ( + prefix: /api/plant + group: ocr + jwt: Auth +) +service plant-api { + @doc "OCR植物识别" + @handler OcrClassify + post /ocr/classify (OcrReq) +} + +@server ( + prefix: /api/plant + group: exchange + jwt: Auth +) +service plant-api { + @doc "兑换商品列表" + @handler GetExchangeItemList + post /exchange/list (ExchangeItemListReq) + + @doc "兑换商品" + @handler CreateExchangeOrder + post /exchange/order (ExchangeOrderReq) +} + +@server ( + prefix: /api/plant + group: ai + jwt: Auth +) +service plant-api { + @doc "AI问答" + @handler AiChat + post /ai/chat (AiChatReq) + + @doc "聊天历史" + @handler GetAiChatHistory + get /ai/history +} + +@server ( + prefix: /api/plant + group: userProfile + jwt: Auth +) +service plant-api { + @doc "获取用户资料" + @handler GetUserProfile + get /profile/info + + @doc "更新用户资料" + @handler UpdateUserProfile + put /profile/update (UpdateProfileReq) +} + +@server ( + prefix: /api/plant + group: config + jwt: Auth +) +service plant-api { + @doc "等级配置列表" + @handler GetLevelConfigList + post /config/level/list (LevelConfigListReq) + + @doc "徽章配置列表" + @handler GetBadgeConfigList + post /config/badge/list (BadgeConfigListReq) +} + diff --git a/app/plant/api/plant.go b/app/plant/api/plant.go new file mode 100644 index 0000000..63db6b2 --- /dev/null +++ b/app/plant/api/plant.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/plant/api/internal/config" + "sundynix-micro-go/app/plant/api/internal/handler" + "sundynix-micro-go/app/plant/api/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/rest" +) + +var configFile = flag.String("f", "etc/plant-api.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + server := rest.MustNewServer(c.RestConf) + defer server.Stop() + + ctx := svc.NewServiceContext(c) + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/app/plant/model/plant_model.go b/app/plant/model/plant_model.go new file mode 100644 index 0000000..168824b --- /dev/null +++ b/app/plant/model/plant_model.go @@ -0,0 +1,327 @@ +package model + +import ( + "sundynix-micro-go/common/model" + "time" +) + +// ========== 用户扩展表(plant业务特有字段) ========== + +// SundynixPlantUserProfile 植物服务用户扩展表 +type SundynixPlantUserProfile struct { + model.BaseModel + UserID string `gorm:"size:50;uniqueIndex;column:user_id" json:"userId"` + NickName string `gorm:"size:100;column:nick_name" json:"nickName"` + AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"` + LevelID string `gorm:"size:50;column:level_id" json:"levelId"` + CurrentSunlight int64 `gorm:"not null;default:0;column:current_sunlight" json:"currentSunlight"` + TotalSunlight int64 `gorm:"not null;default:0;column:total_sunlight" json:"totalSunlight"` + PlantCount int64 `gorm:"not null;default:0;column:plant_count" json:"plantCount"` + CareCount int64 `gorm:"not null;default:0;column:care_count" json:"careCount"` + PostCount int64 `gorm:"not null;default:0;column:post_count" json:"postCount"` + WaterCount int64 `gorm:"not null;default:0;column:water_count" json:"waterCount"` + FertilizeCount int64 `gorm:"not null;default:0;column:fertilize_count" json:"fertilizeCount"` + RepotCount int64 `gorm:"not null;default:0;column:repot_count" json:"repotCount"` + PruneCount int64 `gorm:"not null;default:0;column:prune_count" json:"pruneCount"` + PhotoCount int64 `gorm:"not null;default:0;column:photo_count" json:"photoCount"` +} + +func (SundynixPlantUserProfile) TableName() string { + return "sundynix_plant_user_profile" +} + +// ========== 我的植物 ========== + +// SundynixMyPlant 我的植物 +type SundynixMyPlant struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + Name string `gorm:"size:20;column:name" json:"name"` + PlantTime time.Time `gorm:"column:plant_time" json:"plantTime"` + Status int `gorm:"column:status" json:"status"` + Placement string `gorm:"size:50;column:placement" json:"placement"` + PotMaterial string `gorm:"size:50;column:pot_material" json:"potMaterial"` + PotSize string `gorm:"size:50;column:pot_size" json:"potSize"` + Sunlight string `gorm:"size:50;column:sunlight" json:"sunlight"` + PlantingMaterial string `gorm:"size:50;column:planting_material" json:"plantingMaterial"` +} + +func (SundynixMyPlant) TableName() string { + return "sundynix_my_plant" +} + +// SundynixMyPlantOss 植物图片关联表 +type SundynixMyPlantOss struct { + MyPlantID string `gorm:"size:50;primaryKey;column:sundynix_my_plant_id" json:"myPlantId"` + OssID string `gorm:"size:50;primaryKey;column:sundynix_oss_id" json:"ossId"` +} + +func (SundynixMyPlantOss) TableName() string { + return "sundynix_my_plant_oss" +} + +// ========== 养护计划/记录 ========== + +// SundynixCarePlan 养护计划 +type SundynixCarePlan struct { + model.BaseModel + UserID string `gorm:"size:50;column:user_id" json:"userId"` + PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"` + Icon string `gorm:"type:text;column:icon" json:"icon"` + Name string `gorm:"size:50;column:name" json:"name"` + Period int `gorm:"column:period" json:"period"` + TargetAction string `gorm:"size:32;index;column:target_action" json:"targetAction"` +} + +func (SundynixCarePlan) TableName() string { + return "sundynix_care_plan" +} + +// SundynixCareRecord 养护记录 +type SundynixCareRecord struct { + model.BaseModel + UserID string `gorm:"size:50;column:user_id" json:"userId"` + PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"` + PlanID string `gorm:"size:50;index;column:plan_id" json:"planId"` + Name string `gorm:"size:50;column:name" json:"name"` + Remark string `gorm:"size:200;column:remark" json:"remark"` + Icon string `gorm:"type:text;column:icon" json:"icon"` +} + +func (SundynixCareRecord) TableName() string { + return "sundynix_care_record" +} + +// SundynixCareTask 养护任务 +type SundynixCareTask struct { + model.BaseModel + UserID string `gorm:"size:50;column:user_id" json:"userId"` + PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"` + PlanID string `gorm:"size:50;index;column:plan_id" json:"planId"` + Name string `gorm:"size:50;column:name" json:"name"` + Icon string `gorm:"type:text;column:icon" json:"icon"` + TargetAction string `gorm:"size:32;column:target_action" json:"targetAction"` + DueDate time.Time `gorm:"column:due_date" json:"dueDate"` + Status int `gorm:"default:1;column:status" json:"status"` +} + +func (SundynixCareTask) TableName() string { + return "sundynix_care_task" +} + +// SundynixGrowthRecord 成长记录 +type SundynixGrowthRecord struct { + model.BaseModel + PlantID string `gorm:"size:50;index;column:plant_id" json:"plantId"` + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + Name string `gorm:"size:50;column:name" json:"name"` + Tag string `gorm:"size:50;column:tag" json:"tag"` + Desc string `gorm:"size:200;column:desc" json:"desc"` + Content string `gorm:"size:200;column:content" json:"content"` +} + +func (SundynixGrowthRecord) TableName() string { + return "sundynix_growth_record" +} + +// ========== 百科 ========== + +// SundynixWiki 植物百科 +type SundynixWiki struct { + model.BaseModel + IsHot int `gorm:"column:is_hot" json:"isHot"` + Name string `gorm:"size:50;column:name" json:"name"` + LatinName string `gorm:"size:100;column:latin_name" json:"latinName"` + Aliases string `gorm:"size:100;column:aliases" json:"aliases"` + DistributionArea string `gorm:"type:text;column:distribution_area" json:"distributionArea"` + Genus string `gorm:"size:20;column:genus" json:"genus"` + Difficulty int `gorm:"column:difficulty" json:"difficulty"` + LifeCycle string `gorm:"type:text;column:life_cycle" json:"lifeCycle"` + GrowthHabit string `gorm:"type:text;column:growth_habit" json:"growthHabit"` + ReproductionMethod string `gorm:"size:200;column:reproduction_method" json:"reproductionMethod"` + PestsDiseases string `gorm:"size:200;column:pests_diseases" json:"pestsDiseases"` + LightIntensity string `gorm:"size:50;column:light_intensity" json:"lightIntensity"` + LightType string `gorm:"size:50;column:light_type" json:"lightType"` + OptimalTempPeriod string `gorm:"size:30;column:optimal_temp_period" json:"optimalTempPeriod"` + Stem string `gorm:"size:200;column:stem" json:"stem"` + FoliageType string `gorm:"size:200;column:foliage_type" json:"foliageType"` + FoliageColor string `gorm:"size:200;column:foliage_color" json:"foliageColor"` + FoliageShape string `gorm:"size:200;column:foliage_shape" json:"foliageShape"` + Height int `gorm:"column:height" json:"height"` + FloweringPeriod string `gorm:"size:100;column:flowering_period" json:"floweringPeriod"` + FloweringColor string `gorm:"size:100;column:flowering_color" json:"floweringColor"` + FloweringShape string `gorm:"size:100;column:flowering_shape" json:"floweringShape"` + FlowerDiameter int `gorm:"column:flower_diameter" json:"flowerDiameter"` + Fruit string `gorm:"size:200;column:fruit" json:"fruit"` +} + +func (SundynixWiki) TableName() string { + return "sundynix_wiki" +} + +// SundynixWikiClass 百科分类 +type SundynixWikiClass struct { + model.BaseModel + Name string `gorm:"size:50;column:name" json:"name"` + OssID string `gorm:"size:50;column:oss_id" json:"ossId"` +} + +func (SundynixWikiClass) TableName() string { + return "sundynix_wiki_class" +} + +// SundynixUserStar 用户收藏 +type SundynixUserStar struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + TargetID string `gorm:"size:50;index;column:target_id" json:"targetId"` + Type string `gorm:"size:20;column:type" json:"type"` // wiki/post +} + +func (SundynixUserStar) TableName() string { + return "sundynix_user_star" +} + +// ========== 社区 ========== + +// SundynixPost 社区帖子 +type SundynixPost struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + Title string `gorm:"size:100;column:title" json:"title"` + Content string `gorm:"size:500;column:content" json:"content"` + ViewCount int `gorm:"default:0;column:view_count" json:"viewCount"` + CommentCount int `gorm:"default:0;column:comment_count" json:"commentCount"` + LikeCount int `gorm:"default:0;column:like_count" json:"likeCount"` + StarCount int `gorm:"default:0;column:star_count" json:"starCount"` + Location string `gorm:"size:100;column:location" json:"location"` + HasReviewed int `gorm:"default:0;column:has_reviewed" json:"hasReviewed"` +} + +func (SundynixPost) TableName() string { + return "sundynix_post" +} + +// SundynixPostComment 帖子评论 +type SundynixPostComment struct { + model.BaseModel + PostID string `gorm:"size:50;index;column:post_id" json:"postId"` + UserID string `gorm:"size:50;column:user_id" json:"userId"` + Content string `gorm:"size:500;column:content" json:"content"` + ParentID string `gorm:"size:50;column:parent_id" json:"parentId"` +} + +func (SundynixPostComment) TableName() string { + return "sundynix_post_comment" +} + +// SundynixPostLike 帖子点赞 +type SundynixPostLike struct { + model.BaseModel + PostID string `gorm:"size:50;index;column:post_id" json:"postId"` + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` +} + +func (SundynixPostLike) TableName() string { + return "sundynix_post_like" +} + +// SundynixPostTopic 话题 +type SundynixPostTopic struct { + model.BaseModel + Name string `gorm:"size:50;column:name" json:"name"` + PostCount int `gorm:"default:0;column:post_count" json:"postCount"` +} + +func (SundynixPostTopic) TableName() string { + return "sundynix_post_topic" +} + +// ========== 积分商城 ========== + +// SundynixExchangeItem 兑换商品 +type SundynixExchangeItem struct { + model.BaseModel + Name string `gorm:"size:100;column:name" json:"name"` + Desc string `gorm:"size:200;column:desc" json:"desc"` + ImgID string `gorm:"size:50;column:img_id" json:"imgId"` + Cost int64 `gorm:"column:cost" json:"cost"` + Stock int `gorm:"column:stock" json:"stock"` + Status int `gorm:"default:1;column:status" json:"status"` +} + +func (SundynixExchangeItem) TableName() string { + return "sundynix_exchange_item" +} + +// SundynixExchangeOrder 兑换订单 +type SundynixExchangeOrder struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + ItemID string `gorm:"size:50;column:item_id" json:"itemId"` + Cost int64 `gorm:"column:cost" json:"cost"` + Status int `gorm:"default:0;column:status" json:"status"` + Address string `gorm:"size:200;column:address" json:"address"` +} + +func (SundynixExchangeOrder) TableName() string { + return "sundynix_exchange_order" +} + +// ========== 等级/徽章配置 ========== + +// SundynixLevelConfig 等级配置 +type SundynixLevelConfig struct { + model.BaseModel + Level int `gorm:"column:level" json:"level"` + Title string `gorm:"size:50;column:title" json:"title"` + MinSunlight int64 `gorm:"column:min_sunlight" json:"minSunlight"` + Perks string `gorm:"size:200;column:perks" json:"perks"` +} + +func (SundynixLevelConfig) TableName() string { + return "sundynix_level_config" +} + +// SundynixBadgeConfig 徽章配置 +type SundynixBadgeConfig struct { + model.BaseModel + Name string `gorm:"size:64;column:name" json:"name"` + Description string `gorm:"size:255;column:description" json:"description"` + IconID string `gorm:"size:50;column:icon_id" json:"iconId"` + Dimension string `gorm:"size:32;index;column:dimension" json:"dimension"` + GroupID string `gorm:"size:64;index;column:group_id" json:"groupId"` + Tier int `gorm:"default:1;column:tier" json:"tier"` + TargetAction string `gorm:"size:32;index;column:target_action" json:"targetAction"` + Threshold int64 `gorm:"column:threshold" json:"threshold"` + Comparator string `gorm:"size:10;default:'>=';column:comparator" json:"comparator"` + RewardSunlight int64 `gorm:"column:reward_sunlight" json:"rewardSunlight"` + Sort int `gorm:"default:1;column:sort" json:"sort"` +} + +func (SundynixBadgeConfig) TableName() string { + return "sundynix_badge_config" +} + +// SundynixUserBadge 用户徽章 +type SundynixUserBadge struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + BadgeID string `gorm:"size:50;index;column:badge_id" json:"badgeId"` +} + +func (SundynixUserBadge) TableName() string { + return "sundynix_user_badge" +} + +// SundynixAiChatHistory AI聊天历史 +type SundynixAiChatHistory struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + Role string `gorm:"size:20;column:role" json:"role"` + Content string `gorm:"type:text;column:content" json:"content"` +} + +func (SundynixAiChatHistory) TableName() string { + return "sundynix_ai_chat_history" +} diff --git a/app/plant/rpc/etc/plant.yaml b/app/plant/rpc/etc/plant.yaml new file mode 100644 index 0000000..924b54f --- /dev/null +++ b/app/plant/rpc/etc/plant.yaml @@ -0,0 +1,6 @@ +Name: plant.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: plant.rpc diff --git a/app/plant/rpc/internal/config/config.go b/app/plant/rpc/internal/config/config.go new file mode 100755 index 0000000..c1f85b9 --- /dev/null +++ b/app/plant/rpc/internal/config/config.go @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/app/plant/rpc/internal/logic/addCarePlanLogic.go b/app/plant/rpc/internal/logic/addCarePlanLogic.go new file mode 100644 index 0000000..4f8ffaf --- /dev/null +++ b/app/plant/rpc/internal/logic/addCarePlanLogic.go @@ -0,0 +1,31 @@ +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 AddCarePlanLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewAddCarePlanLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCarePlanLogic { + return &AddCarePlanLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 养护 +func (l *AddCarePlanLogic) AddCarePlan(in *plant.AddCarePlanReq) (*plant.AddCarePlanResp, error) { + // todo: add your logic here and delete this line + + return &plant.AddCarePlanResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/addCareRecordLogic.go b/app/plant/rpc/internal/logic/addCareRecordLogic.go new file mode 100644 index 0000000..9a5b054 --- /dev/null +++ b/app/plant/rpc/internal/logic/addCareRecordLogic.go @@ -0,0 +1,30 @@ +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 AddCareRecordLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewAddCareRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCareRecordLogic { + return &AddCareRecordLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *AddCareRecordLogic) AddCareRecord(in *plant.AddCareRecordReq) (*plant.AddCareRecordResp, error) { + // todo: add your logic here and delete this line + + return &plant.AddCareRecordResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/addGrowthRecordLogic.go b/app/plant/rpc/internal/logic/addGrowthRecordLogic.go new file mode 100644 index 0000000..87d8ed5 --- /dev/null +++ b/app/plant/rpc/internal/logic/addGrowthRecordLogic.go @@ -0,0 +1,30 @@ +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 AddGrowthRecordLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewAddGrowthRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddGrowthRecordLogic { + return &AddGrowthRecordLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *AddGrowthRecordLogic) AddGrowthRecord(in *plant.AddGrowthRecordReq) (*plant.AddGrowthRecordResp, error) { + // todo: add your logic here and delete this line + + return &plant.AddGrowthRecordResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/commentPostLogic.go b/app/plant/rpc/internal/logic/commentPostLogic.go new file mode 100644 index 0000000..a1aa69e --- /dev/null +++ b/app/plant/rpc/internal/logic/commentPostLogic.go @@ -0,0 +1,30 @@ +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 CommentPostLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCommentPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentPostLogic { + return &CommentPostLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CommentPostLogic) CommentPost(in *plant.CommentPostReq) (*plant.CommentPostResp, error) { + // todo: add your logic here and delete this line + + return &plant.CommentPostResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/createExchangeOrderLogic.go b/app/plant/rpc/internal/logic/createExchangeOrderLogic.go new file mode 100644 index 0000000..d3ea6ac --- /dev/null +++ b/app/plant/rpc/internal/logic/createExchangeOrderLogic.go @@ -0,0 +1,30 @@ +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 CreateExchangeOrderLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateExchangeOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateExchangeOrderLogic { + return &CreateExchangeOrderLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateExchangeOrderLogic) CreateExchangeOrder(in *plant.CreateExchangeOrderReq) (*plant.CreateExchangeOrderResp, error) { + // todo: add your logic here and delete this line + + return &plant.CreateExchangeOrderResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/createPlantLogic.go b/app/plant/rpc/internal/logic/createPlantLogic.go new file mode 100644 index 0000000..031fd80 --- /dev/null +++ b/app/plant/rpc/internal/logic/createPlantLogic.go @@ -0,0 +1,31 @@ +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 CreatePlantLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePlantLogic { + return &CreatePlantLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 植物 +func (l *CreatePlantLogic) CreatePlant(in *plant.CreatePlantReq) (*plant.CreatePlantResp, error) { + // todo: add your logic here and delete this line + + return &plant.CreatePlantResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/createPostLogic.go b/app/plant/rpc/internal/logic/createPostLogic.go new file mode 100644 index 0000000..44a1934 --- /dev/null +++ b/app/plant/rpc/internal/logic/createPostLogic.go @@ -0,0 +1,31 @@ +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 CreatePostLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreatePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePostLogic { + return &CreatePostLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 社区 +func (l *CreatePostLogic) CreatePost(in *plant.CreatePostReq) (*plant.CreatePostResp, error) { + // todo: add your logic here and delete this line + + return &plant.CreatePostResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/createTopicLogic.go b/app/plant/rpc/internal/logic/createTopicLogic.go new file mode 100644 index 0000000..0c45af1 --- /dev/null +++ b/app/plant/rpc/internal/logic/createTopicLogic.go @@ -0,0 +1,30 @@ +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 CreateTopicLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTopicLogic { + return &CreateTopicLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateTopicLogic) CreateTopic(in *plant.CreateTopicReq) (*plant.CreateTopicResp, error) { + // todo: add your logic here and delete this line + + return &plant.CreateTopicResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/createWikiClassLogic.go b/app/plant/rpc/internal/logic/createWikiClassLogic.go new file mode 100644 index 0000000..3b9e6ba --- /dev/null +++ b/app/plant/rpc/internal/logic/createWikiClassLogic.go @@ -0,0 +1,30 @@ +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 CreateWikiClassLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateWikiClassLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateWikiClassLogic { + return &CreateWikiClassLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreateWikiClassLogic) CreateWikiClass(in *plant.CreateWikiClassReq) (*plant.CreateWikiClassResp, error) { + // todo: add your logic here and delete this line + + return &plant.CreateWikiClassResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/deletePlantLogic.go b/app/plant/rpc/internal/logic/deletePlantLogic.go new file mode 100644 index 0000000..23bafa4 --- /dev/null +++ b/app/plant/rpc/internal/logic/deletePlantLogic.go @@ -0,0 +1,30 @@ +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 DeletePlantLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeletePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletePlantLogic { + return &DeletePlantLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeletePlantLogic) DeletePlant(in *plant.DeletePlantReq) (*plant.DeletePlantResp, error) { + // todo: add your logic here and delete this line + + return &plant.DeletePlantResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/deletePostLogic.go b/app/plant/rpc/internal/logic/deletePostLogic.go new file mode 100644 index 0000000..f5e3d9c --- /dev/null +++ b/app/plant/rpc/internal/logic/deletePostLogic.go @@ -0,0 +1,30 @@ +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 DeletePostLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeletePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletePostLogic { + return &DeletePostLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeletePostLogic) DeletePost(in *plant.DeletePostReq) (*plant.DeletePostResp, error) { + // todo: add your logic here and delete this line + + return &plant.DeletePostResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/deleteTopicLogic.go b/app/plant/rpc/internal/logic/deleteTopicLogic.go new file mode 100644 index 0000000..1b180c7 --- /dev/null +++ b/app/plant/rpc/internal/logic/deleteTopicLogic.go @@ -0,0 +1,30 @@ +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 DeleteTopicLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteTopicLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTopicLogic { + return &DeleteTopicLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteTopicLogic) DeleteTopic(in *plant.DeleteTopicReq) (*plant.DeleteTopicResp, error) { + // todo: add your logic here and delete this line + + return &plant.DeleteTopicResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getBadgeConfigListLogic.go b/app/plant/rpc/internal/logic/getBadgeConfigListLogic.go new file mode 100644 index 0000000..3fdeade --- /dev/null +++ b/app/plant/rpc/internal/logic/getBadgeConfigListLogic.go @@ -0,0 +1,30 @@ +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 GetBadgeConfigListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetBadgeConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetBadgeConfigListLogic { + return &GetBadgeConfigListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetBadgeConfigListLogic) GetBadgeConfigList(in *plant.GetBadgeConfigListReq) (*plant.GetBadgeConfigListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetBadgeConfigListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getExchangeItemListLogic.go b/app/plant/rpc/internal/logic/getExchangeItemListLogic.go new file mode 100644 index 0000000..d481783 --- /dev/null +++ b/app/plant/rpc/internal/logic/getExchangeItemListLogic.go @@ -0,0 +1,31 @@ +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 GetExchangeItemListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetExchangeItemListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetExchangeItemListLogic { + return &GetExchangeItemListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 兑换 +func (l *GetExchangeItemListLogic) GetExchangeItemList(in *plant.GetExchangeItemListReq) (*plant.GetExchangeItemListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetExchangeItemListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getLevelConfigListLogic.go b/app/plant/rpc/internal/logic/getLevelConfigListLogic.go new file mode 100644 index 0000000..d936c88 --- /dev/null +++ b/app/plant/rpc/internal/logic/getLevelConfigListLogic.go @@ -0,0 +1,31 @@ +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 GetLevelConfigListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetLevelConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLevelConfigListLogic { + return &GetLevelConfigListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 配置 +func (l *GetLevelConfigListLogic) GetLevelConfigList(in *plant.GetLevelConfigListReq) (*plant.GetLevelConfigListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetLevelConfigListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getPlantDetailLogic.go b/app/plant/rpc/internal/logic/getPlantDetailLogic.go new file mode 100644 index 0000000..470609f --- /dev/null +++ b/app/plant/rpc/internal/logic/getPlantDetailLogic.go @@ -0,0 +1,30 @@ +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 GetPlantDetailLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetPlantDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPlantDetailLogic { + return &GetPlantDetailLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetPlantDetailLogic) GetPlantDetail(in *plant.GetPlantDetailReq) (*plant.GetPlantDetailResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetPlantDetailResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getPlantListLogic.go b/app/plant/rpc/internal/logic/getPlantListLogic.go new file mode 100644 index 0000000..48c8be2 --- /dev/null +++ b/app/plant/rpc/internal/logic/getPlantListLogic.go @@ -0,0 +1,30 @@ +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 GetPlantListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetPlantListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPlantListLogic { + return &GetPlantListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetPlantListLogic) GetPlantList(in *plant.GetPlantListReq) (*plant.GetPlantListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetPlantListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getPostDetailLogic.go b/app/plant/rpc/internal/logic/getPostDetailLogic.go new file mode 100644 index 0000000..e48a74e --- /dev/null +++ b/app/plant/rpc/internal/logic/getPostDetailLogic.go @@ -0,0 +1,30 @@ +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 GetPostDetailLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetPostDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPostDetailLogic { + return &GetPostDetailLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetPostDetailLogic) GetPostDetail(in *plant.GetPostDetailReq) (*plant.GetPostDetailResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetPostDetailResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getPostListLogic.go b/app/plant/rpc/internal/logic/getPostListLogic.go new file mode 100644 index 0000000..c306441 --- /dev/null +++ b/app/plant/rpc/internal/logic/getPostListLogic.go @@ -0,0 +1,30 @@ +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 GetPostListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetPostListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPostListLogic { + return &GetPostListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetPostListLogic) GetPostList(in *plant.GetPostListReq) (*plant.GetPostListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetPostListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getTopicListLogic.go b/app/plant/rpc/internal/logic/getTopicListLogic.go new file mode 100644 index 0000000..57be021 --- /dev/null +++ b/app/plant/rpc/internal/logic/getTopicListLogic.go @@ -0,0 +1,31 @@ +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 GetTopicListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetTopicListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTopicListLogic { + return &GetTopicListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 话题 +func (l *GetTopicListLogic) GetTopicList(in *plant.Empty) (*plant.GetTopicListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetTopicListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getUserProfileLogic.go b/app/plant/rpc/internal/logic/getUserProfileLogic.go new file mode 100644 index 0000000..2bc4d0a --- /dev/null +++ b/app/plant/rpc/internal/logic/getUserProfileLogic.go @@ -0,0 +1,31 @@ +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 GetUserProfileLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProfileLogic { + return &GetUserProfileLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 用户Profile +func (l *GetUserProfileLogic) GetUserProfile(in *plant.GetUserProfileReq) (*plant.GetUserProfileResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetUserProfileResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getWikiClassListLogic.go b/app/plant/rpc/internal/logic/getWikiClassListLogic.go new file mode 100644 index 0000000..c83f94c --- /dev/null +++ b/app/plant/rpc/internal/logic/getWikiClassListLogic.go @@ -0,0 +1,30 @@ +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 GetWikiClassListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetWikiClassListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWikiClassListLogic { + return &GetWikiClassListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetWikiClassListLogic) GetWikiClassList(in *plant.Empty) (*plant.GetWikiClassListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetWikiClassListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getWikiDetailLogic.go b/app/plant/rpc/internal/logic/getWikiDetailLogic.go new file mode 100644 index 0000000..17d3ef9 --- /dev/null +++ b/app/plant/rpc/internal/logic/getWikiDetailLogic.go @@ -0,0 +1,30 @@ +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 GetWikiDetailLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetWikiDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWikiDetailLogic { + return &GetWikiDetailLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetWikiDetailLogic) GetWikiDetail(in *plant.GetWikiDetailReq) (*plant.GetWikiDetailResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetWikiDetailResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/getWikiListLogic.go b/app/plant/rpc/internal/logic/getWikiListLogic.go new file mode 100644 index 0000000..f80f950 --- /dev/null +++ b/app/plant/rpc/internal/logic/getWikiListLogic.go @@ -0,0 +1,31 @@ +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 GetWikiListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetWikiListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWikiListLogic { + return &GetWikiListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 百科 +func (l *GetWikiListLogic) GetWikiList(in *plant.GetWikiListReq) (*plant.GetWikiListResp, error) { + // todo: add your logic here and delete this line + + return &plant.GetWikiListResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/incrUserCounterLogic.go b/app/plant/rpc/internal/logic/incrUserCounterLogic.go new file mode 100644 index 0000000..6be5ac0 --- /dev/null +++ b/app/plant/rpc/internal/logic/incrUserCounterLogic.go @@ -0,0 +1,30 @@ +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 +} diff --git a/app/plant/rpc/internal/logic/likePostLogic.go b/app/plant/rpc/internal/logic/likePostLogic.go new file mode 100644 index 0000000..3c68632 --- /dev/null +++ b/app/plant/rpc/internal/logic/likePostLogic.go @@ -0,0 +1,30 @@ +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 LikePostLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewLikePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikePostLogic { + return &LikePostLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *LikePostLogic) LikePost(in *plant.LikePostReq) (*plant.LikePostResp, error) { + // todo: add your logic here and delete this line + + return &plant.LikePostResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/toggleStarLogic.go b/app/plant/rpc/internal/logic/toggleStarLogic.go new file mode 100644 index 0000000..fb847d2 --- /dev/null +++ b/app/plant/rpc/internal/logic/toggleStarLogic.go @@ -0,0 +1,30 @@ +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 ToggleStarLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewToggleStarLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleStarLogic { + return &ToggleStarLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ToggleStarLogic) ToggleStar(in *plant.ToggleStarReq) (*plant.ToggleStarResp, error) { + // todo: add your logic here and delete this line + + return &plant.ToggleStarResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/updatePlantLogic.go b/app/plant/rpc/internal/logic/updatePlantLogic.go new file mode 100644 index 0000000..c6607d7 --- /dev/null +++ b/app/plant/rpc/internal/logic/updatePlantLogic.go @@ -0,0 +1,30 @@ +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 UpdatePlantLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdatePlantLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdatePlantLogic { + return &UpdatePlantLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdatePlantLogic) UpdatePlant(in *plant.UpdatePlantReq) (*plant.UpdatePlantResp, error) { + // todo: add your logic here and delete this line + + return &plant.UpdatePlantResp{}, nil +} diff --git a/app/plant/rpc/internal/logic/updateUserProfileLogic.go b/app/plant/rpc/internal/logic/updateUserProfileLogic.go new file mode 100644 index 0000000..fad2875 --- /dev/null +++ b/app/plant/rpc/internal/logic/updateUserProfileLogic.go @@ -0,0 +1,30 @@ +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 UpdateUserProfileLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserProfileLogic { + return &UpdateUserProfileLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateUserProfileLogic) UpdateUserProfile(in *plant.UpdateUserProfileReq) (*plant.UpdateUserProfileResp, error) { + // todo: add your logic here and delete this line + + return &plant.UpdateUserProfileResp{}, nil +} diff --git a/app/plant/rpc/internal/server/plantServiceServer.go b/app/plant/rpc/internal/server/plantServiceServer.go new file mode 100644 index 0000000..60093b6 --- /dev/null +++ b/app/plant/rpc/internal/server/plantServiceServer.go @@ -0,0 +1,177 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: plant.proto + +package server + +import ( + "context" + + "sundynix-micro-go/app/plant/rpc/internal/logic" + "sundynix-micro-go/app/plant/rpc/internal/svc" + "sundynix-micro-go/app/plant/rpc/plant" +) + +type PlantServiceServer struct { + svcCtx *svc.ServiceContext + plant.UnimplementedPlantServiceServer +} + +func NewPlantServiceServer(svcCtx *svc.ServiceContext) *PlantServiceServer { + return &PlantServiceServer{ + svcCtx: svcCtx, + } +} + +// 用户Profile +func (s *PlantServiceServer) GetUserProfile(ctx context.Context, in *plant.GetUserProfileReq) (*plant.GetUserProfileResp, error) { + l := logic.NewGetUserProfileLogic(ctx, s.svcCtx) + return l.GetUserProfile(in) +} + +func (s *PlantServiceServer) UpdateUserProfile(ctx context.Context, in *plant.UpdateUserProfileReq) (*plant.UpdateUserProfileResp, 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) { + l := logic.NewCreatePlantLogic(ctx, s.svcCtx) + return l.CreatePlant(in) +} + +func (s *PlantServiceServer) UpdatePlant(ctx context.Context, in *plant.UpdatePlantReq) (*plant.UpdatePlantResp, error) { + l := logic.NewUpdatePlantLogic(ctx, s.svcCtx) + return l.UpdatePlant(in) +} + +func (s *PlantServiceServer) DeletePlant(ctx context.Context, in *plant.DeletePlantReq) (*plant.DeletePlantResp, error) { + l := logic.NewDeletePlantLogic(ctx, s.svcCtx) + return l.DeletePlant(in) +} + +func (s *PlantServiceServer) GetPlantList(ctx context.Context, in *plant.GetPlantListReq) (*plant.GetPlantListResp, error) { + l := logic.NewGetPlantListLogic(ctx, s.svcCtx) + return l.GetPlantList(in) +} + +func (s *PlantServiceServer) GetPlantDetail(ctx context.Context, in *plant.GetPlantDetailReq) (*plant.GetPlantDetailResp, error) { + l := logic.NewGetPlantDetailLogic(ctx, s.svcCtx) + return l.GetPlantDetail(in) +} + +// 养护 +func (s *PlantServiceServer) AddCarePlan(ctx context.Context, in *plant.AddCarePlanReq) (*plant.AddCarePlanResp, error) { + l := logic.NewAddCarePlanLogic(ctx, s.svcCtx) + return l.AddCarePlan(in) +} + +func (s *PlantServiceServer) AddCareRecord(ctx context.Context, in *plant.AddCareRecordReq) (*plant.AddCareRecordResp, error) { + l := logic.NewAddCareRecordLogic(ctx, s.svcCtx) + return l.AddCareRecord(in) +} + +func (s *PlantServiceServer) AddGrowthRecord(ctx context.Context, in *plant.AddGrowthRecordReq) (*plant.AddGrowthRecordResp, error) { + l := logic.NewAddGrowthRecordLogic(ctx, s.svcCtx) + return l.AddGrowthRecord(in) +} + +// 百科 +func (s *PlantServiceServer) GetWikiList(ctx context.Context, in *plant.GetWikiListReq) (*plant.GetWikiListResp, error) { + l := logic.NewGetWikiListLogic(ctx, s.svcCtx) + return l.GetWikiList(in) +} + +func (s *PlantServiceServer) GetWikiDetail(ctx context.Context, in *plant.GetWikiDetailReq) (*plant.GetWikiDetailResp, error) { + l := logic.NewGetWikiDetailLogic(ctx, s.svcCtx) + return l.GetWikiDetail(in) +} + +func (s *PlantServiceServer) GetWikiClassList(ctx context.Context, in *plant.Empty) (*plant.GetWikiClassListResp, error) { + l := logic.NewGetWikiClassListLogic(ctx, s.svcCtx) + return l.GetWikiClassList(in) +} + +func (s *PlantServiceServer) CreateWikiClass(ctx context.Context, in *plant.CreateWikiClassReq) (*plant.CreateWikiClassResp, 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) CreatePost(ctx context.Context, in *plant.CreatePostReq) (*plant.CreatePostResp, 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) { + l := logic.NewDeletePostLogic(ctx, s.svcCtx) + return l.DeletePost(in) +} + +func (s *PlantServiceServer) CommentPost(ctx context.Context, in *plant.CommentPostReq) (*plant.CommentPostResp, error) { + l := logic.NewCommentPostLogic(ctx, s.svcCtx) + return l.CommentPost(in) +} + +func (s *PlantServiceServer) LikePost(ctx context.Context, in *plant.LikePostReq) (*plant.LikePostResp, error) { + l := logic.NewLikePostLogic(ctx, s.svcCtx) + return l.LikePost(in) +} + +// 话题 +func (s *PlantServiceServer) GetTopicList(ctx context.Context, in *plant.Empty) (*plant.GetTopicListResp, error) { + l := logic.NewGetTopicListLogic(ctx, s.svcCtx) + return l.GetTopicList(in) +} + +func (s *PlantServiceServer) CreateTopic(ctx context.Context, in *plant.CreateTopicReq) (*plant.CreateTopicResp, error) { + l := logic.NewCreateTopicLogic(ctx, s.svcCtx) + return l.CreateTopic(in) +} + +func (s *PlantServiceServer) DeleteTopic(ctx context.Context, in *plant.DeleteTopicReq) (*plant.DeleteTopicResp, 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) { + l := logic.NewGetExchangeItemListLogic(ctx, s.svcCtx) + return l.GetExchangeItemList(in) +} + +func (s *PlantServiceServer) CreateExchangeOrder(ctx context.Context, in *plant.CreateExchangeOrderReq) (*plant.CreateExchangeOrderResp, error) { + l := logic.NewCreateExchangeOrderLogic(ctx, s.svcCtx) + return l.CreateExchangeOrder(in) +} diff --git a/app/plant/rpc/internal/svc/serviceContext.go b/app/plant/rpc/internal/svc/serviceContext.go new file mode 100644 index 0000000..a23857a --- /dev/null +++ b/app/plant/rpc/internal/svc/serviceContext.go @@ -0,0 +1,13 @@ +package svc + +import "sundynix-micro-go/app/plant/rpc/internal/config" + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + } +} diff --git a/app/plant/rpc/pb/plant.proto b/app/plant/rpc/pb/plant.proto new file mode 100644 index 0000000..365d835 --- /dev/null +++ b/app/plant/rpc/pb/plant.proto @@ -0,0 +1,328 @@ +syntax = "proto3"; + +package plant; + +option go_package = "./plant"; + +// ========== 用户Profile ========== +message UserProfile { + string id = 1; + string userId = 2; + string nickName = 3; + string avatarId = 4; + string levelId = 5; + int64 currentSunlight = 6; + int64 totalSunlight = 7; + int64 plantCount = 8; + int64 careCount = 9; + int64 postCount = 10; + int64 waterCount = 11; + int64 fertilizeCount = 12; + int64 repotCount = 13; + int64 pruneCount = 14; + int64 photoCount = 15; +} + +message GetUserProfileReq { string userId = 1; } +message GetUserProfileResp { UserProfile profile = 1; } +message UpdateUserProfileReq { + 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; + string name = 3; + string plantTime = 4; + int32 status = 5; + string placement = 6; + string potMaterial = 7; + string potSize = 8; + string sunlight = 9; + string plantingMaterial = 10; + repeated string imgIds = 11; + int64 createdAt = 12; +} + +message CreatePlantReq { + string userId = 1; + string name = 2; + string plantTime = 3; + string placement = 4; + string potMaterial = 5; + string potSize = 6; + string sunlight = 7; + string plantingMaterial = 8; + repeated string imgIds = 9; +} +message CreatePlantResp { string id = 1; } + +message UpdatePlantReq { + string id = 1; + string name = 2; + int32 status = 3; + string placement = 4; + string potMaterial = 5; + string potSize = 6; + string sunlight = 7; + string plantingMaterial = 8; +} +message UpdatePlantResp {} + +message DeletePlantReq { repeated string ids = 1; } +message DeletePlantResp {} + +message GetPlantListReq { + string userId = 1; + int32 current = 2; + int32 pageSize = 3; + string name = 4; +} +message GetPlantListResp { + repeated PlantInfo list = 1; + int64 total = 2; +} + +message GetPlantDetailReq { string id = 1; } +message GetPlantDetailResp { PlantInfo plant = 1; } + +// ========== 养护 ========== +message CarePlanInfo { + string id = 1; + string userId = 2; + string plantId = 3; + string name = 4; + string icon = 5; + string targetAction = 6; + int32 period = 7; +} + +message AddCarePlanReq { + string userId = 1; + string plantId = 2; + string name = 3; + string icon = 4; + string targetAction = 5; + int32 period = 6; +} +message AddCarePlanResp { string id = 1; } + +message AddCareRecordReq { + string userId = 1; + string plantId = 2; + string planId = 3; + string action = 4; + string note = 5; +} +message AddCareRecordResp {} + +message AddGrowthRecordReq { + string userId = 1; + string plantId = 2; + string content = 3; + repeated string imgIds = 4; +} +message AddGrowthRecordResp {} + +// ========== 百科 ========== +message WikiInfo { + string id = 1; + string name = 2; + string latinName = 3; + string aliases = 4; + string genus = 5; + int32 difficulty = 6; + int32 isHot = 7; + int64 createdAt = 8; +} + +message GetWikiListReq { + int32 current = 1; + int32 pageSize = 2; + string name = 3; + string classId = 4; + int32 isHot = 5; +} +message GetWikiListResp { + repeated WikiInfo list = 1; + int64 total = 2; +} + +message GetWikiDetailReq { string id = 1; } +message GetWikiDetailResp { 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 ToggleStarReq { + string userId = 1; + string targetId = 2; + string type = 3; +} +message ToggleStarResp { bool starred = 1; } + +// ========== 社区 ========== +message PostInfo { + string id = 1; + string userId = 2; + string title = 3; + string content = 4; + int32 viewCount = 5; + int32 commentCount = 6; + int32 likeCount = 7; + int32 starCount = 8; + string location = 9; + int64 createdAt = 10; +} + +message CreatePostReq { + string userId = 1; + string title = 2; + string content = 3; + string location = 4; + repeated string imgIds = 5; + string topicId = 6; +} +message CreatePostResp { string id = 1; } + +message GetPostListReq { + int32 current = 1; + int32 pageSize = 2; + string keyword = 3; + string topicId = 4; +} +message GetPostListResp { + repeated PostInfo list = 1; + int64 total = 2; +} + +message GetPostDetailReq { string id = 1; } +message GetPostDetailResp { PostInfo post = 1; } + +message DeletePostReq { repeated string ids = 1; } +message DeletePostResp {} + +message CommentPostReq { + string userId = 1; + string postId = 2; + 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 LevelConfigInfo { + string id = 1; + int32 level = 2; + string title = 3; + int64 minSunlight = 4; + string perks = 5; +} +message GetLevelConfigListReq { int32 current = 1; int32 pageSize = 2; } +message GetLevelConfigListResp { repeated LevelConfigInfo list = 1; int64 total = 2; } + +message BadgeConfigInfo { + string id = 1; + string name = 2; + string description = 3; + string dimension = 4; + string groupId = 5; + int32 tier = 6; + string targetAction = 7; + 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 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 {} + +// ========== 服务定义 ========== +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 AddCarePlan(AddCarePlanReq) returns (AddCarePlanResp); + rpc AddCareRecord(AddCareRecordReq) returns (AddCareRecordResp); + rpc AddGrowthRecord(AddGrowthRecordReq) returns (AddGrowthRecordResp); + // 百科 + 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 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 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 GetExchangeItemList(GetExchangeItemListReq) returns (GetExchangeItemListResp); + rpc CreateExchangeOrder(CreateExchangeOrderReq) returns (CreateExchangeOrderResp); +} diff --git a/app/plant/rpc/plant.go b/app/plant/rpc/plant.go new file mode 100644 index 0000000..b53e7c8 --- /dev/null +++ b/app/plant/rpc/plant.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/plant/rpc/internal/config" + "sundynix-micro-go/app/plant/rpc/internal/server" + "sundynix-micro-go/app/plant/rpc/internal/svc" + "sundynix-micro-go/app/plant/rpc/plant" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/plant.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + plant.RegisterPlantServiceServer(grpcServer, server.NewPlantServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/app/plant/rpc/plant/plant.pb.go b/app/plant/rpc/plant/plant.pb.go new file mode 100644 index 0000000..f60e69d --- /dev/null +++ b/app/plant/rpc/plant/plant.pb.go @@ -0,0 +1,4440 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: pb/plant.proto + +package plant + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ========== 用户Profile ========== +type UserProfile struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + NickName string `protobuf:"bytes,3,opt,name=nickName,proto3" json:"nickName,omitempty"` + AvatarId string `protobuf:"bytes,4,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + LevelId string `protobuf:"bytes,5,opt,name=levelId,proto3" json:"levelId,omitempty"` + CurrentSunlight int64 `protobuf:"varint,6,opt,name=currentSunlight,proto3" json:"currentSunlight,omitempty"` + TotalSunlight int64 `protobuf:"varint,7,opt,name=totalSunlight,proto3" json:"totalSunlight,omitempty"` + PlantCount int64 `protobuf:"varint,8,opt,name=plantCount,proto3" json:"plantCount,omitempty"` + CareCount int64 `protobuf:"varint,9,opt,name=careCount,proto3" json:"careCount,omitempty"` + PostCount int64 `protobuf:"varint,10,opt,name=postCount,proto3" json:"postCount,omitempty"` + WaterCount int64 `protobuf:"varint,11,opt,name=waterCount,proto3" json:"waterCount,omitempty"` + FertilizeCount int64 `protobuf:"varint,12,opt,name=fertilizeCount,proto3" json:"fertilizeCount,omitempty"` + RepotCount int64 `protobuf:"varint,13,opt,name=repotCount,proto3" json:"repotCount,omitempty"` + PruneCount int64 `protobuf:"varint,14,opt,name=pruneCount,proto3" json:"pruneCount,omitempty"` + PhotoCount int64 `protobuf:"varint,15,opt,name=photoCount,proto3" json:"photoCount,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserProfile) Reset() { + *x = UserProfile{} + mi := &file_pb_plant_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserProfile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserProfile) ProtoMessage() {} + +func (x *UserProfile) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserProfile.ProtoReflect.Descriptor instead. +func (*UserProfile) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{0} +} + +func (x *UserProfile) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UserProfile) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UserProfile) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +func (x *UserProfile) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +func (x *UserProfile) GetLevelId() string { + if x != nil { + return x.LevelId + } + return "" +} + +func (x *UserProfile) GetCurrentSunlight() int64 { + if x != nil { + return x.CurrentSunlight + } + return 0 +} + +func (x *UserProfile) GetTotalSunlight() int64 { + if x != nil { + return x.TotalSunlight + } + return 0 +} + +func (x *UserProfile) GetPlantCount() int64 { + if x != nil { + return x.PlantCount + } + return 0 +} + +func (x *UserProfile) GetCareCount() int64 { + if x != nil { + return x.CareCount + } + return 0 +} + +func (x *UserProfile) GetPostCount() int64 { + if x != nil { + return x.PostCount + } + return 0 +} + +func (x *UserProfile) GetWaterCount() int64 { + if x != nil { + return x.WaterCount + } + return 0 +} + +func (x *UserProfile) GetFertilizeCount() int64 { + if x != nil { + return x.FertilizeCount + } + return 0 +} + +func (x *UserProfile) GetRepotCount() int64 { + if x != nil { + return x.RepotCount + } + return 0 +} + +func (x *UserProfile) GetPruneCount() int64 { + if x != nil { + return x.PruneCount + } + return 0 +} + +func (x *UserProfile) GetPhotoCount() int64 { + if x != nil { + return x.PhotoCount + } + return 0 +} + +type GetUserProfileReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserProfileReq) Reset() { + *x = GetUserProfileReq{} + mi := &file_pb_plant_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserProfileReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserProfileReq) ProtoMessage() {} + +func (x *GetUserProfileReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserProfileReq.ProtoReflect.Descriptor instead. +func (*GetUserProfileReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{1} +} + +func (x *GetUserProfileReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetUserProfileResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Profile *UserProfile `protobuf:"bytes,1,opt,name=profile,proto3" json:"profile,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserProfileResp) Reset() { + *x = GetUserProfileResp{} + mi := &file_pb_plant_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserProfileResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserProfileResp) ProtoMessage() {} + +func (x *GetUserProfileResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserProfileResp.ProtoReflect.Descriptor instead. +func (*GetUserProfileResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserProfileResp) GetProfile() *UserProfile { + if x != nil { + return x.Profile + } + return nil +} + +type UpdateUserProfileReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + NickName string `protobuf:"bytes,2,opt,name=nickName,proto3" json:"nickName,omitempty"` + AvatarId string `protobuf:"bytes,3,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserProfileReq) Reset() { + *x = UpdateUserProfileReq{} + mi := &file_pb_plant_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserProfileReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserProfileReq) ProtoMessage() {} + +func (x *UpdateUserProfileReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserProfileReq.ProtoReflect.Descriptor instead. +func (*UpdateUserProfileReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateUserProfileReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *UpdateUserProfileReq) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +func (x *UpdateUserProfileReq) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +type UpdateUserProfileResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserProfileResp) Reset() { + *x = UpdateUserProfileResp{} + mi := &file_pb_plant_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserProfileResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserProfileResp) ProtoMessage() {} + +func (x *UpdateUserProfileResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserProfileResp.ProtoReflect.Descriptor instead. +func (*UpdateUserProfileResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{4} +} + +type IncrUserCounterReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` // care_count, water_count, etc. + Delta int64 `protobuf:"varint,3,opt,name=delta,proto3" json:"delta,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IncrUserCounterReq) Reset() { + *x = IncrUserCounterReq{} + mi := &file_pb_plant_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IncrUserCounterReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IncrUserCounterReq) ProtoMessage() {} + +func (x *IncrUserCounterReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IncrUserCounterReq.ProtoReflect.Descriptor instead. +func (*IncrUserCounterReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{5} +} + +func (x *IncrUserCounterReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *IncrUserCounterReq) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *IncrUserCounterReq) GetDelta() int64 { + if x != nil { + return x.Delta + } + return 0 +} + +type IncrUserCounterResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IncrUserCounterResp) Reset() { + *x = IncrUserCounterResp{} + mi := &file_pb_plant_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IncrUserCounterResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IncrUserCounterResp) ProtoMessage() {} + +func (x *IncrUserCounterResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IncrUserCounterResp.ProtoReflect.Descriptor instead. +func (*IncrUserCounterResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{6} +} + +// ========== 我的植物 ========== +type PlantInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + PlantTime string `protobuf:"bytes,4,opt,name=plantTime,proto3" json:"plantTime,omitempty"` + Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + Placement string `protobuf:"bytes,6,opt,name=placement,proto3" json:"placement,omitempty"` + PotMaterial string `protobuf:"bytes,7,opt,name=potMaterial,proto3" json:"potMaterial,omitempty"` + PotSize string `protobuf:"bytes,8,opt,name=potSize,proto3" json:"potSize,omitempty"` + Sunlight string `protobuf:"bytes,9,opt,name=sunlight,proto3" json:"sunlight,omitempty"` + PlantingMaterial string `protobuf:"bytes,10,opt,name=plantingMaterial,proto3" json:"plantingMaterial,omitempty"` + ImgIds []string `protobuf:"bytes,11,rep,name=imgIds,proto3" json:"imgIds,omitempty"` + CreatedAt int64 `protobuf:"varint,12,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PlantInfo) Reset() { + *x = PlantInfo{} + mi := &file_pb_plant_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PlantInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlantInfo) ProtoMessage() {} + +func (x *PlantInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PlantInfo.ProtoReflect.Descriptor instead. +func (*PlantInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{7} +} + +func (x *PlantInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PlantInfo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *PlantInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PlantInfo) GetPlantTime() string { + if x != nil { + return x.PlantTime + } + return "" +} + +func (x *PlantInfo) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *PlantInfo) GetPlacement() string { + if x != nil { + return x.Placement + } + return "" +} + +func (x *PlantInfo) GetPotMaterial() string { + if x != nil { + return x.PotMaterial + } + return "" +} + +func (x *PlantInfo) GetPotSize() string { + if x != nil { + return x.PotSize + } + return "" +} + +func (x *PlantInfo) GetSunlight() string { + if x != nil { + return x.Sunlight + } + return "" +} + +func (x *PlantInfo) GetPlantingMaterial() string { + if x != nil { + return x.PlantingMaterial + } + return "" +} + +func (x *PlantInfo) GetImgIds() []string { + if x != nil { + return x.ImgIds + } + return nil +} + +func (x *PlantInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type CreatePlantReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + PlantTime string `protobuf:"bytes,3,opt,name=plantTime,proto3" json:"plantTime,omitempty"` + Placement string `protobuf:"bytes,4,opt,name=placement,proto3" json:"placement,omitempty"` + PotMaterial string `protobuf:"bytes,5,opt,name=potMaterial,proto3" json:"potMaterial,omitempty"` + PotSize string `protobuf:"bytes,6,opt,name=potSize,proto3" json:"potSize,omitempty"` + Sunlight string `protobuf:"bytes,7,opt,name=sunlight,proto3" json:"sunlight,omitempty"` + PlantingMaterial string `protobuf:"bytes,8,opt,name=plantingMaterial,proto3" json:"plantingMaterial,omitempty"` + ImgIds []string `protobuf:"bytes,9,rep,name=imgIds,proto3" json:"imgIds,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePlantReq) Reset() { + *x = CreatePlantReq{} + mi := &file_pb_plant_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePlantReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePlantReq) ProtoMessage() {} + +func (x *CreatePlantReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePlantReq.ProtoReflect.Descriptor instead. +func (*CreatePlantReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{8} +} + +func (x *CreatePlantReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreatePlantReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreatePlantReq) GetPlantTime() string { + if x != nil { + return x.PlantTime + } + return "" +} + +func (x *CreatePlantReq) GetPlacement() string { + if x != nil { + return x.Placement + } + return "" +} + +func (x *CreatePlantReq) GetPotMaterial() string { + if x != nil { + return x.PotMaterial + } + return "" +} + +func (x *CreatePlantReq) GetPotSize() string { + if x != nil { + return x.PotSize + } + return "" +} + +func (x *CreatePlantReq) GetSunlight() string { + if x != nil { + return x.Sunlight + } + return "" +} + +func (x *CreatePlantReq) GetPlantingMaterial() string { + if x != nil { + return x.PlantingMaterial + } + return "" +} + +func (x *CreatePlantReq) GetImgIds() []string { + if x != nil { + return x.ImgIds + } + return nil +} + +type CreatePlantResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePlantResp) Reset() { + *x = CreatePlantResp{} + mi := &file_pb_plant_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePlantResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePlantResp) ProtoMessage() {} + +func (x *CreatePlantResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePlantResp.ProtoReflect.Descriptor instead. +func (*CreatePlantResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{9} +} + +func (x *CreatePlantResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type UpdatePlantReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Status int32 `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"` + Placement string `protobuf:"bytes,4,opt,name=placement,proto3" json:"placement,omitempty"` + PotMaterial string `protobuf:"bytes,5,opt,name=potMaterial,proto3" json:"potMaterial,omitempty"` + PotSize string `protobuf:"bytes,6,opt,name=potSize,proto3" json:"potSize,omitempty"` + Sunlight string `protobuf:"bytes,7,opt,name=sunlight,proto3" json:"sunlight,omitempty"` + PlantingMaterial string `protobuf:"bytes,8,opt,name=plantingMaterial,proto3" json:"plantingMaterial,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdatePlantReq) Reset() { + *x = UpdatePlantReq{} + mi := &file_pb_plant_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdatePlantReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePlantReq) ProtoMessage() {} + +func (x *UpdatePlantReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePlantReq.ProtoReflect.Descriptor instead. +func (*UpdatePlantReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdatePlantReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdatePlantReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdatePlantReq) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *UpdatePlantReq) GetPlacement() string { + if x != nil { + return x.Placement + } + return "" +} + +func (x *UpdatePlantReq) GetPotMaterial() string { + if x != nil { + return x.PotMaterial + } + return "" +} + +func (x *UpdatePlantReq) GetPotSize() string { + if x != nil { + return x.PotSize + } + return "" +} + +func (x *UpdatePlantReq) GetSunlight() string { + if x != nil { + return x.Sunlight + } + return "" +} + +func (x *UpdatePlantReq) GetPlantingMaterial() string { + if x != nil { + return x.PlantingMaterial + } + return "" +} + +type UpdatePlantResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdatePlantResp) Reset() { + *x = UpdatePlantResp{} + mi := &file_pb_plant_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdatePlantResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePlantResp) ProtoMessage() {} + +func (x *UpdatePlantResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdatePlantResp.ProtoReflect.Descriptor instead. +func (*UpdatePlantResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{11} +} + +type DeletePlantReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeletePlantReq) Reset() { + *x = DeletePlantReq{} + mi := &file_pb_plant_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeletePlantReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePlantReq) ProtoMessage() {} + +func (x *DeletePlantReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePlantReq.ProtoReflect.Descriptor instead. +func (*DeletePlantReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{12} +} + +func (x *DeletePlantReq) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type DeletePlantResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeletePlantResp) Reset() { + *x = DeletePlantResp{} + mi := &file_pb_plant_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeletePlantResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePlantResp) ProtoMessage() {} + +func (x *DeletePlantResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePlantResp.ProtoReflect.Descriptor instead. +func (*DeletePlantResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{13} +} + +type GetPlantListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + Current int32 `protobuf:"varint,2,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPlantListReq) Reset() { + *x = GetPlantListReq{} + mi := &file_pb_plant_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPlantListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPlantListReq) ProtoMessage() {} + +func (x *GetPlantListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPlantListReq.ProtoReflect.Descriptor instead. +func (*GetPlantListReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{14} +} + +func (x *GetPlantListReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetPlantListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetPlantListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetPlantListReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetPlantListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*PlantInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPlantListResp) Reset() { + *x = GetPlantListResp{} + mi := &file_pb_plant_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPlantListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPlantListResp) ProtoMessage() {} + +func (x *GetPlantListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPlantListResp.ProtoReflect.Descriptor instead. +func (*GetPlantListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{15} +} + +func (x *GetPlantListResp) GetList() []*PlantInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetPlantListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetPlantDetailReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPlantDetailReq) Reset() { + *x = GetPlantDetailReq{} + mi := &file_pb_plant_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPlantDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPlantDetailReq) ProtoMessage() {} + +func (x *GetPlantDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPlantDetailReq.ProtoReflect.Descriptor instead. +func (*GetPlantDetailReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{16} +} + +func (x *GetPlantDetailReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetPlantDetailResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Plant *PlantInfo `protobuf:"bytes,1,opt,name=plant,proto3" json:"plant,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPlantDetailResp) Reset() { + *x = GetPlantDetailResp{} + mi := &file_pb_plant_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPlantDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPlantDetailResp) ProtoMessage() {} + +func (x *GetPlantDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPlantDetailResp.ProtoReflect.Descriptor instead. +func (*GetPlantDetailResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{17} +} + +func (x *GetPlantDetailResp) GetPlant() *PlantInfo { + if x != nil { + return x.Plant + } + return nil +} + +// ========== 养护 ========== +type CarePlanInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + PlantId string `protobuf:"bytes,3,opt,name=plantId,proto3" json:"plantId,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` + TargetAction string `protobuf:"bytes,6,opt,name=targetAction,proto3" json:"targetAction,omitempty"` + Period int32 `protobuf:"varint,7,opt,name=period,proto3" json:"period,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CarePlanInfo) Reset() { + *x = CarePlanInfo{} + mi := &file_pb_plant_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CarePlanInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CarePlanInfo) ProtoMessage() {} + +func (x *CarePlanInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CarePlanInfo.ProtoReflect.Descriptor instead. +func (*CarePlanInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{18} +} + +func (x *CarePlanInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CarePlanInfo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CarePlanInfo) GetPlantId() string { + if x != nil { + return x.PlantId + } + return "" +} + +func (x *CarePlanInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CarePlanInfo) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *CarePlanInfo) GetTargetAction() string { + if x != nil { + return x.TargetAction + } + return "" +} + +func (x *CarePlanInfo) GetPeriod() int32 { + if x != nil { + return x.Period + } + return 0 +} + +type AddCarePlanReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + PlantId string `protobuf:"bytes,2,opt,name=plantId,proto3" json:"plantId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` + TargetAction string `protobuf:"bytes,5,opt,name=targetAction,proto3" json:"targetAction,omitempty"` + Period int32 `protobuf:"varint,6,opt,name=period,proto3" json:"period,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddCarePlanReq) Reset() { + *x = AddCarePlanReq{} + mi := &file_pb_plant_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddCarePlanReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddCarePlanReq) ProtoMessage() {} + +func (x *AddCarePlanReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddCarePlanReq.ProtoReflect.Descriptor instead. +func (*AddCarePlanReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{19} +} + +func (x *AddCarePlanReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AddCarePlanReq) GetPlantId() string { + if x != nil { + return x.PlantId + } + return "" +} + +func (x *AddCarePlanReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AddCarePlanReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *AddCarePlanReq) GetTargetAction() string { + if x != nil { + return x.TargetAction + } + return "" +} + +func (x *AddCarePlanReq) GetPeriod() int32 { + if x != nil { + return x.Period + } + return 0 +} + +type AddCarePlanResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddCarePlanResp) Reset() { + *x = AddCarePlanResp{} + mi := &file_pb_plant_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddCarePlanResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddCarePlanResp) ProtoMessage() {} + +func (x *AddCarePlanResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddCarePlanResp.ProtoReflect.Descriptor instead. +func (*AddCarePlanResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{20} +} + +func (x *AddCarePlanResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type AddCareRecordReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + PlantId string `protobuf:"bytes,2,opt,name=plantId,proto3" json:"plantId,omitempty"` + PlanId string `protobuf:"bytes,3,opt,name=planId,proto3" json:"planId,omitempty"` + Action string `protobuf:"bytes,4,opt,name=action,proto3" json:"action,omitempty"` + Note string `protobuf:"bytes,5,opt,name=note,proto3" json:"note,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddCareRecordReq) Reset() { + *x = AddCareRecordReq{} + mi := &file_pb_plant_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddCareRecordReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddCareRecordReq) ProtoMessage() {} + +func (x *AddCareRecordReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddCareRecordReq.ProtoReflect.Descriptor instead. +func (*AddCareRecordReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{21} +} + +func (x *AddCareRecordReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AddCareRecordReq) GetPlantId() string { + if x != nil { + return x.PlantId + } + return "" +} + +func (x *AddCareRecordReq) GetPlanId() string { + if x != nil { + return x.PlanId + } + return "" +} + +func (x *AddCareRecordReq) GetAction() string { + if x != nil { + return x.Action + } + return "" +} + +func (x *AddCareRecordReq) GetNote() string { + if x != nil { + return x.Note + } + return "" +} + +type AddCareRecordResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddCareRecordResp) Reset() { + *x = AddCareRecordResp{} + mi := &file_pb_plant_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddCareRecordResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddCareRecordResp) ProtoMessage() {} + +func (x *AddCareRecordResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddCareRecordResp.ProtoReflect.Descriptor instead. +func (*AddCareRecordResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{22} +} + +type AddGrowthRecordReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + PlantId string `protobuf:"bytes,2,opt,name=plantId,proto3" json:"plantId,omitempty"` + Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` + ImgIds []string `protobuf:"bytes,4,rep,name=imgIds,proto3" json:"imgIds,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddGrowthRecordReq) Reset() { + *x = AddGrowthRecordReq{} + mi := &file_pb_plant_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddGrowthRecordReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddGrowthRecordReq) ProtoMessage() {} + +func (x *AddGrowthRecordReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddGrowthRecordReq.ProtoReflect.Descriptor instead. +func (*AddGrowthRecordReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{23} +} + +func (x *AddGrowthRecordReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AddGrowthRecordReq) GetPlantId() string { + if x != nil { + return x.PlantId + } + return "" +} + +func (x *AddGrowthRecordReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *AddGrowthRecordReq) GetImgIds() []string { + if x != nil { + return x.ImgIds + } + return nil +} + +type AddGrowthRecordResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddGrowthRecordResp) Reset() { + *x = AddGrowthRecordResp{} + mi := &file_pb_plant_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddGrowthRecordResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddGrowthRecordResp) ProtoMessage() {} + +func (x *AddGrowthRecordResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddGrowthRecordResp.ProtoReflect.Descriptor instead. +func (*AddGrowthRecordResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{24} +} + +// ========== 百科 ========== +type WikiInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + LatinName string `protobuf:"bytes,3,opt,name=latinName,proto3" json:"latinName,omitempty"` + Aliases string `protobuf:"bytes,4,opt,name=aliases,proto3" json:"aliases,omitempty"` + Genus string `protobuf:"bytes,5,opt,name=genus,proto3" json:"genus,omitempty"` + Difficulty int32 `protobuf:"varint,6,opt,name=difficulty,proto3" json:"difficulty,omitempty"` + IsHot int32 `protobuf:"varint,7,opt,name=isHot,proto3" json:"isHot,omitempty"` + CreatedAt int64 `protobuf:"varint,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WikiInfo) Reset() { + *x = WikiInfo{} + mi := &file_pb_plant_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WikiInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WikiInfo) ProtoMessage() {} + +func (x *WikiInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WikiInfo.ProtoReflect.Descriptor instead. +func (*WikiInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{25} +} + +func (x *WikiInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *WikiInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *WikiInfo) GetLatinName() string { + if x != nil { + return x.LatinName + } + return "" +} + +func (x *WikiInfo) GetAliases() string { + if x != nil { + return x.Aliases + } + return "" +} + +func (x *WikiInfo) GetGenus() string { + if x != nil { + return x.Genus + } + return "" +} + +func (x *WikiInfo) GetDifficulty() int32 { + if x != nil { + return x.Difficulty + } + return 0 +} + +func (x *WikiInfo) GetIsHot() int32 { + if x != nil { + return x.IsHot + } + return 0 +} + +func (x *WikiInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type GetWikiListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + ClassId string `protobuf:"bytes,4,opt,name=classId,proto3" json:"classId,omitempty"` + IsHot int32 `protobuf:"varint,5,opt,name=isHot,proto3" json:"isHot,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetWikiListReq) Reset() { + *x = GetWikiListReq{} + mi := &file_pb_plant_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetWikiListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWikiListReq) ProtoMessage() {} + +func (x *GetWikiListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWikiListReq.ProtoReflect.Descriptor instead. +func (*GetWikiListReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{26} +} + +func (x *GetWikiListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetWikiListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetWikiListReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetWikiListReq) GetClassId() string { + if x != nil { + return x.ClassId + } + return "" +} + +func (x *GetWikiListReq) GetIsHot() int32 { + if x != nil { + return x.IsHot + } + return 0 +} + +type GetWikiListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*WikiInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetWikiListResp) Reset() { + *x = GetWikiListResp{} + mi := &file_pb_plant_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetWikiListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWikiListResp) ProtoMessage() {} + +func (x *GetWikiListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWikiListResp.ProtoReflect.Descriptor instead. +func (*GetWikiListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{27} +} + +func (x *GetWikiListResp) GetList() []*WikiInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetWikiListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetWikiDetailReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetWikiDetailReq) Reset() { + *x = GetWikiDetailReq{} + mi := &file_pb_plant_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetWikiDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWikiDetailReq) ProtoMessage() {} + +func (x *GetWikiDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWikiDetailReq.ProtoReflect.Descriptor instead. +func (*GetWikiDetailReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{28} +} + +func (x *GetWikiDetailReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetWikiDetailResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Wiki *WikiInfo `protobuf:"bytes,1,opt,name=wiki,proto3" json:"wiki,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetWikiDetailResp) Reset() { + *x = GetWikiDetailResp{} + mi := &file_pb_plant_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetWikiDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWikiDetailResp) ProtoMessage() {} + +func (x *GetWikiDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWikiDetailResp.ProtoReflect.Descriptor instead. +func (*GetWikiDetailResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{29} +} + +func (x *GetWikiDetailResp) GetWiki() *WikiInfo { + if x != nil { + return x.Wiki + } + return nil +} + +type WikiClassInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + OssId string `protobuf:"bytes,3,opt,name=ossId,proto3" json:"ossId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WikiClassInfo) Reset() { + *x = WikiClassInfo{} + mi := &file_pb_plant_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WikiClassInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WikiClassInfo) ProtoMessage() {} + +func (x *WikiClassInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WikiClassInfo.ProtoReflect.Descriptor instead. +func (*WikiClassInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{30} +} + +func (x *WikiClassInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *WikiClassInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *WikiClassInfo) GetOssId() string { + if x != nil { + return x.OssId + } + return "" +} + +type GetWikiClassListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*WikiClassInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetWikiClassListResp) Reset() { + *x = GetWikiClassListResp{} + mi := &file_pb_plant_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetWikiClassListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWikiClassListResp) ProtoMessage() {} + +func (x *GetWikiClassListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWikiClassListResp.ProtoReflect.Descriptor instead. +func (*GetWikiClassListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{31} +} + +func (x *GetWikiClassListResp) GetList() []*WikiClassInfo { + if x != nil { + return x.List + } + return nil +} + +type CreateWikiClassReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OssId string `protobuf:"bytes,2,opt,name=ossId,proto3" json:"ossId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateWikiClassReq) Reset() { + *x = CreateWikiClassReq{} + mi := &file_pb_plant_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateWikiClassReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWikiClassReq) ProtoMessage() {} + +func (x *CreateWikiClassReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWikiClassReq.ProtoReflect.Descriptor instead. +func (*CreateWikiClassReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{32} +} + +func (x *CreateWikiClassReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateWikiClassReq) GetOssId() string { + if x != nil { + return x.OssId + } + return "" +} + +type CreateWikiClassResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateWikiClassResp) Reset() { + *x = CreateWikiClassResp{} + mi := &file_pb_plant_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateWikiClassResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWikiClassResp) ProtoMessage() {} + +func (x *CreateWikiClassResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWikiClassResp.ProtoReflect.Descriptor instead. +func (*CreateWikiClassResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{33} +} + +func (x *CreateWikiClassResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type ToggleStarReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + TargetId string `protobuf:"bytes,2,opt,name=targetId,proto3" json:"targetId,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToggleStarReq) Reset() { + *x = ToggleStarReq{} + mi := &file_pb_plant_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToggleStarReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToggleStarReq) ProtoMessage() {} + +func (x *ToggleStarReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToggleStarReq.ProtoReflect.Descriptor instead. +func (*ToggleStarReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{34} +} + +func (x *ToggleStarReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ToggleStarReq) GetTargetId() string { + if x != nil { + return x.TargetId + } + return "" +} + +func (x *ToggleStarReq) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type ToggleStarResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Starred bool `protobuf:"varint,1,opt,name=starred,proto3" json:"starred,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToggleStarResp) Reset() { + *x = ToggleStarResp{} + mi := &file_pb_plant_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToggleStarResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToggleStarResp) ProtoMessage() {} + +func (x *ToggleStarResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToggleStarResp.ProtoReflect.Descriptor instead. +func (*ToggleStarResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{35} +} + +func (x *ToggleStarResp) GetStarred() bool { + if x != nil { + return x.Starred + } + return false +} + +// ========== 社区 ========== +type PostInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` + ViewCount int32 `protobuf:"varint,5,opt,name=viewCount,proto3" json:"viewCount,omitempty"` + CommentCount int32 `protobuf:"varint,6,opt,name=commentCount,proto3" json:"commentCount,omitempty"` + LikeCount int32 `protobuf:"varint,7,opt,name=likeCount,proto3" json:"likeCount,omitempty"` + StarCount int32 `protobuf:"varint,8,opt,name=starCount,proto3" json:"starCount,omitempty"` + Location string `protobuf:"bytes,9,opt,name=location,proto3" json:"location,omitempty"` + CreatedAt int64 `protobuf:"varint,10,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PostInfo) Reset() { + *x = PostInfo{} + mi := &file_pb_plant_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PostInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostInfo) ProtoMessage() {} + +func (x *PostInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PostInfo.ProtoReflect.Descriptor instead. +func (*PostInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{36} +} + +func (x *PostInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PostInfo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *PostInfo) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *PostInfo) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *PostInfo) GetViewCount() int32 { + if x != nil { + return x.ViewCount + } + return 0 +} + +func (x *PostInfo) GetCommentCount() int32 { + if x != nil { + return x.CommentCount + } + return 0 +} + +func (x *PostInfo) GetLikeCount() int32 { + if x != nil { + return x.LikeCount + } + return 0 +} + +func (x *PostInfo) GetStarCount() int32 { + if x != nil { + return x.StarCount + } + return 0 +} + +func (x *PostInfo) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *PostInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type CreatePostReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` + Location string `protobuf:"bytes,4,opt,name=location,proto3" json:"location,omitempty"` + ImgIds []string `protobuf:"bytes,5,rep,name=imgIds,proto3" json:"imgIds,omitempty"` + TopicId string `protobuf:"bytes,6,opt,name=topicId,proto3" json:"topicId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePostReq) Reset() { + *x = CreatePostReq{} + mi := &file_pb_plant_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePostReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePostReq) ProtoMessage() {} + +func (x *CreatePostReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePostReq.ProtoReflect.Descriptor instead. +func (*CreatePostReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{37} +} + +func (x *CreatePostReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreatePostReq) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *CreatePostReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *CreatePostReq) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *CreatePostReq) GetImgIds() []string { + if x != nil { + return x.ImgIds + } + return nil +} + +func (x *CreatePostReq) GetTopicId() string { + if x != nil { + return x.TopicId + } + return "" +} + +type CreatePostResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePostResp) Reset() { + *x = CreatePostResp{} + mi := &file_pb_plant_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePostResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePostResp) ProtoMessage() {} + +func (x *CreatePostResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePostResp.ProtoReflect.Descriptor instead. +func (*CreatePostResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{38} +} + +func (x *CreatePostResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetPostListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Keyword string `protobuf:"bytes,3,opt,name=keyword,proto3" json:"keyword,omitempty"` + TopicId string `protobuf:"bytes,4,opt,name=topicId,proto3" json:"topicId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPostListReq) Reset() { + *x = GetPostListReq{} + mi := &file_pb_plant_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPostListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPostListReq) ProtoMessage() {} + +func (x *GetPostListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPostListReq.ProtoReflect.Descriptor instead. +func (*GetPostListReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{39} +} + +func (x *GetPostListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetPostListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetPostListReq) GetKeyword() string { + if x != nil { + return x.Keyword + } + return "" +} + +func (x *GetPostListReq) GetTopicId() string { + if x != nil { + return x.TopicId + } + return "" +} + +type GetPostListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*PostInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPostListResp) Reset() { + *x = GetPostListResp{} + mi := &file_pb_plant_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPostListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPostListResp) ProtoMessage() {} + +func (x *GetPostListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPostListResp.ProtoReflect.Descriptor instead. +func (*GetPostListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{40} +} + +func (x *GetPostListResp) GetList() []*PostInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetPostListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetPostDetailReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPostDetailReq) Reset() { + *x = GetPostDetailReq{} + mi := &file_pb_plant_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPostDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPostDetailReq) ProtoMessage() {} + +func (x *GetPostDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPostDetailReq.ProtoReflect.Descriptor instead. +func (*GetPostDetailReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{41} +} + +func (x *GetPostDetailReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetPostDetailResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Post *PostInfo `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetPostDetailResp) Reset() { + *x = GetPostDetailResp{} + mi := &file_pb_plant_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetPostDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPostDetailResp) ProtoMessage() {} + +func (x *GetPostDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetPostDetailResp.ProtoReflect.Descriptor instead. +func (*GetPostDetailResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{42} +} + +func (x *GetPostDetailResp) GetPost() *PostInfo { + if x != nil { + return x.Post + } + return nil +} + +type DeletePostReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeletePostReq) Reset() { + *x = DeletePostReq{} + mi := &file_pb_plant_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeletePostReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePostReq) ProtoMessage() {} + +func (x *DeletePostReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePostReq.ProtoReflect.Descriptor instead. +func (*DeletePostReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{43} +} + +func (x *DeletePostReq) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type DeletePostResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeletePostResp) Reset() { + *x = DeletePostResp{} + mi := &file_pb_plant_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeletePostResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePostResp) ProtoMessage() {} + +func (x *DeletePostResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePostResp.ProtoReflect.Descriptor instead. +func (*DeletePostResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{44} +} + +type CommentPostReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + PostId string `protobuf:"bytes,2,opt,name=postId,proto3" json:"postId,omitempty"` + Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` + ParentId string `protobuf:"bytes,4,opt,name=parentId,proto3" json:"parentId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommentPostReq) Reset() { + *x = CommentPostReq{} + mi := &file_pb_plant_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommentPostReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentPostReq) ProtoMessage() {} + +func (x *CommentPostReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommentPostReq.ProtoReflect.Descriptor instead. +func (*CommentPostReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{45} +} + +func (x *CommentPostReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CommentPostReq) GetPostId() string { + if x != nil { + return x.PostId + } + return "" +} + +func (x *CommentPostReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *CommentPostReq) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +type CommentPostResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommentPostResp) Reset() { + *x = CommentPostResp{} + mi := &file_pb_plant_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommentPostResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentPostResp) ProtoMessage() {} + +func (x *CommentPostResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommentPostResp.ProtoReflect.Descriptor instead. +func (*CommentPostResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{46} +} + +type LikePostReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + PostId string `protobuf:"bytes,2,opt,name=postId,proto3" json:"postId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LikePostReq) Reset() { + *x = LikePostReq{} + mi := &file_pb_plant_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LikePostReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LikePostReq) ProtoMessage() {} + +func (x *LikePostReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LikePostReq.ProtoReflect.Descriptor instead. +func (*LikePostReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{47} +} + +func (x *LikePostReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *LikePostReq) GetPostId() string { + if x != nil { + return x.PostId + } + return "" +} + +type LikePostResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Liked bool `protobuf:"varint,1,opt,name=liked,proto3" json:"liked,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LikePostResp) Reset() { + *x = LikePostResp{} + mi := &file_pb_plant_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LikePostResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LikePostResp) ProtoMessage() {} + +func (x *LikePostResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LikePostResp.ProtoReflect.Descriptor instead. +func (*LikePostResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{48} +} + +func (x *LikePostResp) GetLiked() bool { + if x != nil { + return x.Liked + } + return false +} + +// ========== 话题 ========== +type TopicInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + PostCount int32 `protobuf:"varint,3,opt,name=postCount,proto3" json:"postCount,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopicInfo) Reset() { + *x = TopicInfo{} + mi := &file_pb_plant_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopicInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopicInfo) ProtoMessage() {} + +func (x *TopicInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopicInfo.ProtoReflect.Descriptor instead. +func (*TopicInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{49} +} + +func (x *TopicInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TopicInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TopicInfo) GetPostCount() int32 { + if x != nil { + return x.PostCount + } + return 0 +} + +type GetTopicListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*TopicInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTopicListResp) Reset() { + *x = GetTopicListResp{} + mi := &file_pb_plant_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTopicListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTopicListResp) ProtoMessage() {} + +func (x *GetTopicListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTopicListResp.ProtoReflect.Descriptor instead. +func (*GetTopicListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{50} +} + +func (x *GetTopicListResp) GetList() []*TopicInfo { + if x != nil { + return x.List + } + return nil +} + +type CreateTopicReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateTopicReq) Reset() { + *x = CreateTopicReq{} + mi := &file_pb_plant_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateTopicReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTopicReq) ProtoMessage() {} + +func (x *CreateTopicReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTopicReq.ProtoReflect.Descriptor instead. +func (*CreateTopicReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{51} +} + +func (x *CreateTopicReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CreateTopicResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateTopicResp) Reset() { + *x = CreateTopicResp{} + mi := &file_pb_plant_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateTopicResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateTopicResp) ProtoMessage() {} + +func (x *CreateTopicResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateTopicResp.ProtoReflect.Descriptor instead. +func (*CreateTopicResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{52} +} + +func (x *CreateTopicResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteTopicReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteTopicReq) Reset() { + *x = DeleteTopicReq{} + mi := &file_pb_plant_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteTopicReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTopicReq) ProtoMessage() {} + +func (x *DeleteTopicReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTopicReq.ProtoReflect.Descriptor instead. +func (*DeleteTopicReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{53} +} + +func (x *DeleteTopicReq) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type DeleteTopicResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteTopicResp) Reset() { + *x = DeleteTopicResp{} + mi := &file_pb_plant_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteTopicResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTopicResp) ProtoMessage() {} + +func (x *DeleteTopicResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTopicResp.ProtoReflect.Descriptor instead. +func (*DeleteTopicResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{54} +} + +// ========== 配置 ========== +type LevelConfigInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Level int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + MinSunlight int64 `protobuf:"varint,4,opt,name=minSunlight,proto3" json:"minSunlight,omitempty"` + Perks string `protobuf:"bytes,5,opt,name=perks,proto3" json:"perks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LevelConfigInfo) Reset() { + *x = LevelConfigInfo{} + mi := &file_pb_plant_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LevelConfigInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LevelConfigInfo) ProtoMessage() {} + +func (x *LevelConfigInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LevelConfigInfo.ProtoReflect.Descriptor instead. +func (*LevelConfigInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{55} +} + +func (x *LevelConfigInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *LevelConfigInfo) GetLevel() int32 { + if x != nil { + return x.Level + } + return 0 +} + +func (x *LevelConfigInfo) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *LevelConfigInfo) GetMinSunlight() int64 { + if x != nil { + return x.MinSunlight + } + return 0 +} + +func (x *LevelConfigInfo) GetPerks() string { + if x != nil { + return x.Perks + } + return "" +} + +type GetLevelConfigListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLevelConfigListReq) Reset() { + *x = GetLevelConfigListReq{} + mi := &file_pb_plant_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLevelConfigListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLevelConfigListReq) ProtoMessage() {} + +func (x *GetLevelConfigListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[56] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLevelConfigListReq.ProtoReflect.Descriptor instead. +func (*GetLevelConfigListReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{56} +} + +func (x *GetLevelConfigListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetLevelConfigListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetLevelConfigListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*LevelConfigInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLevelConfigListResp) Reset() { + *x = GetLevelConfigListResp{} + mi := &file_pb_plant_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLevelConfigListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLevelConfigListResp) ProtoMessage() {} + +func (x *GetLevelConfigListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[57] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLevelConfigListResp.ProtoReflect.Descriptor instead. +func (*GetLevelConfigListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{57} +} + +func (x *GetLevelConfigListResp) GetList() []*LevelConfigInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetLevelConfigListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type BadgeConfigInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Dimension string `protobuf:"bytes,4,opt,name=dimension,proto3" json:"dimension,omitempty"` + GroupId string `protobuf:"bytes,5,opt,name=groupId,proto3" json:"groupId,omitempty"` + Tier int32 `protobuf:"varint,6,opt,name=tier,proto3" json:"tier,omitempty"` + TargetAction string `protobuf:"bytes,7,opt,name=targetAction,proto3" json:"targetAction,omitempty"` + Threshold int64 `protobuf:"varint,8,opt,name=threshold,proto3" json:"threshold,omitempty"` + RewardSunlight int64 `protobuf:"varint,9,opt,name=rewardSunlight,proto3" json:"rewardSunlight,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BadgeConfigInfo) Reset() { + *x = BadgeConfigInfo{} + mi := &file_pb_plant_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BadgeConfigInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BadgeConfigInfo) ProtoMessage() {} + +func (x *BadgeConfigInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[58] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BadgeConfigInfo.ProtoReflect.Descriptor instead. +func (*BadgeConfigInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{58} +} + +func (x *BadgeConfigInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *BadgeConfigInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BadgeConfigInfo) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *BadgeConfigInfo) GetDimension() string { + if x != nil { + return x.Dimension + } + return "" +} + +func (x *BadgeConfigInfo) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *BadgeConfigInfo) GetTier() int32 { + if x != nil { + return x.Tier + } + return 0 +} + +func (x *BadgeConfigInfo) GetTargetAction() string { + if x != nil { + return x.TargetAction + } + return "" +} + +func (x *BadgeConfigInfo) GetThreshold() int64 { + if x != nil { + return x.Threshold + } + return 0 +} + +func (x *BadgeConfigInfo) GetRewardSunlight() int64 { + if x != nil { + return x.RewardSunlight + } + return 0 +} + +type GetBadgeConfigListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + Dimension string `protobuf:"bytes,3,opt,name=dimension,proto3" json:"dimension,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBadgeConfigListReq) Reset() { + *x = GetBadgeConfigListReq{} + mi := &file_pb_plant_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBadgeConfigListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBadgeConfigListReq) ProtoMessage() {} + +func (x *GetBadgeConfigListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[59] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBadgeConfigListReq.ProtoReflect.Descriptor instead. +func (*GetBadgeConfigListReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{59} +} + +func (x *GetBadgeConfigListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetBadgeConfigListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetBadgeConfigListReq) GetDimension() string { + if x != nil { + return x.Dimension + } + return "" +} + +type GetBadgeConfigListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*BadgeConfigInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBadgeConfigListResp) Reset() { + *x = GetBadgeConfigListResp{} + mi := &file_pb_plant_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBadgeConfigListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBadgeConfigListResp) ProtoMessage() {} + +func (x *GetBadgeConfigListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[60] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBadgeConfigListResp.ProtoReflect.Descriptor instead. +func (*GetBadgeConfigListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{60} +} + +func (x *GetBadgeConfigListResp) GetList() []*BadgeConfigInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetBadgeConfigListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +// ========== 兑换 ========== +type ExchangeItemInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Desc string `protobuf:"bytes,3,opt,name=desc,proto3" json:"desc,omitempty"` + Cost int64 `protobuf:"varint,4,opt,name=cost,proto3" json:"cost,omitempty"` + Stock int32 `protobuf:"varint,5,opt,name=stock,proto3" json:"stock,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExchangeItemInfo) Reset() { + *x = ExchangeItemInfo{} + mi := &file_pb_plant_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExchangeItemInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExchangeItemInfo) ProtoMessage() {} + +func (x *ExchangeItemInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[61] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExchangeItemInfo.ProtoReflect.Descriptor instead. +func (*ExchangeItemInfo) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{61} +} + +func (x *ExchangeItemInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ExchangeItemInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ExchangeItemInfo) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +func (x *ExchangeItemInfo) GetCost() int64 { + if x != nil { + return x.Cost + } + return 0 +} + +func (x *ExchangeItemInfo) GetStock() int32 { + if x != nil { + return x.Stock + } + return 0 +} + +type GetExchangeItemListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetExchangeItemListReq) Reset() { + *x = GetExchangeItemListReq{} + mi := &file_pb_plant_proto_msgTypes[62] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetExchangeItemListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExchangeItemListReq) ProtoMessage() {} + +func (x *GetExchangeItemListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[62] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExchangeItemListReq.ProtoReflect.Descriptor instead. +func (*GetExchangeItemListReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{62} +} + +func (x *GetExchangeItemListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetExchangeItemListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetExchangeItemListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*ExchangeItemInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetExchangeItemListResp) Reset() { + *x = GetExchangeItemListResp{} + mi := &file_pb_plant_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetExchangeItemListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExchangeItemListResp) ProtoMessage() {} + +func (x *GetExchangeItemListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[63] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExchangeItemListResp.ProtoReflect.Descriptor instead. +func (*GetExchangeItemListResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{63} +} + +func (x *GetExchangeItemListResp) GetList() []*ExchangeItemInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetExchangeItemListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type CreateExchangeOrderReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + ItemId string `protobuf:"bytes,2,opt,name=itemId,proto3" json:"itemId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateExchangeOrderReq) Reset() { + *x = CreateExchangeOrderReq{} + mi := &file_pb_plant_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateExchangeOrderReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateExchangeOrderReq) ProtoMessage() {} + +func (x *CreateExchangeOrderReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[64] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateExchangeOrderReq.ProtoReflect.Descriptor instead. +func (*CreateExchangeOrderReq) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{64} +} + +func (x *CreateExchangeOrderReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreateExchangeOrderReq) GetItemId() string { + if x != nil { + return x.ItemId + } + return "" +} + +type CreateExchangeOrderResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateExchangeOrderResp) Reset() { + *x = CreateExchangeOrderResp{} + mi := &file_pb_plant_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateExchangeOrderResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateExchangeOrderResp) ProtoMessage() {} + +func (x *CreateExchangeOrderResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[65] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateExchangeOrderResp.ProtoReflect.Descriptor instead. +func (*CreateExchangeOrderResp) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{65} +} + +func (x *CreateExchangeOrderResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +// ========== 通用 ========== +type Empty struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Empty) Reset() { + *x = Empty{} + mi := &file_pb_plant_proto_msgTypes[66] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_pb_plant_proto_msgTypes[66] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_pb_plant_proto_rawDescGZIP(), []int{66} +} + +var File_pb_plant_proto protoreflect.FileDescriptor + +const file_pb_plant_proto_rawDesc = "" + + "\n" + + "\x0epb/plant.proto\x12\x05plant\"\xdb\x03\n" + + "\vUserProfile\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x1a\n" + + "\bnickName\x18\x03 \x01(\tR\bnickName\x12\x1a\n" + + "\bavatarId\x18\x04 \x01(\tR\bavatarId\x12\x18\n" + + "\alevelId\x18\x05 \x01(\tR\alevelId\x12(\n" + + "\x0fcurrentSunlight\x18\x06 \x01(\x03R\x0fcurrentSunlight\x12$\n" + + "\rtotalSunlight\x18\a \x01(\x03R\rtotalSunlight\x12\x1e\n" + + "\n" + + "plantCount\x18\b \x01(\x03R\n" + + "plantCount\x12\x1c\n" + + "\tcareCount\x18\t \x01(\x03R\tcareCount\x12\x1c\n" + + "\tpostCount\x18\n" + + " \x01(\x03R\tpostCount\x12\x1e\n" + + "\n" + + "waterCount\x18\v \x01(\x03R\n" + + "waterCount\x12&\n" + + "\x0efertilizeCount\x18\f \x01(\x03R\x0efertilizeCount\x12\x1e\n" + + "\n" + + "repotCount\x18\r \x01(\x03R\n" + + "repotCount\x12\x1e\n" + + "\n" + + "pruneCount\x18\x0e \x01(\x03R\n" + + "pruneCount\x12\x1e\n" + + "\n" + + "photoCount\x18\x0f \x01(\x03R\n" + + "photoCount\"+\n" + + "\x11GetUserProfileReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\"B\n" + + "\x12GetUserProfileResp\x12,\n" + + "\aprofile\x18\x01 \x01(\v2\x12.plant.UserProfileR\aprofile\"f\n" + + "\x14UpdateUserProfileReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1a\n" + + "\bnickName\x18\x02 \x01(\tR\bnickName\x12\x1a\n" + + "\bavatarId\x18\x03 \x01(\tR\bavatarId\"\x17\n" + + "\x15UpdateUserProfileResp\"X\n" + + "\x12IncrUserCounterReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x14\n" + + "\x05field\x18\x02 \x01(\tR\x05field\x12\x14\n" + + "\x05delta\x18\x03 \x01(\x03R\x05delta\"\x15\n" + + "\x13IncrUserCounterResp\"\xd5\x02\n" + + "\tPlantInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x1c\n" + + "\tplantTime\x18\x04 \x01(\tR\tplantTime\x12\x16\n" + + "\x06status\x18\x05 \x01(\x05R\x06status\x12\x1c\n" + + "\tplacement\x18\x06 \x01(\tR\tplacement\x12 \n" + + "\vpotMaterial\x18\a \x01(\tR\vpotMaterial\x12\x18\n" + + "\apotSize\x18\b \x01(\tR\apotSize\x12\x1a\n" + + "\bsunlight\x18\t \x01(\tR\bsunlight\x12*\n" + + "\x10plantingMaterial\x18\n" + + " \x01(\tR\x10plantingMaterial\x12\x16\n" + + "\x06imgIds\x18\v \x03(\tR\x06imgIds\x12\x1c\n" + + "\tcreatedAt\x18\f \x01(\x03R\tcreatedAt\"\x94\x02\n" + + "\x0eCreatePlantReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + + "\tplantTime\x18\x03 \x01(\tR\tplantTime\x12\x1c\n" + + "\tplacement\x18\x04 \x01(\tR\tplacement\x12 \n" + + "\vpotMaterial\x18\x05 \x01(\tR\vpotMaterial\x12\x18\n" + + "\apotSize\x18\x06 \x01(\tR\apotSize\x12\x1a\n" + + "\bsunlight\x18\a \x01(\tR\bsunlight\x12*\n" + + "\x10plantingMaterial\x18\b \x01(\tR\x10plantingMaterial\x12\x16\n" + + "\x06imgIds\x18\t \x03(\tR\x06imgIds\"!\n" + + "\x0fCreatePlantResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\xee\x01\n" + + "\x0eUpdatePlantReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" + + "\x06status\x18\x03 \x01(\x05R\x06status\x12\x1c\n" + + "\tplacement\x18\x04 \x01(\tR\tplacement\x12 \n" + + "\vpotMaterial\x18\x05 \x01(\tR\vpotMaterial\x12\x18\n" + + "\apotSize\x18\x06 \x01(\tR\apotSize\x12\x1a\n" + + "\bsunlight\x18\a \x01(\tR\bsunlight\x12*\n" + + "\x10plantingMaterial\x18\b \x01(\tR\x10plantingMaterial\"\x11\n" + + "\x0fUpdatePlantResp\"\"\n" + + "\x0eDeletePlantReq\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\"\x11\n" + + "\x0fDeletePlantResp\"s\n" + + "\x0fGetPlantListReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + + "\acurrent\x18\x02 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x03 \x01(\x05R\bpageSize\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\"N\n" + + "\x10GetPlantListResp\x12$\n" + + "\x04list\x18\x01 \x03(\v2\x10.plant.PlantInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"#\n" + + "\x11GetPlantDetailReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"<\n" + + "\x12GetPlantDetailResp\x12&\n" + + "\x05plant\x18\x01 \x01(\v2\x10.plant.PlantInfoR\x05plant\"\xb4\x01\n" + + "\fCarePlanInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x18\n" + + "\aplantId\x18\x03 \x01(\tR\aplantId\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x12\x12\n" + + "\x04icon\x18\x05 \x01(\tR\x04icon\x12\"\n" + + "\ftargetAction\x18\x06 \x01(\tR\ftargetAction\x12\x16\n" + + "\x06period\x18\a \x01(\x05R\x06period\"\xa6\x01\n" + + "\x0eAddCarePlanReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + + "\aplantId\x18\x02 \x01(\tR\aplantId\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x12\n" + + "\x04icon\x18\x04 \x01(\tR\x04icon\x12\"\n" + + "\ftargetAction\x18\x05 \x01(\tR\ftargetAction\x12\x16\n" + + "\x06period\x18\x06 \x01(\x05R\x06period\"!\n" + + "\x0fAddCarePlanResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\x88\x01\n" + + "\x10AddCareRecordReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + + "\aplantId\x18\x02 \x01(\tR\aplantId\x12\x16\n" + + "\x06planId\x18\x03 \x01(\tR\x06planId\x12\x16\n" + + "\x06action\x18\x04 \x01(\tR\x06action\x12\x12\n" + + "\x04note\x18\x05 \x01(\tR\x04note\"\x13\n" + + "\x11AddCareRecordResp\"x\n" + + "\x12AddGrowthRecordReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + + "\aplantId\x18\x02 \x01(\tR\aplantId\x12\x18\n" + + "\acontent\x18\x03 \x01(\tR\acontent\x12\x16\n" + + "\x06imgIds\x18\x04 \x03(\tR\x06imgIds\"\x15\n" + + "\x13AddGrowthRecordResp\"\xd0\x01\n" + + "\bWikiInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + + "\tlatinName\x18\x03 \x01(\tR\tlatinName\x12\x18\n" + + "\aaliases\x18\x04 \x01(\tR\aaliases\x12\x14\n" + + "\x05genus\x18\x05 \x01(\tR\x05genus\x12\x1e\n" + + "\n" + + "difficulty\x18\x06 \x01(\x05R\n" + + "difficulty\x12\x14\n" + + "\x05isHot\x18\a \x01(\x05R\x05isHot\x12\x1c\n" + + "\tcreatedAt\x18\b \x01(\x03R\tcreatedAt\"\x8a\x01\n" + + "\x0eGetWikiListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x18\n" + + "\aclassId\x18\x04 \x01(\tR\aclassId\x12\x14\n" + + "\x05isHot\x18\x05 \x01(\x05R\x05isHot\"L\n" + + "\x0fGetWikiListResp\x12#\n" + + "\x04list\x18\x01 \x03(\v2\x0f.plant.WikiInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\"\n" + + "\x10GetWikiDetailReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"8\n" + + "\x11GetWikiDetailResp\x12#\n" + + "\x04wiki\x18\x01 \x01(\v2\x0f.plant.WikiInfoR\x04wiki\"I\n" + + "\rWikiClassInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + + "\x05ossId\x18\x03 \x01(\tR\x05ossId\"@\n" + + "\x14GetWikiClassListResp\x12(\n" + + "\x04list\x18\x01 \x03(\v2\x14.plant.WikiClassInfoR\x04list\">\n" + + "\x12CreateWikiClassReq\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05ossId\x18\x02 \x01(\tR\x05ossId\"%\n" + + "\x13CreateWikiClassResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"W\n" + + "\rToggleStarReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1a\n" + + "\btargetId\x18\x02 \x01(\tR\btargetId\x12\x12\n" + + "\x04type\x18\x03 \x01(\tR\x04type\"*\n" + + "\x0eToggleStarResp\x12\x18\n" + + "\astarred\x18\x01 \x01(\bR\astarred\"\x9a\x02\n" + + "\bPostInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12\x18\n" + + "\acontent\x18\x04 \x01(\tR\acontent\x12\x1c\n" + + "\tviewCount\x18\x05 \x01(\x05R\tviewCount\x12\"\n" + + "\fcommentCount\x18\x06 \x01(\x05R\fcommentCount\x12\x1c\n" + + "\tlikeCount\x18\a \x01(\x05R\tlikeCount\x12\x1c\n" + + "\tstarCount\x18\b \x01(\x05R\tstarCount\x12\x1a\n" + + "\blocation\x18\t \x01(\tR\blocation\x12\x1c\n" + + "\tcreatedAt\x18\n" + + " \x01(\x03R\tcreatedAt\"\xa5\x01\n" + + "\rCreatePostReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x14\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12\x18\n" + + "\acontent\x18\x03 \x01(\tR\acontent\x12\x1a\n" + + "\blocation\x18\x04 \x01(\tR\blocation\x12\x16\n" + + "\x06imgIds\x18\x05 \x03(\tR\x06imgIds\x12\x18\n" + + "\atopicId\x18\x06 \x01(\tR\atopicId\" \n" + + "\x0eCreatePostResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"z\n" + + "\x0eGetPostListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x18\n" + + "\akeyword\x18\x03 \x01(\tR\akeyword\x12\x18\n" + + "\atopicId\x18\x04 \x01(\tR\atopicId\"L\n" + + "\x0fGetPostListResp\x12#\n" + + "\x04list\x18\x01 \x03(\v2\x0f.plant.PostInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\"\n" + + "\x10GetPostDetailReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"8\n" + + "\x11GetPostDetailResp\x12#\n" + + "\x04post\x18\x01 \x01(\v2\x0f.plant.PostInfoR\x04post\"!\n" + + "\rDeletePostReq\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\"\x10\n" + + "\x0eDeletePostResp\"v\n" + + "\x0eCommentPostReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x16\n" + + "\x06postId\x18\x02 \x01(\tR\x06postId\x12\x18\n" + + "\acontent\x18\x03 \x01(\tR\acontent\x12\x1a\n" + + "\bparentId\x18\x04 \x01(\tR\bparentId\"\x11\n" + + "\x0fCommentPostResp\"=\n" + + "\vLikePostReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x16\n" + + "\x06postId\x18\x02 \x01(\tR\x06postId\"$\n" + + "\fLikePostResp\x12\x14\n" + + "\x05liked\x18\x01 \x01(\bR\x05liked\"M\n" + + "\tTopicInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + + "\tpostCount\x18\x03 \x01(\x05R\tpostCount\"8\n" + + "\x10GetTopicListResp\x12$\n" + + "\x04list\x18\x01 \x03(\v2\x10.plant.TopicInfoR\x04list\"$\n" + + "\x0eCreateTopicReq\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"!\n" + + "\x0fCreateTopicResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\"\n" + + "\x0eDeleteTopicReq\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\"\x11\n" + + "\x0fDeleteTopicResp\"\x85\x01\n" + + "\x0fLevelConfigInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" + + "\x05level\x18\x02 \x01(\x05R\x05level\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + + "\vminSunlight\x18\x04 \x01(\x03R\vminSunlight\x12\x14\n" + + "\x05perks\x18\x05 \x01(\tR\x05perks\"M\n" + + "\x15GetLevelConfigListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"Z\n" + + "\x16GetLevelConfigListResp\x12*\n" + + "\x04list\x18\x01 \x03(\v2\x16.plant.LevelConfigInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\x8d\x02\n" + + "\x0fBadgeConfigInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x1c\n" + + "\tdimension\x18\x04 \x01(\tR\tdimension\x12\x18\n" + + "\agroupId\x18\x05 \x01(\tR\agroupId\x12\x12\n" + + "\x04tier\x18\x06 \x01(\x05R\x04tier\x12\"\n" + + "\ftargetAction\x18\a \x01(\tR\ftargetAction\x12\x1c\n" + + "\tthreshold\x18\b \x01(\x03R\tthreshold\x12&\n" + + "\x0erewardSunlight\x18\t \x01(\x03R\x0erewardSunlight\"k\n" + + "\x15GetBadgeConfigListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x1c\n" + + "\tdimension\x18\x03 \x01(\tR\tdimension\"Z\n" + + "\x16GetBadgeConfigListResp\x12*\n" + + "\x04list\x18\x01 \x03(\v2\x16.plant.BadgeConfigInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"t\n" + + "\x10ExchangeItemInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04desc\x18\x03 \x01(\tR\x04desc\x12\x12\n" + + "\x04cost\x18\x04 \x01(\x03R\x04cost\x12\x14\n" + + "\x05stock\x18\x05 \x01(\x05R\x05stock\"N\n" + + "\x16GetExchangeItemListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"\\\n" + + "\x17GetExchangeItemListResp\x12+\n" + + "\x04list\x18\x01 \x03(\v2\x17.plant.ExchangeItemInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"H\n" + + "\x16CreateExchangeOrderReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x16\n" + + "\x06itemId\x18\x02 \x01(\tR\x06itemId\")\n" + + "\x17CreateExchangeOrderResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\a\n" + + "\x05Empty2\xb3\x0f\n" + + "\fPlantService\x12E\n" + + "\x0eGetUserProfile\x12\x18.plant.GetUserProfileReq\x1a\x19.plant.GetUserProfileResp\x12N\n" + + "\x11UpdateUserProfile\x12\x1b.plant.UpdateUserProfileReq\x1a\x1c.plant.UpdateUserProfileResp\x12H\n" + + "\x0fIncrUserCounter\x12\x19.plant.IncrUserCounterReq\x1a\x1a.plant.IncrUserCounterResp\x12<\n" + + "\vCreatePlant\x12\x15.plant.CreatePlantReq\x1a\x16.plant.CreatePlantResp\x12<\n" + + "\vUpdatePlant\x12\x15.plant.UpdatePlantReq\x1a\x16.plant.UpdatePlantResp\x12<\n" + + "\vDeletePlant\x12\x15.plant.DeletePlantReq\x1a\x16.plant.DeletePlantResp\x12?\n" + + "\fGetPlantList\x12\x16.plant.GetPlantListReq\x1a\x17.plant.GetPlantListResp\x12E\n" + + "\x0eGetPlantDetail\x12\x18.plant.GetPlantDetailReq\x1a\x19.plant.GetPlantDetailResp\x12<\n" + + "\vAddCarePlan\x12\x15.plant.AddCarePlanReq\x1a\x16.plant.AddCarePlanResp\x12B\n" + + "\rAddCareRecord\x12\x17.plant.AddCareRecordReq\x1a\x18.plant.AddCareRecordResp\x12H\n" + + "\x0fAddGrowthRecord\x12\x19.plant.AddGrowthRecordReq\x1a\x1a.plant.AddGrowthRecordResp\x12<\n" + + "\vGetWikiList\x12\x15.plant.GetWikiListReq\x1a\x16.plant.GetWikiListResp\x12B\n" + + "\rGetWikiDetail\x12\x17.plant.GetWikiDetailReq\x1a\x18.plant.GetWikiDetailResp\x12=\n" + + "\x10GetWikiClassList\x12\f.plant.Empty\x1a\x1b.plant.GetWikiClassListResp\x12H\n" + + "\x0fCreateWikiClass\x12\x19.plant.CreateWikiClassReq\x1a\x1a.plant.CreateWikiClassResp\x129\n" + + "\n" + + "ToggleStar\x12\x14.plant.ToggleStarReq\x1a\x15.plant.ToggleStarResp\x129\n" + + "\n" + + "CreatePost\x12\x14.plant.CreatePostReq\x1a\x15.plant.CreatePostResp\x12<\n" + + "\vGetPostList\x12\x15.plant.GetPostListReq\x1a\x16.plant.GetPostListResp\x12B\n" + + "\rGetPostDetail\x12\x17.plant.GetPostDetailReq\x1a\x18.plant.GetPostDetailResp\x129\n" + + "\n" + + "DeletePost\x12\x14.plant.DeletePostReq\x1a\x15.plant.DeletePostResp\x12<\n" + + "\vCommentPost\x12\x15.plant.CommentPostReq\x1a\x16.plant.CommentPostResp\x123\n" + + "\bLikePost\x12\x12.plant.LikePostReq\x1a\x13.plant.LikePostResp\x125\n" + + "\fGetTopicList\x12\f.plant.Empty\x1a\x17.plant.GetTopicListResp\x12<\n" + + "\vCreateTopic\x12\x15.plant.CreateTopicReq\x1a\x16.plant.CreateTopicResp\x12<\n" + + "\vDeleteTopic\x12\x15.plant.DeleteTopicReq\x1a\x16.plant.DeleteTopicResp\x12Q\n" + + "\x12GetLevelConfigList\x12\x1c.plant.GetLevelConfigListReq\x1a\x1d.plant.GetLevelConfigListResp\x12Q\n" + + "\x12GetBadgeConfigList\x12\x1c.plant.GetBadgeConfigListReq\x1a\x1d.plant.GetBadgeConfigListResp\x12T\n" + + "\x13GetExchangeItemList\x12\x1d.plant.GetExchangeItemListReq\x1a\x1e.plant.GetExchangeItemListResp\x12T\n" + + "\x13CreateExchangeOrder\x12\x1d.plant.CreateExchangeOrderReq\x1a\x1e.plant.CreateExchangeOrderRespB\tZ\a./plantb\x06proto3" + +var ( + file_pb_plant_proto_rawDescOnce sync.Once + file_pb_plant_proto_rawDescData []byte +) + +func file_pb_plant_proto_rawDescGZIP() []byte { + file_pb_plant_proto_rawDescOnce.Do(func() { + file_pb_plant_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_plant_proto_rawDesc), len(file_pb_plant_proto_rawDesc))) + }) + return file_pb_plant_proto_rawDescData +} + +var file_pb_plant_proto_msgTypes = make([]protoimpl.MessageInfo, 67) +var file_pb_plant_proto_goTypes = []any{ + (*UserProfile)(nil), // 0: plant.UserProfile + (*GetUserProfileReq)(nil), // 1: plant.GetUserProfileReq + (*GetUserProfileResp)(nil), // 2: plant.GetUserProfileResp + (*UpdateUserProfileReq)(nil), // 3: plant.UpdateUserProfileReq + (*UpdateUserProfileResp)(nil), // 4: plant.UpdateUserProfileResp + (*IncrUserCounterReq)(nil), // 5: plant.IncrUserCounterReq + (*IncrUserCounterResp)(nil), // 6: plant.IncrUserCounterResp + (*PlantInfo)(nil), // 7: plant.PlantInfo + (*CreatePlantReq)(nil), // 8: plant.CreatePlantReq + (*CreatePlantResp)(nil), // 9: plant.CreatePlantResp + (*UpdatePlantReq)(nil), // 10: plant.UpdatePlantReq + (*UpdatePlantResp)(nil), // 11: plant.UpdatePlantResp + (*DeletePlantReq)(nil), // 12: plant.DeletePlantReq + (*DeletePlantResp)(nil), // 13: plant.DeletePlantResp + (*GetPlantListReq)(nil), // 14: plant.GetPlantListReq + (*GetPlantListResp)(nil), // 15: plant.GetPlantListResp + (*GetPlantDetailReq)(nil), // 16: plant.GetPlantDetailReq + (*GetPlantDetailResp)(nil), // 17: plant.GetPlantDetailResp + (*CarePlanInfo)(nil), // 18: plant.CarePlanInfo + (*AddCarePlanReq)(nil), // 19: plant.AddCarePlanReq + (*AddCarePlanResp)(nil), // 20: plant.AddCarePlanResp + (*AddCareRecordReq)(nil), // 21: plant.AddCareRecordReq + (*AddCareRecordResp)(nil), // 22: plant.AddCareRecordResp + (*AddGrowthRecordReq)(nil), // 23: plant.AddGrowthRecordReq + (*AddGrowthRecordResp)(nil), // 24: plant.AddGrowthRecordResp + (*WikiInfo)(nil), // 25: plant.WikiInfo + (*GetWikiListReq)(nil), // 26: plant.GetWikiListReq + (*GetWikiListResp)(nil), // 27: plant.GetWikiListResp + (*GetWikiDetailReq)(nil), // 28: plant.GetWikiDetailReq + (*GetWikiDetailResp)(nil), // 29: plant.GetWikiDetailResp + (*WikiClassInfo)(nil), // 30: plant.WikiClassInfo + (*GetWikiClassListResp)(nil), // 31: plant.GetWikiClassListResp + (*CreateWikiClassReq)(nil), // 32: plant.CreateWikiClassReq + (*CreateWikiClassResp)(nil), // 33: plant.CreateWikiClassResp + (*ToggleStarReq)(nil), // 34: plant.ToggleStarReq + (*ToggleStarResp)(nil), // 35: plant.ToggleStarResp + (*PostInfo)(nil), // 36: plant.PostInfo + (*CreatePostReq)(nil), // 37: plant.CreatePostReq + (*CreatePostResp)(nil), // 38: plant.CreatePostResp + (*GetPostListReq)(nil), // 39: plant.GetPostListReq + (*GetPostListResp)(nil), // 40: plant.GetPostListResp + (*GetPostDetailReq)(nil), // 41: plant.GetPostDetailReq + (*GetPostDetailResp)(nil), // 42: plant.GetPostDetailResp + (*DeletePostReq)(nil), // 43: plant.DeletePostReq + (*DeletePostResp)(nil), // 44: plant.DeletePostResp + (*CommentPostReq)(nil), // 45: plant.CommentPostReq + (*CommentPostResp)(nil), // 46: plant.CommentPostResp + (*LikePostReq)(nil), // 47: plant.LikePostReq + (*LikePostResp)(nil), // 48: plant.LikePostResp + (*TopicInfo)(nil), // 49: plant.TopicInfo + (*GetTopicListResp)(nil), // 50: plant.GetTopicListResp + (*CreateTopicReq)(nil), // 51: plant.CreateTopicReq + (*CreateTopicResp)(nil), // 52: plant.CreateTopicResp + (*DeleteTopicReq)(nil), // 53: plant.DeleteTopicReq + (*DeleteTopicResp)(nil), // 54: plant.DeleteTopicResp + (*LevelConfigInfo)(nil), // 55: plant.LevelConfigInfo + (*GetLevelConfigListReq)(nil), // 56: plant.GetLevelConfigListReq + (*GetLevelConfigListResp)(nil), // 57: plant.GetLevelConfigListResp + (*BadgeConfigInfo)(nil), // 58: plant.BadgeConfigInfo + (*GetBadgeConfigListReq)(nil), // 59: plant.GetBadgeConfigListReq + (*GetBadgeConfigListResp)(nil), // 60: plant.GetBadgeConfigListResp + (*ExchangeItemInfo)(nil), // 61: plant.ExchangeItemInfo + (*GetExchangeItemListReq)(nil), // 62: plant.GetExchangeItemListReq + (*GetExchangeItemListResp)(nil), // 63: plant.GetExchangeItemListResp + (*CreateExchangeOrderReq)(nil), // 64: plant.CreateExchangeOrderReq + (*CreateExchangeOrderResp)(nil), // 65: plant.CreateExchangeOrderResp + (*Empty)(nil), // 66: plant.Empty +} +var file_pb_plant_proto_depIdxs = []int32{ + 0, // 0: plant.GetUserProfileResp.profile:type_name -> plant.UserProfile + 7, // 1: plant.GetPlantListResp.list:type_name -> plant.PlantInfo + 7, // 2: plant.GetPlantDetailResp.plant:type_name -> plant.PlantInfo + 25, // 3: plant.GetWikiListResp.list:type_name -> plant.WikiInfo + 25, // 4: plant.GetWikiDetailResp.wiki:type_name -> plant.WikiInfo + 30, // 5: plant.GetWikiClassListResp.list:type_name -> plant.WikiClassInfo + 36, // 6: plant.GetPostListResp.list:type_name -> plant.PostInfo + 36, // 7: plant.GetPostDetailResp.post:type_name -> plant.PostInfo + 49, // 8: plant.GetTopicListResp.list:type_name -> plant.TopicInfo + 55, // 9: plant.GetLevelConfigListResp.list:type_name -> plant.LevelConfigInfo + 58, // 10: plant.GetBadgeConfigListResp.list:type_name -> plant.BadgeConfigInfo + 61, // 11: plant.GetExchangeItemListResp.list:type_name -> plant.ExchangeItemInfo + 1, // 12: plant.PlantService.GetUserProfile:input_type -> plant.GetUserProfileReq + 3, // 13: plant.PlantService.UpdateUserProfile:input_type -> plant.UpdateUserProfileReq + 5, // 14: plant.PlantService.IncrUserCounter:input_type -> plant.IncrUserCounterReq + 8, // 15: plant.PlantService.CreatePlant:input_type -> plant.CreatePlantReq + 10, // 16: plant.PlantService.UpdatePlant:input_type -> plant.UpdatePlantReq + 12, // 17: plant.PlantService.DeletePlant:input_type -> plant.DeletePlantReq + 14, // 18: plant.PlantService.GetPlantList:input_type -> plant.GetPlantListReq + 16, // 19: plant.PlantService.GetPlantDetail:input_type -> plant.GetPlantDetailReq + 19, // 20: plant.PlantService.AddCarePlan:input_type -> plant.AddCarePlanReq + 21, // 21: plant.PlantService.AddCareRecord:input_type -> plant.AddCareRecordReq + 23, // 22: plant.PlantService.AddGrowthRecord:input_type -> plant.AddGrowthRecordReq + 26, // 23: plant.PlantService.GetWikiList:input_type -> plant.GetWikiListReq + 28, // 24: plant.PlantService.GetWikiDetail:input_type -> plant.GetWikiDetailReq + 66, // 25: plant.PlantService.GetWikiClassList:input_type -> plant.Empty + 32, // 26: plant.PlantService.CreateWikiClass:input_type -> plant.CreateWikiClassReq + 34, // 27: plant.PlantService.ToggleStar:input_type -> plant.ToggleStarReq + 37, // 28: plant.PlantService.CreatePost:input_type -> plant.CreatePostReq + 39, // 29: plant.PlantService.GetPostList:input_type -> plant.GetPostListReq + 41, // 30: plant.PlantService.GetPostDetail:input_type -> plant.GetPostDetailReq + 43, // 31: plant.PlantService.DeletePost:input_type -> plant.DeletePostReq + 45, // 32: plant.PlantService.CommentPost:input_type -> plant.CommentPostReq + 47, // 33: plant.PlantService.LikePost:input_type -> plant.LikePostReq + 66, // 34: plant.PlantService.GetTopicList:input_type -> plant.Empty + 51, // 35: plant.PlantService.CreateTopic:input_type -> plant.CreateTopicReq + 53, // 36: plant.PlantService.DeleteTopic:input_type -> plant.DeleteTopicReq + 56, // 37: plant.PlantService.GetLevelConfigList:input_type -> plant.GetLevelConfigListReq + 59, // 38: plant.PlantService.GetBadgeConfigList:input_type -> plant.GetBadgeConfigListReq + 62, // 39: plant.PlantService.GetExchangeItemList:input_type -> plant.GetExchangeItemListReq + 64, // 40: plant.PlantService.CreateExchangeOrder:input_type -> plant.CreateExchangeOrderReq + 2, // 41: plant.PlantService.GetUserProfile:output_type -> plant.GetUserProfileResp + 4, // 42: plant.PlantService.UpdateUserProfile:output_type -> plant.UpdateUserProfileResp + 6, // 43: plant.PlantService.IncrUserCounter:output_type -> plant.IncrUserCounterResp + 9, // 44: plant.PlantService.CreatePlant:output_type -> plant.CreatePlantResp + 11, // 45: plant.PlantService.UpdatePlant:output_type -> plant.UpdatePlantResp + 13, // 46: plant.PlantService.DeletePlant:output_type -> plant.DeletePlantResp + 15, // 47: plant.PlantService.GetPlantList:output_type -> plant.GetPlantListResp + 17, // 48: plant.PlantService.GetPlantDetail:output_type -> plant.GetPlantDetailResp + 20, // 49: plant.PlantService.AddCarePlan:output_type -> plant.AddCarePlanResp + 22, // 50: plant.PlantService.AddCareRecord:output_type -> plant.AddCareRecordResp + 24, // 51: plant.PlantService.AddGrowthRecord:output_type -> plant.AddGrowthRecordResp + 27, // 52: plant.PlantService.GetWikiList:output_type -> plant.GetWikiListResp + 29, // 53: plant.PlantService.GetWikiDetail:output_type -> plant.GetWikiDetailResp + 31, // 54: plant.PlantService.GetWikiClassList:output_type -> plant.GetWikiClassListResp + 33, // 55: plant.PlantService.CreateWikiClass:output_type -> plant.CreateWikiClassResp + 35, // 56: plant.PlantService.ToggleStar:output_type -> plant.ToggleStarResp + 38, // 57: plant.PlantService.CreatePost:output_type -> plant.CreatePostResp + 40, // 58: plant.PlantService.GetPostList:output_type -> plant.GetPostListResp + 42, // 59: plant.PlantService.GetPostDetail:output_type -> plant.GetPostDetailResp + 44, // 60: plant.PlantService.DeletePost:output_type -> plant.DeletePostResp + 46, // 61: plant.PlantService.CommentPost:output_type -> plant.CommentPostResp + 48, // 62: plant.PlantService.LikePost:output_type -> plant.LikePostResp + 50, // 63: plant.PlantService.GetTopicList:output_type -> plant.GetTopicListResp + 52, // 64: plant.PlantService.CreateTopic:output_type -> plant.CreateTopicResp + 54, // 65: plant.PlantService.DeleteTopic:output_type -> plant.DeleteTopicResp + 57, // 66: plant.PlantService.GetLevelConfigList:output_type -> plant.GetLevelConfigListResp + 60, // 67: plant.PlantService.GetBadgeConfigList:output_type -> plant.GetBadgeConfigListResp + 63, // 68: plant.PlantService.GetExchangeItemList:output_type -> plant.GetExchangeItemListResp + 65, // 69: plant.PlantService.CreateExchangeOrder:output_type -> plant.CreateExchangeOrderResp + 41, // [41:70] is the sub-list for method output_type + 12, // [12:41] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_pb_plant_proto_init() } +func file_pb_plant_proto_init() { + if File_pb_plant_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_plant_proto_rawDesc), len(file_pb_plant_proto_rawDesc)), + NumEnums: 0, + NumMessages: 67, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pb_plant_proto_goTypes, + DependencyIndexes: file_pb_plant_proto_depIdxs, + MessageInfos: file_pb_plant_proto_msgTypes, + }.Build() + File_pb_plant_proto = out.File + file_pb_plant_proto_goTypes = nil + file_pb_plant_proto_depIdxs = nil +} diff --git a/app/plant/rpc/plant/plant_grpc.pb.go b/app/plant/rpc/plant/plant_grpc.pb.go new file mode 100644 index 0000000..8f49c23 --- /dev/null +++ b/app/plant/rpc/plant/plant_grpc.pb.go @@ -0,0 +1,1205 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v7.34.1 +// source: pb/plant.proto + +package plant + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + PlantService_GetUserProfile_FullMethodName = "/plant.PlantService/GetUserProfile" + PlantService_UpdateUserProfile_FullMethodName = "/plant.PlantService/UpdateUserProfile" + PlantService_IncrUserCounter_FullMethodName = "/plant.PlantService/IncrUserCounter" + PlantService_CreatePlant_FullMethodName = "/plant.PlantService/CreatePlant" + PlantService_UpdatePlant_FullMethodName = "/plant.PlantService/UpdatePlant" + PlantService_DeletePlant_FullMethodName = "/plant.PlantService/DeletePlant" + PlantService_GetPlantList_FullMethodName = "/plant.PlantService/GetPlantList" + PlantService_GetPlantDetail_FullMethodName = "/plant.PlantService/GetPlantDetail" + PlantService_AddCarePlan_FullMethodName = "/plant.PlantService/AddCarePlan" + PlantService_AddCareRecord_FullMethodName = "/plant.PlantService/AddCareRecord" + PlantService_AddGrowthRecord_FullMethodName = "/plant.PlantService/AddGrowthRecord" + PlantService_GetWikiList_FullMethodName = "/plant.PlantService/GetWikiList" + PlantService_GetWikiDetail_FullMethodName = "/plant.PlantService/GetWikiDetail" + PlantService_GetWikiClassList_FullMethodName = "/plant.PlantService/GetWikiClassList" + PlantService_CreateWikiClass_FullMethodName = "/plant.PlantService/CreateWikiClass" + PlantService_ToggleStar_FullMethodName = "/plant.PlantService/ToggleStar" + PlantService_CreatePost_FullMethodName = "/plant.PlantService/CreatePost" + PlantService_GetPostList_FullMethodName = "/plant.PlantService/GetPostList" + PlantService_GetPostDetail_FullMethodName = "/plant.PlantService/GetPostDetail" + PlantService_DeletePost_FullMethodName = "/plant.PlantService/DeletePost" + PlantService_CommentPost_FullMethodName = "/plant.PlantService/CommentPost" + PlantService_LikePost_FullMethodName = "/plant.PlantService/LikePost" + PlantService_GetTopicList_FullMethodName = "/plant.PlantService/GetTopicList" + PlantService_CreateTopic_FullMethodName = "/plant.PlantService/CreateTopic" + PlantService_DeleteTopic_FullMethodName = "/plant.PlantService/DeleteTopic" + PlantService_GetLevelConfigList_FullMethodName = "/plant.PlantService/GetLevelConfigList" + PlantService_GetBadgeConfigList_FullMethodName = "/plant.PlantService/GetBadgeConfigList" + PlantService_GetExchangeItemList_FullMethodName = "/plant.PlantService/GetExchangeItemList" + PlantService_CreateExchangeOrder_FullMethodName = "/plant.PlantService/CreateExchangeOrder" +) + +// PlantServiceClient is the client API for PlantService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// ========== 服务定义 ========== +type PlantServiceClient 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) + // 养护 + 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) + // 百科 + 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) + // 社区 + 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) + // 话题 + 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) + // 兑换 + GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error) + CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error) +} + +type plantServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPlantServiceClient(cc grpc.ClientConnInterface) PlantServiceClient { + return &plantServiceClient{cc} +} + +func (c *plantServiceClient) GetUserProfile(ctx context.Context, in *GetUserProfileReq, opts ...grpc.CallOption) (*GetUserProfileResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserProfileResp) + err := c.cc.Invoke(ctx, PlantService_GetUserProfile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) UpdateUserProfile(ctx context.Context, in *UpdateUserProfileReq, opts ...grpc.CallOption) (*UpdateUserProfileResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateUserProfileResp) + err := c.cc.Invoke(ctx, PlantService_UpdateUserProfile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) IncrUserCounter(ctx context.Context, in *IncrUserCounterReq, opts ...grpc.CallOption) (*IncrUserCounterResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(IncrUserCounterResp) + err := c.cc.Invoke(ctx, PlantService_IncrUserCounter_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) CreatePlant(ctx context.Context, in *CreatePlantReq, opts ...grpc.CallOption) (*CreatePlantResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreatePlantResp) + err := c.cc.Invoke(ctx, PlantService_CreatePlant_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) UpdatePlant(ctx context.Context, in *UpdatePlantReq, opts ...grpc.CallOption) (*UpdatePlantResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdatePlantResp) + err := c.cc.Invoke(ctx, PlantService_UpdatePlant_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) DeletePlant(ctx context.Context, in *DeletePlantReq, opts ...grpc.CallOption) (*DeletePlantResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeletePlantResp) + err := c.cc.Invoke(ctx, PlantService_DeletePlant_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetPlantList(ctx context.Context, in *GetPlantListReq, opts ...grpc.CallOption) (*GetPlantListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetPlantListResp) + err := c.cc.Invoke(ctx, PlantService_GetPlantList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetPlantDetail(ctx context.Context, in *GetPlantDetailReq, opts ...grpc.CallOption) (*GetPlantDetailResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetPlantDetailResp) + err := c.cc.Invoke(ctx, PlantService_GetPlantDetail_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) AddCarePlan(ctx context.Context, in *AddCarePlanReq, opts ...grpc.CallOption) (*AddCarePlanResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddCarePlanResp) + err := c.cc.Invoke(ctx, PlantService_AddCarePlan_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) AddCareRecord(ctx context.Context, in *AddCareRecordReq, opts ...grpc.CallOption) (*AddCareRecordResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddCareRecordResp) + err := c.cc.Invoke(ctx, PlantService_AddCareRecord_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) AddGrowthRecord(ctx context.Context, in *AddGrowthRecordReq, opts ...grpc.CallOption) (*AddGrowthRecordResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddGrowthRecordResp) + err := c.cc.Invoke(ctx, PlantService_AddGrowthRecord_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetWikiList(ctx context.Context, in *GetWikiListReq, opts ...grpc.CallOption) (*GetWikiListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetWikiListResp) + err := c.cc.Invoke(ctx, PlantService_GetWikiList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetWikiDetail(ctx context.Context, in *GetWikiDetailReq, opts ...grpc.CallOption) (*GetWikiDetailResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetWikiDetailResp) + err := c.cc.Invoke(ctx, PlantService_GetWikiDetail_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetWikiClassList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetWikiClassListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetWikiClassListResp) + err := c.cc.Invoke(ctx, PlantService_GetWikiClassList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) CreateWikiClass(ctx context.Context, in *CreateWikiClassReq, opts ...grpc.CallOption) (*CreateWikiClassResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateWikiClassResp) + err := c.cc.Invoke(ctx, PlantService_CreateWikiClass_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) ToggleStar(ctx context.Context, in *ToggleStarReq, opts ...grpc.CallOption) (*ToggleStarResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ToggleStarResp) + err := c.cc.Invoke(ctx, PlantService_ToggleStar_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CreatePostResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreatePostResp) + err := c.cc.Invoke(ctx, PlantService_CreatePost_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetPostList(ctx context.Context, in *GetPostListReq, opts ...grpc.CallOption) (*GetPostListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetPostListResp) + err := c.cc.Invoke(ctx, PlantService_GetPostList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetPostDetail(ctx context.Context, in *GetPostDetailReq, opts ...grpc.CallOption) (*GetPostDetailResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetPostDetailResp) + err := c.cc.Invoke(ctx, PlantService_GetPostDetail_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) DeletePost(ctx context.Context, in *DeletePostReq, opts ...grpc.CallOption) (*DeletePostResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeletePostResp) + err := c.cc.Invoke(ctx, PlantService_DeletePost_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) CommentPost(ctx context.Context, in *CommentPostReq, opts ...grpc.CallOption) (*CommentPostResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommentPostResp) + err := c.cc.Invoke(ctx, PlantService_CommentPost_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) LikePost(ctx context.Context, in *LikePostReq, opts ...grpc.CallOption) (*LikePostResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LikePostResp) + err := c.cc.Invoke(ctx, PlantService_LikePost_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetTopicList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetTopicListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetTopicListResp) + err := c.cc.Invoke(ctx, PlantService_GetTopicList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) CreateTopic(ctx context.Context, in *CreateTopicReq, opts ...grpc.CallOption) (*CreateTopicResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateTopicResp) + err := c.cc.Invoke(ctx, PlantService_CreateTopic_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) DeleteTopic(ctx context.Context, in *DeleteTopicReq, opts ...grpc.CallOption) (*DeleteTopicResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteTopicResp) + err := c.cc.Invoke(ctx, PlantService_DeleteTopic_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetLevelConfigList(ctx context.Context, in *GetLevelConfigListReq, opts ...grpc.CallOption) (*GetLevelConfigListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetLevelConfigListResp) + err := c.cc.Invoke(ctx, PlantService_GetLevelConfigList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetBadgeConfigList(ctx context.Context, in *GetBadgeConfigListReq, opts ...grpc.CallOption) (*GetBadgeConfigListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetBadgeConfigListResp) + err := c.cc.Invoke(ctx, PlantService_GetBadgeConfigList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetExchangeItemListResp) + err := c.cc.Invoke(ctx, PlantService_GetExchangeItemList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *plantServiceClient) CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateExchangeOrderResp) + err := c.cc.Invoke(ctx, PlantService_CreateExchangeOrder_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PlantServiceServer is the server API for PlantService service. +// All implementations must embed UnimplementedPlantServiceServer +// for forward compatibility. +// +// ========== 服务定义 ========== +type PlantServiceServer interface { + // 用户Profile + GetUserProfile(context.Context, *GetUserProfileReq) (*GetUserProfileResp, error) + UpdateUserProfile(context.Context, *UpdateUserProfileReq) (*UpdateUserProfileResp, error) + IncrUserCounter(context.Context, *IncrUserCounterReq) (*IncrUserCounterResp, error) + // 植物 + CreatePlant(context.Context, *CreatePlantReq) (*CreatePlantResp, error) + UpdatePlant(context.Context, *UpdatePlantReq) (*UpdatePlantResp, error) + DeletePlant(context.Context, *DeletePlantReq) (*DeletePlantResp, error) + GetPlantList(context.Context, *GetPlantListReq) (*GetPlantListResp, error) + GetPlantDetail(context.Context, *GetPlantDetailReq) (*GetPlantDetailResp, error) + // 养护 + AddCarePlan(context.Context, *AddCarePlanReq) (*AddCarePlanResp, error) + AddCareRecord(context.Context, *AddCareRecordReq) (*AddCareRecordResp, error) + AddGrowthRecord(context.Context, *AddGrowthRecordReq) (*AddGrowthRecordResp, error) + // 百科 + GetWikiList(context.Context, *GetWikiListReq) (*GetWikiListResp, error) + GetWikiDetail(context.Context, *GetWikiDetailReq) (*GetWikiDetailResp, error) + GetWikiClassList(context.Context, *Empty) (*GetWikiClassListResp, error) + CreateWikiClass(context.Context, *CreateWikiClassReq) (*CreateWikiClassResp, error) + ToggleStar(context.Context, *ToggleStarReq) (*ToggleStarResp, error) + // 社区 + CreatePost(context.Context, *CreatePostReq) (*CreatePostResp, error) + GetPostList(context.Context, *GetPostListReq) (*GetPostListResp, error) + GetPostDetail(context.Context, *GetPostDetailReq) (*GetPostDetailResp, error) + DeletePost(context.Context, *DeletePostReq) (*DeletePostResp, error) + CommentPost(context.Context, *CommentPostReq) (*CommentPostResp, error) + LikePost(context.Context, *LikePostReq) (*LikePostResp, error) + // 话题 + GetTopicList(context.Context, *Empty) (*GetTopicListResp, error) + CreateTopic(context.Context, *CreateTopicReq) (*CreateTopicResp, error) + DeleteTopic(context.Context, *DeleteTopicReq) (*DeleteTopicResp, error) + // 配置 + GetLevelConfigList(context.Context, *GetLevelConfigListReq) (*GetLevelConfigListResp, error) + GetBadgeConfigList(context.Context, *GetBadgeConfigListReq) (*GetBadgeConfigListResp, error) + // 兑换 + GetExchangeItemList(context.Context, *GetExchangeItemListReq) (*GetExchangeItemListResp, error) + CreateExchangeOrder(context.Context, *CreateExchangeOrderReq) (*CreateExchangeOrderResp, error) + mustEmbedUnimplementedPlantServiceServer() +} + +// UnimplementedPlantServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedPlantServiceServer struct{} + +func (UnimplementedPlantServiceServer) GetUserProfile(context.Context, *GetUserProfileReq) (*GetUserProfileResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserProfile not implemented") +} +func (UnimplementedPlantServiceServer) UpdateUserProfile(context.Context, *UpdateUserProfileReq) (*UpdateUserProfileResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUserProfile not implemented") +} +func (UnimplementedPlantServiceServer) IncrUserCounter(context.Context, *IncrUserCounterReq) (*IncrUserCounterResp, error) { + return nil, status.Error(codes.Unimplemented, "method IncrUserCounter not implemented") +} +func (UnimplementedPlantServiceServer) CreatePlant(context.Context, *CreatePlantReq) (*CreatePlantResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreatePlant not implemented") +} +func (UnimplementedPlantServiceServer) UpdatePlant(context.Context, *UpdatePlantReq) (*UpdatePlantResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdatePlant not implemented") +} +func (UnimplementedPlantServiceServer) DeletePlant(context.Context, *DeletePlantReq) (*DeletePlantResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeletePlant not implemented") +} +func (UnimplementedPlantServiceServer) GetPlantList(context.Context, *GetPlantListReq) (*GetPlantListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetPlantList not implemented") +} +func (UnimplementedPlantServiceServer) GetPlantDetail(context.Context, *GetPlantDetailReq) (*GetPlantDetailResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetPlantDetail not implemented") +} +func (UnimplementedPlantServiceServer) AddCarePlan(context.Context, *AddCarePlanReq) (*AddCarePlanResp, error) { + return nil, status.Error(codes.Unimplemented, "method AddCarePlan not implemented") +} +func (UnimplementedPlantServiceServer) AddCareRecord(context.Context, *AddCareRecordReq) (*AddCareRecordResp, error) { + return nil, status.Error(codes.Unimplemented, "method AddCareRecord not implemented") +} +func (UnimplementedPlantServiceServer) AddGrowthRecord(context.Context, *AddGrowthRecordReq) (*AddGrowthRecordResp, error) { + return nil, status.Error(codes.Unimplemented, "method AddGrowthRecord not implemented") +} +func (UnimplementedPlantServiceServer) GetWikiList(context.Context, *GetWikiListReq) (*GetWikiListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetWikiList not implemented") +} +func (UnimplementedPlantServiceServer) GetWikiDetail(context.Context, *GetWikiDetailReq) (*GetWikiDetailResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetWikiDetail not implemented") +} +func (UnimplementedPlantServiceServer) GetWikiClassList(context.Context, *Empty) (*GetWikiClassListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetWikiClassList not implemented") +} +func (UnimplementedPlantServiceServer) CreateWikiClass(context.Context, *CreateWikiClassReq) (*CreateWikiClassResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateWikiClass not implemented") +} +func (UnimplementedPlantServiceServer) ToggleStar(context.Context, *ToggleStarReq) (*ToggleStarResp, error) { + return nil, status.Error(codes.Unimplemented, "method ToggleStar not implemented") +} +func (UnimplementedPlantServiceServer) CreatePost(context.Context, *CreatePostReq) (*CreatePostResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreatePost not implemented") +} +func (UnimplementedPlantServiceServer) GetPostList(context.Context, *GetPostListReq) (*GetPostListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetPostList not implemented") +} +func (UnimplementedPlantServiceServer) GetPostDetail(context.Context, *GetPostDetailReq) (*GetPostDetailResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetPostDetail not implemented") +} +func (UnimplementedPlantServiceServer) DeletePost(context.Context, *DeletePostReq) (*DeletePostResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeletePost not implemented") +} +func (UnimplementedPlantServiceServer) CommentPost(context.Context, *CommentPostReq) (*CommentPostResp, error) { + return nil, status.Error(codes.Unimplemented, "method CommentPost not implemented") +} +func (UnimplementedPlantServiceServer) LikePost(context.Context, *LikePostReq) (*LikePostResp, error) { + return nil, status.Error(codes.Unimplemented, "method LikePost not implemented") +} +func (UnimplementedPlantServiceServer) GetTopicList(context.Context, *Empty) (*GetTopicListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetTopicList not implemented") +} +func (UnimplementedPlantServiceServer) CreateTopic(context.Context, *CreateTopicReq) (*CreateTopicResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateTopic not implemented") +} +func (UnimplementedPlantServiceServer) DeleteTopic(context.Context, *DeleteTopicReq) (*DeleteTopicResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteTopic not implemented") +} +func (UnimplementedPlantServiceServer) GetLevelConfigList(context.Context, *GetLevelConfigListReq) (*GetLevelConfigListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetLevelConfigList not implemented") +} +func (UnimplementedPlantServiceServer) GetBadgeConfigList(context.Context, *GetBadgeConfigListReq) (*GetBadgeConfigListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetBadgeConfigList not implemented") +} +func (UnimplementedPlantServiceServer) GetExchangeItemList(context.Context, *GetExchangeItemListReq) (*GetExchangeItemListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetExchangeItemList not implemented") +} +func (UnimplementedPlantServiceServer) CreateExchangeOrder(context.Context, *CreateExchangeOrderReq) (*CreateExchangeOrderResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateExchangeOrder not implemented") +} +func (UnimplementedPlantServiceServer) mustEmbedUnimplementedPlantServiceServer() {} +func (UnimplementedPlantServiceServer) testEmbeddedByValue() {} + +// UnsafePlantServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PlantServiceServer will +// result in compilation errors. +type UnsafePlantServiceServer interface { + mustEmbedUnimplementedPlantServiceServer() +} + +func RegisterPlantServiceServer(s grpc.ServiceRegistrar, srv PlantServiceServer) { + // If the following call panics, it indicates UnimplementedPlantServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&PlantService_ServiceDesc, srv) +} + +func _PlantService_GetUserProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserProfileReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetUserProfile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetUserProfile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetUserProfile(ctx, req.(*GetUserProfileReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_UpdateUserProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserProfileReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).UpdateUserProfile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_UpdateUserProfile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).UpdateUserProfile(ctx, req.(*UpdateUserProfileReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_IncrUserCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IncrUserCounterReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).IncrUserCounter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_IncrUserCounter_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).IncrUserCounter(ctx, req.(*IncrUserCounterReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_CreatePlant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePlantReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).CreatePlant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_CreatePlant_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).CreatePlant(ctx, req.(*CreatePlantReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_UpdatePlant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePlantReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).UpdatePlant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_UpdatePlant_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).UpdatePlant(ctx, req.(*UpdatePlantReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_DeletePlant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePlantReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).DeletePlant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_DeletePlant_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).DeletePlant(ctx, req.(*DeletePlantReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetPlantList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPlantListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetPlantList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetPlantList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetPlantList(ctx, req.(*GetPlantListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetPlantDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPlantDetailReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetPlantDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetPlantDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetPlantDetail(ctx, req.(*GetPlantDetailReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_AddCarePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddCarePlanReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).AddCarePlan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_AddCarePlan_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).AddCarePlan(ctx, req.(*AddCarePlanReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_AddCareRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddCareRecordReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).AddCareRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_AddCareRecord_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).AddCareRecord(ctx, req.(*AddCareRecordReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_AddGrowthRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddGrowthRecordReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).AddGrowthRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_AddGrowthRecord_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).AddGrowthRecord(ctx, req.(*AddGrowthRecordReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetWikiList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetWikiListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetWikiList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetWikiList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetWikiList(ctx, req.(*GetWikiListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetWikiDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetWikiDetailReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetWikiDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetWikiDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetWikiDetail(ctx, req.(*GetWikiDetailReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetWikiClassList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetWikiClassList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetWikiClassList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetWikiClassList(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_CreateWikiClass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateWikiClassReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).CreateWikiClass(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_CreateWikiClass_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).CreateWikiClass(ctx, req.(*CreateWikiClassReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_ToggleStar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ToggleStarReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).ToggleStar(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_ToggleStar_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).ToggleStar(ctx, req.(*ToggleStarReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_CreatePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePostReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).CreatePost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_CreatePost_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).CreatePost(ctx, req.(*CreatePostReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetPostList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPostListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetPostList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetPostList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetPostList(ctx, req.(*GetPostListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetPostDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPostDetailReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetPostDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetPostDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetPostDetail(ctx, req.(*GetPostDetailReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_DeletePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePostReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).DeletePost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_DeletePost_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).DeletePost(ctx, req.(*DeletePostReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_CommentPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommentPostReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).CommentPost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_CommentPost_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).CommentPost(ctx, req.(*CommentPostReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_LikePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LikePostReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).LikePost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_LikePost_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).LikePost(ctx, req.(*LikePostReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetTopicList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetTopicList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetTopicList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetTopicList(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_CreateTopic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTopicReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).CreateTopic(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_CreateTopic_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).CreateTopic(ctx, req.(*CreateTopicReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_DeleteTopic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTopicReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).DeleteTopic(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_DeleteTopic_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).DeleteTopic(ctx, req.(*DeleteTopicReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetLevelConfigList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLevelConfigListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetLevelConfigList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetLevelConfigList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetLevelConfigList(ctx, req.(*GetLevelConfigListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetBadgeConfigList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBadgeConfigListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetBadgeConfigList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetBadgeConfigList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetBadgeConfigList(ctx, req.(*GetBadgeConfigListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_GetExchangeItemList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetExchangeItemListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).GetExchangeItemList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_GetExchangeItemList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).GetExchangeItemList(ctx, req.(*GetExchangeItemListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlantService_CreateExchangeOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateExchangeOrderReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlantServiceServer).CreateExchangeOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: PlantService_CreateExchangeOrder_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlantServiceServer).CreateExchangeOrder(ctx, req.(*CreateExchangeOrderReq)) + } + return interceptor(ctx, in, info, handler) +} + +// PlantService_ServiceDesc is the grpc.ServiceDesc for PlantService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PlantService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plant.PlantService", + HandlerType: (*PlantServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetUserProfile", + Handler: _PlantService_GetUserProfile_Handler, + }, + { + MethodName: "UpdateUserProfile", + Handler: _PlantService_UpdateUserProfile_Handler, + }, + { + MethodName: "IncrUserCounter", + Handler: _PlantService_IncrUserCounter_Handler, + }, + { + MethodName: "CreatePlant", + Handler: _PlantService_CreatePlant_Handler, + }, + { + MethodName: "UpdatePlant", + Handler: _PlantService_UpdatePlant_Handler, + }, + { + MethodName: "DeletePlant", + Handler: _PlantService_DeletePlant_Handler, + }, + { + MethodName: "GetPlantList", + Handler: _PlantService_GetPlantList_Handler, + }, + { + MethodName: "GetPlantDetail", + Handler: _PlantService_GetPlantDetail_Handler, + }, + { + MethodName: "AddCarePlan", + Handler: _PlantService_AddCarePlan_Handler, + }, + { + MethodName: "AddCareRecord", + Handler: _PlantService_AddCareRecord_Handler, + }, + { + MethodName: "AddGrowthRecord", + Handler: _PlantService_AddGrowthRecord_Handler, + }, + { + MethodName: "GetWikiList", + Handler: _PlantService_GetWikiList_Handler, + }, + { + MethodName: "GetWikiDetail", + Handler: _PlantService_GetWikiDetail_Handler, + }, + { + MethodName: "GetWikiClassList", + Handler: _PlantService_GetWikiClassList_Handler, + }, + { + MethodName: "CreateWikiClass", + Handler: _PlantService_CreateWikiClass_Handler, + }, + { + MethodName: "ToggleStar", + Handler: _PlantService_ToggleStar_Handler, + }, + { + MethodName: "CreatePost", + Handler: _PlantService_CreatePost_Handler, + }, + { + MethodName: "GetPostList", + Handler: _PlantService_GetPostList_Handler, + }, + { + MethodName: "GetPostDetail", + Handler: _PlantService_GetPostDetail_Handler, + }, + { + MethodName: "DeletePost", + Handler: _PlantService_DeletePost_Handler, + }, + { + MethodName: "CommentPost", + Handler: _PlantService_CommentPost_Handler, + }, + { + MethodName: "LikePost", + Handler: _PlantService_LikePost_Handler, + }, + { + MethodName: "GetTopicList", + Handler: _PlantService_GetTopicList_Handler, + }, + { + MethodName: "CreateTopic", + Handler: _PlantService_CreateTopic_Handler, + }, + { + MethodName: "DeleteTopic", + Handler: _PlantService_DeleteTopic_Handler, + }, + { + MethodName: "GetLevelConfigList", + Handler: _PlantService_GetLevelConfigList_Handler, + }, + { + MethodName: "GetBadgeConfigList", + Handler: _PlantService_GetBadgeConfigList_Handler, + }, + { + MethodName: "GetExchangeItemList", + Handler: _PlantService_GetExchangeItemList_Handler, + }, + { + MethodName: "CreateExchangeOrder", + Handler: _PlantService_CreateExchangeOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pb/plant.proto", +} diff --git a/app/plant/rpc/plantservice/plantService.go b/app/plant/rpc/plantservice/plantService.go new file mode 100644 index 0000000..a90bbfb --- /dev/null +++ b/app/plant/rpc/plantservice/plantService.go @@ -0,0 +1,287 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: plant.proto + +package plantservice + +import ( + "context" + + "sundynix-micro-go/app/plant/rpc/plant" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +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 + + 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) + // 养护 + 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) + // 百科 + 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) + // 社区 + 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) + // 话题 + 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) + // 兑换 + GetExchangeItemList(ctx context.Context, in *GetExchangeItemListReq, opts ...grpc.CallOption) (*GetExchangeItemListResp, error) + CreateExchangeOrder(ctx context.Context, in *CreateExchangeOrderReq, opts ...grpc.CallOption) (*CreateExchangeOrderResp, error) + } + + defaultPlantService struct { + cli zrpc.Client + } +) + +func NewPlantService(cli zrpc.Client) PlantService { + return &defaultPlantService{ + cli: cli, + } +} + +// 用户Profile +func (m *defaultPlantService) GetUserProfile(ctx context.Context, in *GetUserProfileReq, opts ...grpc.CallOption) (*GetUserProfileResp, 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + client := plant.NewPlantServiceClient(m.cli.Conn()) + return client.ToggleStar(ctx, in, opts...) +} + +// 社区 +func (m *defaultPlantService) CreatePost(ctx context.Context, in *CreatePostReq, opts ...grpc.CallOption) (*CreatePostResp, 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + client := plant.NewPlantServiceClient(m.cli.Conn()) + return client.CreateExchangeOrder(ctx, in, opts...) +} diff --git a/app/radio/api/etc/radio-api.yaml b/app/radio/api/etc/radio-api.yaml new file mode 100644 index 0000000..0e672d4 --- /dev/null +++ b/app/radio/api/etc/radio-api.yaml @@ -0,0 +1,45 @@ +Name: radio-api +Host: 0.0.0.0 +Port: 9005 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# MySQL +DB: + DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local + +# Redis +Cache: + - Host: 127.0.0.1:6379 + Pass: sundynix + Type: node + +# RPC 依赖 +UserRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: user.rpc + +FileRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: file.rpc + +# TTS 火山引擎 +Tts: + AppId: "9604175735" + ResourceId: "seed-tts-2.0" + AccessKey: "IMSrxDQgXWOwaJnuF-5G7uppRQutwBny" + +# 微信支付 +WechatPay: + MchId: "1735188493" + MchCertificateSerialNumber: "3725BFCA9CA3AF819AEC5D0CB7D3540BBC67F2CF" + MchApiV3Key: "a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6" + PrivateKeyPath: "/Users/blizzard/privateFolder/cert/apiclient_key.pem" + PublicKeyPath: "/Users/blizzard/privateFolder/cert/pub_key.pem" + NotifyUrl: "https://radio.sundynix.cn/api/wechatpay/notify" diff --git a/app/radio/api/internal/config/config.go b/app/radio/api/internal/config/config.go new file mode 100644 index 0000000..3e32222 --- /dev/null +++ b/app/radio/api/internal/config/config.go @@ -0,0 +1,40 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + rest.RestConf + Auth struct { + AccessSecret string + AccessExpire int64 + } + DB struct { + DataSource string + } + Cache []struct { + Host string + Pass string + Type string + } + UserRpc zrpc.RpcClientConf + FileRpc zrpc.RpcClientConf + Tts struct { + AppId string + ResourceId string + AccessKey string + } + WechatPay struct { + MchId string + MchCertificateSerialNumber string + MchApiV3Key string + PrivateKeyPath string + PublicKeyPath string + NotifyUrl string + } +} diff --git a/app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go b/app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go new file mode 100644 index 0000000..8c4e605 --- /dev/null +++ b/app/radio/api/internal/handler/analytics/getAnalyticsOverviewHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package analytics + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/analytics" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 数据概览 +func GetAnalyticsOverviewHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AnalyticsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := analytics.NewGetAnalyticsOverviewLogic(r.Context(), svcCtx) + err := l.GetAnalyticsOverview(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go b/app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go new file mode 100644 index 0000000..fe30c5a --- /dev/null +++ b/app/radio/api/internal/handler/analytics/getChannelAnalyticsHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package analytics + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/analytics" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 频道数据 +func GetChannelAnalyticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AnalyticsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := analytics.NewGetChannelAnalyticsLogic(r.Context(), svcCtx) + err := l.GetChannelAnalytics(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go b/app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go new file mode 100644 index 0000000..8d92047 --- /dev/null +++ b/app/radio/api/internal/handler/analytics/getUserAnalyticsHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package analytics + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/analytics" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 用户数据 +func GetUserAnalyticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AnalyticsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := analytics.NewGetUserAnalyticsLogic(r.Context(), svcCtx) + err := l.GetUserAnalytics(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go b/app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go new file mode 100644 index 0000000..193d351 --- /dev/null +++ b/app/radio/api/internal/handler/callback/wechatPayCallbackHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package callback + +import ( + "net/http" + + "sundynix-micro-go/app/radio/api/internal/logic/callback" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 微信支付回调 +func WechatPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := callback.NewWechatPayCallbackLogic(r.Context(), svcCtx) + err := l.WechatPayCallback() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/category/createCategoryHandler.go b/app/radio/api/internal/handler/category/createCategoryHandler.go new file mode 100644 index 0000000..3f1b76f --- /dev/null +++ b/app/radio/api/internal/handler/category/createCategoryHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/category" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建分类 +func CreateCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CategoryReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := category.NewCreateCategoryLogic(r.Context(), svcCtx) + err := l.CreateCategory(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/category/deleteCategoryHandler.go b/app/radio/api/internal/handler/category/deleteCategoryHandler.go new file mode 100644 index 0000000..b71a830 --- /dev/null +++ b/app/radio/api/internal/handler/category/deleteCategoryHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/category" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除分类 +func DeleteCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := category.NewDeleteCategoryLogic(r.Context(), svcCtx) + err := l.DeleteCategory(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/category/getCategoryListHandler.go b/app/radio/api/internal/handler/category/getCategoryListHandler.go new file mode 100644 index 0000000..ba49c30 --- /dev/null +++ b/app/radio/api/internal/handler/category/getCategoryListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/category" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 分类列表 +func GetCategoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CategoryListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := category.NewGetCategoryListLogic(r.Context(), svcCtx) + err := l.GetCategoryList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/category/updateCategoryHandler.go b/app/radio/api/internal/handler/category/updateCategoryHandler.go new file mode 100644 index 0000000..410fec1 --- /dev/null +++ b/app/radio/api/internal/handler/category/updateCategoryHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/category" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新分类 +func UpdateCategoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CategoryUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := category.NewUpdateCategoryLogic(r.Context(), svcCtx) + err := l.UpdateCategory(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/channel/createChannelHandler.go b/app/radio/api/internal/handler/channel/createChannelHandler.go new file mode 100644 index 0000000..675b7dc --- /dev/null +++ b/app/radio/api/internal/handler/channel/createChannelHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/channel" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建频道 +func CreateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChannelReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := channel.NewCreateChannelLogic(r.Context(), svcCtx) + err := l.CreateChannel(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/channel/deleteChannelHandler.go b/app/radio/api/internal/handler/channel/deleteChannelHandler.go new file mode 100644 index 0000000..3e9d943 --- /dev/null +++ b/app/radio/api/internal/handler/channel/deleteChannelHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/channel" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除频道 +func DeleteChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := channel.NewDeleteChannelLogic(r.Context(), svcCtx) + err := l.DeleteChannel(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/channel/getChannelDetailHandler.go b/app/radio/api/internal/handler/channel/getChannelDetailHandler.go new file mode 100644 index 0000000..a80a9e2 --- /dev/null +++ b/app/radio/api/internal/handler/channel/getChannelDetailHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/channel" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 频道详情 +func GetChannelDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdPathReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := channel.NewGetChannelDetailLogic(r.Context(), svcCtx) + err := l.GetChannelDetail(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/channel/getChannelListHandler.go b/app/radio/api/internal/handler/channel/getChannelListHandler.go new file mode 100644 index 0000000..7963a15 --- /dev/null +++ b/app/radio/api/internal/handler/channel/getChannelListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/channel" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 频道列表 +func GetChannelListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChannelListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := channel.NewGetChannelListLogic(r.Context(), svcCtx) + err := l.GetChannelList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/channel/updateChannelHandler.go b/app/radio/api/internal/handler/channel/updateChannelHandler.go new file mode 100644 index 0000000..a3710ea --- /dev/null +++ b/app/radio/api/internal/handler/channel/updateChannelHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/channel" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新频道 +func UpdateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChannelUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := channel.NewUpdateChannelLogic(r.Context(), svcCtx) + err := l.UpdateChannel(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/interaction/commentProgramHandler.go b/app/radio/api/internal/handler/interaction/commentProgramHandler.go new file mode 100644 index 0000000..197a8d6 --- /dev/null +++ b/app/radio/api/internal/handler/interaction/commentProgramHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/interaction" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 评论节目 +func CommentProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommentReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := interaction.NewCommentProgramLogic(r.Context(), svcCtx) + err := l.CommentProgram(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/interaction/getFavoriteListHandler.go b/app/radio/api/internal/handler/interaction/getFavoriteListHandler.go new file mode 100644 index 0000000..b72cfb7 --- /dev/null +++ b/app/radio/api/internal/handler/interaction/getFavoriteListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/interaction" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 我的收藏列表 +func GetFavoriteListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.HistoryListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := interaction.NewGetFavoriteListLogic(r.Context(), svcCtx) + err := l.GetFavoriteList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/interaction/getHistoryListHandler.go b/app/radio/api/internal/handler/interaction/getHistoryListHandler.go new file mode 100644 index 0000000..85a1d36 --- /dev/null +++ b/app/radio/api/internal/handler/interaction/getHistoryListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/interaction" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 播放历史列表 +func GetHistoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.HistoryListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := interaction.NewGetHistoryListLogic(r.Context(), svcCtx) + err := l.GetHistoryList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/interaction/recordHistoryHandler.go b/app/radio/api/internal/handler/interaction/recordHistoryHandler.go new file mode 100644 index 0000000..ff598c4 --- /dev/null +++ b/app/radio/api/internal/handler/interaction/recordHistoryHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/interaction" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 记录播放历史 +func RecordHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.HistoryReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := interaction.NewRecordHistoryLogic(r.Context(), svcCtx) + err := l.RecordHistory(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go b/app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go new file mode 100644 index 0000000..9777f30 --- /dev/null +++ b/app/radio/api/internal/handler/interaction/toggleFavoriteHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/interaction" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 收藏/取消收藏 +func ToggleFavoriteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FavoriteReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := interaction.NewToggleFavoriteLogic(r.Context(), svcCtx) + err := l.ToggleFavorite(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/interaction/toggleLikeHandler.go b/app/radio/api/internal/handler/interaction/toggleLikeHandler.go new file mode 100644 index 0000000..76e8872 --- /dev/null +++ b/app/radio/api/internal/handler/interaction/toggleLikeHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/interaction" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 点赞/取消点赞 +func ToggleLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.LikeReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := interaction.NewToggleLikeLogic(r.Context(), svcCtx) + err := l.ToggleLike(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/pay/createPayOrderHandler.go b/app/radio/api/internal/handler/pay/createPayOrderHandler.go new file mode 100644 index 0000000..35ad0d2 --- /dev/null +++ b/app/radio/api/internal/handler/pay/createPayOrderHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package pay + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/pay" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建支付订单 +func CreatePayOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreatePayOrderReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := pay.NewCreatePayOrderLogic(r.Context(), svcCtx) + err := l.CreatePayOrder(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/program/createProgramHandler.go b/app/radio/api/internal/handler/program/createProgramHandler.go new file mode 100644 index 0000000..680eaf4 --- /dev/null +++ b/app/radio/api/internal/handler/program/createProgramHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/program" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建节目 +func CreateProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ProgramReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := program.NewCreateProgramLogic(r.Context(), svcCtx) + err := l.CreateProgram(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/program/deleteProgramHandler.go b/app/radio/api/internal/handler/program/deleteProgramHandler.go new file mode 100644 index 0000000..bb5f9bf --- /dev/null +++ b/app/radio/api/internal/handler/program/deleteProgramHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/program" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除节目 +func DeleteProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := program.NewDeleteProgramLogic(r.Context(), svcCtx) + err := l.DeleteProgram(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/program/generateTtsHandler.go b/app/radio/api/internal/handler/program/generateTtsHandler.go new file mode 100644 index 0000000..2920203 --- /dev/null +++ b/app/radio/api/internal/handler/program/generateTtsHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/program" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// TTS生成音频 +func GenerateTtsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.TtsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := program.NewGenerateTtsLogic(r.Context(), svcCtx) + err := l.GenerateTts(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/program/getProgramDetailHandler.go b/app/radio/api/internal/handler/program/getProgramDetailHandler.go new file mode 100644 index 0000000..7baa7a5 --- /dev/null +++ b/app/radio/api/internal/handler/program/getProgramDetailHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/program" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 节目详情 +func GetProgramDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdPathReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := program.NewGetProgramDetailLogic(r.Context(), svcCtx) + err := l.GetProgramDetail(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/program/getProgramListHandler.go b/app/radio/api/internal/handler/program/getProgramListHandler.go new file mode 100644 index 0000000..76e3ae2 --- /dev/null +++ b/app/radio/api/internal/handler/program/getProgramListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/program" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 节目列表 +func GetProgramListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ProgramListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := program.NewGetProgramListLogic(r.Context(), svcCtx) + err := l.GetProgramList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/program/updateProgramHandler.go b/app/radio/api/internal/handler/program/updateProgramHandler.go new file mode 100644 index 0000000..ffc9ffe --- /dev/null +++ b/app/radio/api/internal/handler/program/updateProgramHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/program" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新节目 +func UpdateProgramHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ProgramUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := program.NewUpdateProgramLogic(r.Context(), svcCtx) + err := l.UpdateProgram(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/routes.go b/app/radio/api/internal/handler/routes.go new file mode 100644 index 0000000..9e5c8c2 --- /dev/null +++ b/app/radio/api/internal/handler/routes.go @@ -0,0 +1,291 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package handler + +import ( + "net/http" + + analytics "sundynix-micro-go/app/radio/api/internal/handler/analytics" + callback "sundynix-micro-go/app/radio/api/internal/handler/callback" + category "sundynix-micro-go/app/radio/api/internal/handler/category" + channel "sundynix-micro-go/app/radio/api/internal/handler/channel" + interaction "sundynix-micro-go/app/radio/api/internal/handler/interaction" + pay "sundynix-micro-go/app/radio/api/internal/handler/pay" + program "sundynix-micro-go/app/radio/api/internal/handler/program" + subscription "sundynix-micro-go/app/radio/api/internal/handler/subscription" + vip "sundynix-micro-go/app/radio/api/internal/handler/vip" + voice "sundynix-micro-go/app/radio/api/internal/handler/voice" + "sundynix-micro-go/app/radio/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + // 频道数据 + Method: http.MethodPost, + Path: "/analytics/channel", + Handler: analytics.GetChannelAnalyticsHandler(serverCtx), + }, + { + // 数据概览 + Method: http.MethodPost, + Path: "/analytics/overview", + Handler: analytics.GetAnalyticsOverviewHandler(serverCtx), + }, + { + // 用户数据 + Method: http.MethodPost, + Path: "/analytics/user", + Handler: analytics.GetUserAnalyticsHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 微信支付回调 + Method: http.MethodPost, + Path: "/callback/wechatpay", + Handler: callback.WechatPayCallbackHandler(serverCtx), + }, + }, + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 创建分类 + Method: http.MethodPost, + Path: "/category/create", + Handler: category.CreateCategoryHandler(serverCtx), + }, + { + // 删除分类 + Method: http.MethodDelete, + Path: "/category/delete", + Handler: category.DeleteCategoryHandler(serverCtx), + }, + { + // 分类列表 + Method: http.MethodPost, + Path: "/category/list", + Handler: category.GetCategoryListHandler(serverCtx), + }, + { + // 更新分类 + Method: http.MethodPut, + Path: "/category/update", + Handler: category.UpdateCategoryHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 频道详情 + Method: http.MethodGet, + Path: "/channel/:id", + Handler: channel.GetChannelDetailHandler(serverCtx), + }, + { + // 创建频道 + Method: http.MethodPost, + Path: "/channel/create", + Handler: channel.CreateChannelHandler(serverCtx), + }, + { + // 删除频道 + Method: http.MethodDelete, + Path: "/channel/delete", + Handler: channel.DeleteChannelHandler(serverCtx), + }, + { + // 频道列表 + Method: http.MethodPost, + Path: "/channel/list", + Handler: channel.GetChannelListHandler(serverCtx), + }, + { + // 更新频道 + Method: http.MethodPut, + Path: "/channel/update", + Handler: channel.UpdateChannelHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 评论节目 + Method: http.MethodPost, + Path: "/interaction/comment", + Handler: interaction.CommentProgramHandler(serverCtx), + }, + { + // 收藏/取消收藏 + Method: http.MethodPost, + Path: "/interaction/favorite", + Handler: interaction.ToggleFavoriteHandler(serverCtx), + }, + { + // 我的收藏列表 + Method: http.MethodPost, + Path: "/interaction/favorite/list", + Handler: interaction.GetFavoriteListHandler(serverCtx), + }, + { + // 记录播放历史 + Method: http.MethodPost, + Path: "/interaction/history", + Handler: interaction.RecordHistoryHandler(serverCtx), + }, + { + // 播放历史列表 + Method: http.MethodPost, + Path: "/interaction/history/list", + Handler: interaction.GetHistoryListHandler(serverCtx), + }, + { + // 点赞/取消点赞 + Method: http.MethodPost, + Path: "/interaction/like", + Handler: interaction.ToggleLikeHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 创建支付订单 + Method: http.MethodPost, + Path: "/pay/create", + Handler: pay.CreatePayOrderHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 节目详情 + Method: http.MethodGet, + Path: "/program/:id", + Handler: program.GetProgramDetailHandler(serverCtx), + }, + { + // 创建节目 + Method: http.MethodPost, + Path: "/program/create", + Handler: program.CreateProgramHandler(serverCtx), + }, + { + // 删除节目 + Method: http.MethodDelete, + Path: "/program/delete", + Handler: program.DeleteProgramHandler(serverCtx), + }, + { + // 节目列表 + Method: http.MethodPost, + Path: "/program/list", + Handler: program.GetProgramListHandler(serverCtx), + }, + { + // TTS生成音频 + Method: http.MethodPost, + Path: "/program/tts", + Handler: program.GenerateTtsHandler(serverCtx), + }, + { + // 更新节目 + Method: http.MethodPut, + Path: "/program/update", + Handler: program.UpdateProgramHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 我的订阅列表 + Method: http.MethodGet, + Path: "/subscription/list", + Handler: subscription.GetMySubscriptionsHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 我的VIP信息 + Method: http.MethodGet, + Path: "/vip/info", + Handler: vip.GetMyVipInfoHandler(serverCtx), + }, + { + // VIP配置列表 + Method: http.MethodPost, + Path: "/vip/list", + Handler: vip.GetVipConfigListHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 创建音色 + Method: http.MethodPost, + Path: "/voice/create", + Handler: voice.CreateVoiceHandler(serverCtx), + }, + { + // 删除音色 + Method: http.MethodDelete, + Path: "/voice/delete", + Handler: voice.DeleteVoiceHandler(serverCtx), + }, + { + // 音色列表 + Method: http.MethodPost, + Path: "/voice/list", + Handler: voice.GetVoiceListHandler(serverCtx), + }, + { + // 更新音色 + Method: http.MethodPut, + Path: "/voice/update", + Handler: voice.UpdateVoiceHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/radio"), + ) +} diff --git a/app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go b/app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go new file mode 100644 index 0000000..f95e067 --- /dev/null +++ b/app/radio/api/internal/handler/subscription/getMySubscriptionsHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package subscription + +import ( + "net/http" + + "sundynix-micro-go/app/radio/api/internal/logic/subscription" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 我的订阅列表 +func GetMySubscriptionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := subscription.NewGetMySubscriptionsLogic(r.Context(), svcCtx) + err := l.GetMySubscriptions() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/vip/getMyVipInfoHandler.go b/app/radio/api/internal/handler/vip/getMyVipInfoHandler.go new file mode 100644 index 0000000..b4f7a2d --- /dev/null +++ b/app/radio/api/internal/handler/vip/getMyVipInfoHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package vip + +import ( + "net/http" + + "sundynix-micro-go/app/radio/api/internal/logic/vip" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 我的VIP信息 +func GetMyVipInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := vip.NewGetMyVipInfoLogic(r.Context(), svcCtx) + err := l.GetMyVipInfo() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/vip/getVipConfigListHandler.go b/app/radio/api/internal/handler/vip/getVipConfigListHandler.go new file mode 100644 index 0000000..ef8c2c1 --- /dev/null +++ b/app/radio/api/internal/handler/vip/getVipConfigListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package vip + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/vip" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// VIP配置列表 +func GetVipConfigListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.VipConfigListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := vip.NewGetVipConfigListLogic(r.Context(), svcCtx) + err := l.GetVipConfigList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/voice/createVoiceHandler.go b/app/radio/api/internal/handler/voice/createVoiceHandler.go new file mode 100644 index 0000000..491b8be --- /dev/null +++ b/app/radio/api/internal/handler/voice/createVoiceHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/voice" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建音色 +func CreateVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.VoiceReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := voice.NewCreateVoiceLogic(r.Context(), svcCtx) + err := l.CreateVoice(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/voice/deleteVoiceHandler.go b/app/radio/api/internal/handler/voice/deleteVoiceHandler.go new file mode 100644 index 0000000..5f9fdf0 --- /dev/null +++ b/app/radio/api/internal/handler/voice/deleteVoiceHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/voice" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除音色 +func DeleteVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := voice.NewDeleteVoiceLogic(r.Context(), svcCtx) + err := l.DeleteVoice(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/voice/getVoiceListHandler.go b/app/radio/api/internal/handler/voice/getVoiceListHandler.go new file mode 100644 index 0000000..3a9d8c9 --- /dev/null +++ b/app/radio/api/internal/handler/voice/getVoiceListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/voice" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 音色列表 +func GetVoiceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.VoiceListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := voice.NewGetVoiceListLogic(r.Context(), svcCtx) + err := l.GetVoiceList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/handler/voice/updateVoiceHandler.go b/app/radio/api/internal/handler/voice/updateVoiceHandler.go new file mode 100644 index 0000000..9b131b1 --- /dev/null +++ b/app/radio/api/internal/handler/voice/updateVoiceHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/radio/api/internal/logic/voice" + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新音色 +func UpdateVoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.VoiceUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := voice.NewUpdateVoiceLogic(r.Context(), svcCtx) + err := l.UpdateVoice(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go b/app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go new file mode 100644 index 0000000..89d0238 --- /dev/null +++ b/app/radio/api/internal/logic/analytics/getAnalyticsOverviewLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package analytics + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetAnalyticsOverviewLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 数据概览 +func NewGetAnalyticsOverviewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnalyticsOverviewLogic { + return &GetAnalyticsOverviewLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetAnalyticsOverviewLogic) GetAnalyticsOverview(req *types.AnalyticsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go b/app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go new file mode 100644 index 0000000..43aaf2b --- /dev/null +++ b/app/radio/api/internal/logic/analytics/getChannelAnalyticsLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package analytics + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetChannelAnalyticsLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 频道数据 +func NewGetChannelAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelAnalyticsLogic { + return &GetChannelAnalyticsLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetChannelAnalyticsLogic) GetChannelAnalytics(req *types.AnalyticsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go b/app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go new file mode 100644 index 0000000..a51ba66 --- /dev/null +++ b/app/radio/api/internal/logic/analytics/getUserAnalyticsLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package analytics + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserAnalyticsLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 用户数据 +func NewGetUserAnalyticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserAnalyticsLogic { + return &GetUserAnalyticsLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetUserAnalyticsLogic) GetUserAnalytics(req *types.AnalyticsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go b/app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go new file mode 100644 index 0000000..b2e4b43 --- /dev/null +++ b/app/radio/api/internal/logic/callback/wechatPayCallbackLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package callback + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/radio/api/internal/svc" +) + +type WechatPayCallbackLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 微信支付回调 +func NewWechatPayCallbackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WechatPayCallbackLogic { + return &WechatPayCallbackLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *WechatPayCallbackLogic) WechatPayCallback() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/category/createCategoryLogic.go b/app/radio/api/internal/logic/category/createCategoryLogic.go new file mode 100644 index 0000000..6687b98 --- /dev/null +++ b/app/radio/api/internal/logic/category/createCategoryLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateCategoryLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建分类 +func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic { + return &CreateCategoryLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateCategoryLogic) CreateCategory(req *types.CategoryReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/category/deleteCategoryLogic.go b/app/radio/api/internal/logic/category/deleteCategoryLogic.go new file mode 100644 index 0000000..71c6fe6 --- /dev/null +++ b/app/radio/api/internal/logic/category/deleteCategoryLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteCategoryLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除分类 +func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic { + return &DeleteCategoryLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteCategoryLogic) DeleteCategory(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/category/getCategoryListLogic.go b/app/radio/api/internal/logic/category/getCategoryListLogic.go new file mode 100644 index 0000000..07b5d82 --- /dev/null +++ b/app/radio/api/internal/logic/category/getCategoryListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetCategoryListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 分类列表 +func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryListLogic { + return &GetCategoryListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetCategoryListLogic) GetCategoryList(req *types.CategoryListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/category/updateCategoryLogic.go b/app/radio/api/internal/logic/category/updateCategoryLogic.go new file mode 100644 index 0000000..87a0199 --- /dev/null +++ b/app/radio/api/internal/logic/category/updateCategoryLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package category + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateCategoryLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 更新分类 +func NewUpdateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateCategoryLogic { + return &UpdateCategoryLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateCategoryLogic) UpdateCategory(req *types.CategoryUpdateReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/channel/createChannelLogic.go b/app/radio/api/internal/logic/channel/createChannelLogic.go new file mode 100644 index 0000000..b7e04e7 --- /dev/null +++ b/app/radio/api/internal/logic/channel/createChannelLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateChannelLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建频道 +func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChannelLogic { + return &CreateChannelLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateChannelLogic) CreateChannel(req *types.ChannelReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/channel/deleteChannelLogic.go b/app/radio/api/internal/logic/channel/deleteChannelLogic.go new file mode 100644 index 0000000..3ee1c99 --- /dev/null +++ b/app/radio/api/internal/logic/channel/deleteChannelLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteChannelLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除频道 +func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteChannelLogic { + return &DeleteChannelLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteChannelLogic) DeleteChannel(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/channel/getChannelDetailLogic.go b/app/radio/api/internal/logic/channel/getChannelDetailLogic.go new file mode 100644 index 0000000..5da5de4 --- /dev/null +++ b/app/radio/api/internal/logic/channel/getChannelDetailLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetChannelDetailLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 频道详情 +func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelDetailLogic { + return &GetChannelDetailLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetChannelDetailLogic) GetChannelDetail(req *types.IdPathReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/channel/getChannelListLogic.go b/app/radio/api/internal/logic/channel/getChannelListLogic.go new file mode 100644 index 0000000..a912191 --- /dev/null +++ b/app/radio/api/internal/logic/channel/getChannelListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetChannelListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 频道列表 +func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelListLogic { + return &GetChannelListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetChannelListLogic) GetChannelList(req *types.ChannelListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/channel/updateChannelLogic.go b/app/radio/api/internal/logic/channel/updateChannelLogic.go new file mode 100644 index 0000000..9ed5ad5 --- /dev/null +++ b/app/radio/api/internal/logic/channel/updateChannelLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package channel + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateChannelLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 更新频道 +func NewUpdateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateChannelLogic { + return &UpdateChannelLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateChannelLogic) UpdateChannel(req *types.ChannelUpdateReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/interaction/commentProgramLogic.go b/app/radio/api/internal/logic/interaction/commentProgramLogic.go new file mode 100644 index 0000000..30f13db --- /dev/null +++ b/app/radio/api/internal/logic/interaction/commentProgramLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CommentProgramLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 评论节目 +func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentProgramLogic { + return &CommentProgramLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CommentProgramLogic) CommentProgram(req *types.CommentReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/interaction/getFavoriteListLogic.go b/app/radio/api/internal/logic/interaction/getFavoriteListLogic.go new file mode 100644 index 0000000..b8d6b21 --- /dev/null +++ b/app/radio/api/internal/logic/interaction/getFavoriteListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetFavoriteListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 我的收藏列表 +func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFavoriteListLogic { + return &GetFavoriteListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetFavoriteListLogic) GetFavoriteList(req *types.HistoryListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/interaction/getHistoryListLogic.go b/app/radio/api/internal/logic/interaction/getHistoryListLogic.go new file mode 100644 index 0000000..87de32a --- /dev/null +++ b/app/radio/api/internal/logic/interaction/getHistoryListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetHistoryListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 播放历史列表 +func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryListLogic { + return &GetHistoryListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetHistoryListLogic) GetHistoryList(req *types.HistoryListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/interaction/recordHistoryLogic.go b/app/radio/api/internal/logic/interaction/recordHistoryLogic.go new file mode 100644 index 0000000..62cb478 --- /dev/null +++ b/app/radio/api/internal/logic/interaction/recordHistoryLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type RecordHistoryLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 记录播放历史 +func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecordHistoryLogic { + return &RecordHistoryLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *RecordHistoryLogic) RecordHistory(req *types.HistoryReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go b/app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go new file mode 100644 index 0000000..07a54a5 --- /dev/null +++ b/app/radio/api/internal/logic/interaction/toggleFavoriteLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ToggleFavoriteLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 收藏/取消收藏 +func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleFavoriteLogic { + return &ToggleFavoriteLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ToggleFavoriteLogic) ToggleFavorite(req *types.FavoriteReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/interaction/toggleLikeLogic.go b/app/radio/api/internal/logic/interaction/toggleLikeLogic.go new file mode 100644 index 0000000..f399e8d --- /dev/null +++ b/app/radio/api/internal/logic/interaction/toggleLikeLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package interaction + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ToggleLikeLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 点赞/取消点赞 +func NewToggleLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleLikeLogic { + return &ToggleLikeLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ToggleLikeLogic) ToggleLike(req *types.LikeReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/pay/createPayOrderLogic.go b/app/radio/api/internal/logic/pay/createPayOrderLogic.go new file mode 100644 index 0000000..6bec0f4 --- /dev/null +++ b/app/radio/api/internal/logic/pay/createPayOrderLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package pay + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreatePayOrderLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建支付订单 +func NewCreatePayOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayOrderLogic { + return &CreatePayOrderLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreatePayOrderLogic) CreatePayOrder(req *types.CreatePayOrderReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/program/createProgramLogic.go b/app/radio/api/internal/logic/program/createProgramLogic.go new file mode 100644 index 0000000..57bf1db --- /dev/null +++ b/app/radio/api/internal/logic/program/createProgramLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateProgramLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建节目 +func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProgramLogic { + return &CreateProgramLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateProgramLogic) CreateProgram(req *types.ProgramReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/program/deleteProgramLogic.go b/app/radio/api/internal/logic/program/deleteProgramLogic.go new file mode 100644 index 0000000..e790b44 --- /dev/null +++ b/app/radio/api/internal/logic/program/deleteProgramLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteProgramLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除节目 +func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProgramLogic { + return &DeleteProgramLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteProgramLogic) DeleteProgram(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/program/generateTtsLogic.go b/app/radio/api/internal/logic/program/generateTtsLogic.go new file mode 100644 index 0000000..126550d --- /dev/null +++ b/app/radio/api/internal/logic/program/generateTtsLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GenerateTtsLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// TTS生成音频 +func NewGenerateTtsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GenerateTtsLogic { + return &GenerateTtsLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GenerateTtsLogic) GenerateTts(req *types.TtsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/program/getProgramDetailLogic.go b/app/radio/api/internal/logic/program/getProgramDetailLogic.go new file mode 100644 index 0000000..2cab661 --- /dev/null +++ b/app/radio/api/internal/logic/program/getProgramDetailLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetProgramDetailLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 节目详情 +func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramDetailLogic { + return &GetProgramDetailLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetProgramDetailLogic) GetProgramDetail(req *types.IdPathReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/program/getProgramListLogic.go b/app/radio/api/internal/logic/program/getProgramListLogic.go new file mode 100644 index 0000000..eb3a7d2 --- /dev/null +++ b/app/radio/api/internal/logic/program/getProgramListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetProgramListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 节目列表 +func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramListLogic { + return &GetProgramListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetProgramListLogic) GetProgramList(req *types.ProgramListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/program/updateProgramLogic.go b/app/radio/api/internal/logic/program/updateProgramLogic.go new file mode 100644 index 0000000..5cafcc6 --- /dev/null +++ b/app/radio/api/internal/logic/program/updateProgramLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package program + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateProgramLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 更新节目 +func NewUpdateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProgramLogic { + return &UpdateProgramLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateProgramLogic) UpdateProgram(req *types.ProgramUpdateReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go b/app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go new file mode 100644 index 0000000..fda38c9 --- /dev/null +++ b/app/radio/api/internal/logic/subscription/getMySubscriptionsLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package subscription + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/radio/api/internal/svc" +) + +type GetMySubscriptionsLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 我的订阅列表 +func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMySubscriptionsLogic { + return &GetMySubscriptionsLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetMySubscriptionsLogic) GetMySubscriptions() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/vip/getMyVipInfoLogic.go b/app/radio/api/internal/logic/vip/getMyVipInfoLogic.go new file mode 100644 index 0000000..24a9c9c --- /dev/null +++ b/app/radio/api/internal/logic/vip/getMyVipInfoLogic.go @@ -0,0 +1,32 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package vip + +import ( + "context" + + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/radio/api/internal/svc" +) + +type GetMyVipInfoLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 我的VIP信息 +func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyVipInfoLogic { + return &GetMyVipInfoLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetMyVipInfoLogic) GetMyVipInfo() error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/vip/getVipConfigListLogic.go b/app/radio/api/internal/logic/vip/getVipConfigListLogic.go new file mode 100644 index 0000000..3560f8a --- /dev/null +++ b/app/radio/api/internal/logic/vip/getVipConfigListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package vip + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetVipConfigListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// VIP配置列表 +func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVipConfigListLogic { + return &GetVipConfigListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetVipConfigListLogic) GetVipConfigList(req *types.VipConfigListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/voice/createVoiceLogic.go b/app/radio/api/internal/logic/voice/createVoiceLogic.go new file mode 100644 index 0000000..89a61cc --- /dev/null +++ b/app/radio/api/internal/logic/voice/createVoiceLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateVoiceLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 创建音色 +func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVoiceLogic { + return &CreateVoiceLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateVoiceLogic) CreateVoice(req *types.VoiceReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/voice/deleteVoiceLogic.go b/app/radio/api/internal/logic/voice/deleteVoiceLogic.go new file mode 100644 index 0000000..1cb8f09 --- /dev/null +++ b/app/radio/api/internal/logic/voice/deleteVoiceLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteVoiceLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除音色 +func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVoiceLogic { + return &DeleteVoiceLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteVoiceLogic) DeleteVoice(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/voice/getVoiceListLogic.go b/app/radio/api/internal/logic/voice/getVoiceListLogic.go new file mode 100644 index 0000000..ba5ff45 --- /dev/null +++ b/app/radio/api/internal/logic/voice/getVoiceListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetVoiceListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 音色列表 +func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVoiceListLogic { + return &GetVoiceListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetVoiceListLogic) GetVoiceList(req *types.VoiceListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/logic/voice/updateVoiceLogic.go b/app/radio/api/internal/logic/voice/updateVoiceLogic.go new file mode 100644 index 0000000..7e239b0 --- /dev/null +++ b/app/radio/api/internal/logic/voice/updateVoiceLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package voice + +import ( + "context" + + "sundynix-micro-go/app/radio/api/internal/svc" + "sundynix-micro-go/app/radio/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateVoiceLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 更新音色 +func NewUpdateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVoiceLogic { + return &UpdateVoiceLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateVoiceLogic) UpdateVoice(req *types.VoiceUpdateReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/radio/api/internal/svc/serviceContext.go b/app/radio/api/internal/svc/serviceContext.go new file mode 100644 index 0000000..286e75d --- /dev/null +++ b/app/radio/api/internal/svc/serviceContext.go @@ -0,0 +1,58 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package svc + +import ( + "sundynix-micro-go/app/file/rpc/fileservice" + "sundynix-micro-go/app/radio/api/internal/config" + radioModel "sundynix-micro-go/app/radio/model" + "sundynix-micro-go/app/user/rpc/userservice" + + "github.com/zeromicro/go-zero/core/logx" + "github.com/zeromicro/go-zero/zrpc" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +type ServiceContext struct { + Config config.Config + DB *gorm.DB + UserRpc userservice.UserService + FileRpc fileservice.FileService +} + +func NewServiceContext(c config.Config) *ServiceContext { + db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) + if err != nil { + logx.Errorf("连接数据库失败: %v", err) + panic(err) + } + + // 自动迁移 + if err := db.AutoMigrate( + &radioModel.SundynixRadioUserProfile{}, + &radioModel.SundynixRadioCategory{}, + &radioModel.SundynixRadioChannel{}, + &radioModel.SundynixRadioProgram{}, + &radioModel.SundynixRadioVoice{}, + &radioModel.SundynixRadioLike{}, + &radioModel.SundynixRadioFavorite{}, + &radioModel.SundynixRadioComment{}, + &radioModel.SundynixRadioHistory{}, + &radioModel.SundynixRadioSubscription{}, + &radioModel.SundynixRadioSubscriptionOrder{}, + &radioModel.SundynixRadioPayNotify{}, + &radioModel.SundynixRadioVipConfig{}, + &radioModel.SundynixRadioListenLog{}, + ); err != nil { + logx.Errorf("数据库迁移失败: %v", err) + } + + return &ServiceContext{ + Config: c, + DB: db, + UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)), + FileRpc: fileservice.NewFileService(zrpc.MustNewClient(c.FileRpc)), + } +} diff --git a/app/radio/api/internal/types/types.go b/app/radio/api/internal/types/types.go new file mode 100644 index 0000000..19e587e --- /dev/null +++ b/app/radio/api/internal/types/types.go @@ -0,0 +1,180 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package types + +type AnalyticsReq struct { + StartDate string `json:"startDate,optional"` + EndDate string `json:"endDate,optional"` +} + +type CategoryListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` +} + +type CategoryReq struct { + Name string `json:"name"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` +} + +type CategoryUpdateReq struct { + Id string `json:"id"` + Name string `json:"name,optional"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` +} + +type ChannelListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + CategoryId string `json:"categoryId,optional"` + Name string `json:"name,optional"` +} + +type ChannelReq struct { + CategoryId string `json:"categoryId"` + Name string `json:"name"` + Description string `json:"description,optional"` + IsFree int `json:"isFree,optional"` + IsVipOnly int `json:"isVipOnly,optional"` + MonthlyPrice int `json:"monthlyPrice,optional"` + QuarterlyPrice int `json:"quarterlyPrice,optional"` + AnnualPrice int `json:"annualPrice,optional"` + Cover string `json:"cover,optional"` + Tags string `json:"tags,optional"` + Sort int `json:"sort,optional"` +} + +type ChannelUpdateReq struct { + Id string `json:"id"` + CategoryId string `json:"categoryId,optional"` + Name string `json:"name,optional"` + Description string `json:"description,optional"` + IsFree int `json:"isFree,optional"` + IsVipOnly int `json:"isVipOnly,optional"` + MonthlyPrice int `json:"monthlyPrice,optional"` + QuarterlyPrice int `json:"quarterlyPrice,optional"` + AnnualPrice int `json:"annualPrice,optional"` + Cover string `json:"cover,optional"` + Tags string `json:"tags,optional"` + Sort int `json:"sort,optional"` + Status int `json:"status,optional"` +} + +type CommentReq struct { + ProgramId string `json:"programId"` + Content string `json:"content"` + ParentId string `json:"parentId,optional"` +} + +type CreatePayOrderReq struct { + ChannelId string `json:"channelId,optional"` + PlanType string `json:"planType"` + OrderType string `json:"orderType"` +} + +type FavoriteReq struct { + ProgramId string `json:"programId"` +} + +type HistoryListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` +} + +type HistoryReq struct { + ProgramId string `json:"programId"` + Duration int `json:"duration,optional"` +} + +type IdPathReq struct { + Id string `path:"id"` +} + +type IdReq struct { + Id string `json:"id"` +} + +type IdsReq struct { + Ids []string `json:"ids"` +} + +type LikeReq struct { + ProgramId string `json:"programId"` +} + +type ProgramListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + ChannelId string `json:"channelId,optional"` + Title string `json:"title,optional"` +} + +type ProgramReq struct { + ChannelId string `json:"channelId"` + Title string `json:"title"` + Description string `json:"description,optional"` + Content string `json:"content,optional"` + Cover string `json:"cover,optional"` + AudioId string `json:"audioId,optional"` + Tags string `json:"tags,optional"` +} + +type ProgramUpdateReq struct { + Id string `json:"id"` + ChannelId string `json:"channelId,optional"` + Title string `json:"title,optional"` + Description string `json:"description,optional"` + Content string `json:"content,optional"` + Cover string `json:"cover,optional"` + AudioId string `json:"audioId,optional"` + Tags string `json:"tags,optional"` + Status int `json:"status,optional"` +} + +type SubscribeReq struct { + ChannelId string `json:"channelId"` + PlanType string `json:"planType"` +} + +type TtsReq struct { + Text string `json:"text"` + SpeakerId string `json:"speakerId,optional"` +} + +type VipConfigListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` +} + +type VoiceListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Gender string `json:"gender,optional"` +} + +type VoiceReq struct { + SpeakerId string `json:"speakerId"` + Name string `json:"name"` + Description string `json:"description,optional"` + Gender string `json:"gender,optional"` + Icon string `json:"icon,optional"` + AudioId string `json:"audioId,optional"` + Sort int `json:"sort,optional"` + IsDefault int `json:"isDefault,optional"` +} + +type VoiceUpdateReq struct { + Id string `json:"id"` + Name string `json:"name,optional"` + Description string `json:"description,optional"` + Gender string `json:"gender,optional"` + Icon string `json:"icon,optional"` + AudioId string `json:"audioId,optional"` + Sort int `json:"sort,optional"` + IsDefault int `json:"isDefault,optional"` + Status int `json:"status,optional"` +} diff --git a/app/radio/api/radio.api b/app/radio/api/radio.api new file mode 100644 index 0000000..5506cf8 --- /dev/null +++ b/app/radio/api/radio.api @@ -0,0 +1,377 @@ +syntax = "v1" + +info ( + title: "电台业务服务API" + desc: "频道、节目、订阅、互动、支付、VIP、音色等HTTP接口" + author: "sundynix" + version: "v1.0.0" +) + +type ( + // ---------- 通用 ---------- + IdReq { + Id string `json:"id"` + } + IdPathReq { + Id string `path:"id"` + } + IdsReq { + Ids []string `json:"ids"` + } + // ---------- 分类 ---------- + CategoryReq { + Name string `json:"name"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` + } + CategoryUpdateReq { + Id string `json:"id"` + Name string `json:"name,optional"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` + } + CategoryListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + } + // ---------- 频道 ---------- + ChannelReq { + CategoryId string `json:"categoryId"` + Name string `json:"name"` + Description string `json:"description,optional"` + IsFree int `json:"isFree,optional"` + IsVipOnly int `json:"isVipOnly,optional"` + MonthlyPrice int `json:"monthlyPrice,optional"` + QuarterlyPrice int `json:"quarterlyPrice,optional"` + AnnualPrice int `json:"annualPrice,optional"` + Cover string `json:"cover,optional"` + Tags string `json:"tags,optional"` + Sort int `json:"sort,optional"` + } + ChannelUpdateReq { + Id string `json:"id"` + CategoryId string `json:"categoryId,optional"` + Name string `json:"name,optional"` + Description string `json:"description,optional"` + IsFree int `json:"isFree,optional"` + IsVipOnly int `json:"isVipOnly,optional"` + MonthlyPrice int `json:"monthlyPrice,optional"` + QuarterlyPrice int `json:"quarterlyPrice,optional"` + AnnualPrice int `json:"annualPrice,optional"` + Cover string `json:"cover,optional"` + Tags string `json:"tags,optional"` + Sort int `json:"sort,optional"` + Status int `json:"status,optional"` + } + ChannelListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + CategoryId string `json:"categoryId,optional"` + Name string `json:"name,optional"` + } + // ---------- 节目 ---------- + ProgramReq { + ChannelId string `json:"channelId"` + Title string `json:"title"` + Description string `json:"description,optional"` + Content string `json:"content,optional"` + Cover string `json:"cover,optional"` + AudioId string `json:"audioId,optional"` + Tags string `json:"tags,optional"` + } + ProgramUpdateReq { + Id string `json:"id"` + ChannelId string `json:"channelId,optional"` + Title string `json:"title,optional"` + Description string `json:"description,optional"` + Content string `json:"content,optional"` + Cover string `json:"cover,optional"` + AudioId string `json:"audioId,optional"` + Tags string `json:"tags,optional"` + Status int `json:"status,optional"` + } + ProgramListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + ChannelId string `json:"channelId,optional"` + Title string `json:"title,optional"` + } + // ---------- 音色 ---------- + VoiceReq { + SpeakerId string `json:"speakerId"` + Name string `json:"name"` + Description string `json:"description,optional"` + Gender string `json:"gender,optional"` + Icon string `json:"icon,optional"` + AudioId string `json:"audioId,optional"` + Sort int `json:"sort,optional"` + IsDefault int `json:"isDefault,optional"` + } + VoiceUpdateReq { + Id string `json:"id"` + Name string `json:"name,optional"` + Description string `json:"description,optional"` + Gender string `json:"gender,optional"` + Icon string `json:"icon,optional"` + AudioId string `json:"audioId,optional"` + Sort int `json:"sort,optional"` + IsDefault int `json:"isDefault,optional"` + Status int `json:"status,optional"` + } + VoiceListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Gender string `json:"gender,optional"` + } + // ---------- 订阅 ---------- + SubscribeReq { + ChannelId string `json:"channelId"` + PlanType string `json:"planType"` + } + // ---------- 互动 ---------- + LikeReq { + ProgramId string `json:"programId"` + } + FavoriteReq { + ProgramId string `json:"programId"` + } + CommentReq { + ProgramId string `json:"programId"` + Content string `json:"content"` + ParentId string `json:"parentId,optional"` + } + HistoryReq { + ProgramId string `json:"programId"` + Duration int `json:"duration,optional"` + } + HistoryListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + } + // ---------- 支付 ---------- + CreatePayOrderReq { + ChannelId string `json:"channelId,optional"` + PlanType string `json:"planType"` + OrderType string `json:"orderType"` + } + // ---------- VIP ---------- + VipConfigListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + } + // ---------- 数据分析 ---------- + AnalyticsReq { + StartDate string `json:"startDate,optional"` + EndDate string `json:"endDate,optional"` + } + // ---------- TTS ---------- + TtsReq { + Text string `json:"text"` + SpeakerId string `json:"speakerId,optional"` + } +) + +// ========== 无需鉴权 ========== +@server ( + prefix: /api/radio + group: callback +) +service radio-api { + @doc "微信支付回调" + @handler WechatPayCallback + post /callback/wechatpay +} + +// ========== 需要鉴权 ========== +@server ( + prefix: /api/radio + group: category + jwt: Auth +) +service radio-api { + @doc "创建分类" + @handler CreateCategory + post /category/create (CategoryReq) + + @doc "更新分类" + @handler UpdateCategory + put /category/update (CategoryUpdateReq) + + @doc "删除分类" + @handler DeleteCategory + delete /category/delete (IdsReq) + + @doc "分类列表" + @handler GetCategoryList + post /category/list (CategoryListReq) +} + +@server ( + prefix: /api/radio + group: channel + jwt: Auth +) +service radio-api { + @doc "创建频道" + @handler CreateChannel + post /channel/create (ChannelReq) + + @doc "更新频道" + @handler UpdateChannel + put /channel/update (ChannelUpdateReq) + + @doc "删除频道" + @handler DeleteChannel + delete /channel/delete (IdsReq) + + @doc "频道列表" + @handler GetChannelList + post /channel/list (ChannelListReq) + + @doc "频道详情" + @handler GetChannelDetail + get /channel/:id (IdPathReq) +} + +@server ( + prefix: /api/radio + group: program + jwt: Auth +) +service radio-api { + @doc "创建节目" + @handler CreateProgram + post /program/create (ProgramReq) + + @doc "更新节目" + @handler UpdateProgram + put /program/update (ProgramUpdateReq) + + @doc "删除节目" + @handler DeleteProgram + delete /program/delete (IdsReq) + + @doc "节目列表" + @handler GetProgramList + post /program/list (ProgramListReq) + + @doc "节目详情" + @handler GetProgramDetail + get /program/:id (IdPathReq) + + @doc "TTS生成音频" + @handler GenerateTts + post /program/tts (TtsReq) +} + +@server ( + prefix: /api/radio + group: voice + jwt: Auth +) +service radio-api { + @doc "创建音色" + @handler CreateVoice + post /voice/create (VoiceReq) + + @doc "更新音色" + @handler UpdateVoice + put /voice/update (VoiceUpdateReq) + + @doc "删除音色" + @handler DeleteVoice + delete /voice/delete (IdsReq) + + @doc "音色列表" + @handler GetVoiceList + post /voice/list (VoiceListReq) +} + +@server ( + prefix: /api/radio + group: subscription + jwt: Auth +) +service radio-api { + @doc "我的订阅列表" + @handler GetMySubscriptions + get /subscription/list +} + +@server ( + prefix: /api/radio + group: interaction + jwt: Auth +) +service radio-api { + @doc "点赞/取消点赞" + @handler ToggleLike + post /interaction/like (LikeReq) + + @doc "收藏/取消收藏" + @handler ToggleFavorite + post /interaction/favorite (FavoriteReq) + + @doc "评论节目" + @handler CommentProgram + post /interaction/comment (CommentReq) + + @doc "记录播放历史" + @handler RecordHistory + post /interaction/history (HistoryReq) + + @doc "播放历史列表" + @handler GetHistoryList + post /interaction/history/list (HistoryListReq) + + @doc "我的收藏列表" + @handler GetFavoriteList + post /interaction/favorite/list (HistoryListReq) +} + +@server ( + prefix: /api/radio + group: pay + jwt: Auth +) +service radio-api { + @doc "创建支付订单" + @handler CreatePayOrder + post /pay/create (CreatePayOrderReq) +} + +@server ( + prefix: /api/radio + group: vip + jwt: Auth +) +service radio-api { + @doc "VIP配置列表" + @handler GetVipConfigList + post /vip/list (VipConfigListReq) + + @doc "我的VIP信息" + @handler GetMyVipInfo + get /vip/info +} + +@server ( + prefix: /api/radio + group: analytics + jwt: Auth +) +service radio-api { + @doc "数据概览" + @handler GetAnalyticsOverview + post /analytics/overview (AnalyticsReq) + + @doc "频道数据" + @handler GetChannelAnalytics + post /analytics/channel (AnalyticsReq) + + @doc "用户数据" + @handler GetUserAnalytics + post /analytics/user (AnalyticsReq) +} + diff --git a/app/radio/api/radio.go b/app/radio/api/radio.go new file mode 100644 index 0000000..58743eb --- /dev/null +++ b/app/radio/api/radio.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/radio/api/internal/config" + "sundynix-micro-go/app/radio/api/internal/handler" + "sundynix-micro-go/app/radio/api/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/rest" +) + +var configFile = flag.String("f", "etc/radio-api.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + server := rest.MustNewServer(c.RestConf) + defer server.Stop() + + ctx := svc.NewServiceContext(c) + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/app/radio/model/radio_model.go b/app/radio/model/radio_model.go new file mode 100644 index 0000000..dcfee1f --- /dev/null +++ b/app/radio/model/radio_model.go @@ -0,0 +1,230 @@ +package model + +import ( + "sundynix-micro-go/common/model" + "time" +) + +// ========== 用户扩展表(radio业务特有字段) ========== + +// SundynixRadioUserProfile 电台服务用户扩展表 +type SundynixRadioUserProfile struct { + model.BaseModel + UserID string `gorm:"size:50;uniqueIndex;column:user_id" json:"userId"` + NickName string `gorm:"size:100;column:nick_name" json:"nickName"` + AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"` + IsVip int `gorm:"default:0;column:is_vip" json:"isVip"` + VipExpireAt *time.Time `gorm:"column:vip_expire_at" json:"vipExpireAt"` + VipLevel int `gorm:"default:0;column:vip_level" json:"vipLevel"` +} + +func (SundynixRadioUserProfile) TableName() string { + return "sundynix_radio_user_profile" +} + +// ========== 分类 ========== + +// SundynixRadioCategory 电台分类 +type SundynixRadioCategory struct { + model.BaseModel + Name string `gorm:"size:50;column:name" json:"name"` + Icon string `gorm:"size:255;column:icon" json:"icon"` + Sort int `gorm:"default:0;column:sort" json:"sort"` +} + +func (SundynixRadioCategory) TableName() string { + return "sundynix_radio_category" +} + +// ========== 频道 ========== + +// SundynixRadioChannel 电台频道 +type SundynixRadioChannel struct { + model.BaseModel + CategoryID string `gorm:"size:50;index;column:category_id" json:"categoryId"` + Name string `gorm:"size:50;column:name" json:"name"` + Description string `gorm:"size:500;column:description" json:"description"` + IsFree int `gorm:"default:0;column:is_free" json:"isFree"` + IsVipOnly int `gorm:"default:0;column:is_vip_only" json:"isVipOnly"` + MonthlyPrice int `gorm:"default:0;column:monthly_price" json:"monthlyPrice"` + QuarterlyPrice int `gorm:"default:0;column:quarterly_price" json:"quarterlyPrice"` + AnnualPrice int `gorm:"default:0;column:annual_price" json:"annualPrice"` + Cover string `gorm:"size:100;column:cover" json:"cover"` + Tags string `gorm:"size:255;column:tags" json:"tags"` + Sort int `gorm:"default:0;column:sort" json:"sort"` + Status int `gorm:"default:1;column:status" json:"status"` +} + +func (SundynixRadioChannel) TableName() string { + return "sundynix_radio_channel" +} + +// ========== 节目 ========== + +// SundynixRadioProgram 电台节目 +type SundynixRadioProgram struct { + model.BaseModel + ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"` + Title string `gorm:"size:100;column:title" json:"title"` + Description string `gorm:"size:500;column:description" json:"description"` + Content string `gorm:"type:text;column:content" json:"content"` + Cover string `gorm:"size:100;column:cover" json:"cover"` + AudioID string `gorm:"size:50;column:audio_id" json:"audioId"` + AudioStatus int `gorm:"default:0;column:audio_status" json:"audioStatus"` + Duration int `gorm:"default:0;column:duration" json:"duration"` + Tags string `gorm:"size:255;column:tags" json:"tags"` + PlayCount int `gorm:"default:0;column:play_count" json:"playCount"` + LikeCount int `gorm:"default:0;column:like_count" json:"likeCount"` + Status int `gorm:"default:1;column:status" json:"status"` +} + +func (SundynixRadioProgram) TableName() string { + return "sundynix_radio_program" +} + +// ========== 音色 ========== + +// SundynixRadioVoice 音色管理 +type SundynixRadioVoice struct { + model.BaseModel + SpeakerID string `gorm:"size:50;uniqueIndex;column:speaker_id" json:"speakerId"` + Name string `gorm:"size:50;column:name" json:"name"` + Description string `gorm:"size:255;column:description" json:"description"` + Gender string `gorm:"size:10;column:gender" json:"gender"` + Icon string `gorm:"size:255;column:icon" json:"icon"` + AudioID string `gorm:"size:50;column:audio_id" json:"audioId"` + Sort int `gorm:"default:0;column:sort" json:"sort"` + Status int `gorm:"default:1;column:status" json:"status"` + IsDefault int `gorm:"default:0;column:is_default" json:"isDefault"` + UseCount int `gorm:"default:0;column:use_count" json:"useCount"` +} + +func (SundynixRadioVoice) TableName() string { + return "sundynix_radio_voice" +} + +// ========== 互动 ========== + +// SundynixRadioLike 节目点赞 +type SundynixRadioLike struct { + model.BaseModel + ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` +} + +func (SundynixRadioLike) TableName() string { + return "sundynix_radio_like" +} + +// SundynixRadioFavorite 节目收藏 +type SundynixRadioFavorite struct { + model.BaseModel + ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` +} + +func (SundynixRadioFavorite) TableName() string { + return "sundynix_radio_favorite" +} + +// SundynixRadioComment 节目评论 +type SundynixRadioComment struct { + model.BaseModel + ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` + UserID string `gorm:"size:50;column:user_id" json:"userId"` + Content string `gorm:"size:500;column:content" json:"content"` + ParentID string `gorm:"size:50;column:parent_id" json:"parentId"` +} + +func (SundynixRadioComment) TableName() string { + return "sundynix_radio_comment" +} + +// SundynixRadioHistory 播放历史 +type SundynixRadioHistory struct { + model.BaseModel + ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + Duration int `gorm:"default:0;column:duration" json:"duration"` +} + +func (SundynixRadioHistory) TableName() string { + return "sundynix_radio_history" +} + +// ========== 订阅/支付 ========== + +// SundynixRadioSubscription 用户订阅 +type SundynixRadioSubscription struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"` + ExpiredAt time.Time `gorm:"index;column:expired_at" json:"expiredAt"` + Status int `gorm:"default:1;column:status" json:"status"` +} + +func (SundynixRadioSubscription) TableName() string { + return "sundynix_radio_subscription" +} + +// SundynixRadioSubscriptionOrder 订阅订单 +type SundynixRadioSubscriptionOrder struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + ChannelID string `gorm:"size:50;column:channel_id" json:"channelId"` + OrderNo string `gorm:"size:50;uniqueIndex;column:order_no" json:"orderNo"` + PlanType string `gorm:"size:20;column:plan_type" json:"planType"` + Amount int `gorm:"column:amount" json:"amount"` + Status int `gorm:"default:0;column:status" json:"status"` + PayType string `gorm:"size:20;column:pay_type" json:"payType"` + PrepayID string `gorm:"size:100;column:prepay_id" json:"prepayId"` +} + +func (SundynixRadioSubscriptionOrder) TableName() string { + return "sundynix_radio_subscription_order" +} + +// SundynixRadioPayNotify 支付回调记录 +type SundynixRadioPayNotify struct { + model.BaseModel + OrderNo string `gorm:"size:50;column:order_no" json:"orderNo"` + TransactionID string `gorm:"size:50;column:transaction_id" json:"transactionId"` + TradeState string `gorm:"size:20;column:trade_state" json:"tradeState"` + RawData string `gorm:"type:text;column:raw_data" json:"rawData"` +} + +func (SundynixRadioPayNotify) TableName() string { + return "sundynix_radio_pay_notify" +} + +// ========== VIP配置 ========== + +// SundynixRadioVipConfig VIP配置 +type SundynixRadioVipConfig struct { + model.BaseModel + Name string `gorm:"size:50;column:name" json:"name"` + PlanType string `gorm:"size:20;column:plan_type" json:"planType"` + Price int `gorm:"column:price" json:"price"` + OriginalPrice int `gorm:"column:original_price" json:"originalPrice"` + Duration int `gorm:"column:duration" json:"duration"` + Desc string `gorm:"size:200;column:desc" json:"desc"` + Sort int `gorm:"default:0;column:sort" json:"sort"` + Status int `gorm:"default:1;column:status" json:"status"` +} + +func (SundynixRadioVipConfig) TableName() string { + return "sundynix_radio_vip_config" +} + +// SundynixRadioListenLog 收听日志(数据分析用) +type SundynixRadioListenLog struct { + model.BaseModel + UserID string `gorm:"size:50;index;column:user_id" json:"userId"` + ProgramID string `gorm:"size:50;index;column:program_id" json:"programId"` + ChannelID string `gorm:"size:50;index;column:channel_id" json:"channelId"` + Duration int `gorm:"column:duration" json:"duration"` +} + +func (SundynixRadioListenLog) TableName() string { + return "sundynix_radio_listen_log" +} diff --git a/app/radio/rpc/etc/radio.yaml b/app/radio/rpc/etc/radio.yaml new file mode 100644 index 0000000..5f7336f --- /dev/null +++ b/app/radio/rpc/etc/radio.yaml @@ -0,0 +1,6 @@ +Name: radio.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: radio.rpc diff --git a/app/radio/rpc/internal/config/config.go b/app/radio/rpc/internal/config/config.go new file mode 100755 index 0000000..c1f85b9 --- /dev/null +++ b/app/radio/rpc/internal/config/config.go @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/app/radio/rpc/internal/logic/commentProgramLogic.go b/app/radio/rpc/internal/logic/commentProgramLogic.go new file mode 100644 index 0000000..7bdd4c3 --- /dev/null +++ b/app/radio/rpc/internal/logic/commentProgramLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CommentProgramLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCommentProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentProgramLogic { + return &CommentProgramLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CommentProgramLogic) CommentProgram(in *radio.CommentReq) (*radio.CommentResp, error) { + // todo: add your logic here and delete this line + + return &radio.CommentResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/createCategoryLogic.go b/app/radio/rpc/internal/logic/createCategoryLogic.go new file mode 100644 index 0000000..6925a7f --- /dev/null +++ b/app/radio/rpc/internal/logic/createCategoryLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateCategoryLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateCategoryLogic { + return &CreateCategoryLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 分类 +func (l *CreateCategoryLogic) CreateCategory(in *radio.CreateCategoryReq) (*radio.CreateCategoryResp, error) { + // todo: add your logic here and delete this line + + return &radio.CreateCategoryResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/createChannelLogic.go b/app/radio/rpc/internal/logic/createChannelLogic.go new file mode 100644 index 0000000..0df0bf2 --- /dev/null +++ b/app/radio/rpc/internal/logic/createChannelLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateChannelLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChannelLogic { + return &CreateChannelLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 频道 +func (l *CreateChannelLogic) CreateChannel(in *radio.CreateChannelReq) (*radio.CreateChannelResp, error) { + // todo: add your logic here and delete this line + + return &radio.CreateChannelResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/createPayOrderLogic.go b/app/radio/rpc/internal/logic/createPayOrderLogic.go new file mode 100644 index 0000000..a2446c0 --- /dev/null +++ b/app/radio/rpc/internal/logic/createPayOrderLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreatePayOrderLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreatePayOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayOrderLogic { + return &CreatePayOrderLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *CreatePayOrderLogic) CreatePayOrder(in *radio.CreatePayOrderReq) (*radio.CreatePayOrderResp, error) { + // todo: add your logic here and delete this line + + return &radio.CreatePayOrderResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/createProgramLogic.go b/app/radio/rpc/internal/logic/createProgramLogic.go new file mode 100644 index 0000000..ab54222 --- /dev/null +++ b/app/radio/rpc/internal/logic/createProgramLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateProgramLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProgramLogic { + return &CreateProgramLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 节目 +func (l *CreateProgramLogic) CreateProgram(in *radio.CreateProgramReq) (*radio.CreateProgramResp, error) { + // todo: add your logic here and delete this line + + return &radio.CreateProgramResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/createVoiceLogic.go b/app/radio/rpc/internal/logic/createVoiceLogic.go new file mode 100644 index 0000000..91a33f7 --- /dev/null +++ b/app/radio/rpc/internal/logic/createVoiceLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateVoiceLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateVoiceLogic { + return &CreateVoiceLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 音色 +func (l *CreateVoiceLogic) CreateVoice(in *radio.CreateVoiceReq) (*radio.CreateVoiceResp, error) { + // todo: add your logic here and delete this line + + return &radio.CreateVoiceResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/deleteCategoryLogic.go b/app/radio/rpc/internal/logic/deleteCategoryLogic.go new file mode 100644 index 0000000..17f9196 --- /dev/null +++ b/app/radio/rpc/internal/logic/deleteCategoryLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteCategoryLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic { + return &DeleteCategoryLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteCategoryLogic) DeleteCategory(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + // todo: add your logic here and delete this line + + return &radio.DeleteResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/deleteChannelLogic.go b/app/radio/rpc/internal/logic/deleteChannelLogic.go new file mode 100644 index 0000000..18011e0 --- /dev/null +++ b/app/radio/rpc/internal/logic/deleteChannelLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteChannelLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteChannelLogic { + return &DeleteChannelLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteChannelLogic) DeleteChannel(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + // todo: add your logic here and delete this line + + return &radio.DeleteResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/deleteProgramLogic.go b/app/radio/rpc/internal/logic/deleteProgramLogic.go new file mode 100644 index 0000000..f078347 --- /dev/null +++ b/app/radio/rpc/internal/logic/deleteProgramLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteProgramLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProgramLogic { + return &DeleteProgramLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteProgramLogic) DeleteProgram(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + // todo: add your logic here and delete this line + + return &radio.DeleteResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/deleteVoiceLogic.go b/app/radio/rpc/internal/logic/deleteVoiceLogic.go new file mode 100644 index 0000000..f498ad7 --- /dev/null +++ b/app/radio/rpc/internal/logic/deleteVoiceLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteVoiceLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDeleteVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteVoiceLogic { + return &DeleteVoiceLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DeleteVoiceLogic) DeleteVoice(in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + // todo: add your logic here and delete this line + + return &radio.DeleteResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getCategoryListLogic.go b/app/radio/rpc/internal/logic/getCategoryListLogic.go new file mode 100644 index 0000000..da7069a --- /dev/null +++ b/app/radio/rpc/internal/logic/getCategoryListLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetCategoryListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetCategoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryListLogic { + return &GetCategoryListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetCategoryListLogic) GetCategoryList(in *radio.GetCategoryListReq) (*radio.GetCategoryListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetCategoryListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getChannelDetailLogic.go b/app/radio/rpc/internal/logic/getChannelDetailLogic.go new file mode 100644 index 0000000..21bc458 --- /dev/null +++ b/app/radio/rpc/internal/logic/getChannelDetailLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetChannelDetailLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetChannelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelDetailLogic { + return &GetChannelDetailLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetChannelDetailLogic) GetChannelDetail(in *radio.GetChannelDetailReq) (*radio.GetChannelDetailResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetChannelDetailResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getChannelListLogic.go b/app/radio/rpc/internal/logic/getChannelListLogic.go new file mode 100644 index 0000000..21ab6ce --- /dev/null +++ b/app/radio/rpc/internal/logic/getChannelListLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetChannelListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetChannelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetChannelListLogic { + return &GetChannelListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetChannelListLogic) GetChannelList(in *radio.GetChannelListReq) (*radio.GetChannelListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetChannelListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getFavoriteListLogic.go b/app/radio/rpc/internal/logic/getFavoriteListLogic.go new file mode 100644 index 0000000..75b1a99 --- /dev/null +++ b/app/radio/rpc/internal/logic/getFavoriteListLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetFavoriteListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetFavoriteListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFavoriteListLogic { + return &GetFavoriteListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetFavoriteListLogic) GetFavoriteList(in *radio.GetFavoriteListReq) (*radio.GetFavoriteListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetFavoriteListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getHistoryListLogic.go b/app/radio/rpc/internal/logic/getHistoryListLogic.go new file mode 100644 index 0000000..e3c06e7 --- /dev/null +++ b/app/radio/rpc/internal/logic/getHistoryListLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetHistoryListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryListLogic { + return &GetHistoryListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetHistoryListLogic) GetHistoryList(in *radio.GetHistoryListReq) (*radio.GetHistoryListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetHistoryListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getMySubscriptionsLogic.go b/app/radio/rpc/internal/logic/getMySubscriptionsLogic.go new file mode 100644 index 0000000..46c41d5 --- /dev/null +++ b/app/radio/rpc/internal/logic/getMySubscriptionsLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetMySubscriptionsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetMySubscriptionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMySubscriptionsLogic { + return &GetMySubscriptionsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 订阅 +func (l *GetMySubscriptionsLogic) GetMySubscriptions(in *radio.GetMySubscriptionsReq) (*radio.GetMySubscriptionsResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetMySubscriptionsResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getMyVipInfoLogic.go b/app/radio/rpc/internal/logic/getMyVipInfoLogic.go new file mode 100644 index 0000000..130e2ba --- /dev/null +++ b/app/radio/rpc/internal/logic/getMyVipInfoLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetMyVipInfoLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetMyVipInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyVipInfoLogic { + return &GetMyVipInfoLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetMyVipInfoLogic) GetMyVipInfo(in *radio.GetMyVipInfoReq) (*radio.GetMyVipInfoResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetMyVipInfoResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getProgramDetailLogic.go b/app/radio/rpc/internal/logic/getProgramDetailLogic.go new file mode 100644 index 0000000..4ffb92d --- /dev/null +++ b/app/radio/rpc/internal/logic/getProgramDetailLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetProgramDetailLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetProgramDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramDetailLogic { + return &GetProgramDetailLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetProgramDetailLogic) GetProgramDetail(in *radio.GetProgramDetailReq) (*radio.GetProgramDetailResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetProgramDetailResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getProgramListLogic.go b/app/radio/rpc/internal/logic/getProgramListLogic.go new file mode 100644 index 0000000..b675d61 --- /dev/null +++ b/app/radio/rpc/internal/logic/getProgramListLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetProgramListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetProgramListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProgramListLogic { + return &GetProgramListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetProgramListLogic) GetProgramList(in *radio.GetProgramListReq) (*radio.GetProgramListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetProgramListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getRadioUserProfileLogic.go b/app/radio/rpc/internal/logic/getRadioUserProfileLogic.go new file mode 100644 index 0000000..28cf1a2 --- /dev/null +++ b/app/radio/rpc/internal/logic/getRadioUserProfileLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetRadioUserProfileLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetRadioUserProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRadioUserProfileLogic { + return &GetRadioUserProfileLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 用户 +func (l *GetRadioUserProfileLogic) GetRadioUserProfile(in *radio.GetRadioUserProfileReq) (*radio.GetRadioUserProfileResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetRadioUserProfileResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getVipConfigListLogic.go b/app/radio/rpc/internal/logic/getVipConfigListLogic.go new file mode 100644 index 0000000..4d040dd --- /dev/null +++ b/app/radio/rpc/internal/logic/getVipConfigListLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetVipConfigListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetVipConfigListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVipConfigListLogic { + return &GetVipConfigListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// VIP +func (l *GetVipConfigListLogic) GetVipConfigList(in *radio.GetVipConfigListReq) (*radio.GetVipConfigListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetVipConfigListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/getVoiceListLogic.go b/app/radio/rpc/internal/logic/getVoiceListLogic.go new file mode 100644 index 0000000..cfbe032 --- /dev/null +++ b/app/radio/rpc/internal/logic/getVoiceListLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetVoiceListLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetVoiceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVoiceListLogic { + return &GetVoiceListLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetVoiceListLogic) GetVoiceList(in *radio.GetVoiceListReq) (*radio.GetVoiceListResp, error) { + // todo: add your logic here and delete this line + + return &radio.GetVoiceListResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/recordHistoryLogic.go b/app/radio/rpc/internal/logic/recordHistoryLogic.go new file mode 100644 index 0000000..657eac1 --- /dev/null +++ b/app/radio/rpc/internal/logic/recordHistoryLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type RecordHistoryLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewRecordHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecordHistoryLogic { + return &RecordHistoryLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *RecordHistoryLogic) RecordHistory(in *radio.RecordHistoryReq) (*radio.RecordHistoryResp, error) { + // todo: add your logic here and delete this line + + return &radio.RecordHistoryResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/toggleFavoriteLogic.go b/app/radio/rpc/internal/logic/toggleFavoriteLogic.go new file mode 100644 index 0000000..3de0d28 --- /dev/null +++ b/app/radio/rpc/internal/logic/toggleFavoriteLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ToggleFavoriteLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewToggleFavoriteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleFavoriteLogic { + return &ToggleFavoriteLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *ToggleFavoriteLogic) ToggleFavorite(in *radio.ToggleFavoriteReq) (*radio.ToggleFavoriteResp, error) { + // todo: add your logic here and delete this line + + return &radio.ToggleFavoriteResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/toggleLikeLogic.go b/app/radio/rpc/internal/logic/toggleLikeLogic.go new file mode 100644 index 0000000..ec56cf8 --- /dev/null +++ b/app/radio/rpc/internal/logic/toggleLikeLogic.go @@ -0,0 +1,31 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ToggleLikeLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewToggleLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToggleLikeLogic { + return &ToggleLikeLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 互动 +func (l *ToggleLikeLogic) ToggleLike(in *radio.ToggleLikeReq) (*radio.ToggleLikeResp, error) { + // todo: add your logic here and delete this line + + return &radio.ToggleLikeResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/updateCategoryLogic.go b/app/radio/rpc/internal/logic/updateCategoryLogic.go new file mode 100644 index 0000000..50d7e80 --- /dev/null +++ b/app/radio/rpc/internal/logic/updateCategoryLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateCategoryLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateCategoryLogic { + return &UpdateCategoryLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateCategoryLogic) UpdateCategory(in *radio.UpdateCategoryReq) (*radio.UpdateCategoryResp, error) { + // todo: add your logic here and delete this line + + return &radio.UpdateCategoryResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/updateChannelLogic.go b/app/radio/rpc/internal/logic/updateChannelLogic.go new file mode 100644 index 0000000..aa54db7 --- /dev/null +++ b/app/radio/rpc/internal/logic/updateChannelLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateChannelLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateChannelLogic { + return &UpdateChannelLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateChannelLogic) UpdateChannel(in *radio.UpdateChannelReq) (*radio.UpdateChannelResp, error) { + // todo: add your logic here and delete this line + + return &radio.UpdateChannelResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/updateProgramLogic.go b/app/radio/rpc/internal/logic/updateProgramLogic.go new file mode 100644 index 0000000..d52af05 --- /dev/null +++ b/app/radio/rpc/internal/logic/updateProgramLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateProgramLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateProgramLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProgramLogic { + return &UpdateProgramLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateProgramLogic) UpdateProgram(in *radio.UpdateProgramReq) (*radio.UpdateProgramResp, error) { + // todo: add your logic here and delete this line + + return &radio.UpdateProgramResp{}, nil +} diff --git a/app/radio/rpc/internal/logic/updateVoiceLogic.go b/app/radio/rpc/internal/logic/updateVoiceLogic.go new file mode 100644 index 0000000..35d8d93 --- /dev/null +++ b/app/radio/rpc/internal/logic/updateVoiceLogic.go @@ -0,0 +1,30 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateVoiceLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateVoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateVoiceLogic { + return &UpdateVoiceLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UpdateVoiceLogic) UpdateVoice(in *radio.UpdateVoiceReq) (*radio.UpdateVoiceResp, error) { + // todo: add your logic here and delete this line + + return &radio.UpdateVoiceResp{}, nil +} diff --git a/app/radio/rpc/internal/server/radioServiceServer.go b/app/radio/rpc/internal/server/radioServiceServer.go new file mode 100644 index 0000000..6ebe2b6 --- /dev/null +++ b/app/radio/rpc/internal/server/radioServiceServer.go @@ -0,0 +1,177 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: radio.proto + +package server + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/internal/logic" + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" +) + +type RadioServiceServer struct { + svcCtx *svc.ServiceContext + radio.UnimplementedRadioServiceServer +} + +func NewRadioServiceServer(svcCtx *svc.ServiceContext) *RadioServiceServer { + return &RadioServiceServer{ + svcCtx: svcCtx, + } +} + +// 用户 +func (s *RadioServiceServer) GetRadioUserProfile(ctx context.Context, in *radio.GetRadioUserProfileReq) (*radio.GetRadioUserProfileResp, error) { + l := logic.NewGetRadioUserProfileLogic(ctx, s.svcCtx) + return l.GetRadioUserProfile(in) +} + +// 分类 +func (s *RadioServiceServer) CreateCategory(ctx context.Context, in *radio.CreateCategoryReq) (*radio.CreateCategoryResp, error) { + l := logic.NewCreateCategoryLogic(ctx, s.svcCtx) + return l.CreateCategory(in) +} + +func (s *RadioServiceServer) UpdateCategory(ctx context.Context, in *radio.UpdateCategoryReq) (*radio.UpdateCategoryResp, error) { + l := logic.NewUpdateCategoryLogic(ctx, s.svcCtx) + return l.UpdateCategory(in) +} + +func (s *RadioServiceServer) DeleteCategory(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + l := logic.NewDeleteCategoryLogic(ctx, s.svcCtx) + return l.DeleteCategory(in) +} + +func (s *RadioServiceServer) GetCategoryList(ctx context.Context, in *radio.GetCategoryListReq) (*radio.GetCategoryListResp, error) { + l := logic.NewGetCategoryListLogic(ctx, s.svcCtx) + return l.GetCategoryList(in) +} + +// 频道 +func (s *RadioServiceServer) CreateChannel(ctx context.Context, in *radio.CreateChannelReq) (*radio.CreateChannelResp, error) { + l := logic.NewCreateChannelLogic(ctx, s.svcCtx) + return l.CreateChannel(in) +} + +func (s *RadioServiceServer) UpdateChannel(ctx context.Context, in *radio.UpdateChannelReq) (*radio.UpdateChannelResp, error) { + l := logic.NewUpdateChannelLogic(ctx, s.svcCtx) + return l.UpdateChannel(in) +} + +func (s *RadioServiceServer) DeleteChannel(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + l := logic.NewDeleteChannelLogic(ctx, s.svcCtx) + return l.DeleteChannel(in) +} + +func (s *RadioServiceServer) GetChannelList(ctx context.Context, in *radio.GetChannelListReq) (*radio.GetChannelListResp, error) { + l := logic.NewGetChannelListLogic(ctx, s.svcCtx) + return l.GetChannelList(in) +} + +func (s *RadioServiceServer) GetChannelDetail(ctx context.Context, in *radio.GetChannelDetailReq) (*radio.GetChannelDetailResp, error) { + l := logic.NewGetChannelDetailLogic(ctx, s.svcCtx) + return l.GetChannelDetail(in) +} + +// 节目 +func (s *RadioServiceServer) CreateProgram(ctx context.Context, in *radio.CreateProgramReq) (*radio.CreateProgramResp, error) { + l := logic.NewCreateProgramLogic(ctx, s.svcCtx) + return l.CreateProgram(in) +} + +func (s *RadioServiceServer) UpdateProgram(ctx context.Context, in *radio.UpdateProgramReq) (*radio.UpdateProgramResp, error) { + l := logic.NewUpdateProgramLogic(ctx, s.svcCtx) + return l.UpdateProgram(in) +} + +func (s *RadioServiceServer) DeleteProgram(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + l := logic.NewDeleteProgramLogic(ctx, s.svcCtx) + return l.DeleteProgram(in) +} + +func (s *RadioServiceServer) GetProgramList(ctx context.Context, in *radio.GetProgramListReq) (*radio.GetProgramListResp, error) { + l := logic.NewGetProgramListLogic(ctx, s.svcCtx) + return l.GetProgramList(in) +} + +func (s *RadioServiceServer) GetProgramDetail(ctx context.Context, in *radio.GetProgramDetailReq) (*radio.GetProgramDetailResp, error) { + l := logic.NewGetProgramDetailLogic(ctx, s.svcCtx) + return l.GetProgramDetail(in) +} + +// 音色 +func (s *RadioServiceServer) CreateVoice(ctx context.Context, in *radio.CreateVoiceReq) (*radio.CreateVoiceResp, error) { + l := logic.NewCreateVoiceLogic(ctx, s.svcCtx) + return l.CreateVoice(in) +} + +func (s *RadioServiceServer) UpdateVoice(ctx context.Context, in *radio.UpdateVoiceReq) (*radio.UpdateVoiceResp, error) { + l := logic.NewUpdateVoiceLogic(ctx, s.svcCtx) + return l.UpdateVoice(in) +} + +func (s *RadioServiceServer) DeleteVoice(ctx context.Context, in *radio.DeleteByIdsReq) (*radio.DeleteResp, error) { + l := logic.NewDeleteVoiceLogic(ctx, s.svcCtx) + return l.DeleteVoice(in) +} + +func (s *RadioServiceServer) GetVoiceList(ctx context.Context, in *radio.GetVoiceListReq) (*radio.GetVoiceListResp, error) { + l := logic.NewGetVoiceListLogic(ctx, s.svcCtx) + return l.GetVoiceList(in) +} + +// 互动 +func (s *RadioServiceServer) ToggleLike(ctx context.Context, in *radio.ToggleLikeReq) (*radio.ToggleLikeResp, error) { + l := logic.NewToggleLikeLogic(ctx, s.svcCtx) + return l.ToggleLike(in) +} + +func (s *RadioServiceServer) ToggleFavorite(ctx context.Context, in *radio.ToggleFavoriteReq) (*radio.ToggleFavoriteResp, error) { + l := logic.NewToggleFavoriteLogic(ctx, s.svcCtx) + return l.ToggleFavorite(in) +} + +func (s *RadioServiceServer) CommentProgram(ctx context.Context, in *radio.CommentReq) (*radio.CommentResp, error) { + l := logic.NewCommentProgramLogic(ctx, s.svcCtx) + return l.CommentProgram(in) +} + +func (s *RadioServiceServer) RecordHistory(ctx context.Context, in *radio.RecordHistoryReq) (*radio.RecordHistoryResp, error) { + l := logic.NewRecordHistoryLogic(ctx, s.svcCtx) + return l.RecordHistory(in) +} + +func (s *RadioServiceServer) GetHistoryList(ctx context.Context, in *radio.GetHistoryListReq) (*radio.GetHistoryListResp, error) { + l := logic.NewGetHistoryListLogic(ctx, s.svcCtx) + return l.GetHistoryList(in) +} + +func (s *RadioServiceServer) GetFavoriteList(ctx context.Context, in *radio.GetFavoriteListReq) (*radio.GetFavoriteListResp, error) { + l := logic.NewGetFavoriteListLogic(ctx, s.svcCtx) + return l.GetFavoriteList(in) +} + +// 订阅 +func (s *RadioServiceServer) GetMySubscriptions(ctx context.Context, in *radio.GetMySubscriptionsReq) (*radio.GetMySubscriptionsResp, error) { + l := logic.NewGetMySubscriptionsLogic(ctx, s.svcCtx) + return l.GetMySubscriptions(in) +} + +func (s *RadioServiceServer) CreatePayOrder(ctx context.Context, in *radio.CreatePayOrderReq) (*radio.CreatePayOrderResp, error) { + l := logic.NewCreatePayOrderLogic(ctx, s.svcCtx) + return l.CreatePayOrder(in) +} + +// VIP +func (s *RadioServiceServer) GetVipConfigList(ctx context.Context, in *radio.GetVipConfigListReq) (*radio.GetVipConfigListResp, error) { + l := logic.NewGetVipConfigListLogic(ctx, s.svcCtx) + return l.GetVipConfigList(in) +} + +func (s *RadioServiceServer) GetMyVipInfo(ctx context.Context, in *radio.GetMyVipInfoReq) (*radio.GetMyVipInfoResp, error) { + l := logic.NewGetMyVipInfoLogic(ctx, s.svcCtx) + return l.GetMyVipInfo(in) +} diff --git a/app/radio/rpc/internal/svc/serviceContext.go b/app/radio/rpc/internal/svc/serviceContext.go new file mode 100644 index 0000000..34977ab --- /dev/null +++ b/app/radio/rpc/internal/svc/serviceContext.go @@ -0,0 +1,13 @@ +package svc + +import "sundynix-micro-go/app/radio/rpc/internal/config" + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + } +} diff --git a/app/radio/rpc/pb/radio.proto b/app/radio/rpc/pb/radio.proto new file mode 100644 index 0000000..10d24a7 --- /dev/null +++ b/app/radio/rpc/pb/radio.proto @@ -0,0 +1,196 @@ +syntax = "proto3"; + +package radio; + +option go_package = "./radio"; + +// ========== 用户Profile ========== +message RadioUserProfile { + string id = 1; + string userId = 2; + string nickName = 3; + string avatarId = 4; + int32 isVip = 5; + int64 vipExpireAt = 6; + int32 vipLevel = 7; +} +message GetRadioUserProfileReq { string userId = 1; } +message GetRadioUserProfileResp { RadioUserProfile profile = 1; } + +// ========== 分类 ========== +message CategoryInfo { + string id = 1; + string name = 2; + string icon = 3; + int32 sort = 4; +} +message CreateCategoryReq { string name = 1; string icon = 2; int32 sort = 3; } +message CreateCategoryResp { string id = 1; } +message UpdateCategoryReq { string id = 1; string name = 2; string icon = 3; int32 sort = 4; } +message UpdateCategoryResp {} +message DeleteByIdsReq { repeated string ids = 1; } +message DeleteResp {} +message GetCategoryListReq { int32 current = 1; int32 pageSize = 2; } +message GetCategoryListResp { repeated CategoryInfo list = 1; int64 total = 2; } + +// ========== 频道 ========== +message ChannelInfo { + string id = 1; + string categoryId = 2; + string name = 3; + string description = 4; + int32 isFree = 5; + int32 isVipOnly = 6; + int32 monthlyPrice = 7; + int32 quarterlyPrice = 8; + int32 annualPrice = 9; + string cover = 10; + string tags = 11; + int32 sort = 12; + int32 status = 13; + int64 createdAt = 14; +} +message CreateChannelReq { + string categoryId = 1; string name = 2; string description = 3; + int32 isFree = 4; int32 isVipOnly = 5; + int32 monthlyPrice = 6; int32 quarterlyPrice = 7; int32 annualPrice = 8; + string cover = 9; string tags = 10; int32 sort = 11; +} +message CreateChannelResp { string id = 1; } +message UpdateChannelReq { + string id = 1; string name = 2; string description = 3; + int32 isFree = 4; int32 isVipOnly = 5; + int32 monthlyPrice = 6; int32 quarterlyPrice = 7; int32 annualPrice = 8; + string cover = 9; string tags = 10; int32 sort = 11; int32 status = 12; +} +message UpdateChannelResp {} +message GetChannelListReq { int32 current = 1; int32 pageSize = 2; string categoryId = 3; string userId = 4; } +message GetChannelListResp { repeated ChannelInfo list = 1; int64 total = 2; } +message GetChannelDetailReq { string id = 1; string userId = 2; } +message GetChannelDetailResp { ChannelInfo channel = 1; } + +// ========== 节目 ========== +message ProgramInfo { + string id = 1; + string channelId = 2; + string title = 3; + string description = 4; + string content = 5; + string cover = 6; + string audioId = 7; + int32 audioStatus = 8; + int32 duration = 9; + string tags = 10; + int32 playCount = 11; + int32 likeCount = 12; + int32 status = 13; + int64 createdAt = 14; +} +message CreateProgramReq { + string channelId = 1; string title = 2; string description = 3; + string content = 4; string cover = 5; string tags = 6; +} +message CreateProgramResp { string id = 1; } +message UpdateProgramReq { + string id = 1; string title = 2; string description = 3; + string content = 4; string cover = 5; string audioId = 6; + int32 audioStatus = 7; int32 duration = 8; string tags = 9; int32 status = 10; +} +message UpdateProgramResp {} +message GetProgramListReq { int32 current = 1; int32 pageSize = 2; string channelId = 3; string userId = 4; } +message GetProgramListResp { repeated ProgramInfo list = 1; int64 total = 2; } +message GetProgramDetailReq { string id = 1; string userId = 2; } +message GetProgramDetailResp { ProgramInfo program = 1; } + +// ========== 音色 ========== +message VoiceInfo { + string id = 1; string speakerId = 2; string name = 3; + string description = 4; string gender = 5; string icon = 6; + string audioId = 7; int32 sort = 8; int32 status = 9; + int32 isDefault = 10; int32 useCount = 11; +} +message CreateVoiceReq { string speakerId = 1; string name = 2; string description = 3; string gender = 4; string icon = 5; string audioId = 6; int32 sort = 7; int32 isDefault = 8; } +message CreateVoiceResp { string id = 1; } +message UpdateVoiceReq { string id = 1; string name = 2; string description = 3; string icon = 4; string audioId = 5; int32 sort = 6; int32 status = 7; int32 isDefault = 8; } +message UpdateVoiceResp {} +message GetVoiceListReq { int32 current = 1; int32 pageSize = 2; } +message GetVoiceListResp { repeated VoiceInfo list = 1; int64 total = 2; } + +// ========== 互动 ========== +message ToggleLikeReq { string userId = 1; string programId = 2; } +message ToggleLikeResp { bool liked = 1; } +message ToggleFavoriteReq { string userId = 1; string programId = 2; } +message ToggleFavoriteResp { bool favorited = 1; } +message CommentReq { string userId = 1; string programId = 2; string content = 3; string parentId = 4; } +message CommentResp {} +message RecordHistoryReq { string userId = 1; string programId = 2; int32 duration = 3; } +message RecordHistoryResp {} +message GetHistoryListReq { string userId = 1; int32 current = 2; int32 pageSize = 3; } +message GetHistoryListResp { repeated ProgramInfo list = 1; int64 total = 2; } +message GetFavoriteListReq { string userId = 1; int32 current = 2; int32 pageSize = 3; } +message GetFavoriteListResp { repeated ProgramInfo list = 1; int64 total = 2; } + +// ========== 订阅/支付 ========== +message SubscriptionInfo { + string id = 1; string userId = 2; string channelId = 3; + int64 expiredAt = 4; int32 status = 5; +} +message GetMySubscriptionsReq { string userId = 1; } +message GetMySubscriptionsResp { repeated SubscriptionInfo list = 1; } +message CreatePayOrderReq { string userId = 1; string channelId = 2; string planType = 3; } +message CreatePayOrderResp { string orderNo = 1; string prepayId = 2; } + +// ========== VIP ========== +message VipConfigInfo { + string id = 1; string name = 2; string planType = 3; + int32 price = 4; int32 originalPrice = 5; int32 duration = 6; + string desc = 7; +} +message GetVipConfigListReq { int32 current = 1; int32 pageSize = 2; } +message GetVipConfigListResp { repeated VipConfigInfo list = 1; int64 total = 2; } +message GetMyVipInfoReq { string userId = 1; } +message GetMyVipInfoResp { RadioUserProfile profile = 1; } + +// ========== 通用 ========== +message Empty {} + +// ========== 服务定义 ========== +service RadioService { + // 用户 + rpc GetRadioUserProfile(GetRadioUserProfileReq) returns (GetRadioUserProfileResp); + // 分类 + rpc CreateCategory(CreateCategoryReq) returns (CreateCategoryResp); + rpc UpdateCategory(UpdateCategoryReq) returns (UpdateCategoryResp); + rpc DeleteCategory(DeleteByIdsReq) returns (DeleteResp); + rpc GetCategoryList(GetCategoryListReq) returns (GetCategoryListResp); + // 频道 + rpc CreateChannel(CreateChannelReq) returns (CreateChannelResp); + rpc UpdateChannel(UpdateChannelReq) returns (UpdateChannelResp); + rpc DeleteChannel(DeleteByIdsReq) returns (DeleteResp); + rpc GetChannelList(GetChannelListReq) returns (GetChannelListResp); + rpc GetChannelDetail(GetChannelDetailReq) returns (GetChannelDetailResp); + // 节目 + rpc CreateProgram(CreateProgramReq) returns (CreateProgramResp); + rpc UpdateProgram(UpdateProgramReq) returns (UpdateProgramResp); + rpc DeleteProgram(DeleteByIdsReq) returns (DeleteResp); + rpc GetProgramList(GetProgramListReq) returns (GetProgramListResp); + rpc GetProgramDetail(GetProgramDetailReq) returns (GetProgramDetailResp); + // 音色 + rpc CreateVoice(CreateVoiceReq) returns (CreateVoiceResp); + rpc UpdateVoice(UpdateVoiceReq) returns (UpdateVoiceResp); + rpc DeleteVoice(DeleteByIdsReq) returns (DeleteResp); + rpc GetVoiceList(GetVoiceListReq) returns (GetVoiceListResp); + // 互动 + rpc ToggleLike(ToggleLikeReq) returns (ToggleLikeResp); + rpc ToggleFavorite(ToggleFavoriteReq) returns (ToggleFavoriteResp); + rpc CommentProgram(CommentReq) returns (CommentResp); + rpc RecordHistory(RecordHistoryReq) returns (RecordHistoryResp); + rpc GetHistoryList(GetHistoryListReq) returns (GetHistoryListResp); + rpc GetFavoriteList(GetFavoriteListReq) returns (GetFavoriteListResp); + // 订阅 + rpc GetMySubscriptions(GetMySubscriptionsReq) returns (GetMySubscriptionsResp); + rpc CreatePayOrder(CreatePayOrderReq) returns (CreatePayOrderResp); + // VIP + rpc GetVipConfigList(GetVipConfigListReq) returns (GetVipConfigListResp); + rpc GetMyVipInfo(GetMyVipInfoReq) returns (GetMyVipInfoResp); +} diff --git a/app/radio/rpc/radio.go b/app/radio/rpc/radio.go new file mode 100644 index 0000000..78c0960 --- /dev/null +++ b/app/radio/rpc/radio.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/radio/rpc/internal/config" + "sundynix-micro-go/app/radio/rpc/internal/server" + "sundynix-micro-go/app/radio/rpc/internal/svc" + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/radio.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + radio.RegisterRadioServiceServer(grpcServer, server.NewRadioServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/app/radio/rpc/radio/radio.pb.go b/app/radio/rpc/radio/radio.pb.go new file mode 100644 index 0000000..48fc804 --- /dev/null +++ b/app/radio/rpc/radio/radio.pb.go @@ -0,0 +1,4216 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: pb/radio.proto + +package radio + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ========== 用户Profile ========== +type RadioUserProfile struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + NickName string `protobuf:"bytes,3,opt,name=nickName,proto3" json:"nickName,omitempty"` + AvatarId string `protobuf:"bytes,4,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + IsVip int32 `protobuf:"varint,5,opt,name=isVip,proto3" json:"isVip,omitempty"` + VipExpireAt int64 `protobuf:"varint,6,opt,name=vipExpireAt,proto3" json:"vipExpireAt,omitempty"` + VipLevel int32 `protobuf:"varint,7,opt,name=vipLevel,proto3" json:"vipLevel,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RadioUserProfile) Reset() { + *x = RadioUserProfile{} + mi := &file_pb_radio_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RadioUserProfile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RadioUserProfile) ProtoMessage() {} + +func (x *RadioUserProfile) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RadioUserProfile.ProtoReflect.Descriptor instead. +func (*RadioUserProfile) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{0} +} + +func (x *RadioUserProfile) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RadioUserProfile) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *RadioUserProfile) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +func (x *RadioUserProfile) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +func (x *RadioUserProfile) GetIsVip() int32 { + if x != nil { + return x.IsVip + } + return 0 +} + +func (x *RadioUserProfile) GetVipExpireAt() int64 { + if x != nil { + return x.VipExpireAt + } + return 0 +} + +func (x *RadioUserProfile) GetVipLevel() int32 { + if x != nil { + return x.VipLevel + } + return 0 +} + +type GetRadioUserProfileReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRadioUserProfileReq) Reset() { + *x = GetRadioUserProfileReq{} + mi := &file_pb_radio_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRadioUserProfileReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRadioUserProfileReq) ProtoMessage() {} + +func (x *GetRadioUserProfileReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRadioUserProfileReq.ProtoReflect.Descriptor instead. +func (*GetRadioUserProfileReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{1} +} + +func (x *GetRadioUserProfileReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetRadioUserProfileResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Profile *RadioUserProfile `protobuf:"bytes,1,opt,name=profile,proto3" json:"profile,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRadioUserProfileResp) Reset() { + *x = GetRadioUserProfileResp{} + mi := &file_pb_radio_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRadioUserProfileResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRadioUserProfileResp) ProtoMessage() {} + +func (x *GetRadioUserProfileResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRadioUserProfileResp.ProtoReflect.Descriptor instead. +func (*GetRadioUserProfileResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{2} +} + +func (x *GetRadioUserProfileResp) GetProfile() *RadioUserProfile { + if x != nil { + return x.Profile + } + return nil +} + +// ========== 分类 ========== +type CategoryInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` + Sort int32 `protobuf:"varint,4,opt,name=sort,proto3" json:"sort,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CategoryInfo) Reset() { + *x = CategoryInfo{} + mi := &file_pb_radio_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CategoryInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CategoryInfo) ProtoMessage() {} + +func (x *CategoryInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CategoryInfo.ProtoReflect.Descriptor instead. +func (*CategoryInfo) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{3} +} + +func (x *CategoryInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CategoryInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CategoryInfo) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *CategoryInfo) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +type CreateCategoryReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Icon string `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"` + Sort int32 `protobuf:"varint,3,opt,name=sort,proto3" json:"sort,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateCategoryReq) Reset() { + *x = CreateCategoryReq{} + mi := &file_pb_radio_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateCategoryReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCategoryReq) ProtoMessage() {} + +func (x *CreateCategoryReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateCategoryReq.ProtoReflect.Descriptor instead. +func (*CreateCategoryReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateCategoryReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateCategoryReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *CreateCategoryReq) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +type CreateCategoryResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateCategoryResp) Reset() { + *x = CreateCategoryResp{} + mi := &file_pb_radio_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateCategoryResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCategoryResp) ProtoMessage() {} + +func (x *CreateCategoryResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateCategoryResp.ProtoReflect.Descriptor instead. +func (*CreateCategoryResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateCategoryResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type UpdateCategoryReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Icon string `protobuf:"bytes,3,opt,name=icon,proto3" json:"icon,omitempty"` + Sort int32 `protobuf:"varint,4,opt,name=sort,proto3" json:"sort,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateCategoryReq) Reset() { + *x = UpdateCategoryReq{} + mi := &file_pb_radio_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateCategoryReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateCategoryReq) ProtoMessage() {} + +func (x *UpdateCategoryReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateCategoryReq.ProtoReflect.Descriptor instead. +func (*UpdateCategoryReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateCategoryReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateCategoryReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateCategoryReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *UpdateCategoryReq) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +type UpdateCategoryResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateCategoryResp) Reset() { + *x = UpdateCategoryResp{} + mi := &file_pb_radio_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateCategoryResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateCategoryResp) ProtoMessage() {} + +func (x *UpdateCategoryResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateCategoryResp.ProtoReflect.Descriptor instead. +func (*UpdateCategoryResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{7} +} + +type DeleteByIdsReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteByIdsReq) Reset() { + *x = DeleteByIdsReq{} + mi := &file_pb_radio_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteByIdsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteByIdsReq) ProtoMessage() {} + +func (x *DeleteByIdsReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteByIdsReq.ProtoReflect.Descriptor instead. +func (*DeleteByIdsReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteByIdsReq) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +type DeleteResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResp) Reset() { + *x = DeleteResp{} + mi := &file_pb_radio_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResp) ProtoMessage() {} + +func (x *DeleteResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResp.ProtoReflect.Descriptor instead. +func (*DeleteResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{9} +} + +type GetCategoryListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCategoryListReq) Reset() { + *x = GetCategoryListReq{} + mi := &file_pb_radio_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCategoryListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCategoryListReq) ProtoMessage() {} + +func (x *GetCategoryListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCategoryListReq.ProtoReflect.Descriptor instead. +func (*GetCategoryListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{10} +} + +func (x *GetCategoryListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetCategoryListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetCategoryListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*CategoryInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCategoryListResp) Reset() { + *x = GetCategoryListResp{} + mi := &file_pb_radio_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCategoryListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCategoryListResp) ProtoMessage() {} + +func (x *GetCategoryListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCategoryListResp.ProtoReflect.Descriptor instead. +func (*GetCategoryListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{11} +} + +func (x *GetCategoryListResp) GetList() []*CategoryInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetCategoryListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +// ========== 频道 ========== +type ChannelInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CategoryId string `protobuf:"bytes,2,opt,name=categoryId,proto3" json:"categoryId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + IsFree int32 `protobuf:"varint,5,opt,name=isFree,proto3" json:"isFree,omitempty"` + IsVipOnly int32 `protobuf:"varint,6,opt,name=isVipOnly,proto3" json:"isVipOnly,omitempty"` + MonthlyPrice int32 `protobuf:"varint,7,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` + QuarterlyPrice int32 `protobuf:"varint,8,opt,name=quarterlyPrice,proto3" json:"quarterlyPrice,omitempty"` + AnnualPrice int32 `protobuf:"varint,9,opt,name=annualPrice,proto3" json:"annualPrice,omitempty"` + Cover string `protobuf:"bytes,10,opt,name=cover,proto3" json:"cover,omitempty"` + Tags string `protobuf:"bytes,11,opt,name=tags,proto3" json:"tags,omitempty"` + Sort int32 `protobuf:"varint,12,opt,name=sort,proto3" json:"sort,omitempty"` + Status int32 `protobuf:"varint,13,opt,name=status,proto3" json:"status,omitempty"` + CreatedAt int64 `protobuf:"varint,14,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChannelInfo) Reset() { + *x = ChannelInfo{} + mi := &file_pb_radio_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChannelInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelInfo) ProtoMessage() {} + +func (x *ChannelInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelInfo.ProtoReflect.Descriptor instead. +func (*ChannelInfo) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{12} +} + +func (x *ChannelInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ChannelInfo) GetCategoryId() string { + if x != nil { + return x.CategoryId + } + return "" +} + +func (x *ChannelInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ChannelInfo) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ChannelInfo) GetIsFree() int32 { + if x != nil { + return x.IsFree + } + return 0 +} + +func (x *ChannelInfo) GetIsVipOnly() int32 { + if x != nil { + return x.IsVipOnly + } + return 0 +} + +func (x *ChannelInfo) GetMonthlyPrice() int32 { + if x != nil { + return x.MonthlyPrice + } + return 0 +} + +func (x *ChannelInfo) GetQuarterlyPrice() int32 { + if x != nil { + return x.QuarterlyPrice + } + return 0 +} + +func (x *ChannelInfo) GetAnnualPrice() int32 { + if x != nil { + return x.AnnualPrice + } + return 0 +} + +func (x *ChannelInfo) GetCover() string { + if x != nil { + return x.Cover + } + return "" +} + +func (x *ChannelInfo) GetTags() string { + if x != nil { + return x.Tags + } + return "" +} + +func (x *ChannelInfo) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +func (x *ChannelInfo) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ChannelInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type CreateChannelReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + CategoryId string `protobuf:"bytes,1,opt,name=categoryId,proto3" json:"categoryId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + IsFree int32 `protobuf:"varint,4,opt,name=isFree,proto3" json:"isFree,omitempty"` + IsVipOnly int32 `protobuf:"varint,5,opt,name=isVipOnly,proto3" json:"isVipOnly,omitempty"` + MonthlyPrice int32 `protobuf:"varint,6,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` + QuarterlyPrice int32 `protobuf:"varint,7,opt,name=quarterlyPrice,proto3" json:"quarterlyPrice,omitempty"` + AnnualPrice int32 `protobuf:"varint,8,opt,name=annualPrice,proto3" json:"annualPrice,omitempty"` + Cover string `protobuf:"bytes,9,opt,name=cover,proto3" json:"cover,omitempty"` + Tags string `protobuf:"bytes,10,opt,name=tags,proto3" json:"tags,omitempty"` + Sort int32 `protobuf:"varint,11,opt,name=sort,proto3" json:"sort,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateChannelReq) Reset() { + *x = CreateChannelReq{} + mi := &file_pb_radio_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateChannelReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateChannelReq) ProtoMessage() {} + +func (x *CreateChannelReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateChannelReq.ProtoReflect.Descriptor instead. +func (*CreateChannelReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{13} +} + +func (x *CreateChannelReq) GetCategoryId() string { + if x != nil { + return x.CategoryId + } + return "" +} + +func (x *CreateChannelReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateChannelReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateChannelReq) GetIsFree() int32 { + if x != nil { + return x.IsFree + } + return 0 +} + +func (x *CreateChannelReq) GetIsVipOnly() int32 { + if x != nil { + return x.IsVipOnly + } + return 0 +} + +func (x *CreateChannelReq) GetMonthlyPrice() int32 { + if x != nil { + return x.MonthlyPrice + } + return 0 +} + +func (x *CreateChannelReq) GetQuarterlyPrice() int32 { + if x != nil { + return x.QuarterlyPrice + } + return 0 +} + +func (x *CreateChannelReq) GetAnnualPrice() int32 { + if x != nil { + return x.AnnualPrice + } + return 0 +} + +func (x *CreateChannelReq) GetCover() string { + if x != nil { + return x.Cover + } + return "" +} + +func (x *CreateChannelReq) GetTags() string { + if x != nil { + return x.Tags + } + return "" +} + +func (x *CreateChannelReq) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +type CreateChannelResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateChannelResp) Reset() { + *x = CreateChannelResp{} + mi := &file_pb_radio_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateChannelResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateChannelResp) ProtoMessage() {} + +func (x *CreateChannelResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateChannelResp.ProtoReflect.Descriptor instead. +func (*CreateChannelResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{14} +} + +func (x *CreateChannelResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type UpdateChannelReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + IsFree int32 `protobuf:"varint,4,opt,name=isFree,proto3" json:"isFree,omitempty"` + IsVipOnly int32 `protobuf:"varint,5,opt,name=isVipOnly,proto3" json:"isVipOnly,omitempty"` + MonthlyPrice int32 `protobuf:"varint,6,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` + QuarterlyPrice int32 `protobuf:"varint,7,opt,name=quarterlyPrice,proto3" json:"quarterlyPrice,omitempty"` + AnnualPrice int32 `protobuf:"varint,8,opt,name=annualPrice,proto3" json:"annualPrice,omitempty"` + Cover string `protobuf:"bytes,9,opt,name=cover,proto3" json:"cover,omitempty"` + Tags string `protobuf:"bytes,10,opt,name=tags,proto3" json:"tags,omitempty"` + Sort int32 `protobuf:"varint,11,opt,name=sort,proto3" json:"sort,omitempty"` + Status int32 `protobuf:"varint,12,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateChannelReq) Reset() { + *x = UpdateChannelReq{} + mi := &file_pb_radio_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateChannelReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateChannelReq) ProtoMessage() {} + +func (x *UpdateChannelReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateChannelReq.ProtoReflect.Descriptor instead. +func (*UpdateChannelReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{15} +} + +func (x *UpdateChannelReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateChannelReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateChannelReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *UpdateChannelReq) GetIsFree() int32 { + if x != nil { + return x.IsFree + } + return 0 +} + +func (x *UpdateChannelReq) GetIsVipOnly() int32 { + if x != nil { + return x.IsVipOnly + } + return 0 +} + +func (x *UpdateChannelReq) GetMonthlyPrice() int32 { + if x != nil { + return x.MonthlyPrice + } + return 0 +} + +func (x *UpdateChannelReq) GetQuarterlyPrice() int32 { + if x != nil { + return x.QuarterlyPrice + } + return 0 +} + +func (x *UpdateChannelReq) GetAnnualPrice() int32 { + if x != nil { + return x.AnnualPrice + } + return 0 +} + +func (x *UpdateChannelReq) GetCover() string { + if x != nil { + return x.Cover + } + return "" +} + +func (x *UpdateChannelReq) GetTags() string { + if x != nil { + return x.Tags + } + return "" +} + +func (x *UpdateChannelReq) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +func (x *UpdateChannelReq) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type UpdateChannelResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateChannelResp) Reset() { + *x = UpdateChannelResp{} + mi := &file_pb_radio_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateChannelResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateChannelResp) ProtoMessage() {} + +func (x *UpdateChannelResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateChannelResp.ProtoReflect.Descriptor instead. +func (*UpdateChannelResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{16} +} + +type GetChannelListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + CategoryId string `protobuf:"bytes,3,opt,name=categoryId,proto3" json:"categoryId,omitempty"` + UserId string `protobuf:"bytes,4,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetChannelListReq) Reset() { + *x = GetChannelListReq{} + mi := &file_pb_radio_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetChannelListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetChannelListReq) ProtoMessage() {} + +func (x *GetChannelListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetChannelListReq.ProtoReflect.Descriptor instead. +func (*GetChannelListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{17} +} + +func (x *GetChannelListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetChannelListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetChannelListReq) GetCategoryId() string { + if x != nil { + return x.CategoryId + } + return "" +} + +func (x *GetChannelListReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetChannelListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*ChannelInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetChannelListResp) Reset() { + *x = GetChannelListResp{} + mi := &file_pb_radio_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetChannelListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetChannelListResp) ProtoMessage() {} + +func (x *GetChannelListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetChannelListResp.ProtoReflect.Descriptor instead. +func (*GetChannelListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{18} +} + +func (x *GetChannelListResp) GetList() []*ChannelInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetChannelListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetChannelDetailReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetChannelDetailReq) Reset() { + *x = GetChannelDetailReq{} + mi := &file_pb_radio_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetChannelDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetChannelDetailReq) ProtoMessage() {} + +func (x *GetChannelDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetChannelDetailReq.ProtoReflect.Descriptor instead. +func (*GetChannelDetailReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{19} +} + +func (x *GetChannelDetailReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *GetChannelDetailReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetChannelDetailResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Channel *ChannelInfo `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetChannelDetailResp) Reset() { + *x = GetChannelDetailResp{} + mi := &file_pb_radio_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetChannelDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetChannelDetailResp) ProtoMessage() {} + +func (x *GetChannelDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetChannelDetailResp.ProtoReflect.Descriptor instead. +func (*GetChannelDetailResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{20} +} + +func (x *GetChannelDetailResp) GetChannel() *ChannelInfo { + if x != nil { + return x.Channel + } + return nil +} + +// ========== 节目 ========== +type ProgramInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channelId,proto3" json:"channelId,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` + Cover string `protobuf:"bytes,6,opt,name=cover,proto3" json:"cover,omitempty"` + AudioId string `protobuf:"bytes,7,opt,name=audioId,proto3" json:"audioId,omitempty"` + AudioStatus int32 `protobuf:"varint,8,opt,name=audioStatus,proto3" json:"audioStatus,omitempty"` + Duration int32 `protobuf:"varint,9,opt,name=duration,proto3" json:"duration,omitempty"` + Tags string `protobuf:"bytes,10,opt,name=tags,proto3" json:"tags,omitempty"` + PlayCount int32 `protobuf:"varint,11,opt,name=playCount,proto3" json:"playCount,omitempty"` + LikeCount int32 `protobuf:"varint,12,opt,name=likeCount,proto3" json:"likeCount,omitempty"` + Status int32 `protobuf:"varint,13,opt,name=status,proto3" json:"status,omitempty"` + CreatedAt int64 `protobuf:"varint,14,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ProgramInfo) Reset() { + *x = ProgramInfo{} + mi := &file_pb_radio_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ProgramInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProgramInfo) ProtoMessage() {} + +func (x *ProgramInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProgramInfo.ProtoReflect.Descriptor instead. +func (*ProgramInfo) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{21} +} + +func (x *ProgramInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ProgramInfo) GetChannelId() string { + if x != nil { + return x.ChannelId + } + return "" +} + +func (x *ProgramInfo) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *ProgramInfo) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *ProgramInfo) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *ProgramInfo) GetCover() string { + if x != nil { + return x.Cover + } + return "" +} + +func (x *ProgramInfo) GetAudioId() string { + if x != nil { + return x.AudioId + } + return "" +} + +func (x *ProgramInfo) GetAudioStatus() int32 { + if x != nil { + return x.AudioStatus + } + return 0 +} + +func (x *ProgramInfo) GetDuration() int32 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *ProgramInfo) GetTags() string { + if x != nil { + return x.Tags + } + return "" +} + +func (x *ProgramInfo) GetPlayCount() int32 { + if x != nil { + return x.PlayCount + } + return 0 +} + +func (x *ProgramInfo) GetLikeCount() int32 { + if x != nil { + return x.LikeCount + } + return 0 +} + +func (x *ProgramInfo) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ProgramInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type CreateProgramReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + ChannelId string `protobuf:"bytes,1,opt,name=channelId,proto3" json:"channelId,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` + Cover string `protobuf:"bytes,5,opt,name=cover,proto3" json:"cover,omitempty"` + Tags string `protobuf:"bytes,6,opt,name=tags,proto3" json:"tags,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateProgramReq) Reset() { + *x = CreateProgramReq{} + mi := &file_pb_radio_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateProgramReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateProgramReq) ProtoMessage() {} + +func (x *CreateProgramReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateProgramReq.ProtoReflect.Descriptor instead. +func (*CreateProgramReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{22} +} + +func (x *CreateProgramReq) GetChannelId() string { + if x != nil { + return x.ChannelId + } + return "" +} + +func (x *CreateProgramReq) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *CreateProgramReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateProgramReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *CreateProgramReq) GetCover() string { + if x != nil { + return x.Cover + } + return "" +} + +func (x *CreateProgramReq) GetTags() string { + if x != nil { + return x.Tags + } + return "" +} + +type CreateProgramResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateProgramResp) Reset() { + *x = CreateProgramResp{} + mi := &file_pb_radio_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateProgramResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateProgramResp) ProtoMessage() {} + +func (x *CreateProgramResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateProgramResp.ProtoReflect.Descriptor instead. +func (*CreateProgramResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{23} +} + +func (x *CreateProgramResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type UpdateProgramReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` + Cover string `protobuf:"bytes,5,opt,name=cover,proto3" json:"cover,omitempty"` + AudioId string `protobuf:"bytes,6,opt,name=audioId,proto3" json:"audioId,omitempty"` + AudioStatus int32 `protobuf:"varint,7,opt,name=audioStatus,proto3" json:"audioStatus,omitempty"` + Duration int32 `protobuf:"varint,8,opt,name=duration,proto3" json:"duration,omitempty"` + Tags string `protobuf:"bytes,9,opt,name=tags,proto3" json:"tags,omitempty"` + Status int32 `protobuf:"varint,10,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateProgramReq) Reset() { + *x = UpdateProgramReq{} + mi := &file_pb_radio_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateProgramReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateProgramReq) ProtoMessage() {} + +func (x *UpdateProgramReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateProgramReq.ProtoReflect.Descriptor instead. +func (*UpdateProgramReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{24} +} + +func (x *UpdateProgramReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateProgramReq) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *UpdateProgramReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *UpdateProgramReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *UpdateProgramReq) GetCover() string { + if x != nil { + return x.Cover + } + return "" +} + +func (x *UpdateProgramReq) GetAudioId() string { + if x != nil { + return x.AudioId + } + return "" +} + +func (x *UpdateProgramReq) GetAudioStatus() int32 { + if x != nil { + return x.AudioStatus + } + return 0 +} + +func (x *UpdateProgramReq) GetDuration() int32 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *UpdateProgramReq) GetTags() string { + if x != nil { + return x.Tags + } + return "" +} + +func (x *UpdateProgramReq) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type UpdateProgramResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateProgramResp) Reset() { + *x = UpdateProgramResp{} + mi := &file_pb_radio_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateProgramResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateProgramResp) ProtoMessage() {} + +func (x *UpdateProgramResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateProgramResp.ProtoReflect.Descriptor instead. +func (*UpdateProgramResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{25} +} + +type GetProgramListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + ChannelId string `protobuf:"bytes,3,opt,name=channelId,proto3" json:"channelId,omitempty"` + UserId string `protobuf:"bytes,4,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProgramListReq) Reset() { + *x = GetProgramListReq{} + mi := &file_pb_radio_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProgramListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProgramListReq) ProtoMessage() {} + +func (x *GetProgramListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProgramListReq.ProtoReflect.Descriptor instead. +func (*GetProgramListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{26} +} + +func (x *GetProgramListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetProgramListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetProgramListReq) GetChannelId() string { + if x != nil { + return x.ChannelId + } + return "" +} + +func (x *GetProgramListReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetProgramListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*ProgramInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProgramListResp) Reset() { + *x = GetProgramListResp{} + mi := &file_pb_radio_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProgramListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProgramListResp) ProtoMessage() {} + +func (x *GetProgramListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProgramListResp.ProtoReflect.Descriptor instead. +func (*GetProgramListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{27} +} + +func (x *GetProgramListResp) GetList() []*ProgramInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetProgramListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetProgramDetailReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProgramDetailReq) Reset() { + *x = GetProgramDetailReq{} + mi := &file_pb_radio_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProgramDetailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProgramDetailReq) ProtoMessage() {} + +func (x *GetProgramDetailReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProgramDetailReq.ProtoReflect.Descriptor instead. +func (*GetProgramDetailReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{28} +} + +func (x *GetProgramDetailReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *GetProgramDetailReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetProgramDetailResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Program *ProgramInfo `protobuf:"bytes,1,opt,name=program,proto3" json:"program,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetProgramDetailResp) Reset() { + *x = GetProgramDetailResp{} + mi := &file_pb_radio_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetProgramDetailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetProgramDetailResp) ProtoMessage() {} + +func (x *GetProgramDetailResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetProgramDetailResp.ProtoReflect.Descriptor instead. +func (*GetProgramDetailResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{29} +} + +func (x *GetProgramDetailResp) GetProgram() *ProgramInfo { + if x != nil { + return x.Program + } + return nil +} + +// ========== 音色 ========== +type VoiceInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SpeakerId string `protobuf:"bytes,2,opt,name=speakerId,proto3" json:"speakerId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + Gender string `protobuf:"bytes,5,opt,name=gender,proto3" json:"gender,omitempty"` + Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` + AudioId string `protobuf:"bytes,7,opt,name=audioId,proto3" json:"audioId,omitempty"` + Sort int32 `protobuf:"varint,8,opt,name=sort,proto3" json:"sort,omitempty"` + Status int32 `protobuf:"varint,9,opt,name=status,proto3" json:"status,omitempty"` + IsDefault int32 `protobuf:"varint,10,opt,name=isDefault,proto3" json:"isDefault,omitempty"` + UseCount int32 `protobuf:"varint,11,opt,name=useCount,proto3" json:"useCount,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VoiceInfo) Reset() { + *x = VoiceInfo{} + mi := &file_pb_radio_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VoiceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VoiceInfo) ProtoMessage() {} + +func (x *VoiceInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VoiceInfo.ProtoReflect.Descriptor instead. +func (*VoiceInfo) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{30} +} + +func (x *VoiceInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *VoiceInfo) GetSpeakerId() string { + if x != nil { + return x.SpeakerId + } + return "" +} + +func (x *VoiceInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *VoiceInfo) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *VoiceInfo) GetGender() string { + if x != nil { + return x.Gender + } + return "" +} + +func (x *VoiceInfo) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *VoiceInfo) GetAudioId() string { + if x != nil { + return x.AudioId + } + return "" +} + +func (x *VoiceInfo) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +func (x *VoiceInfo) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *VoiceInfo) GetIsDefault() int32 { + if x != nil { + return x.IsDefault + } + return 0 +} + +func (x *VoiceInfo) GetUseCount() int32 { + if x != nil { + return x.UseCount + } + return 0 +} + +type CreateVoiceReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + SpeakerId string `protobuf:"bytes,1,opt,name=speakerId,proto3" json:"speakerId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Gender string `protobuf:"bytes,4,opt,name=gender,proto3" json:"gender,omitempty"` + Icon string `protobuf:"bytes,5,opt,name=icon,proto3" json:"icon,omitempty"` + AudioId string `protobuf:"bytes,6,opt,name=audioId,proto3" json:"audioId,omitempty"` + Sort int32 `protobuf:"varint,7,opt,name=sort,proto3" json:"sort,omitempty"` + IsDefault int32 `protobuf:"varint,8,opt,name=isDefault,proto3" json:"isDefault,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateVoiceReq) Reset() { + *x = CreateVoiceReq{} + mi := &file_pb_radio_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateVoiceReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateVoiceReq) ProtoMessage() {} + +func (x *CreateVoiceReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateVoiceReq.ProtoReflect.Descriptor instead. +func (*CreateVoiceReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{31} +} + +func (x *CreateVoiceReq) GetSpeakerId() string { + if x != nil { + return x.SpeakerId + } + return "" +} + +func (x *CreateVoiceReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateVoiceReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateVoiceReq) GetGender() string { + if x != nil { + return x.Gender + } + return "" +} + +func (x *CreateVoiceReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *CreateVoiceReq) GetAudioId() string { + if x != nil { + return x.AudioId + } + return "" +} + +func (x *CreateVoiceReq) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +func (x *CreateVoiceReq) GetIsDefault() int32 { + if x != nil { + return x.IsDefault + } + return 0 +} + +type CreateVoiceResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateVoiceResp) Reset() { + *x = CreateVoiceResp{} + mi := &file_pb_radio_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateVoiceResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateVoiceResp) ProtoMessage() {} + +func (x *CreateVoiceResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateVoiceResp.ProtoReflect.Descriptor instead. +func (*CreateVoiceResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{32} +} + +func (x *CreateVoiceResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type UpdateVoiceReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` + AudioId string `protobuf:"bytes,5,opt,name=audioId,proto3" json:"audioId,omitempty"` + Sort int32 `protobuf:"varint,6,opt,name=sort,proto3" json:"sort,omitempty"` + Status int32 `protobuf:"varint,7,opt,name=status,proto3" json:"status,omitempty"` + IsDefault int32 `protobuf:"varint,8,opt,name=isDefault,proto3" json:"isDefault,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateVoiceReq) Reset() { + *x = UpdateVoiceReq{} + mi := &file_pb_radio_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateVoiceReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateVoiceReq) ProtoMessage() {} + +func (x *UpdateVoiceReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateVoiceReq.ProtoReflect.Descriptor instead. +func (*UpdateVoiceReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{33} +} + +func (x *UpdateVoiceReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateVoiceReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateVoiceReq) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *UpdateVoiceReq) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *UpdateVoiceReq) GetAudioId() string { + if x != nil { + return x.AudioId + } + return "" +} + +func (x *UpdateVoiceReq) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +func (x *UpdateVoiceReq) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *UpdateVoiceReq) GetIsDefault() int32 { + if x != nil { + return x.IsDefault + } + return 0 +} + +type UpdateVoiceResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateVoiceResp) Reset() { + *x = UpdateVoiceResp{} + mi := &file_pb_radio_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateVoiceResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateVoiceResp) ProtoMessage() {} + +func (x *UpdateVoiceResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateVoiceResp.ProtoReflect.Descriptor instead. +func (*UpdateVoiceResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{34} +} + +type GetVoiceListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetVoiceListReq) Reset() { + *x = GetVoiceListReq{} + mi := &file_pb_radio_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetVoiceListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVoiceListReq) ProtoMessage() {} + +func (x *GetVoiceListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVoiceListReq.ProtoReflect.Descriptor instead. +func (*GetVoiceListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{35} +} + +func (x *GetVoiceListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetVoiceListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetVoiceListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*VoiceInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetVoiceListResp) Reset() { + *x = GetVoiceListResp{} + mi := &file_pb_radio_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetVoiceListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVoiceListResp) ProtoMessage() {} + +func (x *GetVoiceListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVoiceListResp.ProtoReflect.Descriptor instead. +func (*GetVoiceListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{36} +} + +func (x *GetVoiceListResp) GetList() []*VoiceInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetVoiceListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +// ========== 互动 ========== +type ToggleLikeReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToggleLikeReq) Reset() { + *x = ToggleLikeReq{} + mi := &file_pb_radio_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToggleLikeReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToggleLikeReq) ProtoMessage() {} + +func (x *ToggleLikeReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToggleLikeReq.ProtoReflect.Descriptor instead. +func (*ToggleLikeReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{37} +} + +func (x *ToggleLikeReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ToggleLikeReq) GetProgramId() string { + if x != nil { + return x.ProgramId + } + return "" +} + +type ToggleLikeResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Liked bool `protobuf:"varint,1,opt,name=liked,proto3" json:"liked,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToggleLikeResp) Reset() { + *x = ToggleLikeResp{} + mi := &file_pb_radio_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToggleLikeResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToggleLikeResp) ProtoMessage() {} + +func (x *ToggleLikeResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToggleLikeResp.ProtoReflect.Descriptor instead. +func (*ToggleLikeResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{38} +} + +func (x *ToggleLikeResp) GetLiked() bool { + if x != nil { + return x.Liked + } + return false +} + +type ToggleFavoriteReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToggleFavoriteReq) Reset() { + *x = ToggleFavoriteReq{} + mi := &file_pb_radio_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToggleFavoriteReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToggleFavoriteReq) ProtoMessage() {} + +func (x *ToggleFavoriteReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToggleFavoriteReq.ProtoReflect.Descriptor instead. +func (*ToggleFavoriteReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{39} +} + +func (x *ToggleFavoriteReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *ToggleFavoriteReq) GetProgramId() string { + if x != nil { + return x.ProgramId + } + return "" +} + +type ToggleFavoriteResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Favorited bool `protobuf:"varint,1,opt,name=favorited,proto3" json:"favorited,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToggleFavoriteResp) Reset() { + *x = ToggleFavoriteResp{} + mi := &file_pb_radio_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToggleFavoriteResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToggleFavoriteResp) ProtoMessage() {} + +func (x *ToggleFavoriteResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToggleFavoriteResp.ProtoReflect.Descriptor instead. +func (*ToggleFavoriteResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{40} +} + +func (x *ToggleFavoriteResp) GetFavorited() bool { + if x != nil { + return x.Favorited + } + return false +} + +type CommentReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` + Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` + ParentId string `protobuf:"bytes,4,opt,name=parentId,proto3" json:"parentId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommentReq) Reset() { + *x = CommentReq{} + mi := &file_pb_radio_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommentReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentReq) ProtoMessage() {} + +func (x *CommentReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommentReq.ProtoReflect.Descriptor instead. +func (*CommentReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{41} +} + +func (x *CommentReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CommentReq) GetProgramId() string { + if x != nil { + return x.ProgramId + } + return "" +} + +func (x *CommentReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *CommentReq) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +type CommentResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommentResp) Reset() { + *x = CommentResp{} + mi := &file_pb_radio_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommentResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentResp) ProtoMessage() {} + +func (x *CommentResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommentResp.ProtoReflect.Descriptor instead. +func (*CommentResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{42} +} + +type RecordHistoryReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + ProgramId string `protobuf:"bytes,2,opt,name=programId,proto3" json:"programId,omitempty"` + Duration int32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecordHistoryReq) Reset() { + *x = RecordHistoryReq{} + mi := &file_pb_radio_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecordHistoryReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecordHistoryReq) ProtoMessage() {} + +func (x *RecordHistoryReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecordHistoryReq.ProtoReflect.Descriptor instead. +func (*RecordHistoryReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{43} +} + +func (x *RecordHistoryReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *RecordHistoryReq) GetProgramId() string { + if x != nil { + return x.ProgramId + } + return "" +} + +func (x *RecordHistoryReq) GetDuration() int32 { + if x != nil { + return x.Duration + } + return 0 +} + +type RecordHistoryResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecordHistoryResp) Reset() { + *x = RecordHistoryResp{} + mi := &file_pb_radio_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecordHistoryResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecordHistoryResp) ProtoMessage() {} + +func (x *RecordHistoryResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecordHistoryResp.ProtoReflect.Descriptor instead. +func (*RecordHistoryResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{44} +} + +type GetHistoryListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + Current int32 `protobuf:"varint,2,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetHistoryListReq) Reset() { + *x = GetHistoryListReq{} + mi := &file_pb_radio_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetHistoryListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetHistoryListReq) ProtoMessage() {} + +func (x *GetHistoryListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetHistoryListReq.ProtoReflect.Descriptor instead. +func (*GetHistoryListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{45} +} + +func (x *GetHistoryListReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetHistoryListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetHistoryListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetHistoryListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*ProgramInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetHistoryListResp) Reset() { + *x = GetHistoryListResp{} + mi := &file_pb_radio_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetHistoryListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetHistoryListResp) ProtoMessage() {} + +func (x *GetHistoryListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetHistoryListResp.ProtoReflect.Descriptor instead. +func (*GetHistoryListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{46} +} + +func (x *GetHistoryListResp) GetList() []*ProgramInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetHistoryListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetFavoriteListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + Current int32 `protobuf:"varint,2,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFavoriteListReq) Reset() { + *x = GetFavoriteListReq{} + mi := &file_pb_radio_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFavoriteListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFavoriteListReq) ProtoMessage() {} + +func (x *GetFavoriteListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFavoriteListReq.ProtoReflect.Descriptor instead. +func (*GetFavoriteListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{47} +} + +func (x *GetFavoriteListReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetFavoriteListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetFavoriteListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetFavoriteListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*ProgramInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFavoriteListResp) Reset() { + *x = GetFavoriteListResp{} + mi := &file_pb_radio_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFavoriteListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFavoriteListResp) ProtoMessage() {} + +func (x *GetFavoriteListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFavoriteListResp.ProtoReflect.Descriptor instead. +func (*GetFavoriteListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{48} +} + +func (x *GetFavoriteListResp) GetList() []*ProgramInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetFavoriteListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +// ========== 订阅/支付 ========== +type SubscriptionInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + ChannelId string `protobuf:"bytes,3,opt,name=channelId,proto3" json:"channelId,omitempty"` + ExpiredAt int64 `protobuf:"varint,4,opt,name=expiredAt,proto3" json:"expiredAt,omitempty"` + Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubscriptionInfo) Reset() { + *x = SubscriptionInfo{} + mi := &file_pb_radio_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubscriptionInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscriptionInfo) ProtoMessage() {} + +func (x *SubscriptionInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscriptionInfo.ProtoReflect.Descriptor instead. +func (*SubscriptionInfo) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{49} +} + +func (x *SubscriptionInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SubscriptionInfo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *SubscriptionInfo) GetChannelId() string { + if x != nil { + return x.ChannelId + } + return "" +} + +func (x *SubscriptionInfo) GetExpiredAt() int64 { + if x != nil { + return x.ExpiredAt + } + return 0 +} + +func (x *SubscriptionInfo) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type GetMySubscriptionsReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMySubscriptionsReq) Reset() { + *x = GetMySubscriptionsReq{} + mi := &file_pb_radio_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMySubscriptionsReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMySubscriptionsReq) ProtoMessage() {} + +func (x *GetMySubscriptionsReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMySubscriptionsReq.ProtoReflect.Descriptor instead. +func (*GetMySubscriptionsReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{50} +} + +func (x *GetMySubscriptionsReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetMySubscriptionsResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*SubscriptionInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMySubscriptionsResp) Reset() { + *x = GetMySubscriptionsResp{} + mi := &file_pb_radio_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMySubscriptionsResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMySubscriptionsResp) ProtoMessage() {} + +func (x *GetMySubscriptionsResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMySubscriptionsResp.ProtoReflect.Descriptor instead. +func (*GetMySubscriptionsResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{51} +} + +func (x *GetMySubscriptionsResp) GetList() []*SubscriptionInfo { + if x != nil { + return x.List + } + return nil +} + +type CreatePayOrderReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channelId,proto3" json:"channelId,omitempty"` + PlanType string `protobuf:"bytes,3,opt,name=planType,proto3" json:"planType,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePayOrderReq) Reset() { + *x = CreatePayOrderReq{} + mi := &file_pb_radio_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePayOrderReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePayOrderReq) ProtoMessage() {} + +func (x *CreatePayOrderReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePayOrderReq.ProtoReflect.Descriptor instead. +func (*CreatePayOrderReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{52} +} + +func (x *CreatePayOrderReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreatePayOrderReq) GetChannelId() string { + if x != nil { + return x.ChannelId + } + return "" +} + +func (x *CreatePayOrderReq) GetPlanType() string { + if x != nil { + return x.PlanType + } + return "" +} + +type CreatePayOrderResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + OrderNo string `protobuf:"bytes,1,opt,name=orderNo,proto3" json:"orderNo,omitempty"` + PrepayId string `protobuf:"bytes,2,opt,name=prepayId,proto3" json:"prepayId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePayOrderResp) Reset() { + *x = CreatePayOrderResp{} + mi := &file_pb_radio_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePayOrderResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePayOrderResp) ProtoMessage() {} + +func (x *CreatePayOrderResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePayOrderResp.ProtoReflect.Descriptor instead. +func (*CreatePayOrderResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{53} +} + +func (x *CreatePayOrderResp) GetOrderNo() string { + if x != nil { + return x.OrderNo + } + return "" +} + +func (x *CreatePayOrderResp) GetPrepayId() string { + if x != nil { + return x.PrepayId + } + return "" +} + +// ========== VIP ========== +type VipConfigInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + PlanType string `protobuf:"bytes,3,opt,name=planType,proto3" json:"planType,omitempty"` + Price int32 `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"` + OriginalPrice int32 `protobuf:"varint,5,opt,name=originalPrice,proto3" json:"originalPrice,omitempty"` + Duration int32 `protobuf:"varint,6,opt,name=duration,proto3" json:"duration,omitempty"` + Desc string `protobuf:"bytes,7,opt,name=desc,proto3" json:"desc,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VipConfigInfo) Reset() { + *x = VipConfigInfo{} + mi := &file_pb_radio_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VipConfigInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VipConfigInfo) ProtoMessage() {} + +func (x *VipConfigInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VipConfigInfo.ProtoReflect.Descriptor instead. +func (*VipConfigInfo) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{54} +} + +func (x *VipConfigInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *VipConfigInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *VipConfigInfo) GetPlanType() string { + if x != nil { + return x.PlanType + } + return "" +} + +func (x *VipConfigInfo) GetPrice() int32 { + if x != nil { + return x.Price + } + return 0 +} + +func (x *VipConfigInfo) GetOriginalPrice() int32 { + if x != nil { + return x.OriginalPrice + } + return 0 +} + +func (x *VipConfigInfo) GetDuration() int32 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *VipConfigInfo) GetDesc() string { + if x != nil { + return x.Desc + } + return "" +} + +type GetVipConfigListReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetVipConfigListReq) Reset() { + *x = GetVipConfigListReq{} + mi := &file_pb_radio_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetVipConfigListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVipConfigListReq) ProtoMessage() {} + +func (x *GetVipConfigListReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVipConfigListReq.ProtoReflect.Descriptor instead. +func (*GetVipConfigListReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{55} +} + +func (x *GetVipConfigListReq) GetCurrent() int32 { + if x != nil { + return x.Current + } + return 0 +} + +func (x *GetVipConfigListReq) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +type GetVipConfigListResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + List []*VipConfigInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetVipConfigListResp) Reset() { + *x = GetVipConfigListResp{} + mi := &file_pb_radio_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetVipConfigListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetVipConfigListResp) ProtoMessage() {} + +func (x *GetVipConfigListResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[56] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetVipConfigListResp.ProtoReflect.Descriptor instead. +func (*GetVipConfigListResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{56} +} + +func (x *GetVipConfigListResp) GetList() []*VipConfigInfo { + if x != nil { + return x.List + } + return nil +} + +func (x *GetVipConfigListResp) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +type GetMyVipInfoReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMyVipInfoReq) Reset() { + *x = GetMyVipInfoReq{} + mi := &file_pb_radio_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMyVipInfoReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMyVipInfoReq) ProtoMessage() {} + +func (x *GetMyVipInfoReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[57] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMyVipInfoReq.ProtoReflect.Descriptor instead. +func (*GetMyVipInfoReq) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{57} +} + +func (x *GetMyVipInfoReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetMyVipInfoResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Profile *RadioUserProfile `protobuf:"bytes,1,opt,name=profile,proto3" json:"profile,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMyVipInfoResp) Reset() { + *x = GetMyVipInfoResp{} + mi := &file_pb_radio_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMyVipInfoResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMyVipInfoResp) ProtoMessage() {} + +func (x *GetMyVipInfoResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[58] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMyVipInfoResp.ProtoReflect.Descriptor instead. +func (*GetMyVipInfoResp) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{58} +} + +func (x *GetMyVipInfoResp) GetProfile() *RadioUserProfile { + if x != nil { + return x.Profile + } + return nil +} + +// ========== 通用 ========== +type Empty struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Empty) Reset() { + *x = Empty{} + mi := &file_pb_radio_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_pb_radio_proto_msgTypes[59] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_pb_radio_proto_rawDescGZIP(), []int{59} +} + +var File_pb_radio_proto protoreflect.FileDescriptor + +const file_pb_radio_proto_rawDesc = "" + + "\n" + + "\x0epb/radio.proto\x12\x05radio\"\xc6\x01\n" + + "\x10RadioUserProfile\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x1a\n" + + "\bnickName\x18\x03 \x01(\tR\bnickName\x12\x1a\n" + + "\bavatarId\x18\x04 \x01(\tR\bavatarId\x12\x14\n" + + "\x05isVip\x18\x05 \x01(\x05R\x05isVip\x12 \n" + + "\vvipExpireAt\x18\x06 \x01(\x03R\vvipExpireAt\x12\x1a\n" + + "\bvipLevel\x18\a \x01(\x05R\bvipLevel\"0\n" + + "\x16GetRadioUserProfileReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\"L\n" + + "\x17GetRadioUserProfileResp\x121\n" + + "\aprofile\x18\x01 \x01(\v2\x17.radio.RadioUserProfileR\aprofile\"Z\n" + + "\fCategoryInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04icon\x18\x03 \x01(\tR\x04icon\x12\x12\n" + + "\x04sort\x18\x04 \x01(\x05R\x04sort\"O\n" + + "\x11CreateCategoryReq\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04icon\x18\x02 \x01(\tR\x04icon\x12\x12\n" + + "\x04sort\x18\x03 \x01(\x05R\x04sort\"$\n" + + "\x12CreateCategoryResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"_\n" + + "\x11UpdateCategoryReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04icon\x18\x03 \x01(\tR\x04icon\x12\x12\n" + + "\x04sort\x18\x04 \x01(\x05R\x04sort\"\x14\n" + + "\x12UpdateCategoryResp\"\"\n" + + "\x0eDeleteByIdsReq\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\"\f\n" + + "\n" + + "DeleteResp\"J\n" + + "\x12GetCategoryListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"T\n" + + "\x13GetCategoryListResp\x12'\n" + + "\x04list\x18\x01 \x03(\v2\x13.radio.CategoryInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\x8b\x03\n" + + "\vChannelInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1e\n" + + "\n" + + "categoryId\x18\x02 \x01(\tR\n" + + "categoryId\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + + "\x06isFree\x18\x05 \x01(\x05R\x06isFree\x12\x1c\n" + + "\tisVipOnly\x18\x06 \x01(\x05R\tisVipOnly\x12\"\n" + + "\fmonthlyPrice\x18\a \x01(\x05R\fmonthlyPrice\x12&\n" + + "\x0equarterlyPrice\x18\b \x01(\x05R\x0equarterlyPrice\x12 \n" + + "\vannualPrice\x18\t \x01(\x05R\vannualPrice\x12\x14\n" + + "\x05cover\x18\n" + + " \x01(\tR\x05cover\x12\x12\n" + + "\x04tags\x18\v \x01(\tR\x04tags\x12\x12\n" + + "\x04sort\x18\f \x01(\x05R\x04sort\x12\x16\n" + + "\x06status\x18\r \x01(\x05R\x06status\x12\x1c\n" + + "\tcreatedAt\x18\x0e \x01(\x03R\tcreatedAt\"\xca\x02\n" + + "\x10CreateChannelReq\x12\x1e\n" + + "\n" + + "categoryId\x18\x01 \x01(\tR\n" + + "categoryId\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x16\n" + + "\x06isFree\x18\x04 \x01(\x05R\x06isFree\x12\x1c\n" + + "\tisVipOnly\x18\x05 \x01(\x05R\tisVipOnly\x12\"\n" + + "\fmonthlyPrice\x18\x06 \x01(\x05R\fmonthlyPrice\x12&\n" + + "\x0equarterlyPrice\x18\a \x01(\x05R\x0equarterlyPrice\x12 \n" + + "\vannualPrice\x18\b \x01(\x05R\vannualPrice\x12\x14\n" + + "\x05cover\x18\t \x01(\tR\x05cover\x12\x12\n" + + "\x04tags\x18\n" + + " \x01(\tR\x04tags\x12\x12\n" + + "\x04sort\x18\v \x01(\x05R\x04sort\"#\n" + + "\x11CreateChannelResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\xd2\x02\n" + + "\x10UpdateChannelReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x16\n" + + "\x06isFree\x18\x04 \x01(\x05R\x06isFree\x12\x1c\n" + + "\tisVipOnly\x18\x05 \x01(\x05R\tisVipOnly\x12\"\n" + + "\fmonthlyPrice\x18\x06 \x01(\x05R\fmonthlyPrice\x12&\n" + + "\x0equarterlyPrice\x18\a \x01(\x05R\x0equarterlyPrice\x12 \n" + + "\vannualPrice\x18\b \x01(\x05R\vannualPrice\x12\x14\n" + + "\x05cover\x18\t \x01(\tR\x05cover\x12\x12\n" + + "\x04tags\x18\n" + + " \x01(\tR\x04tags\x12\x12\n" + + "\x04sort\x18\v \x01(\x05R\x04sort\x12\x16\n" + + "\x06status\x18\f \x01(\x05R\x06status\"\x13\n" + + "\x11UpdateChannelResp\"\x81\x01\n" + + "\x11GetChannelListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x1e\n" + + "\n" + + "categoryId\x18\x03 \x01(\tR\n" + + "categoryId\x12\x16\n" + + "\x06userId\x18\x04 \x01(\tR\x06userId\"R\n" + + "\x12GetChannelListResp\x12&\n" + + "\x04list\x18\x01 \x03(\v2\x12.radio.ChannelInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"=\n" + + "\x13GetChannelDetailReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\"D\n" + + "\x14GetChannelDetailResp\x12,\n" + + "\achannel\x18\x01 \x01(\v2\x12.radio.ChannelInfoR\achannel\"\x81\x03\n" + + "\vProgramInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + + "\tchannelId\x18\x02 \x01(\tR\tchannelId\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x18\n" + + "\acontent\x18\x05 \x01(\tR\acontent\x12\x14\n" + + "\x05cover\x18\x06 \x01(\tR\x05cover\x12\x18\n" + + "\aaudioId\x18\a \x01(\tR\aaudioId\x12 \n" + + "\vaudioStatus\x18\b \x01(\x05R\vaudioStatus\x12\x1a\n" + + "\bduration\x18\t \x01(\x05R\bduration\x12\x12\n" + + "\x04tags\x18\n" + + " \x01(\tR\x04tags\x12\x1c\n" + + "\tplayCount\x18\v \x01(\x05R\tplayCount\x12\x1c\n" + + "\tlikeCount\x18\f \x01(\x05R\tlikeCount\x12\x16\n" + + "\x06status\x18\r \x01(\x05R\x06status\x12\x1c\n" + + "\tcreatedAt\x18\x0e \x01(\x03R\tcreatedAt\"\xac\x01\n" + + "\x10CreateProgramReq\x12\x1c\n" + + "\tchannelId\x18\x01 \x01(\tR\tchannelId\x12\x14\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" + + "\acontent\x18\x04 \x01(\tR\acontent\x12\x14\n" + + "\x05cover\x18\x05 \x01(\tR\x05cover\x12\x12\n" + + "\x04tags\x18\x06 \x01(\tR\x04tags\"#\n" + + "\x11CreateProgramResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\x8e\x02\n" + + "\x10UpdateProgramReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x18\n" + + "\acontent\x18\x04 \x01(\tR\acontent\x12\x14\n" + + "\x05cover\x18\x05 \x01(\tR\x05cover\x12\x18\n" + + "\aaudioId\x18\x06 \x01(\tR\aaudioId\x12 \n" + + "\vaudioStatus\x18\a \x01(\x05R\vaudioStatus\x12\x1a\n" + + "\bduration\x18\b \x01(\x05R\bduration\x12\x12\n" + + "\x04tags\x18\t \x01(\tR\x04tags\x12\x16\n" + + "\x06status\x18\n" + + " \x01(\x05R\x06status\"\x13\n" + + "\x11UpdateProgramResp\"\x7f\n" + + "\x11GetProgramListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x1c\n" + + "\tchannelId\x18\x03 \x01(\tR\tchannelId\x12\x16\n" + + "\x06userId\x18\x04 \x01(\tR\x06userId\"R\n" + + "\x12GetProgramListResp\x12&\n" + + "\x04list\x18\x01 \x03(\v2\x12.radio.ProgramInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"=\n" + + "\x13GetProgramDetailReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\"D\n" + + "\x14GetProgramDetailResp\x12,\n" + + "\aprogram\x18\x01 \x01(\v2\x12.radio.ProgramInfoR\aprogram\"\x9b\x02\n" + + "\tVoiceInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + + "\tspeakerId\x18\x02 \x01(\tR\tspeakerId\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12\x16\n" + + "\x06gender\x18\x05 \x01(\tR\x06gender\x12\x12\n" + + "\x04icon\x18\x06 \x01(\tR\x04icon\x12\x18\n" + + "\aaudioId\x18\a \x01(\tR\aaudioId\x12\x12\n" + + "\x04sort\x18\b \x01(\x05R\x04sort\x12\x16\n" + + "\x06status\x18\t \x01(\x05R\x06status\x12\x1c\n" + + "\tisDefault\x18\n" + + " \x01(\x05R\tisDefault\x12\x1a\n" + + "\buseCount\x18\v \x01(\x05R\buseCount\"\xdc\x01\n" + + "\x0eCreateVoiceReq\x12\x1c\n" + + "\tspeakerId\x18\x01 \x01(\tR\tspeakerId\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x16\n" + + "\x06gender\x18\x04 \x01(\tR\x06gender\x12\x12\n" + + "\x04icon\x18\x05 \x01(\tR\x04icon\x12\x18\n" + + "\aaudioId\x18\x06 \x01(\tR\aaudioId\x12\x12\n" + + "\x04sort\x18\a \x01(\x05R\x04sort\x12\x1c\n" + + "\tisDefault\x18\b \x01(\x05R\tisDefault\"!\n" + + "\x0fCreateVoiceResp\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\xce\x01\n" + + "\x0eUpdateVoiceReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x12\n" + + "\x04icon\x18\x04 \x01(\tR\x04icon\x12\x18\n" + + "\aaudioId\x18\x05 \x01(\tR\aaudioId\x12\x12\n" + + "\x04sort\x18\x06 \x01(\x05R\x04sort\x12\x16\n" + + "\x06status\x18\a \x01(\x05R\x06status\x12\x1c\n" + + "\tisDefault\x18\b \x01(\x05R\tisDefault\"\x11\n" + + "\x0fUpdateVoiceResp\"G\n" + + "\x0fGetVoiceListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"N\n" + + "\x10GetVoiceListResp\x12$\n" + + "\x04list\x18\x01 \x03(\v2\x10.radio.VoiceInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"E\n" + + "\rToggleLikeReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + + "\tprogramId\x18\x02 \x01(\tR\tprogramId\"&\n" + + "\x0eToggleLikeResp\x12\x14\n" + + "\x05liked\x18\x01 \x01(\bR\x05liked\"I\n" + + "\x11ToggleFavoriteReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + + "\tprogramId\x18\x02 \x01(\tR\tprogramId\"2\n" + + "\x12ToggleFavoriteResp\x12\x1c\n" + + "\tfavorited\x18\x01 \x01(\bR\tfavorited\"x\n" + + "\n" + + "CommentReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + + "\tprogramId\x18\x02 \x01(\tR\tprogramId\x12\x18\n" + + "\acontent\x18\x03 \x01(\tR\acontent\x12\x1a\n" + + "\bparentId\x18\x04 \x01(\tR\bparentId\"\r\n" + + "\vCommentResp\"d\n" + + "\x10RecordHistoryReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + + "\tprogramId\x18\x02 \x01(\tR\tprogramId\x12\x1a\n" + + "\bduration\x18\x03 \x01(\x05R\bduration\"\x13\n" + + "\x11RecordHistoryResp\"a\n" + + "\x11GetHistoryListReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + + "\acurrent\x18\x02 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x03 \x01(\x05R\bpageSize\"R\n" + + "\x12GetHistoryListResp\x12&\n" + + "\x04list\x18\x01 \x03(\v2\x12.radio.ProgramInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"b\n" + + "\x12GetFavoriteListReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x18\n" + + "\acurrent\x18\x02 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x03 \x01(\x05R\bpageSize\"S\n" + + "\x13GetFavoriteListResp\x12&\n" + + "\x04list\x18\x01 \x03(\v2\x12.radio.ProgramInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\"\x8e\x01\n" + + "\x10SubscriptionInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x1c\n" + + "\tchannelId\x18\x03 \x01(\tR\tchannelId\x12\x1c\n" + + "\texpiredAt\x18\x04 \x01(\x03R\texpiredAt\x12\x16\n" + + "\x06status\x18\x05 \x01(\x05R\x06status\"/\n" + + "\x15GetMySubscriptionsReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\"E\n" + + "\x16GetMySubscriptionsResp\x12+\n" + + "\x04list\x18\x01 \x03(\v2\x17.radio.SubscriptionInfoR\x04list\"e\n" + + "\x11CreatePayOrderReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\x12\x1c\n" + + "\tchannelId\x18\x02 \x01(\tR\tchannelId\x12\x1a\n" + + "\bplanType\x18\x03 \x01(\tR\bplanType\"J\n" + + "\x12CreatePayOrderResp\x12\x18\n" + + "\aorderNo\x18\x01 \x01(\tR\aorderNo\x12\x1a\n" + + "\bprepayId\x18\x02 \x01(\tR\bprepayId\"\xbb\x01\n" + + "\rVipConfigInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" + + "\bplanType\x18\x03 \x01(\tR\bplanType\x12\x14\n" + + "\x05price\x18\x04 \x01(\x05R\x05price\x12$\n" + + "\roriginalPrice\x18\x05 \x01(\x05R\roriginalPrice\x12\x1a\n" + + "\bduration\x18\x06 \x01(\x05R\bduration\x12\x12\n" + + "\x04desc\x18\a \x01(\tR\x04desc\"K\n" + + "\x13GetVipConfigListReq\x12\x18\n" + + "\acurrent\x18\x01 \x01(\x05R\acurrent\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x05R\bpageSize\"V\n" + + "\x14GetVipConfigListResp\x12(\n" + + "\x04list\x18\x01 \x03(\v2\x14.radio.VipConfigInfoR\x04list\x12\x14\n" + + "\x05total\x18\x02 \x01(\x03R\x05total\")\n" + + "\x0fGetMyVipInfoReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\"E\n" + + "\x10GetMyVipInfoResp\x121\n" + + "\aprofile\x18\x01 \x01(\v2\x17.radio.RadioUserProfileR\aprofile\"\a\n" + + "\x05Empty2\xd4\x0f\n" + + "\fRadioService\x12T\n" + + "\x13GetRadioUserProfile\x12\x1d.radio.GetRadioUserProfileReq\x1a\x1e.radio.GetRadioUserProfileResp\x12E\n" + + "\x0eCreateCategory\x12\x18.radio.CreateCategoryReq\x1a\x19.radio.CreateCategoryResp\x12E\n" + + "\x0eUpdateCategory\x12\x18.radio.UpdateCategoryReq\x1a\x19.radio.UpdateCategoryResp\x12:\n" + + "\x0eDeleteCategory\x12\x15.radio.DeleteByIdsReq\x1a\x11.radio.DeleteResp\x12H\n" + + "\x0fGetCategoryList\x12\x19.radio.GetCategoryListReq\x1a\x1a.radio.GetCategoryListResp\x12B\n" + + "\rCreateChannel\x12\x17.radio.CreateChannelReq\x1a\x18.radio.CreateChannelResp\x12B\n" + + "\rUpdateChannel\x12\x17.radio.UpdateChannelReq\x1a\x18.radio.UpdateChannelResp\x129\n" + + "\rDeleteChannel\x12\x15.radio.DeleteByIdsReq\x1a\x11.radio.DeleteResp\x12E\n" + + "\x0eGetChannelList\x12\x18.radio.GetChannelListReq\x1a\x19.radio.GetChannelListResp\x12K\n" + + "\x10GetChannelDetail\x12\x1a.radio.GetChannelDetailReq\x1a\x1b.radio.GetChannelDetailResp\x12B\n" + + "\rCreateProgram\x12\x17.radio.CreateProgramReq\x1a\x18.radio.CreateProgramResp\x12B\n" + + "\rUpdateProgram\x12\x17.radio.UpdateProgramReq\x1a\x18.radio.UpdateProgramResp\x129\n" + + "\rDeleteProgram\x12\x15.radio.DeleteByIdsReq\x1a\x11.radio.DeleteResp\x12E\n" + + "\x0eGetProgramList\x12\x18.radio.GetProgramListReq\x1a\x19.radio.GetProgramListResp\x12K\n" + + "\x10GetProgramDetail\x12\x1a.radio.GetProgramDetailReq\x1a\x1b.radio.GetProgramDetailResp\x12<\n" + + "\vCreateVoice\x12\x15.radio.CreateVoiceReq\x1a\x16.radio.CreateVoiceResp\x12<\n" + + "\vUpdateVoice\x12\x15.radio.UpdateVoiceReq\x1a\x16.radio.UpdateVoiceResp\x127\n" + + "\vDeleteVoice\x12\x15.radio.DeleteByIdsReq\x1a\x11.radio.DeleteResp\x12?\n" + + "\fGetVoiceList\x12\x16.radio.GetVoiceListReq\x1a\x17.radio.GetVoiceListResp\x129\n" + + "\n" + + "ToggleLike\x12\x14.radio.ToggleLikeReq\x1a\x15.radio.ToggleLikeResp\x12E\n" + + "\x0eToggleFavorite\x12\x18.radio.ToggleFavoriteReq\x1a\x19.radio.ToggleFavoriteResp\x127\n" + + "\x0eCommentProgram\x12\x11.radio.CommentReq\x1a\x12.radio.CommentResp\x12B\n" + + "\rRecordHistory\x12\x17.radio.RecordHistoryReq\x1a\x18.radio.RecordHistoryResp\x12E\n" + + "\x0eGetHistoryList\x12\x18.radio.GetHistoryListReq\x1a\x19.radio.GetHistoryListResp\x12H\n" + + "\x0fGetFavoriteList\x12\x19.radio.GetFavoriteListReq\x1a\x1a.radio.GetFavoriteListResp\x12Q\n" + + "\x12GetMySubscriptions\x12\x1c.radio.GetMySubscriptionsReq\x1a\x1d.radio.GetMySubscriptionsResp\x12E\n" + + "\x0eCreatePayOrder\x12\x18.radio.CreatePayOrderReq\x1a\x19.radio.CreatePayOrderResp\x12K\n" + + "\x10GetVipConfigList\x12\x1a.radio.GetVipConfigListReq\x1a\x1b.radio.GetVipConfigListResp\x12?\n" + + "\fGetMyVipInfo\x12\x16.radio.GetMyVipInfoReq\x1a\x17.radio.GetMyVipInfoRespB\tZ\a./radiob\x06proto3" + +var ( + file_pb_radio_proto_rawDescOnce sync.Once + file_pb_radio_proto_rawDescData []byte +) + +func file_pb_radio_proto_rawDescGZIP() []byte { + file_pb_radio_proto_rawDescOnce.Do(func() { + file_pb_radio_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_radio_proto_rawDesc), len(file_pb_radio_proto_rawDesc))) + }) + return file_pb_radio_proto_rawDescData +} + +var file_pb_radio_proto_msgTypes = make([]protoimpl.MessageInfo, 60) +var file_pb_radio_proto_goTypes = []any{ + (*RadioUserProfile)(nil), // 0: radio.RadioUserProfile + (*GetRadioUserProfileReq)(nil), // 1: radio.GetRadioUserProfileReq + (*GetRadioUserProfileResp)(nil), // 2: radio.GetRadioUserProfileResp + (*CategoryInfo)(nil), // 3: radio.CategoryInfo + (*CreateCategoryReq)(nil), // 4: radio.CreateCategoryReq + (*CreateCategoryResp)(nil), // 5: radio.CreateCategoryResp + (*UpdateCategoryReq)(nil), // 6: radio.UpdateCategoryReq + (*UpdateCategoryResp)(nil), // 7: radio.UpdateCategoryResp + (*DeleteByIdsReq)(nil), // 8: radio.DeleteByIdsReq + (*DeleteResp)(nil), // 9: radio.DeleteResp + (*GetCategoryListReq)(nil), // 10: radio.GetCategoryListReq + (*GetCategoryListResp)(nil), // 11: radio.GetCategoryListResp + (*ChannelInfo)(nil), // 12: radio.ChannelInfo + (*CreateChannelReq)(nil), // 13: radio.CreateChannelReq + (*CreateChannelResp)(nil), // 14: radio.CreateChannelResp + (*UpdateChannelReq)(nil), // 15: radio.UpdateChannelReq + (*UpdateChannelResp)(nil), // 16: radio.UpdateChannelResp + (*GetChannelListReq)(nil), // 17: radio.GetChannelListReq + (*GetChannelListResp)(nil), // 18: radio.GetChannelListResp + (*GetChannelDetailReq)(nil), // 19: radio.GetChannelDetailReq + (*GetChannelDetailResp)(nil), // 20: radio.GetChannelDetailResp + (*ProgramInfo)(nil), // 21: radio.ProgramInfo + (*CreateProgramReq)(nil), // 22: radio.CreateProgramReq + (*CreateProgramResp)(nil), // 23: radio.CreateProgramResp + (*UpdateProgramReq)(nil), // 24: radio.UpdateProgramReq + (*UpdateProgramResp)(nil), // 25: radio.UpdateProgramResp + (*GetProgramListReq)(nil), // 26: radio.GetProgramListReq + (*GetProgramListResp)(nil), // 27: radio.GetProgramListResp + (*GetProgramDetailReq)(nil), // 28: radio.GetProgramDetailReq + (*GetProgramDetailResp)(nil), // 29: radio.GetProgramDetailResp + (*VoiceInfo)(nil), // 30: radio.VoiceInfo + (*CreateVoiceReq)(nil), // 31: radio.CreateVoiceReq + (*CreateVoiceResp)(nil), // 32: radio.CreateVoiceResp + (*UpdateVoiceReq)(nil), // 33: radio.UpdateVoiceReq + (*UpdateVoiceResp)(nil), // 34: radio.UpdateVoiceResp + (*GetVoiceListReq)(nil), // 35: radio.GetVoiceListReq + (*GetVoiceListResp)(nil), // 36: radio.GetVoiceListResp + (*ToggleLikeReq)(nil), // 37: radio.ToggleLikeReq + (*ToggleLikeResp)(nil), // 38: radio.ToggleLikeResp + (*ToggleFavoriteReq)(nil), // 39: radio.ToggleFavoriteReq + (*ToggleFavoriteResp)(nil), // 40: radio.ToggleFavoriteResp + (*CommentReq)(nil), // 41: radio.CommentReq + (*CommentResp)(nil), // 42: radio.CommentResp + (*RecordHistoryReq)(nil), // 43: radio.RecordHistoryReq + (*RecordHistoryResp)(nil), // 44: radio.RecordHistoryResp + (*GetHistoryListReq)(nil), // 45: radio.GetHistoryListReq + (*GetHistoryListResp)(nil), // 46: radio.GetHistoryListResp + (*GetFavoriteListReq)(nil), // 47: radio.GetFavoriteListReq + (*GetFavoriteListResp)(nil), // 48: radio.GetFavoriteListResp + (*SubscriptionInfo)(nil), // 49: radio.SubscriptionInfo + (*GetMySubscriptionsReq)(nil), // 50: radio.GetMySubscriptionsReq + (*GetMySubscriptionsResp)(nil), // 51: radio.GetMySubscriptionsResp + (*CreatePayOrderReq)(nil), // 52: radio.CreatePayOrderReq + (*CreatePayOrderResp)(nil), // 53: radio.CreatePayOrderResp + (*VipConfigInfo)(nil), // 54: radio.VipConfigInfo + (*GetVipConfigListReq)(nil), // 55: radio.GetVipConfigListReq + (*GetVipConfigListResp)(nil), // 56: radio.GetVipConfigListResp + (*GetMyVipInfoReq)(nil), // 57: radio.GetMyVipInfoReq + (*GetMyVipInfoResp)(nil), // 58: radio.GetMyVipInfoResp + (*Empty)(nil), // 59: radio.Empty +} +var file_pb_radio_proto_depIdxs = []int32{ + 0, // 0: radio.GetRadioUserProfileResp.profile:type_name -> radio.RadioUserProfile + 3, // 1: radio.GetCategoryListResp.list:type_name -> radio.CategoryInfo + 12, // 2: radio.GetChannelListResp.list:type_name -> radio.ChannelInfo + 12, // 3: radio.GetChannelDetailResp.channel:type_name -> radio.ChannelInfo + 21, // 4: radio.GetProgramListResp.list:type_name -> radio.ProgramInfo + 21, // 5: radio.GetProgramDetailResp.program:type_name -> radio.ProgramInfo + 30, // 6: radio.GetVoiceListResp.list:type_name -> radio.VoiceInfo + 21, // 7: radio.GetHistoryListResp.list:type_name -> radio.ProgramInfo + 21, // 8: radio.GetFavoriteListResp.list:type_name -> radio.ProgramInfo + 49, // 9: radio.GetMySubscriptionsResp.list:type_name -> radio.SubscriptionInfo + 54, // 10: radio.GetVipConfigListResp.list:type_name -> radio.VipConfigInfo + 0, // 11: radio.GetMyVipInfoResp.profile:type_name -> radio.RadioUserProfile + 1, // 12: radio.RadioService.GetRadioUserProfile:input_type -> radio.GetRadioUserProfileReq + 4, // 13: radio.RadioService.CreateCategory:input_type -> radio.CreateCategoryReq + 6, // 14: radio.RadioService.UpdateCategory:input_type -> radio.UpdateCategoryReq + 8, // 15: radio.RadioService.DeleteCategory:input_type -> radio.DeleteByIdsReq + 10, // 16: radio.RadioService.GetCategoryList:input_type -> radio.GetCategoryListReq + 13, // 17: radio.RadioService.CreateChannel:input_type -> radio.CreateChannelReq + 15, // 18: radio.RadioService.UpdateChannel:input_type -> radio.UpdateChannelReq + 8, // 19: radio.RadioService.DeleteChannel:input_type -> radio.DeleteByIdsReq + 17, // 20: radio.RadioService.GetChannelList:input_type -> radio.GetChannelListReq + 19, // 21: radio.RadioService.GetChannelDetail:input_type -> radio.GetChannelDetailReq + 22, // 22: radio.RadioService.CreateProgram:input_type -> radio.CreateProgramReq + 24, // 23: radio.RadioService.UpdateProgram:input_type -> radio.UpdateProgramReq + 8, // 24: radio.RadioService.DeleteProgram:input_type -> radio.DeleteByIdsReq + 26, // 25: radio.RadioService.GetProgramList:input_type -> radio.GetProgramListReq + 28, // 26: radio.RadioService.GetProgramDetail:input_type -> radio.GetProgramDetailReq + 31, // 27: radio.RadioService.CreateVoice:input_type -> radio.CreateVoiceReq + 33, // 28: radio.RadioService.UpdateVoice:input_type -> radio.UpdateVoiceReq + 8, // 29: radio.RadioService.DeleteVoice:input_type -> radio.DeleteByIdsReq + 35, // 30: radio.RadioService.GetVoiceList:input_type -> radio.GetVoiceListReq + 37, // 31: radio.RadioService.ToggleLike:input_type -> radio.ToggleLikeReq + 39, // 32: radio.RadioService.ToggleFavorite:input_type -> radio.ToggleFavoriteReq + 41, // 33: radio.RadioService.CommentProgram:input_type -> radio.CommentReq + 43, // 34: radio.RadioService.RecordHistory:input_type -> radio.RecordHistoryReq + 45, // 35: radio.RadioService.GetHistoryList:input_type -> radio.GetHistoryListReq + 47, // 36: radio.RadioService.GetFavoriteList:input_type -> radio.GetFavoriteListReq + 50, // 37: radio.RadioService.GetMySubscriptions:input_type -> radio.GetMySubscriptionsReq + 52, // 38: radio.RadioService.CreatePayOrder:input_type -> radio.CreatePayOrderReq + 55, // 39: radio.RadioService.GetVipConfigList:input_type -> radio.GetVipConfigListReq + 57, // 40: radio.RadioService.GetMyVipInfo:input_type -> radio.GetMyVipInfoReq + 2, // 41: radio.RadioService.GetRadioUserProfile:output_type -> radio.GetRadioUserProfileResp + 5, // 42: radio.RadioService.CreateCategory:output_type -> radio.CreateCategoryResp + 7, // 43: radio.RadioService.UpdateCategory:output_type -> radio.UpdateCategoryResp + 9, // 44: radio.RadioService.DeleteCategory:output_type -> radio.DeleteResp + 11, // 45: radio.RadioService.GetCategoryList:output_type -> radio.GetCategoryListResp + 14, // 46: radio.RadioService.CreateChannel:output_type -> radio.CreateChannelResp + 16, // 47: radio.RadioService.UpdateChannel:output_type -> radio.UpdateChannelResp + 9, // 48: radio.RadioService.DeleteChannel:output_type -> radio.DeleteResp + 18, // 49: radio.RadioService.GetChannelList:output_type -> radio.GetChannelListResp + 20, // 50: radio.RadioService.GetChannelDetail:output_type -> radio.GetChannelDetailResp + 23, // 51: radio.RadioService.CreateProgram:output_type -> radio.CreateProgramResp + 25, // 52: radio.RadioService.UpdateProgram:output_type -> radio.UpdateProgramResp + 9, // 53: radio.RadioService.DeleteProgram:output_type -> radio.DeleteResp + 27, // 54: radio.RadioService.GetProgramList:output_type -> radio.GetProgramListResp + 29, // 55: radio.RadioService.GetProgramDetail:output_type -> radio.GetProgramDetailResp + 32, // 56: radio.RadioService.CreateVoice:output_type -> radio.CreateVoiceResp + 34, // 57: radio.RadioService.UpdateVoice:output_type -> radio.UpdateVoiceResp + 9, // 58: radio.RadioService.DeleteVoice:output_type -> radio.DeleteResp + 36, // 59: radio.RadioService.GetVoiceList:output_type -> radio.GetVoiceListResp + 38, // 60: radio.RadioService.ToggleLike:output_type -> radio.ToggleLikeResp + 40, // 61: radio.RadioService.ToggleFavorite:output_type -> radio.ToggleFavoriteResp + 42, // 62: radio.RadioService.CommentProgram:output_type -> radio.CommentResp + 44, // 63: radio.RadioService.RecordHistory:output_type -> radio.RecordHistoryResp + 46, // 64: radio.RadioService.GetHistoryList:output_type -> radio.GetHistoryListResp + 48, // 65: radio.RadioService.GetFavoriteList:output_type -> radio.GetFavoriteListResp + 51, // 66: radio.RadioService.GetMySubscriptions:output_type -> radio.GetMySubscriptionsResp + 53, // 67: radio.RadioService.CreatePayOrder:output_type -> radio.CreatePayOrderResp + 56, // 68: radio.RadioService.GetVipConfigList:output_type -> radio.GetVipConfigListResp + 58, // 69: radio.RadioService.GetMyVipInfo:output_type -> radio.GetMyVipInfoResp + 41, // [41:70] is the sub-list for method output_type + 12, // [12:41] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_pb_radio_proto_init() } +func file_pb_radio_proto_init() { + if File_pb_radio_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_radio_proto_rawDesc), len(file_pb_radio_proto_rawDesc)), + NumEnums: 0, + NumMessages: 60, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pb_radio_proto_goTypes, + DependencyIndexes: file_pb_radio_proto_depIdxs, + MessageInfos: file_pb_radio_proto_msgTypes, + }.Build() + File_pb_radio_proto = out.File + file_pb_radio_proto_goTypes = nil + file_pb_radio_proto_depIdxs = nil +} diff --git a/app/radio/rpc/radio/radio_grpc.pb.go b/app/radio/rpc/radio/radio_grpc.pb.go new file mode 100644 index 0000000..61c9f36 --- /dev/null +++ b/app/radio/rpc/radio/radio_grpc.pb.go @@ -0,0 +1,1205 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v7.34.1 +// source: pb/radio.proto + +package radio + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + RadioService_GetRadioUserProfile_FullMethodName = "/radio.RadioService/GetRadioUserProfile" + RadioService_CreateCategory_FullMethodName = "/radio.RadioService/CreateCategory" + RadioService_UpdateCategory_FullMethodName = "/radio.RadioService/UpdateCategory" + RadioService_DeleteCategory_FullMethodName = "/radio.RadioService/DeleteCategory" + RadioService_GetCategoryList_FullMethodName = "/radio.RadioService/GetCategoryList" + RadioService_CreateChannel_FullMethodName = "/radio.RadioService/CreateChannel" + RadioService_UpdateChannel_FullMethodName = "/radio.RadioService/UpdateChannel" + RadioService_DeleteChannel_FullMethodName = "/radio.RadioService/DeleteChannel" + RadioService_GetChannelList_FullMethodName = "/radio.RadioService/GetChannelList" + RadioService_GetChannelDetail_FullMethodName = "/radio.RadioService/GetChannelDetail" + RadioService_CreateProgram_FullMethodName = "/radio.RadioService/CreateProgram" + RadioService_UpdateProgram_FullMethodName = "/radio.RadioService/UpdateProgram" + RadioService_DeleteProgram_FullMethodName = "/radio.RadioService/DeleteProgram" + RadioService_GetProgramList_FullMethodName = "/radio.RadioService/GetProgramList" + RadioService_GetProgramDetail_FullMethodName = "/radio.RadioService/GetProgramDetail" + RadioService_CreateVoice_FullMethodName = "/radio.RadioService/CreateVoice" + RadioService_UpdateVoice_FullMethodName = "/radio.RadioService/UpdateVoice" + RadioService_DeleteVoice_FullMethodName = "/radio.RadioService/DeleteVoice" + RadioService_GetVoiceList_FullMethodName = "/radio.RadioService/GetVoiceList" + RadioService_ToggleLike_FullMethodName = "/radio.RadioService/ToggleLike" + RadioService_ToggleFavorite_FullMethodName = "/radio.RadioService/ToggleFavorite" + RadioService_CommentProgram_FullMethodName = "/radio.RadioService/CommentProgram" + RadioService_RecordHistory_FullMethodName = "/radio.RadioService/RecordHistory" + RadioService_GetHistoryList_FullMethodName = "/radio.RadioService/GetHistoryList" + RadioService_GetFavoriteList_FullMethodName = "/radio.RadioService/GetFavoriteList" + RadioService_GetMySubscriptions_FullMethodName = "/radio.RadioService/GetMySubscriptions" + RadioService_CreatePayOrder_FullMethodName = "/radio.RadioService/CreatePayOrder" + RadioService_GetVipConfigList_FullMethodName = "/radio.RadioService/GetVipConfigList" + RadioService_GetMyVipInfo_FullMethodName = "/radio.RadioService/GetMyVipInfo" +) + +// RadioServiceClient is the client API for RadioService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// ========== 服务定义 ========== +type RadioServiceClient interface { + // 用户 + GetRadioUserProfile(ctx context.Context, in *GetRadioUserProfileReq, opts ...grpc.CallOption) (*GetRadioUserProfileResp, error) + // 分类 + CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*CreateCategoryResp, error) + UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*UpdateCategoryResp, error) + DeleteCategory(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetCategoryList(ctx context.Context, in *GetCategoryListReq, opts ...grpc.CallOption) (*GetCategoryListResp, error) + // 频道 + CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CreateChannelResp, error) + UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*UpdateChannelResp, error) + DeleteChannel(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetChannelList(ctx context.Context, in *GetChannelListReq, opts ...grpc.CallOption) (*GetChannelListResp, error) + GetChannelDetail(ctx context.Context, in *GetChannelDetailReq, opts ...grpc.CallOption) (*GetChannelDetailResp, error) + // 节目 + CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CreateProgramResp, error) + UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*UpdateProgramResp, error) + DeleteProgram(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetProgramList(ctx context.Context, in *GetProgramListReq, opts ...grpc.CallOption) (*GetProgramListResp, error) + GetProgramDetail(ctx context.Context, in *GetProgramDetailReq, opts ...grpc.CallOption) (*GetProgramDetailResp, error) + // 音色 + CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CreateVoiceResp, error) + UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*UpdateVoiceResp, error) + DeleteVoice(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetVoiceList(ctx context.Context, in *GetVoiceListReq, opts ...grpc.CallOption) (*GetVoiceListResp, error) + // 互动 + ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*ToggleLikeResp, error) + ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*ToggleFavoriteResp, error) + CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommentResp, error) + RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*RecordHistoryResp, error) + GetHistoryList(ctx context.Context, in *GetHistoryListReq, opts ...grpc.CallOption) (*GetHistoryListResp, error) + GetFavoriteList(ctx context.Context, in *GetFavoriteListReq, opts ...grpc.CallOption) (*GetFavoriteListResp, error) + // 订阅 + GetMySubscriptions(ctx context.Context, in *GetMySubscriptionsReq, opts ...grpc.CallOption) (*GetMySubscriptionsResp, error) + CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) + // VIP + GetVipConfigList(ctx context.Context, in *GetVipConfigListReq, opts ...grpc.CallOption) (*GetVipConfigListResp, error) + GetMyVipInfo(ctx context.Context, in *GetMyVipInfoReq, opts ...grpc.CallOption) (*GetMyVipInfoResp, error) +} + +type radioServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRadioServiceClient(cc grpc.ClientConnInterface) RadioServiceClient { + return &radioServiceClient{cc} +} + +func (c *radioServiceClient) GetRadioUserProfile(ctx context.Context, in *GetRadioUserProfileReq, opts ...grpc.CallOption) (*GetRadioUserProfileResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetRadioUserProfileResp) + err := c.cc.Invoke(ctx, RadioService_GetRadioUserProfile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*CreateCategoryResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateCategoryResp) + err := c.cc.Invoke(ctx, RadioService_CreateCategory_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*UpdateCategoryResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateCategoryResp) + err := c.cc.Invoke(ctx, RadioService_UpdateCategory_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) DeleteCategory(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResp) + err := c.cc.Invoke(ctx, RadioService_DeleteCategory_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetCategoryList(ctx context.Context, in *GetCategoryListReq, opts ...grpc.CallOption) (*GetCategoryListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetCategoryListResp) + err := c.cc.Invoke(ctx, RadioService_GetCategoryList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CreateChannelResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateChannelResp) + err := c.cc.Invoke(ctx, RadioService_CreateChannel_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*UpdateChannelResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateChannelResp) + err := c.cc.Invoke(ctx, RadioService_UpdateChannel_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) DeleteChannel(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResp) + err := c.cc.Invoke(ctx, RadioService_DeleteChannel_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetChannelList(ctx context.Context, in *GetChannelListReq, opts ...grpc.CallOption) (*GetChannelListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetChannelListResp) + err := c.cc.Invoke(ctx, RadioService_GetChannelList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetChannelDetail(ctx context.Context, in *GetChannelDetailReq, opts ...grpc.CallOption) (*GetChannelDetailResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetChannelDetailResp) + err := c.cc.Invoke(ctx, RadioService_GetChannelDetail_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CreateProgramResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateProgramResp) + err := c.cc.Invoke(ctx, RadioService_CreateProgram_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*UpdateProgramResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateProgramResp) + err := c.cc.Invoke(ctx, RadioService_UpdateProgram_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) DeleteProgram(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResp) + err := c.cc.Invoke(ctx, RadioService_DeleteProgram_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetProgramList(ctx context.Context, in *GetProgramListReq, opts ...grpc.CallOption) (*GetProgramListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetProgramListResp) + err := c.cc.Invoke(ctx, RadioService_GetProgramList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetProgramDetail(ctx context.Context, in *GetProgramDetailReq, opts ...grpc.CallOption) (*GetProgramDetailResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetProgramDetailResp) + err := c.cc.Invoke(ctx, RadioService_GetProgramDetail_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CreateVoiceResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateVoiceResp) + err := c.cc.Invoke(ctx, RadioService_CreateVoice_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*UpdateVoiceResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateVoiceResp) + err := c.cc.Invoke(ctx, RadioService_UpdateVoice_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) DeleteVoice(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResp) + err := c.cc.Invoke(ctx, RadioService_DeleteVoice_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetVoiceList(ctx context.Context, in *GetVoiceListReq, opts ...grpc.CallOption) (*GetVoiceListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetVoiceListResp) + err := c.cc.Invoke(ctx, RadioService_GetVoiceList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*ToggleLikeResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ToggleLikeResp) + err := c.cc.Invoke(ctx, RadioService_ToggleLike_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*ToggleFavoriteResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ToggleFavoriteResp) + err := c.cc.Invoke(ctx, RadioService_ToggleFavorite_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommentResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommentResp) + err := c.cc.Invoke(ctx, RadioService_CommentProgram_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*RecordHistoryResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RecordHistoryResp) + err := c.cc.Invoke(ctx, RadioService_RecordHistory_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetHistoryList(ctx context.Context, in *GetHistoryListReq, opts ...grpc.CallOption) (*GetHistoryListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetHistoryListResp) + err := c.cc.Invoke(ctx, RadioService_GetHistoryList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetFavoriteList(ctx context.Context, in *GetFavoriteListReq, opts ...grpc.CallOption) (*GetFavoriteListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFavoriteListResp) + err := c.cc.Invoke(ctx, RadioService_GetFavoriteList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetMySubscriptions(ctx context.Context, in *GetMySubscriptionsReq, opts ...grpc.CallOption) (*GetMySubscriptionsResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMySubscriptionsResp) + err := c.cc.Invoke(ctx, RadioService_GetMySubscriptions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreatePayOrderResp) + err := c.cc.Invoke(ctx, RadioService_CreatePayOrder_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetVipConfigList(ctx context.Context, in *GetVipConfigListReq, opts ...grpc.CallOption) (*GetVipConfigListResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetVipConfigListResp) + err := c.cc.Invoke(ctx, RadioService_GetVipConfigList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *radioServiceClient) GetMyVipInfo(ctx context.Context, in *GetMyVipInfoReq, opts ...grpc.CallOption) (*GetMyVipInfoResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMyVipInfoResp) + err := c.cc.Invoke(ctx, RadioService_GetMyVipInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RadioServiceServer is the server API for RadioService service. +// All implementations must embed UnimplementedRadioServiceServer +// for forward compatibility. +// +// ========== 服务定义 ========== +type RadioServiceServer interface { + // 用户 + GetRadioUserProfile(context.Context, *GetRadioUserProfileReq) (*GetRadioUserProfileResp, error) + // 分类 + CreateCategory(context.Context, *CreateCategoryReq) (*CreateCategoryResp, error) + UpdateCategory(context.Context, *UpdateCategoryReq) (*UpdateCategoryResp, error) + DeleteCategory(context.Context, *DeleteByIdsReq) (*DeleteResp, error) + GetCategoryList(context.Context, *GetCategoryListReq) (*GetCategoryListResp, error) + // 频道 + CreateChannel(context.Context, *CreateChannelReq) (*CreateChannelResp, error) + UpdateChannel(context.Context, *UpdateChannelReq) (*UpdateChannelResp, error) + DeleteChannel(context.Context, *DeleteByIdsReq) (*DeleteResp, error) + GetChannelList(context.Context, *GetChannelListReq) (*GetChannelListResp, error) + GetChannelDetail(context.Context, *GetChannelDetailReq) (*GetChannelDetailResp, error) + // 节目 + CreateProgram(context.Context, *CreateProgramReq) (*CreateProgramResp, error) + UpdateProgram(context.Context, *UpdateProgramReq) (*UpdateProgramResp, error) + DeleteProgram(context.Context, *DeleteByIdsReq) (*DeleteResp, error) + GetProgramList(context.Context, *GetProgramListReq) (*GetProgramListResp, error) + GetProgramDetail(context.Context, *GetProgramDetailReq) (*GetProgramDetailResp, error) + // 音色 + CreateVoice(context.Context, *CreateVoiceReq) (*CreateVoiceResp, error) + UpdateVoice(context.Context, *UpdateVoiceReq) (*UpdateVoiceResp, error) + DeleteVoice(context.Context, *DeleteByIdsReq) (*DeleteResp, error) + GetVoiceList(context.Context, *GetVoiceListReq) (*GetVoiceListResp, error) + // 互动 + ToggleLike(context.Context, *ToggleLikeReq) (*ToggleLikeResp, error) + ToggleFavorite(context.Context, *ToggleFavoriteReq) (*ToggleFavoriteResp, error) + CommentProgram(context.Context, *CommentReq) (*CommentResp, error) + RecordHistory(context.Context, *RecordHistoryReq) (*RecordHistoryResp, error) + GetHistoryList(context.Context, *GetHistoryListReq) (*GetHistoryListResp, error) + GetFavoriteList(context.Context, *GetFavoriteListReq) (*GetFavoriteListResp, error) + // 订阅 + GetMySubscriptions(context.Context, *GetMySubscriptionsReq) (*GetMySubscriptionsResp, error) + CreatePayOrder(context.Context, *CreatePayOrderReq) (*CreatePayOrderResp, error) + // VIP + GetVipConfigList(context.Context, *GetVipConfigListReq) (*GetVipConfigListResp, error) + GetMyVipInfo(context.Context, *GetMyVipInfoReq) (*GetMyVipInfoResp, error) + mustEmbedUnimplementedRadioServiceServer() +} + +// UnimplementedRadioServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedRadioServiceServer struct{} + +func (UnimplementedRadioServiceServer) GetRadioUserProfile(context.Context, *GetRadioUserProfileReq) (*GetRadioUserProfileResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetRadioUserProfile not implemented") +} +func (UnimplementedRadioServiceServer) CreateCategory(context.Context, *CreateCategoryReq) (*CreateCategoryResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateCategory not implemented") +} +func (UnimplementedRadioServiceServer) UpdateCategory(context.Context, *UpdateCategoryReq) (*UpdateCategoryResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateCategory not implemented") +} +func (UnimplementedRadioServiceServer) DeleteCategory(context.Context, *DeleteByIdsReq) (*DeleteResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteCategory not implemented") +} +func (UnimplementedRadioServiceServer) GetCategoryList(context.Context, *GetCategoryListReq) (*GetCategoryListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetCategoryList not implemented") +} +func (UnimplementedRadioServiceServer) CreateChannel(context.Context, *CreateChannelReq) (*CreateChannelResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateChannel not implemented") +} +func (UnimplementedRadioServiceServer) UpdateChannel(context.Context, *UpdateChannelReq) (*UpdateChannelResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateChannel not implemented") +} +func (UnimplementedRadioServiceServer) DeleteChannel(context.Context, *DeleteByIdsReq) (*DeleteResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteChannel not implemented") +} +func (UnimplementedRadioServiceServer) GetChannelList(context.Context, *GetChannelListReq) (*GetChannelListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetChannelList not implemented") +} +func (UnimplementedRadioServiceServer) GetChannelDetail(context.Context, *GetChannelDetailReq) (*GetChannelDetailResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetChannelDetail not implemented") +} +func (UnimplementedRadioServiceServer) CreateProgram(context.Context, *CreateProgramReq) (*CreateProgramResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateProgram not implemented") +} +func (UnimplementedRadioServiceServer) UpdateProgram(context.Context, *UpdateProgramReq) (*UpdateProgramResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateProgram not implemented") +} +func (UnimplementedRadioServiceServer) DeleteProgram(context.Context, *DeleteByIdsReq) (*DeleteResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteProgram not implemented") +} +func (UnimplementedRadioServiceServer) GetProgramList(context.Context, *GetProgramListReq) (*GetProgramListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetProgramList not implemented") +} +func (UnimplementedRadioServiceServer) GetProgramDetail(context.Context, *GetProgramDetailReq) (*GetProgramDetailResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetProgramDetail not implemented") +} +func (UnimplementedRadioServiceServer) CreateVoice(context.Context, *CreateVoiceReq) (*CreateVoiceResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateVoice not implemented") +} +func (UnimplementedRadioServiceServer) UpdateVoice(context.Context, *UpdateVoiceReq) (*UpdateVoiceResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateVoice not implemented") +} +func (UnimplementedRadioServiceServer) DeleteVoice(context.Context, *DeleteByIdsReq) (*DeleteResp, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteVoice not implemented") +} +func (UnimplementedRadioServiceServer) GetVoiceList(context.Context, *GetVoiceListReq) (*GetVoiceListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetVoiceList not implemented") +} +func (UnimplementedRadioServiceServer) ToggleLike(context.Context, *ToggleLikeReq) (*ToggleLikeResp, error) { + return nil, status.Error(codes.Unimplemented, "method ToggleLike not implemented") +} +func (UnimplementedRadioServiceServer) ToggleFavorite(context.Context, *ToggleFavoriteReq) (*ToggleFavoriteResp, error) { + return nil, status.Error(codes.Unimplemented, "method ToggleFavorite not implemented") +} +func (UnimplementedRadioServiceServer) CommentProgram(context.Context, *CommentReq) (*CommentResp, error) { + return nil, status.Error(codes.Unimplemented, "method CommentProgram not implemented") +} +func (UnimplementedRadioServiceServer) RecordHistory(context.Context, *RecordHistoryReq) (*RecordHistoryResp, error) { + return nil, status.Error(codes.Unimplemented, "method RecordHistory not implemented") +} +func (UnimplementedRadioServiceServer) GetHistoryList(context.Context, *GetHistoryListReq) (*GetHistoryListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetHistoryList not implemented") +} +func (UnimplementedRadioServiceServer) GetFavoriteList(context.Context, *GetFavoriteListReq) (*GetFavoriteListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetFavoriteList not implemented") +} +func (UnimplementedRadioServiceServer) GetMySubscriptions(context.Context, *GetMySubscriptionsReq) (*GetMySubscriptionsResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetMySubscriptions not implemented") +} +func (UnimplementedRadioServiceServer) CreatePayOrder(context.Context, *CreatePayOrderReq) (*CreatePayOrderResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreatePayOrder not implemented") +} +func (UnimplementedRadioServiceServer) GetVipConfigList(context.Context, *GetVipConfigListReq) (*GetVipConfigListResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetVipConfigList not implemented") +} +func (UnimplementedRadioServiceServer) GetMyVipInfo(context.Context, *GetMyVipInfoReq) (*GetMyVipInfoResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetMyVipInfo not implemented") +} +func (UnimplementedRadioServiceServer) mustEmbedUnimplementedRadioServiceServer() {} +func (UnimplementedRadioServiceServer) testEmbeddedByValue() {} + +// UnsafeRadioServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RadioServiceServer will +// result in compilation errors. +type UnsafeRadioServiceServer interface { + mustEmbedUnimplementedRadioServiceServer() +} + +func RegisterRadioServiceServer(s grpc.ServiceRegistrar, srv RadioServiceServer) { + // If the following call panics, it indicates UnimplementedRadioServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&RadioService_ServiceDesc, srv) +} + +func _RadioService_GetRadioUserProfile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRadioUserProfileReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetRadioUserProfile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetRadioUserProfile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetRadioUserProfile(ctx, req.(*GetRadioUserProfileReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_CreateCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateCategoryReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).CreateCategory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_CreateCategory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).CreateCategory(ctx, req.(*CreateCategoryReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_UpdateCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCategoryReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).UpdateCategory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_UpdateCategory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).UpdateCategory(ctx, req.(*UpdateCategoryReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_DeleteCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteByIdsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).DeleteCategory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_DeleteCategory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).DeleteCategory(ctx, req.(*DeleteByIdsReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetCategoryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCategoryListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetCategoryList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetCategoryList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetCategoryList(ctx, req.(*GetCategoryListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_CreateChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateChannelReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).CreateChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_CreateChannel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).CreateChannel(ctx, req.(*CreateChannelReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_UpdateChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateChannelReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).UpdateChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_UpdateChannel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).UpdateChannel(ctx, req.(*UpdateChannelReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_DeleteChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteByIdsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).DeleteChannel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_DeleteChannel_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).DeleteChannel(ctx, req.(*DeleteByIdsReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetChannelList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetChannelListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetChannelList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetChannelList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetChannelList(ctx, req.(*GetChannelListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetChannelDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetChannelDetailReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetChannelDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetChannelDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetChannelDetail(ctx, req.(*GetChannelDetailReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_CreateProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateProgramReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).CreateProgram(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_CreateProgram_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).CreateProgram(ctx, req.(*CreateProgramReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_UpdateProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateProgramReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).UpdateProgram(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_UpdateProgram_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).UpdateProgram(ctx, req.(*UpdateProgramReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_DeleteProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteByIdsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).DeleteProgram(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_DeleteProgram_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).DeleteProgram(ctx, req.(*DeleteByIdsReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetProgramList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProgramListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetProgramList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetProgramList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetProgramList(ctx, req.(*GetProgramListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetProgramDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProgramDetailReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetProgramDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetProgramDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetProgramDetail(ctx, req.(*GetProgramDetailReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_CreateVoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateVoiceReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).CreateVoice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_CreateVoice_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).CreateVoice(ctx, req.(*CreateVoiceReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_UpdateVoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateVoiceReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).UpdateVoice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_UpdateVoice_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).UpdateVoice(ctx, req.(*UpdateVoiceReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_DeleteVoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteByIdsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).DeleteVoice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_DeleteVoice_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).DeleteVoice(ctx, req.(*DeleteByIdsReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetVoiceList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetVoiceListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetVoiceList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetVoiceList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetVoiceList(ctx, req.(*GetVoiceListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_ToggleLike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ToggleLikeReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).ToggleLike(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_ToggleLike_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).ToggleLike(ctx, req.(*ToggleLikeReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_ToggleFavorite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ToggleFavoriteReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).ToggleFavorite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_ToggleFavorite_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).ToggleFavorite(ctx, req.(*ToggleFavoriteReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_CommentProgram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommentReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).CommentProgram(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_CommentProgram_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).CommentProgram(ctx, req.(*CommentReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_RecordHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RecordHistoryReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).RecordHistory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_RecordHistory_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).RecordHistory(ctx, req.(*RecordHistoryReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetHistoryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetHistoryListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetHistoryList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetHistoryList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetHistoryList(ctx, req.(*GetHistoryListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetFavoriteList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFavoriteListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetFavoriteList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetFavoriteList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetFavoriteList(ctx, req.(*GetFavoriteListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetMySubscriptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMySubscriptionsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetMySubscriptions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetMySubscriptions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetMySubscriptions(ctx, req.(*GetMySubscriptionsReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_CreatePayOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePayOrderReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).CreatePayOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_CreatePayOrder_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).CreatePayOrder(ctx, req.(*CreatePayOrderReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetVipConfigList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetVipConfigListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetVipConfigList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetVipConfigList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetVipConfigList(ctx, req.(*GetVipConfigListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _RadioService_GetMyVipInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMyVipInfoReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RadioServiceServer).GetMyVipInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RadioService_GetMyVipInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RadioServiceServer).GetMyVipInfo(ctx, req.(*GetMyVipInfoReq)) + } + return interceptor(ctx, in, info, handler) +} + +// RadioService_ServiceDesc is the grpc.ServiceDesc for RadioService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RadioService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "radio.RadioService", + HandlerType: (*RadioServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetRadioUserProfile", + Handler: _RadioService_GetRadioUserProfile_Handler, + }, + { + MethodName: "CreateCategory", + Handler: _RadioService_CreateCategory_Handler, + }, + { + MethodName: "UpdateCategory", + Handler: _RadioService_UpdateCategory_Handler, + }, + { + MethodName: "DeleteCategory", + Handler: _RadioService_DeleteCategory_Handler, + }, + { + MethodName: "GetCategoryList", + Handler: _RadioService_GetCategoryList_Handler, + }, + { + MethodName: "CreateChannel", + Handler: _RadioService_CreateChannel_Handler, + }, + { + MethodName: "UpdateChannel", + Handler: _RadioService_UpdateChannel_Handler, + }, + { + MethodName: "DeleteChannel", + Handler: _RadioService_DeleteChannel_Handler, + }, + { + MethodName: "GetChannelList", + Handler: _RadioService_GetChannelList_Handler, + }, + { + MethodName: "GetChannelDetail", + Handler: _RadioService_GetChannelDetail_Handler, + }, + { + MethodName: "CreateProgram", + Handler: _RadioService_CreateProgram_Handler, + }, + { + MethodName: "UpdateProgram", + Handler: _RadioService_UpdateProgram_Handler, + }, + { + MethodName: "DeleteProgram", + Handler: _RadioService_DeleteProgram_Handler, + }, + { + MethodName: "GetProgramList", + Handler: _RadioService_GetProgramList_Handler, + }, + { + MethodName: "GetProgramDetail", + Handler: _RadioService_GetProgramDetail_Handler, + }, + { + MethodName: "CreateVoice", + Handler: _RadioService_CreateVoice_Handler, + }, + { + MethodName: "UpdateVoice", + Handler: _RadioService_UpdateVoice_Handler, + }, + { + MethodName: "DeleteVoice", + Handler: _RadioService_DeleteVoice_Handler, + }, + { + MethodName: "GetVoiceList", + Handler: _RadioService_GetVoiceList_Handler, + }, + { + MethodName: "ToggleLike", + Handler: _RadioService_ToggleLike_Handler, + }, + { + MethodName: "ToggleFavorite", + Handler: _RadioService_ToggleFavorite_Handler, + }, + { + MethodName: "CommentProgram", + Handler: _RadioService_CommentProgram_Handler, + }, + { + MethodName: "RecordHistory", + Handler: _RadioService_RecordHistory_Handler, + }, + { + MethodName: "GetHistoryList", + Handler: _RadioService_GetHistoryList_Handler, + }, + { + MethodName: "GetFavoriteList", + Handler: _RadioService_GetFavoriteList_Handler, + }, + { + MethodName: "GetMySubscriptions", + Handler: _RadioService_GetMySubscriptions_Handler, + }, + { + MethodName: "CreatePayOrder", + Handler: _RadioService_CreatePayOrder_Handler, + }, + { + MethodName: "GetVipConfigList", + Handler: _RadioService_GetVipConfigList_Handler, + }, + { + MethodName: "GetMyVipInfo", + Handler: _RadioService_GetMyVipInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pb/radio.proto", +} diff --git a/app/radio/rpc/radioservice/radioService.go b/app/radio/rpc/radioservice/radioService.go new file mode 100644 index 0000000..41535c7 --- /dev/null +++ b/app/radio/rpc/radioservice/radioService.go @@ -0,0 +1,280 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: radio.proto + +package radioservice + +import ( + "context" + + "sundynix-micro-go/app/radio/rpc/radio" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + CategoryInfo = radio.CategoryInfo + ChannelInfo = radio.ChannelInfo + CommentReq = radio.CommentReq + CommentResp = radio.CommentResp + CreateCategoryReq = radio.CreateCategoryReq + CreateCategoryResp = radio.CreateCategoryResp + CreateChannelReq = radio.CreateChannelReq + CreateChannelResp = radio.CreateChannelResp + CreatePayOrderReq = radio.CreatePayOrderReq + CreatePayOrderResp = radio.CreatePayOrderResp + CreateProgramReq = radio.CreateProgramReq + CreateProgramResp = radio.CreateProgramResp + CreateVoiceReq = radio.CreateVoiceReq + CreateVoiceResp = radio.CreateVoiceResp + DeleteByIdsReq = radio.DeleteByIdsReq + DeleteResp = radio.DeleteResp + Empty = radio.Empty + GetCategoryListReq = radio.GetCategoryListReq + GetCategoryListResp = radio.GetCategoryListResp + GetChannelDetailReq = radio.GetChannelDetailReq + GetChannelDetailResp = radio.GetChannelDetailResp + GetChannelListReq = radio.GetChannelListReq + GetChannelListResp = radio.GetChannelListResp + GetFavoriteListReq = radio.GetFavoriteListReq + GetFavoriteListResp = radio.GetFavoriteListResp + GetHistoryListReq = radio.GetHistoryListReq + GetHistoryListResp = radio.GetHistoryListResp + GetMySubscriptionsReq = radio.GetMySubscriptionsReq + GetMySubscriptionsResp = radio.GetMySubscriptionsResp + GetMyVipInfoReq = radio.GetMyVipInfoReq + GetMyVipInfoResp = radio.GetMyVipInfoResp + GetProgramDetailReq = radio.GetProgramDetailReq + GetProgramDetailResp = radio.GetProgramDetailResp + GetProgramListReq = radio.GetProgramListReq + GetProgramListResp = radio.GetProgramListResp + GetRadioUserProfileReq = radio.GetRadioUserProfileReq + GetRadioUserProfileResp = radio.GetRadioUserProfileResp + GetVipConfigListReq = radio.GetVipConfigListReq + GetVipConfigListResp = radio.GetVipConfigListResp + GetVoiceListReq = radio.GetVoiceListReq + GetVoiceListResp = radio.GetVoiceListResp + ProgramInfo = radio.ProgramInfo + RadioUserProfile = radio.RadioUserProfile + RecordHistoryReq = radio.RecordHistoryReq + RecordHistoryResp = radio.RecordHistoryResp + SubscriptionInfo = radio.SubscriptionInfo + ToggleFavoriteReq = radio.ToggleFavoriteReq + ToggleFavoriteResp = radio.ToggleFavoriteResp + ToggleLikeReq = radio.ToggleLikeReq + ToggleLikeResp = radio.ToggleLikeResp + UpdateCategoryReq = radio.UpdateCategoryReq + UpdateCategoryResp = radio.UpdateCategoryResp + UpdateChannelReq = radio.UpdateChannelReq + UpdateChannelResp = radio.UpdateChannelResp + UpdateProgramReq = radio.UpdateProgramReq + UpdateProgramResp = radio.UpdateProgramResp + UpdateVoiceReq = radio.UpdateVoiceReq + UpdateVoiceResp = radio.UpdateVoiceResp + VipConfigInfo = radio.VipConfigInfo + VoiceInfo = radio.VoiceInfo + + RadioService interface { + // 用户 + GetRadioUserProfile(ctx context.Context, in *GetRadioUserProfileReq, opts ...grpc.CallOption) (*GetRadioUserProfileResp, error) + // 分类 + CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*CreateCategoryResp, error) + UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*UpdateCategoryResp, error) + DeleteCategory(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetCategoryList(ctx context.Context, in *GetCategoryListReq, opts ...grpc.CallOption) (*GetCategoryListResp, error) + // 频道 + CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CreateChannelResp, error) + UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*UpdateChannelResp, error) + DeleteChannel(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetChannelList(ctx context.Context, in *GetChannelListReq, opts ...grpc.CallOption) (*GetChannelListResp, error) + GetChannelDetail(ctx context.Context, in *GetChannelDetailReq, opts ...grpc.CallOption) (*GetChannelDetailResp, error) + // 节目 + CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CreateProgramResp, error) + UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*UpdateProgramResp, error) + DeleteProgram(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetProgramList(ctx context.Context, in *GetProgramListReq, opts ...grpc.CallOption) (*GetProgramListResp, error) + GetProgramDetail(ctx context.Context, in *GetProgramDetailReq, opts ...grpc.CallOption) (*GetProgramDetailResp, error) + // 音色 + CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CreateVoiceResp, error) + UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*UpdateVoiceResp, error) + DeleteVoice(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) + GetVoiceList(ctx context.Context, in *GetVoiceListReq, opts ...grpc.CallOption) (*GetVoiceListResp, error) + // 互动 + ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*ToggleLikeResp, error) + ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*ToggleFavoriteResp, error) + CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommentResp, error) + RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*RecordHistoryResp, error) + GetHistoryList(ctx context.Context, in *GetHistoryListReq, opts ...grpc.CallOption) (*GetHistoryListResp, error) + GetFavoriteList(ctx context.Context, in *GetFavoriteListReq, opts ...grpc.CallOption) (*GetFavoriteListResp, error) + // 订阅 + GetMySubscriptions(ctx context.Context, in *GetMySubscriptionsReq, opts ...grpc.CallOption) (*GetMySubscriptionsResp, error) + CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) + // VIP + GetVipConfigList(ctx context.Context, in *GetVipConfigListReq, opts ...grpc.CallOption) (*GetVipConfigListResp, error) + GetMyVipInfo(ctx context.Context, in *GetMyVipInfoReq, opts ...grpc.CallOption) (*GetMyVipInfoResp, error) + } + + defaultRadioService struct { + cli zrpc.Client + } +) + +func NewRadioService(cli zrpc.Client) RadioService { + return &defaultRadioService{ + cli: cli, + } +} + +// 用户 +func (m *defaultRadioService) GetRadioUserProfile(ctx context.Context, in *GetRadioUserProfileReq, opts ...grpc.CallOption) (*GetRadioUserProfileResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetRadioUserProfile(ctx, in, opts...) +} + +// 分类 +func (m *defaultRadioService) CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*CreateCategoryResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.CreateCategory(ctx, in, opts...) +} + +func (m *defaultRadioService) UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*UpdateCategoryResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.UpdateCategory(ctx, in, opts...) +} + +func (m *defaultRadioService) DeleteCategory(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.DeleteCategory(ctx, in, opts...) +} + +func (m *defaultRadioService) GetCategoryList(ctx context.Context, in *GetCategoryListReq, opts ...grpc.CallOption) (*GetCategoryListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetCategoryList(ctx, in, opts...) +} + +// 频道 +func (m *defaultRadioService) CreateChannel(ctx context.Context, in *CreateChannelReq, opts ...grpc.CallOption) (*CreateChannelResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.CreateChannel(ctx, in, opts...) +} + +func (m *defaultRadioService) UpdateChannel(ctx context.Context, in *UpdateChannelReq, opts ...grpc.CallOption) (*UpdateChannelResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.UpdateChannel(ctx, in, opts...) +} + +func (m *defaultRadioService) DeleteChannel(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.DeleteChannel(ctx, in, opts...) +} + +func (m *defaultRadioService) GetChannelList(ctx context.Context, in *GetChannelListReq, opts ...grpc.CallOption) (*GetChannelListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetChannelList(ctx, in, opts...) +} + +func (m *defaultRadioService) GetChannelDetail(ctx context.Context, in *GetChannelDetailReq, opts ...grpc.CallOption) (*GetChannelDetailResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetChannelDetail(ctx, in, opts...) +} + +// 节目 +func (m *defaultRadioService) CreateProgram(ctx context.Context, in *CreateProgramReq, opts ...grpc.CallOption) (*CreateProgramResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.CreateProgram(ctx, in, opts...) +} + +func (m *defaultRadioService) UpdateProgram(ctx context.Context, in *UpdateProgramReq, opts ...grpc.CallOption) (*UpdateProgramResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.UpdateProgram(ctx, in, opts...) +} + +func (m *defaultRadioService) DeleteProgram(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.DeleteProgram(ctx, in, opts...) +} + +func (m *defaultRadioService) GetProgramList(ctx context.Context, in *GetProgramListReq, opts ...grpc.CallOption) (*GetProgramListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetProgramList(ctx, in, opts...) +} + +func (m *defaultRadioService) GetProgramDetail(ctx context.Context, in *GetProgramDetailReq, opts ...grpc.CallOption) (*GetProgramDetailResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetProgramDetail(ctx, in, opts...) +} + +// 音色 +func (m *defaultRadioService) CreateVoice(ctx context.Context, in *CreateVoiceReq, opts ...grpc.CallOption) (*CreateVoiceResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.CreateVoice(ctx, in, opts...) +} + +func (m *defaultRadioService) UpdateVoice(ctx context.Context, in *UpdateVoiceReq, opts ...grpc.CallOption) (*UpdateVoiceResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.UpdateVoice(ctx, in, opts...) +} + +func (m *defaultRadioService) DeleteVoice(ctx context.Context, in *DeleteByIdsReq, opts ...grpc.CallOption) (*DeleteResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.DeleteVoice(ctx, in, opts...) +} + +func (m *defaultRadioService) GetVoiceList(ctx context.Context, in *GetVoiceListReq, opts ...grpc.CallOption) (*GetVoiceListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetVoiceList(ctx, in, opts...) +} + +// 互动 +func (m *defaultRadioService) ToggleLike(ctx context.Context, in *ToggleLikeReq, opts ...grpc.CallOption) (*ToggleLikeResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.ToggleLike(ctx, in, opts...) +} + +func (m *defaultRadioService) ToggleFavorite(ctx context.Context, in *ToggleFavoriteReq, opts ...grpc.CallOption) (*ToggleFavoriteResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.ToggleFavorite(ctx, in, opts...) +} + +func (m *defaultRadioService) CommentProgram(ctx context.Context, in *CommentReq, opts ...grpc.CallOption) (*CommentResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.CommentProgram(ctx, in, opts...) +} + +func (m *defaultRadioService) RecordHistory(ctx context.Context, in *RecordHistoryReq, opts ...grpc.CallOption) (*RecordHistoryResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.RecordHistory(ctx, in, opts...) +} + +func (m *defaultRadioService) GetHistoryList(ctx context.Context, in *GetHistoryListReq, opts ...grpc.CallOption) (*GetHistoryListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetHistoryList(ctx, in, opts...) +} + +func (m *defaultRadioService) GetFavoriteList(ctx context.Context, in *GetFavoriteListReq, opts ...grpc.CallOption) (*GetFavoriteListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetFavoriteList(ctx, in, opts...) +} + +// 订阅 +func (m *defaultRadioService) GetMySubscriptions(ctx context.Context, in *GetMySubscriptionsReq, opts ...grpc.CallOption) (*GetMySubscriptionsResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetMySubscriptions(ctx, in, opts...) +} + +func (m *defaultRadioService) CreatePayOrder(ctx context.Context, in *CreatePayOrderReq, opts ...grpc.CallOption) (*CreatePayOrderResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.CreatePayOrder(ctx, in, opts...) +} + +// VIP +func (m *defaultRadioService) GetVipConfigList(ctx context.Context, in *GetVipConfigListReq, opts ...grpc.CallOption) (*GetVipConfigListResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetVipConfigList(ctx, in, opts...) +} + +func (m *defaultRadioService) GetMyVipInfo(ctx context.Context, in *GetMyVipInfoReq, opts ...grpc.CallOption) (*GetMyVipInfoResp, error) { + client := radio.NewRadioServiceClient(m.cli.Conn()) + return client.GetMyVipInfo(ctx, in, opts...) +} diff --git a/app/system/api/etc/system-api.yaml b/app/system/api/etc/system-api.yaml new file mode 100644 index 0000000..081150a --- /dev/null +++ b/app/system/api/etc/system-api.yaml @@ -0,0 +1,17 @@ +Name: system-api +Host: 0.0.0.0 +Port: 9003 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +DB: + DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local + +# system-rpc 服务配置 +SystemRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc diff --git a/app/system/api/internal/config/config.go b/app/system/api/internal/config/config.go new file mode 100644 index 0000000..f6f84c4 --- /dev/null +++ b/app/system/api/internal/config/config.go @@ -0,0 +1,21 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + rest.RestConf + Auth struct { + AccessSecret string + AccessExpire int64 + } + SystemRpc zrpc.RpcClientConf + DB struct { + DataSource string + } +} diff --git a/app/system/api/internal/handler/client/createClientHandler.go b/app/system/api/internal/handler/client/createClientHandler.go new file mode 100644 index 0000000..6ad99fa --- /dev/null +++ b/app/system/api/internal/handler/client/createClientHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/client" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建客户端 +func CreateClientHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClientReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := client.NewCreateClientLogic(r.Context(), svcCtx) + err := l.CreateClient(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/client/deleteClientHandler.go b/app/system/api/internal/handler/client/deleteClientHandler.go new file mode 100644 index 0000000..e7627b8 --- /dev/null +++ b/app/system/api/internal/handler/client/deleteClientHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/client" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除客户端 +func DeleteClientHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := client.NewDeleteClientLogic(r.Context(), svcCtx) + err := l.DeleteClient(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/client/getClientListHandler.go b/app/system/api/internal/handler/client/getClientListHandler.go new file mode 100644 index 0000000..afab28a --- /dev/null +++ b/app/system/api/internal/handler/client/getClientListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/client" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 客户端列表 +func GetClientListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClientListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := client.NewGetClientListLogic(r.Context(), svcCtx) + resp, err := l.GetClientList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/system/api/internal/handler/client/updateClientHandler.go b/app/system/api/internal/handler/client/updateClientHandler.go new file mode 100644 index 0000000..c776b03 --- /dev/null +++ b/app/system/api/internal/handler/client/updateClientHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/client" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新客户端 +func UpdateClientHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClientUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := client.NewUpdateClientLogic(r.Context(), svcCtx) + err := l.UpdateClient(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/dict/createDictHandler.go b/app/system/api/internal/handler/dict/createDictHandler.go new file mode 100644 index 0000000..bb60112 --- /dev/null +++ b/app/system/api/internal/handler/dict/createDictHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package dict + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/dict" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建字典 +func CreateDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := dict.NewCreateDictLogic(r.Context(), svcCtx) + err := l.CreateDict(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/dict/deleteDictHandler.go b/app/system/api/internal/handler/dict/deleteDictHandler.go new file mode 100644 index 0000000..791035f --- /dev/null +++ b/app/system/api/internal/handler/dict/deleteDictHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package dict + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/dict" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除字典 +func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := dict.NewDeleteDictLogic(r.Context(), svcCtx) + err := l.DeleteDict(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/dict/getDictListHandler.go b/app/system/api/internal/handler/dict/getDictListHandler.go new file mode 100644 index 0000000..26849ff --- /dev/null +++ b/app/system/api/internal/handler/dict/getDictListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package dict + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/dict" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 字典列表 +func GetDictListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := dict.NewGetDictListLogic(r.Context(), svcCtx) + resp, err := l.GetDictList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/system/api/internal/handler/dict/updateDictHandler.go b/app/system/api/internal/handler/dict/updateDictHandler.go new file mode 100644 index 0000000..13a4a76 --- /dev/null +++ b/app/system/api/internal/handler/dict/updateDictHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package dict + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/dict" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新字典 +func UpdateDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := dict.NewUpdateDictLogic(r.Context(), svcCtx) + err := l.UpdateDict(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/menu/createMenuHandler.go b/app/system/api/internal/handler/menu/createMenuHandler.go new file mode 100644 index 0000000..74a667c --- /dev/null +++ b/app/system/api/internal/handler/menu/createMenuHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package menu + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/menu" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建菜单 +func CreateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MenuReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := menu.NewCreateMenuLogic(r.Context(), svcCtx) + err := l.CreateMenu(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/menu/deleteMenuHandler.go b/app/system/api/internal/handler/menu/deleteMenuHandler.go new file mode 100644 index 0000000..36325a6 --- /dev/null +++ b/app/system/api/internal/handler/menu/deleteMenuHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package menu + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/menu" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除菜单 +func DeleteMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := menu.NewDeleteMenuLogic(r.Context(), svcCtx) + err := l.DeleteMenu(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/menu/getMenuByRoleHandler.go b/app/system/api/internal/handler/menu/getMenuByRoleHandler.go new file mode 100644 index 0000000..2608b2d --- /dev/null +++ b/app/system/api/internal/handler/menu/getMenuByRoleHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package menu + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/menu" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 根据角色获取菜单 +func GetMenuByRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := menu.NewGetMenuByRoleLogic(r.Context(), svcCtx) + resp, err := l.GetMenuByRole(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/system/api/internal/handler/menu/getMenuListHandler.go b/app/system/api/internal/handler/menu/getMenuListHandler.go new file mode 100644 index 0000000..c6cea6b --- /dev/null +++ b/app/system/api/internal/handler/menu/getMenuListHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package menu + +import ( + "net/http" + + "sundynix-micro-go/app/system/api/internal/logic/menu" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 菜单列表(树形) +func GetMenuListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := menu.NewGetMenuListLogic(r.Context(), svcCtx) + resp, err := l.GetMenuList() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/system/api/internal/handler/menu/updateMenuHandler.go b/app/system/api/internal/handler/menu/updateMenuHandler.go new file mode 100644 index 0000000..a858a19 --- /dev/null +++ b/app/system/api/internal/handler/menu/updateMenuHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package menu + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/menu" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新菜单 +func UpdateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MenuUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := menu.NewUpdateMenuLogic(r.Context(), svcCtx) + err := l.UpdateMenu(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/operationRecord/deleteOperationRecordHandler.go b/app/system/api/internal/handler/operationRecord/deleteOperationRecordHandler.go new file mode 100644 index 0000000..64902a3 --- /dev/null +++ b/app/system/api/internal/handler/operationRecord/deleteOperationRecordHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package operationRecord + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/operationRecord" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除操作日志 +func DeleteOperationRecordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := operationRecord.NewDeleteOperationRecordLogic(r.Context(), svcCtx) + err := l.DeleteOperationRecord(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/operationRecord/getOperationRecordListHandler.go b/app/system/api/internal/handler/operationRecord/getOperationRecordListHandler.go new file mode 100644 index 0000000..4e31dd5 --- /dev/null +++ b/app/system/api/internal/handler/operationRecord/getOperationRecordListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package operationRecord + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + operationrecord "sundynix-micro-go/app/system/api/internal/logic/operationRecord" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 操作日志列表 +func GetOperationRecordListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.OperationRecordListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := operationrecord.NewGetOperationRecordListLogic(r.Context(), svcCtx) + resp, err := l.GetOperationRecordList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/system/api/internal/handler/role/createRoleHandler.go b/app/system/api/internal/handler/role/createRoleHandler.go new file mode 100644 index 0000000..3699650 --- /dev/null +++ b/app/system/api/internal/handler/role/createRoleHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package role + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/role" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 创建角色 +func CreateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RoleReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := role.NewCreateRoleLogic(r.Context(), svcCtx) + err := l.CreateRole(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/role/deleteRoleHandler.go b/app/system/api/internal/handler/role/deleteRoleHandler.go new file mode 100644 index 0000000..27313bc --- /dev/null +++ b/app/system/api/internal/handler/role/deleteRoleHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package role + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/role" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除角色 +func DeleteRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := role.NewDeleteRoleLogic(r.Context(), svcCtx) + err := l.DeleteRole(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/role/getRoleListHandler.go b/app/system/api/internal/handler/role/getRoleListHandler.go new file mode 100644 index 0000000..ab94f8e --- /dev/null +++ b/app/system/api/internal/handler/role/getRoleListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package role + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/role" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 角色列表 +func GetRoleListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RoleListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := role.NewGetRoleListLogic(r.Context(), svcCtx) + resp, err := l.GetRoleList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/system/api/internal/handler/role/updateRoleHandler.go b/app/system/api/internal/handler/role/updateRoleHandler.go new file mode 100644 index 0000000..cd2a592 --- /dev/null +++ b/app/system/api/internal/handler/role/updateRoleHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package role + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/system/api/internal/logic/role" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新角色 +func UpdateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RoleUpdateReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := role.NewUpdateRoleLogic(r.Context(), svcCtx) + err := l.UpdateRole(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/system/api/internal/handler/routes.go b/app/system/api/internal/handler/routes.go new file mode 100644 index 0000000..dfa0b61 --- /dev/null +++ b/app/system/api/internal/handler/routes.go @@ -0,0 +1,168 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package handler + +import ( + "net/http" + + client "sundynix-micro-go/app/system/api/internal/handler/client" + dict "sundynix-micro-go/app/system/api/internal/handler/dict" + menu "sundynix-micro-go/app/system/api/internal/handler/menu" + operationRecord "sundynix-micro-go/app/system/api/internal/handler/operationRecord" + role "sundynix-micro-go/app/system/api/internal/handler/role" + "sundynix-micro-go/app/system/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + // 创建客户端 + Method: http.MethodPost, + Path: "/client/create", + Handler: client.CreateClientHandler(serverCtx), + }, + { + // 删除客户端 + Method: http.MethodDelete, + Path: "/client/delete", + Handler: client.DeleteClientHandler(serverCtx), + }, + { + // 客户端列表 + Method: http.MethodPost, + Path: "/client/list", + Handler: client.GetClientListHandler(serverCtx), + }, + { + // 更新客户端 + Method: http.MethodPut, + Path: "/client/update", + Handler: client.UpdateClientHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/sys"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 创建字典 + Method: http.MethodPost, + Path: "/dict/create", + Handler: dict.CreateDictHandler(serverCtx), + }, + { + // 删除字典 + Method: http.MethodDelete, + Path: "/dict/delete", + Handler: dict.DeleteDictHandler(serverCtx), + }, + { + // 字典列表 + Method: http.MethodPost, + Path: "/dict/list", + Handler: dict.GetDictListHandler(serverCtx), + }, + { + // 更新字典 + Method: http.MethodPut, + Path: "/dict/update", + Handler: dict.UpdateDictHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/sys"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 根据角色获取菜单 + Method: http.MethodPost, + Path: "/menu/byRole", + Handler: menu.GetMenuByRoleHandler(serverCtx), + }, + { + // 创建菜单 + Method: http.MethodPost, + Path: "/menu/create", + Handler: menu.CreateMenuHandler(serverCtx), + }, + { + // 删除菜单 + Method: http.MethodDelete, + Path: "/menu/delete", + Handler: menu.DeleteMenuHandler(serverCtx), + }, + { + // 菜单列表(树形) + Method: http.MethodGet, + Path: "/menu/list", + Handler: menu.GetMenuListHandler(serverCtx), + }, + { + // 更新菜单 + Method: http.MethodPut, + Path: "/menu/update", + Handler: menu.UpdateMenuHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/sys"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 删除操作日志 + Method: http.MethodDelete, + Path: "/log/delete", + Handler: operationRecord.DeleteOperationRecordHandler(serverCtx), + }, + { + // 操作日志列表 + Method: http.MethodPost, + Path: "/log/list", + Handler: operationRecord.GetOperationRecordListHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/sys"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 创建角色 + Method: http.MethodPost, + Path: "/role/create", + Handler: role.CreateRoleHandler(serverCtx), + }, + { + // 删除角色 + Method: http.MethodDelete, + Path: "/role/delete", + Handler: role.DeleteRoleHandler(serverCtx), + }, + { + // 角色列表 + Method: http.MethodPost, + Path: "/role/list", + Handler: role.GetRoleListHandler(serverCtx), + }, + { + // 更新角色 + Method: http.MethodPut, + Path: "/role/update", + Handler: role.UpdateRoleHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/sys"), + ) +} diff --git a/app/system/api/internal/logic/client/createClientLogic.go b/app/system/api/internal/logic/client/createClientLogic.go new file mode 100644 index 0000000..9155694 --- /dev/null +++ b/app/system/api/internal/logic/client/createClientLogic.go @@ -0,0 +1,44 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateClientLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateClientLogic { + return &CreateClientLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CreateClientLogic) CreateClient(req *types.ClientReq) error { + client := sysModel.SundynixClient{ + ClientID: req.ClientId, + Name: req.Name, + GrantType: req.GrantType, + AdditionalInfo: req.AdditionalInfo, + ActiveTimeout: req.ActiveTimeout, + } + if err := l.svcCtx.DB.Create(&client).Error; err != nil { + l.Errorf("创建客户端失败: %v", err) + return fmt.Errorf("创建客户端失败") + } + return nil +} diff --git a/app/system/api/internal/logic/client/deleteClientLogic.go b/app/system/api/internal/logic/client/deleteClientLogic.go new file mode 100644 index 0000000..8dcd245 --- /dev/null +++ b/app/system/api/internal/logic/client/deleteClientLogic.go @@ -0,0 +1,37 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteClientLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteClientLogic { + return &DeleteClientLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteClientLogic) DeleteClient(req *types.IdsReq) error { + if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixClient{}).Error; err != nil { + l.Errorf("删除客户端失败: %v", err) + return fmt.Errorf("删除客户端失败") + } + return nil +} diff --git a/app/system/api/internal/logic/client/getClientListLogic.go b/app/system/api/internal/logic/client/getClientListLogic.go new file mode 100644 index 0000000..bdf0feb --- /dev/null +++ b/app/system/api/internal/logic/client/getClientListLogic.go @@ -0,0 +1,66 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetClientListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetClientListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClientListLogic { + return &GetClientListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetClientListLogic) GetClientList(req *types.ClientListReq) (resp interface{}, err error) { + var clients []sysModel.SundynixClient + var total int64 + + db := l.svcCtx.DB.Model(&sysModel.SundynixClient{}) + if req.Name != "" { + db = db.Where("name LIKE ?", "%"+req.Name+"%") + } + + if err := db.Count(&total).Error; err != nil { + l.Errorf("查询客户端总数失败: %v", err) + return nil, fmt.Errorf("查询失败") + } + + current := req.Current + pageSize := req.PageSize + if current <= 0 { + current = 1 + } + if pageSize <= 0 { + pageSize = 10 + } + + offset := (current - 1) * pageSize + if err := db.Offset(offset).Limit(pageSize).Find(&clients).Error; err != nil { + l.Errorf("查询客户端列表失败: %v", err) + return nil, fmt.Errorf("查询失败") + } + + return map[string]interface{}{ + "list": clients, + "total": total, + "current": current, + "size": pageSize, + }, nil +} diff --git a/app/system/api/internal/logic/client/updateClientLogic.go b/app/system/api/internal/logic/client/updateClientLogic.go new file mode 100644 index 0000000..5159531 --- /dev/null +++ b/app/system/api/internal/logic/client/updateClientLogic.go @@ -0,0 +1,54 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package client + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateClientLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateClientLogic { + return &UpdateClientLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateClientLogic) UpdateClient(req *types.ClientUpdateReq) error { + updates := map[string]interface{}{} + if req.ClientId != "" { + updates["client_id"] = req.ClientId + } + if req.Name != "" { + updates["name"] = req.Name + } + if req.GrantType != "" { + updates["grant_type"] = req.GrantType + } + if req.AdditionalInfo != "" { + updates["additional_info"] = req.AdditionalInfo + } + if req.ActiveTimeout > 0 { + updates["active_timeout"] = req.ActiveTimeout + } + + if err := l.svcCtx.DB.Model(&sysModel.SundynixClient{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil { + l.Errorf("更新客户端失败: %v", err) + return fmt.Errorf("更新客户端失败") + } + return nil +} diff --git a/app/system/api/internal/logic/dict/createDictLogic.go b/app/system/api/internal/logic/dict/createDictLogic.go new file mode 100644 index 0000000..5307ec4 --- /dev/null +++ b/app/system/api/internal/logic/dict/createDictLogic.go @@ -0,0 +1,29 @@ +// Code scaffolded by goctl. Safe to edit. +package dict + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type CreateDictLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateDictLogic { + return &CreateDictLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *CreateDictLogic) CreateDict(req *types.DictReq) error { + dict := sysModel.SundynixDict{Type: req.Type, Label: req.Label, Value: req.Value, Sort: req.Sort, Desc: req.Desc} + if err := l.svcCtx.DB.Create(&dict).Error; err != nil { + return fmt.Errorf("创建字典失败") + } + return nil +} diff --git a/app/system/api/internal/logic/dict/deleteDictLogic.go b/app/system/api/internal/logic/dict/deleteDictLogic.go new file mode 100644 index 0000000..675908b --- /dev/null +++ b/app/system/api/internal/logic/dict/deleteDictLogic.go @@ -0,0 +1,28 @@ +// Code scaffolded by goctl. Safe to edit. +package dict + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type DeleteDictLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteDictLogic { + return &DeleteDictLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *DeleteDictLogic) DeleteDict(req *types.IdsReq) error { + if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixDict{}).Error; err != nil { + return fmt.Errorf("删除字典失败") + } + return nil +} diff --git a/app/system/api/internal/logic/dict/getDictListLogic.go b/app/system/api/internal/logic/dict/getDictListLogic.go new file mode 100644 index 0000000..b13074c --- /dev/null +++ b/app/system/api/internal/logic/dict/getDictListLogic.go @@ -0,0 +1,42 @@ +// Code scaffolded by goctl. Safe to edit. +package dict + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type GetDictListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetDictListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDictListLogic { + return &GetDictListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetDictListLogic) GetDictList(req *types.DictListReq) (resp interface{}, err error) { + var dicts []sysModel.SundynixDict + var total int64 + db := l.svcCtx.DB.Model(&sysModel.SundynixDict{}) + if req.Type != "" { + db = db.Where("type = ?", req.Type) + } + db.Count(&total) + current, pageSize := req.Current, req.PageSize + if current <= 0 { + current = 1 + } + if pageSize <= 0 { + pageSize = 10 + } + if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("sort").Find(&dicts).Error; err != nil { + return nil, fmt.Errorf("查询字典列表失败") + } + return map[string]interface{}{"list": dicts, "total": total, "current": current, "size": pageSize}, nil +} diff --git a/app/system/api/internal/logic/dict/updateDictLogic.go b/app/system/api/internal/logic/dict/updateDictLogic.go new file mode 100644 index 0000000..6eb20e6 --- /dev/null +++ b/app/system/api/internal/logic/dict/updateDictLogic.go @@ -0,0 +1,46 @@ +// Code scaffolded by goctl. Safe to edit. +package dict + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type UpdateDictLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateDictLogic { + return &UpdateDictLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *UpdateDictLogic) UpdateDict(req *types.DictUpdateReq) error { + updates := map[string]interface{}{} + if req.Type != "" { + updates["type"] = req.Type + } + if req.Label != "" { + updates["label"] = req.Label + } + if req.Value != "" { + updates["value"] = req.Value + } + if req.Sort > 0 { + updates["sort"] = req.Sort + } + if req.Desc != "" { + updates["desc"] = req.Desc + } + if len(updates) > 0 { + if err := l.svcCtx.DB.Model(&sysModel.SundynixDict{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil { + return fmt.Errorf("更新字典失败") + } + } + return nil +} diff --git a/app/system/api/internal/logic/menu/createMenuLogic.go b/app/system/api/internal/logic/menu/createMenuLogic.go new file mode 100644 index 0000000..d2be937 --- /dev/null +++ b/app/system/api/internal/logic/menu/createMenuLogic.go @@ -0,0 +1,36 @@ +// Code scaffolded by goctl. Safe to edit. +package menu + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type CreateMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateMenuLogic { + return &CreateMenuLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *CreateMenuLogic) CreateMenu(req *types.MenuReq) error { + menu := sysModel.SundynixMenu{ + ParentID: req.ParentId, Category: req.Category, Name: req.Name, Title: req.Title, + Code: req.Code, Path: req.Path, Permission: req.Permission, Locale: req.Locale, + Icon: req.Icon, Sort: req.Sort, + } + if menu.ParentID == "" { + menu.ParentID = "0" + } + if err := l.svcCtx.DB.Create(&menu).Error; err != nil { + return fmt.Errorf("创建菜单失败") + } + return nil +} diff --git a/app/system/api/internal/logic/menu/deleteMenuLogic.go b/app/system/api/internal/logic/menu/deleteMenuLogic.go new file mode 100644 index 0000000..309caa4 --- /dev/null +++ b/app/system/api/internal/logic/menu/deleteMenuLogic.go @@ -0,0 +1,28 @@ +// Code scaffolded by goctl. Safe to edit. +package menu + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type DeleteMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteMenuLogic { + return &DeleteMenuLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *DeleteMenuLogic) DeleteMenu(req *types.IdsReq) error { + if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixMenu{}).Error; err != nil { + return fmt.Errorf("删除菜单失败") + } + return nil +} diff --git a/app/system/api/internal/logic/menu/getMenuByRoleLogic.go b/app/system/api/internal/logic/menu/getMenuByRoleLogic.go new file mode 100644 index 0000000..d4cd0e8 --- /dev/null +++ b/app/system/api/internal/logic/menu/getMenuByRoleLogic.go @@ -0,0 +1,29 @@ +// Code scaffolded by goctl. Safe to edit. +package menu + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type GetMenuByRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetMenuByRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenuByRoleLogic { + return &GetMenuByRoleLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetMenuByRoleLogic) GetMenuByRole(req *types.IdReq) (resp interface{}, err error) { + var role sysModel.SundynixRole + if err := l.svcCtx.DB.Preload("Menus").Where("id = ?", req.Id).First(&role).Error; err != nil { + return nil, fmt.Errorf("查询角色菜单失败") + } + return role.Menus, nil +} diff --git a/app/system/api/internal/logic/menu/getMenuListLogic.go b/app/system/api/internal/logic/menu/getMenuListLogic.go new file mode 100644 index 0000000..c8ca0e2 --- /dev/null +++ b/app/system/api/internal/logic/menu/getMenuListLogic.go @@ -0,0 +1,44 @@ +// Code scaffolded by goctl. Safe to edit. +package menu + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + sysModel "sundynix-micro-go/app/system/model" +) + +type GetMenuListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetMenuListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenuListLogic { + return &GetMenuListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetMenuListLogic) GetMenuList() (resp interface{}, err error) { + var menus []sysModel.SundynixMenu + if err := l.svcCtx.DB.Order("sort").Find(&menus).Error; err != nil { + return nil, fmt.Errorf("查询菜单列表失败") + } + // 构建树形结构 + menuMap := make(map[string]*sysModel.SundynixMenu) + for i := range menus { + menus[i].Children = []*sysModel.SundynixMenu{} + menuMap[menus[i].ID] = &menus[i] + } + var tree []*sysModel.SundynixMenu + for _, m := range menuMap { + if m.ParentID == "0" || m.ParentID == "" { + tree = append(tree, m) + } else if parent, ok := menuMap[m.ParentID]; ok { + parent.Children = append(parent.Children, m) + } else { + tree = append(tree, m) + } + } + return tree, nil +} diff --git a/app/system/api/internal/logic/menu/updateMenuLogic.go b/app/system/api/internal/logic/menu/updateMenuLogic.go new file mode 100644 index 0000000..0a1d3bd --- /dev/null +++ b/app/system/api/internal/logic/menu/updateMenuLogic.go @@ -0,0 +1,61 @@ +// Code scaffolded by goctl. Safe to edit. +package menu + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type UpdateMenuLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateMenuLogic { + return &UpdateMenuLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *UpdateMenuLogic) UpdateMenu(req *types.MenuUpdateReq) error { + updates := map[string]interface{}{} + if req.ParentId != "" { + updates["parent_id"] = req.ParentId + } + if req.Name != "" { + updates["name"] = req.Name + } + if req.Title != "" { + updates["title"] = req.Title + } + if req.Code != "" { + updates["code"] = req.Code + } + if req.Path != "" { + updates["path"] = req.Path + } + if req.Permission != "" { + updates["permission"] = req.Permission + } + if req.Locale != "" { + updates["locale"] = req.Locale + } + if req.Icon != "" { + updates["icon"] = req.Icon + } + if req.Sort > 0 { + updates["sort"] = req.Sort + } + if req.Category > 0 { + updates["category"] = req.Category + } + if len(updates) > 0 { + if err := l.svcCtx.DB.Model(&sysModel.SundynixMenu{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil { + return fmt.Errorf("更新菜单失败") + } + } + return nil +} diff --git a/app/system/api/internal/logic/operationRecord/deleteOperationRecordLogic.go b/app/system/api/internal/logic/operationRecord/deleteOperationRecordLogic.go new file mode 100644 index 0000000..0cb1b09 --- /dev/null +++ b/app/system/api/internal/logic/operationRecord/deleteOperationRecordLogic.go @@ -0,0 +1,28 @@ +// Code scaffolded by goctl. Safe to edit. +package operationRecord + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type DeleteOperationRecordLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteOperationRecordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteOperationRecordLogic { + return &DeleteOperationRecordLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *DeleteOperationRecordLogic) DeleteOperationRecord(req *types.IdsReq) error { + if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixOperationRecord{}).Error; err != nil { + return fmt.Errorf("删除操作日志失败") + } + return nil +} diff --git a/app/system/api/internal/logic/operationRecord/getOperationRecordListLogic.go b/app/system/api/internal/logic/operationRecord/getOperationRecordListLogic.go new file mode 100644 index 0000000..305a809 --- /dev/null +++ b/app/system/api/internal/logic/operationRecord/getOperationRecordListLogic.go @@ -0,0 +1,48 @@ +// Code scaffolded by goctl. Safe to edit. +package operationRecord + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type GetOperationRecordListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetOperationRecordListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetOperationRecordListLogic { + return &GetOperationRecordListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetOperationRecordListLogic) GetOperationRecordList(req *types.OperationRecordListReq) (resp interface{}, err error) { + var records []sysModel.SundynixOperationRecord + var total int64 + db := l.svcCtx.DB.Model(&sysModel.SundynixOperationRecord{}) + if req.Method != "" { + db = db.Where("method = ?", req.Method) + } + if req.Path != "" { + db = db.Where("path LIKE ?", "%"+req.Path+"%") + } + if req.Status > 0 { + db = db.Where("status = ?", req.Status) + } + db.Count(&total) + current, pageSize := req.Current, req.PageSize + if current <= 0 { + current = 1 + } + if pageSize <= 0 { + pageSize = 10 + } + if err := db.Offset((current - 1) * pageSize).Limit(pageSize).Order("created_at DESC").Find(&records).Error; err != nil { + return nil, fmt.Errorf("查询操作日志失败") + } + return map[string]interface{}{"list": records, "total": total, "current": current, "size": pageSize}, nil +} diff --git a/app/system/api/internal/logic/role/createRoleLogic.go b/app/system/api/internal/logic/role/createRoleLogic.go new file mode 100644 index 0000000..32335e4 --- /dev/null +++ b/app/system/api/internal/logic/role/createRoleLogic.go @@ -0,0 +1,39 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package role + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CreateRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCreateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateRoleLogic { + return &CreateRoleLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *CreateRoleLogic) CreateRole(req *types.RoleReq) error { + role := sysModel.SundynixRole{Name: req.Name, Code: req.Code, Sort: req.Sort} + if err := l.svcCtx.DB.Create(&role).Error; err != nil { + return fmt.Errorf("创建角色失败") + } + // 关联菜单 + if len(req.MenuIds) > 0 { + for _, menuID := range req.MenuIds { + l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: role.ID, MenuID: menuID}) + } + } + return nil +} diff --git a/app/system/api/internal/logic/role/deleteRoleLogic.go b/app/system/api/internal/logic/role/deleteRoleLogic.go new file mode 100644 index 0000000..6f765e9 --- /dev/null +++ b/app/system/api/internal/logic/role/deleteRoleLogic.go @@ -0,0 +1,30 @@ +// Code scaffolded by goctl. Safe to edit. +package role + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type DeleteRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewDeleteRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteRoleLogic { + return &DeleteRoleLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *DeleteRoleLogic) DeleteRole(req *types.IdsReq) error { + if err := l.svcCtx.DB.Where("id IN ?", req.Ids).Delete(&sysModel.SundynixRole{}).Error; err != nil { + return fmt.Errorf("删除角色失败") + } + // 清理角色菜单关联 + l.svcCtx.DB.Where("role_id IN ?", req.Ids).Delete(&sysModel.SundynixRoleMenu{}) + return nil +} diff --git a/app/system/api/internal/logic/role/getRoleListLogic.go b/app/system/api/internal/logic/role/getRoleListLogic.go new file mode 100644 index 0000000..2a834b0 --- /dev/null +++ b/app/system/api/internal/logic/role/getRoleListLogic.go @@ -0,0 +1,42 @@ +// Code scaffolded by goctl. Safe to edit. +package role + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type GetRoleListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetRoleListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRoleListLogic { + return &GetRoleListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *GetRoleListLogic) GetRoleList(req *types.RoleListReq) (resp interface{}, err error) { + var roles []sysModel.SundynixRole + var total int64 + db := l.svcCtx.DB.Model(&sysModel.SundynixRole{}) + if req.Name != "" { + db = db.Where("name LIKE ?", "%"+req.Name+"%") + } + db.Count(&total) + current, pageSize := req.Current, req.PageSize + if current <= 0 { + current = 1 + } + if pageSize <= 0 { + pageSize = 10 + } + if err := db.Preload("Menus").Offset((current - 1) * pageSize).Limit(pageSize).Order("sort").Find(&roles).Error; err != nil { + return nil, fmt.Errorf("查询角色列表失败") + } + return map[string]interface{}{"list": roles, "total": total, "current": current, "size": pageSize}, nil +} diff --git a/app/system/api/internal/logic/role/updateRoleLogic.go b/app/system/api/internal/logic/role/updateRoleLogic.go new file mode 100644 index 0000000..210ec13 --- /dev/null +++ b/app/system/api/internal/logic/role/updateRoleLogic.go @@ -0,0 +1,47 @@ +// Code scaffolded by goctl. Safe to edit. +package role + +import ( + "context" + "fmt" + "github.com/zeromicro/go-zero/core/logx" + "sundynix-micro-go/app/system/api/internal/svc" + "sundynix-micro-go/app/system/api/internal/types" + sysModel "sundynix-micro-go/app/system/model" +) + +type UpdateRoleLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateRoleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateRoleLogic { + return &UpdateRoleLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} +} + +func (l *UpdateRoleLogic) UpdateRole(req *types.RoleUpdateReq) error { + updates := map[string]interface{}{} + if req.Name != "" { + updates["name"] = req.Name + } + if req.Code != "" { + updates["code"] = req.Code + } + if req.Sort > 0 { + updates["sort"] = req.Sort + } + if len(updates) > 0 { + if err := l.svcCtx.DB.Model(&sysModel.SundynixRole{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil { + return fmt.Errorf("更新角色失败") + } + } + // 更新菜单关联 + if len(req.MenuIds) > 0 { + l.svcCtx.DB.Where("role_id = ?", req.Id).Delete(&sysModel.SundynixRoleMenu{}) + for _, menuID := range req.MenuIds { + l.svcCtx.DB.Create(&sysModel.SundynixRoleMenu{RoleID: req.Id, MenuID: menuID}) + } + } + return nil +} diff --git a/app/system/api/internal/svc/serviceContext.go b/app/system/api/internal/svc/serviceContext.go new file mode 100644 index 0000000..6cc2d5d --- /dev/null +++ b/app/system/api/internal/svc/serviceContext.go @@ -0,0 +1,30 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package svc + +import ( + "sundynix-micro-go/app/system/api/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 { + db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) + if err != nil { + logx.Errorf("连接数据库失败: %v", err) + panic(err) + } + + return &ServiceContext{ + Config: c, + DB: db, + } +} diff --git a/app/system/api/internal/types/types.go b/app/system/api/internal/types/types.go new file mode 100644 index 0000000..7a06b5a --- /dev/null +++ b/app/system/api/internal/types/types.go @@ -0,0 +1,120 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package types + +type ClientListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` +} + +type ClientReq struct { + ClientId string `json:"clientId"` + Name string `json:"name"` + GrantType string `json:"grantType,optional"` + AdditionalInfo string `json:"additionalInfo,optional"` + ActiveTimeout int64 `json:"activeTimeout,optional"` +} + +type ClientUpdateReq struct { + Id string `json:"id"` + ClientId string `json:"clientId,optional"` + Name string `json:"name,optional"` + GrantType string `json:"grantType,optional"` + AdditionalInfo string `json:"additionalInfo,optional"` + ActiveTimeout int64 `json:"activeTimeout,optional"` +} + +type DictListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Type string `json:"type,optional"` +} + +type DictReq struct { + Type string `json:"type"` + Label string `json:"label"` + Value string `json:"value"` + Sort int `json:"sort,optional"` + Desc string `json:"desc,optional"` +} + +type DictUpdateReq struct { + Id string `json:"id"` + Type string `json:"type,optional"` + Label string `json:"label,optional"` + Value string `json:"value,optional"` + Sort int `json:"sort,optional"` + Desc string `json:"desc,optional"` +} + +type IdReq struct { + Id string `json:"id"` +} + +type IdsReq struct { + Ids []string `json:"ids"` +} + +type MenuReq struct { + ParentId string `json:"parentId,optional"` + Category int `json:"category,optional"` + Name string `json:"name"` + Title string `json:"title,optional"` + Code string `json:"code,optional"` + Path string `json:"path,optional"` + Permission string `json:"permission,optional"` + Locale string `json:"locale,optional"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` +} + +type MenuUpdateReq struct { + Id string `json:"id"` + ParentId string `json:"parentId,optional"` + Category int `json:"category,optional"` + Name string `json:"name,optional"` + Title string `json:"title,optional"` + Code string `json:"code,optional"` + Path string `json:"path,optional"` + Permission string `json:"permission,optional"` + Locale string `json:"locale,optional"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` +} + +type OperationRecordListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Method string `json:"method,optional"` + Path string `json:"path,optional"` + Status int `json:"status,optional"` +} + +type PageReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Keyword string `json:"keyword,optional"` +} + +type RoleListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` +} + +type RoleReq struct { + Name string `json:"name"` + Code string `json:"code"` + Sort int `json:"sort,optional"` + MenuIds []string `json:"menuIds,optional"` +} + +type RoleUpdateReq struct { + Id string `json:"id"` + Name string `json:"name,optional"` + Code string `json:"code,optional"` + Sort int `json:"sort,optional"` + MenuIds []string `json:"menuIds,optional"` +} diff --git a/app/system/api/system.api b/app/system/api/system.api new file mode 100644 index 0000000..35fd4c4 --- /dev/null +++ b/app/system/api/system.api @@ -0,0 +1,231 @@ +syntax = "v1" + +info ( + title: "系统服务API" + desc: "客户端管理、角色管理、菜单管理、操作日志等HTTP接口" + author: "sundynix" + version: "v1.0.0" +) + +type ( + // ---------- 通用 ---------- + IdReq { + Id string `json:"id"` + } + IdsReq { + Ids []string `json:"ids"` + } + PageReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Keyword string `json:"keyword,optional"` + } + // ---------- 客户端 ---------- + ClientReq { + ClientId string `json:"clientId"` + Name string `json:"name"` + GrantType string `json:"grantType,optional"` + AdditionalInfo string `json:"additionalInfo,optional"` + ActiveTimeout int64 `json:"activeTimeout,optional"` + } + ClientUpdateReq { + Id string `json:"id"` + ClientId string `json:"clientId,optional"` + Name string `json:"name,optional"` + GrantType string `json:"grantType,optional"` + AdditionalInfo string `json:"additionalInfo,optional"` + ActiveTimeout int64 `json:"activeTimeout,optional"` + } + ClientListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + } + // ---------- 角色 ---------- + RoleReq { + Name string `json:"name"` + Code string `json:"code"` + Sort int `json:"sort,optional"` + MenuIds []string `json:"menuIds,optional"` + } + RoleUpdateReq { + Id string `json:"id"` + Name string `json:"name,optional"` + Code string `json:"code,optional"` + Sort int `json:"sort,optional"` + MenuIds []string `json:"menuIds,optional"` + } + RoleListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Name string `json:"name,optional"` + } + // ---------- 菜单 ---------- + MenuReq { + ParentId string `json:"parentId,optional"` + Category int `json:"category,optional"` + Name string `json:"name"` + Title string `json:"title,optional"` + Code string `json:"code,optional"` + Path string `json:"path,optional"` + Permission string `json:"permission,optional"` + Locale string `json:"locale,optional"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` + } + MenuUpdateReq { + Id string `json:"id"` + ParentId string `json:"parentId,optional"` + Category int `json:"category,optional"` + Name string `json:"name,optional"` + Title string `json:"title,optional"` + Code string `json:"code,optional"` + Path string `json:"path,optional"` + Permission string `json:"permission,optional"` + Locale string `json:"locale,optional"` + Icon string `json:"icon,optional"` + Sort int `json:"sort,optional"` + } + // ---------- 操作日志 ---------- + OperationRecordListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Method string `json:"method,optional"` + Path string `json:"path,optional"` + Status int `json:"status,optional"` + } + // ---------- 字典 ---------- + DictReq { + Type string `json:"type"` + Label string `json:"label"` + Value string `json:"value"` + Sort int `json:"sort,optional"` + Desc string `json:"desc,optional"` + } + DictUpdateReq { + Id string `json:"id"` + Type string `json:"type,optional"` + Label string `json:"label,optional"` + Value string `json:"value,optional"` + Sort int `json:"sort,optional"` + Desc string `json:"desc,optional"` + } + DictListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Type string `json:"type,optional"` + } +) + +// ========== 需要鉴权的接口 ========== +@server ( + prefix: /api/sys + group: client + jwt: Auth +) +service system-api { + @doc "创建客户端" + @handler CreateClient + post /client/create (ClientReq) + + @doc "更新客户端" + @handler UpdateClient + put /client/update (ClientUpdateReq) + + @doc "删除客户端" + @handler DeleteClient + delete /client/delete (IdsReq) + + @doc "客户端列表" + @handler GetClientList + post /client/list (ClientListReq) +} + +@server ( + prefix: /api/sys + group: role + jwt: Auth +) +service system-api { + @doc "创建角色" + @handler CreateRole + post /role/create (RoleReq) + + @doc "更新角色" + @handler UpdateRole + put /role/update (RoleUpdateReq) + + @doc "删除角色" + @handler DeleteRole + delete /role/delete (IdsReq) + + @doc "角色列表" + @handler GetRoleList + post /role/list (RoleListReq) +} + +@server ( + prefix: /api/sys + group: menu + jwt: Auth +) +service system-api { + @doc "创建菜单" + @handler CreateMenu + post /menu/create (MenuReq) + + @doc "更新菜单" + @handler UpdateMenu + put /menu/update (MenuUpdateReq) + + @doc "删除菜单" + @handler DeleteMenu + delete /menu/delete (IdsReq) + + @doc "菜单列表(树形)" + @handler GetMenuList + get /menu/list + + @doc "根据角色获取菜单" + @handler GetMenuByRole + post /menu/byRole (IdReq) +} + +@server ( + prefix: /api/sys + group: operationRecord + jwt: Auth +) +service system-api { + @doc "操作日志列表" + @handler GetOperationRecordList + post /log/list (OperationRecordListReq) + + @doc "删除操作日志" + @handler DeleteOperationRecord + delete /log/delete (IdsReq) +} + +@server ( + prefix: /api/sys + group: dict + jwt: Auth +) +service system-api { + @doc "创建字典" + @handler CreateDict + post /dict/create (DictReq) + + @doc "更新字典" + @handler UpdateDict + put /dict/update (DictUpdateReq) + + @doc "删除字典" + @handler DeleteDict + delete /dict/delete (IdsReq) + + @doc "字典列表" + @handler GetDictList + post /dict/list (DictListReq) +} + diff --git a/app/system/api/system.go b/app/system/api/system.go new file mode 100644 index 0000000..52ac1b9 --- /dev/null +++ b/app/system/api/system.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/system/api/internal/config" + "sundynix-micro-go/app/system/api/internal/handler" + "sundynix-micro-go/app/system/api/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/rest" +) + +var configFile = flag.String("f", "etc/system-api.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + server := rest.MustNewServer(c.RestConf) + defer server.Stop() + + ctx := svc.NewServiceContext(c) + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/app/system/model/system_model.go b/app/system/model/system_model.go new file mode 100644 index 0000000..8b56013 --- /dev/null +++ b/app/system/model/system_model.go @@ -0,0 +1,106 @@ +package model + +import ( + "sundynix-micro-go/common/model" + "time" +) + +// SundynixClient 客户端表 +type SundynixClient struct { + model.BaseModel + ClientID string `gorm:"size:20;column:client_id" json:"clientId"` + Name string `gorm:"size:50;column:name" json:"name"` + GrantType string `gorm:"size:50;column:grant_type" json:"grantType"` + AdditionalInfo string `gorm:"type:text;column:additional_info" json:"additionalInfo"` + ActiveTimeout int64 `gorm:"column:active_timeout" json:"activeTimeout"` +} + +func (SundynixClient) TableName() string { + return "sundynix_client" +} + +// SundynixRole 角色表 +type SundynixRole struct { + model.BaseModel + Name string `gorm:"size:20;column:name" json:"name"` + Code string `gorm:"size:20;column:code" json:"code"` + Sort int `gorm:"column:sort" json:"sort"` + Menus []*SundynixMenu `gorm:"many2many:sundynix_role_menu;" json:"menus"` +} + +func (SundynixRole) TableName() string { + return "sundynix_role" +} + +// SundynixMenu 菜单表 +type SundynixMenu struct { + model.BaseModel + ParentID string `gorm:"size:100;default:'0';column:parent_id" json:"parentId"` + Category int `gorm:"column:category" json:"category"` + Name string `gorm:"size:20;column:name" json:"name"` + Title string `gorm:"size:20;column:title" json:"title"` + Code string `gorm:"size:50;column:code" json:"code"` + Path string `gorm:"size:100;column:path" json:"path"` + Permission string `gorm:"size:20;column:permission" json:"permission"` + Locale string `gorm:"size:50;column:locale" json:"locale"` + Icon string `gorm:"size:20;column:icon" json:"icon"` + Sort int `gorm:"column:sort" json:"sort"` + Children []*SundynixMenu `gorm:"-" json:"children"` +} + +func (SundynixMenu) TableName() string { + return "sundynix_menu" +} + +// SundynixRoleMenu 角色菜单关联表 +type SundynixRoleMenu struct { + RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"` + MenuID string `gorm:"size:50;primaryKey;column:menu_id" json:"menuId"` +} + +func (SundynixRoleMenu) TableName() string { + return "sundynix_role_menu" +} + +// SundynixUserRole 用户角色关联表 +type SundynixUserRole struct { + UserID string `gorm:"size:50;primaryKey;column:user_id" json:"userId"` + RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"` +} + +func (SundynixUserRole) TableName() string { + return "sundynix_user_role" +} + +// SundynixOperationRecord 操作记录表 +type SundynixOperationRecord struct { + model.BaseModel + IP string `gorm:"column:ip;comment:请求ip" json:"ip"` + Method string `gorm:"column:method;comment:请求方法" json:"method"` + Path string `gorm:"column:path;comment:请求路径" json:"path"` + Status int `gorm:"column:status;comment:请求状态" json:"status"` + Latency time.Duration `gorm:"column:latency;comment:延迟" json:"latency"` + Agent string `gorm:"type:text;column:agent;comment:代理" json:"agent"` + ErrorMessage string `gorm:"column:error_message;comment:错误信息" json:"errorMessage"` + Body string `gorm:"type:text;column:body;comment:请求Body" json:"body"` + Resp string `gorm:"type:text;column:resp;comment:响应Body" json:"resp"` + UserID string `gorm:"column:user_id;comment:用户id" json:"userId"` +} + +func (SundynixOperationRecord) TableName() string { + return "sundynix_operation_record" +} + +// SundynixDict 字典表(新增) +type SundynixDict struct { + model.BaseModel + Type string `gorm:"size:50;column:type;comment:字典类型" json:"type"` + Label string `gorm:"size:100;column:label;comment:字典标签" json:"label"` + Value string `gorm:"size:100;column:value;comment:字典值" json:"value"` + Sort int `gorm:"column:sort;default:0;comment:排序" json:"sort"` + Desc string `gorm:"size:200;column:desc;comment:描述" json:"desc"` +} + +func (SundynixDict) TableName() string { + return "sundynix_dict" +} diff --git a/app/system/rpc/etc/system.yaml b/app/system/rpc/etc/system.yaml new file mode 100644 index 0000000..61d78e0 --- /dev/null +++ b/app/system/rpc/etc/system.yaml @@ -0,0 +1,10 @@ +Name: system.rpc +ListenOn: 0.0.0.0:9103 +Etcd: + Hosts: + - 192.168.100.127:2379 + Key: system.rpc + +# MySQL +DB: + DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local diff --git a/app/system/rpc/internal/config/config.go b/app/system/rpc/internal/config/config.go new file mode 100755 index 0000000..897b703 --- /dev/null +++ b/app/system/rpc/internal/config/config.go @@ -0,0 +1,10 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf + DB struct { + DataSource string + } +} diff --git a/app/system/rpc/internal/logic/getClientByIdLogic.go b/app/system/rpc/internal/logic/getClientByIdLogic.go new file mode 100644 index 0000000..d3ba39c --- /dev/null +++ b/app/system/rpc/internal/logic/getClientByIdLogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type GetClientByIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetClientByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClientByIdLogic { + return &GetClientByIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 获取客户端信息 +func (l *GetClientByIdLogic) GetClientById(in *system.GetClientByIdReq) (*system.GetClientByIdResp, error) { + var client sysModel.SundynixClient + err := l.svcCtx.DB.Where("client_id = ?", in.ClientId).First(&client).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return nil, status.Error(codes.NotFound, "客户端不存在") + } + l.Errorf("查询客户端失败: %v", err) + return nil, status.Error(codes.Internal, "查询客户端失败") + } + + return &system.GetClientByIdResp{ + Client: &system.ClientInfo{ + Id: client.ID, + ClientId: client.ClientID, + Name: client.Name, + GrantType: client.GrantType, + AdditionalInfo: client.AdditionalInfo, + ActiveTimeout: client.ActiveTimeout, + }, + }, nil +} diff --git a/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go b/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go new file mode 100644 index 0000000..e64cca7 --- /dev/null +++ b/app/system/rpc/internal/logic/getMenusByRoleIdLogic.go @@ -0,0 +1,89 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetMenusByRoleIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetMenusByRoleIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMenusByRoleIdLogic { + return &GetMenusByRoleIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 获取角色菜单列表 +func (l *GetMenusByRoleIdLogic) GetMenusByRoleId(in *system.GetMenusByRoleIdReq) (*system.GetMenusByRoleIdResp, error) { + // 查询角色菜单关联 + var roleMenus []sysModel.SundynixRoleMenu + if err := l.svcCtx.DB.Where("role_id = ?", in.RoleId).Find(&roleMenus).Error; err != nil { + l.Errorf("查询角色菜单失败: %v", err) + return nil, status.Error(codes.Internal, "查询角色菜单失败") + } + + if len(roleMenus) == 0 { + return &system.GetMenusByRoleIdResp{Menus: []*system.MenuInfo{}}, nil + } + + menuIds := make([]string, 0, len(roleMenus)) + for _, rm := range roleMenus { + menuIds = append(menuIds, rm.MenuID) + } + + // 查询菜单信息 + var menus []sysModel.SundynixMenu + if err := l.svcCtx.DB.Where("id IN ?", menuIds).Order("sort").Find(&menus).Error; err != nil { + l.Errorf("查询菜单信息失败: %v", err) + return nil, status.Error(codes.Internal, "查询菜单信息失败") + } + + // 构建树形结构 + menuMap := make(map[string]*system.MenuInfo) + var rootMenus []*system.MenuInfo + + for _, m := range menus { + menuInfo := &system.MenuInfo{ + Id: m.ID, + ParentId: m.ParentID, + Category: int32(m.Category), + Name: m.Name, + Title: m.Title, + Code: m.Code, + Path: m.Path, + Permission: m.Permission, + Locale: m.Locale, + Icon: m.Icon, + Sort: int32(m.Sort), + Children: []*system.MenuInfo{}, + } + menuMap[m.ID] = menuInfo + } + + for _, menuInfo := range menuMap { + if menuInfo.ParentId == "0" || menuInfo.ParentId == "" { + rootMenus = append(rootMenus, menuInfo) + } else { + if parent, ok := menuMap[menuInfo.ParentId]; ok { + parent.Children = append(parent.Children, menuInfo) + } else { + rootMenus = append(rootMenus, menuInfo) + } + } + } + + return &system.GetMenusByRoleIdResp{Menus: rootMenus}, nil +} diff --git a/app/system/rpc/internal/logic/getRolesByUserIdLogic.go b/app/system/rpc/internal/logic/getRolesByUserIdLogic.go new file mode 100644 index 0000000..189ccf6 --- /dev/null +++ b/app/system/rpc/internal/logic/getRolesByUserIdLogic.go @@ -0,0 +1,64 @@ +package logic + +import ( + "context" + + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type GetRolesByUserIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetRolesByUserIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRolesByUserIdLogic { + return &GetRolesByUserIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 获取用户角色列表 +func (l *GetRolesByUserIdLogic) GetRolesByUserId(in *system.GetRolesByUserIdReq) (*system.GetRolesByUserIdResp, error) { + // 查询用户角色关联 + var userRoles []sysModel.SundynixUserRole + if err := l.svcCtx.DB.Where("user_id = ?", in.UserId).Find(&userRoles).Error; err != nil { + l.Errorf("查询用户角色失败: %v", err) + return nil, status.Error(codes.Internal, "查询用户角色失败") + } + + if len(userRoles) == 0 { + return &system.GetRolesByUserIdResp{Roles: []*system.RoleInfo{}}, nil + } + + roleIds := make([]string, 0, len(userRoles)) + for _, ur := range userRoles { + roleIds = append(roleIds, ur.RoleID) + } + + var roles []sysModel.SundynixRole + if err := l.svcCtx.DB.Where("id IN ?", roleIds).Find(&roles).Error; err != nil { + l.Errorf("查询角色信息失败: %v", err) + return nil, status.Error(codes.Internal, "查询角色信息失败") + } + + roleInfos := make([]*system.RoleInfo, 0, len(roles)) + for _, r := range roles { + roleInfos = append(roleInfos, &system.RoleInfo{ + Id: r.ID, + Name: r.Name, + Code: r.Code, + Sort: int32(r.Sort), + }) + } + + return &system.GetRolesByUserIdResp{Roles: roleInfos}, nil +} diff --git a/app/system/rpc/internal/server/systemServiceServer.go b/app/system/rpc/internal/server/systemServiceServer.go new file mode 100644 index 0000000..d183580 --- /dev/null +++ b/app/system/rpc/internal/server/systemServiceServer.go @@ -0,0 +1,42 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: system.proto + +package server + +import ( + "context" + + "sundynix-micro-go/app/system/rpc/internal/logic" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" +) + +type SystemServiceServer struct { + svcCtx *svc.ServiceContext + system.UnimplementedSystemServiceServer +} + +func NewSystemServiceServer(svcCtx *svc.ServiceContext) *SystemServiceServer { + return &SystemServiceServer{ + svcCtx: svcCtx, + } +} + +// 获取用户角色列表 +func (s *SystemServiceServer) GetRolesByUserId(ctx context.Context, in *system.GetRolesByUserIdReq) (*system.GetRolesByUserIdResp, error) { + l := logic.NewGetRolesByUserIdLogic(ctx, s.svcCtx) + return l.GetRolesByUserId(in) +} + +// 获取角色菜单列表 +func (s *SystemServiceServer) GetMenusByRoleId(ctx context.Context, in *system.GetMenusByRoleIdReq) (*system.GetMenusByRoleIdResp, error) { + l := logic.NewGetMenusByRoleIdLogic(ctx, s.svcCtx) + return l.GetMenusByRoleId(in) +} + +// 获取客户端信息 +func (s *SystemServiceServer) GetClientById(ctx context.Context, in *system.GetClientByIdReq) (*system.GetClientByIdResp, error) { + l := logic.NewGetClientByIdLogic(ctx, s.svcCtx) + return l.GetClientById(in) +} diff --git a/app/system/rpc/internal/svc/serviceContext.go b/app/system/rpc/internal/svc/serviceContext.go new file mode 100644 index 0000000..d1e7a94 --- /dev/null +++ b/app/system/rpc/internal/svc/serviceContext.go @@ -0,0 +1,40 @@ +package svc + +import ( + sysModel "sundynix-micro-go/app/system/model" + "sundynix-micro-go/app/system/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 { + db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) + if err != nil { + logx.Errorf("连接数据库失败: %v", err) + panic(err) + } + + // 自动迁移 + if err := db.AutoMigrate( + &sysModel.SundynixClient{}, + &sysModel.SundynixRole{}, + &sysModel.SundynixMenu{}, + &sysModel.SundynixRoleMenu{}, + &sysModel.SundynixOperationRecord{}, + &sysModel.SundynixDict{}, + ); err != nil { + logx.Errorf("数据库迁移失败: %v", err) + } + + return &ServiceContext{ + Config: c, + DB: db, + } +} diff --git a/app/system/rpc/pb/system.proto b/app/system/rpc/pb/system.proto new file mode 100644 index 0000000..18c9c06 --- /dev/null +++ b/app/system/rpc/pb/system.proto @@ -0,0 +1,86 @@ +syntax = "proto3"; + +package system; + +option go_package = "./system"; + +// ---------- 通用消息 ---------- + +message CommonResp { + int64 code = 1; + string msg = 2; +} + +// ---------- 角色信息 ---------- + +message RoleInfo { + string id = 1; + string name = 2; + string code = 3; + int32 sort = 4; +} + +// ---------- 菜单信息 ---------- + +message MenuInfo { + string id = 1; + string parentId = 2; + int32 category = 3; + string name = 4; + string title = 5; + string code = 6; + string path = 7; + string permission = 8; + string locale = 9; + string icon = 10; + int32 sort = 11; + repeated MenuInfo children = 12; +} + +// ---------- 客户端信息 ---------- + +message ClientInfo { + string id = 1; + string clientId = 2; + string name = 3; + string grantType = 4; + string additionalInfo = 5; + int64 activeTimeout = 6; +} + +// ---------- 请求/响应 ---------- + +message GetRolesByUserIdReq { + string userId = 1; +} + +message GetRolesByUserIdResp { + repeated RoleInfo roles = 1; +} + +message GetMenusByRoleIdReq { + string roleId = 1; +} + +message GetMenusByRoleIdResp { + repeated MenuInfo menus = 1; +} + +message GetClientByIdReq { + string clientId = 1; +} + +message GetClientByIdResp { + ClientInfo client = 1; +} + +// ---------- 服务定义 ---------- + +service SystemService { + // 获取用户角色列表 + rpc GetRolesByUserId(GetRolesByUserIdReq) returns (GetRolesByUserIdResp); + // 获取角色菜单列表 + rpc GetMenusByRoleId(GetMenusByRoleIdReq) returns (GetMenusByRoleIdResp); + // 获取客户端信息 + rpc GetClientById(GetClientByIdReq) returns (GetClientByIdResp); +} diff --git a/app/system/rpc/system.go b/app/system/rpc/system.go new file mode 100644 index 0000000..310fc07 --- /dev/null +++ b/app/system/rpc/system.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/system/rpc/internal/config" + "sundynix-micro-go/app/system/rpc/internal/server" + "sundynix-micro-go/app/system/rpc/internal/svc" + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/system.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + system.RegisterSystemServiceServer(grpcServer, server.NewSystemServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/app/system/rpc/system/system.pb.go b/app/system/rpc/system/system.pb.go new file mode 100644 index 0000000..5edb908 --- /dev/null +++ b/app/system/rpc/system/system.pb.go @@ -0,0 +1,745 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: pb/system.proto + +package system + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CommonResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommonResp) Reset() { + *x = CommonResp{} + mi := &file_pb_system_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommonResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommonResp) ProtoMessage() {} + +func (x *CommonResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead. +func (*CommonResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{0} +} + +func (x *CommonResp) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *CommonResp) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +type RoleInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` + Sort int32 `protobuf:"varint,4,opt,name=sort,proto3" json:"sort,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleInfo) Reset() { + *x = RoleInfo{} + mi := &file_pb_system_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleInfo) ProtoMessage() {} + +func (x *RoleInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RoleInfo.ProtoReflect.Descriptor instead. +func (*RoleInfo) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{1} +} + +func (x *RoleInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RoleInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RoleInfo) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *RoleInfo) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +type MenuInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ParentId string `protobuf:"bytes,2,opt,name=parentId,proto3" json:"parentId,omitempty"` + Category int32 `protobuf:"varint,3,opt,name=category,proto3" json:"category,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` + Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"` + Path string `protobuf:"bytes,7,opt,name=path,proto3" json:"path,omitempty"` + Permission string `protobuf:"bytes,8,opt,name=permission,proto3" json:"permission,omitempty"` + Locale string `protobuf:"bytes,9,opt,name=locale,proto3" json:"locale,omitempty"` + Icon string `protobuf:"bytes,10,opt,name=icon,proto3" json:"icon,omitempty"` + Sort int32 `protobuf:"varint,11,opt,name=sort,proto3" json:"sort,omitempty"` + Children []*MenuInfo `protobuf:"bytes,12,rep,name=children,proto3" json:"children,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MenuInfo) Reset() { + *x = MenuInfo{} + mi := &file_pb_system_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MenuInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MenuInfo) ProtoMessage() {} + +func (x *MenuInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MenuInfo.ProtoReflect.Descriptor instead. +func (*MenuInfo) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{2} +} + +func (x *MenuInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *MenuInfo) GetParentId() string { + if x != nil { + return x.ParentId + } + return "" +} + +func (x *MenuInfo) GetCategory() int32 { + if x != nil { + return x.Category + } + return 0 +} + +func (x *MenuInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MenuInfo) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *MenuInfo) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *MenuInfo) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *MenuInfo) GetPermission() string { + if x != nil { + return x.Permission + } + return "" +} + +func (x *MenuInfo) GetLocale() string { + if x != nil { + return x.Locale + } + return "" +} + +func (x *MenuInfo) GetIcon() string { + if x != nil { + return x.Icon + } + return "" +} + +func (x *MenuInfo) GetSort() int32 { + if x != nil { + return x.Sort + } + return 0 +} + +func (x *MenuInfo) GetChildren() []*MenuInfo { + if x != nil { + return x.Children + } + return nil +} + +type ClientInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=clientId,proto3" json:"clientId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + GrantType string `protobuf:"bytes,4,opt,name=grantType,proto3" json:"grantType,omitempty"` + AdditionalInfo string `protobuf:"bytes,5,opt,name=additionalInfo,proto3" json:"additionalInfo,omitempty"` + ActiveTimeout int64 `protobuf:"varint,6,opt,name=activeTimeout,proto3" json:"activeTimeout,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClientInfo) Reset() { + *x = ClientInfo{} + mi := &file_pb_system_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClientInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientInfo) ProtoMessage() {} + +func (x *ClientInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientInfo.ProtoReflect.Descriptor instead. +func (*ClientInfo) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{3} +} + +func (x *ClientInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ClientInfo) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *ClientInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ClientInfo) GetGrantType() string { + if x != nil { + return x.GrantType + } + return "" +} + +func (x *ClientInfo) GetAdditionalInfo() string { + if x != nil { + return x.AdditionalInfo + } + return "" +} + +func (x *ClientInfo) GetActiveTimeout() int64 { + if x != nil { + return x.ActiveTimeout + } + return 0 +} + +type GetRolesByUserIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRolesByUserIdReq) Reset() { + *x = GetRolesByUserIdReq{} + mi := &file_pb_system_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRolesByUserIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRolesByUserIdReq) ProtoMessage() {} + +func (x *GetRolesByUserIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRolesByUserIdReq.ProtoReflect.Descriptor instead. +func (*GetRolesByUserIdReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{4} +} + +func (x *GetRolesByUserIdReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetRolesByUserIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Roles []*RoleInfo `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRolesByUserIdResp) Reset() { + *x = GetRolesByUserIdResp{} + mi := &file_pb_system_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRolesByUserIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRolesByUserIdResp) ProtoMessage() {} + +func (x *GetRolesByUserIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRolesByUserIdResp.ProtoReflect.Descriptor instead. +func (*GetRolesByUserIdResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{5} +} + +func (x *GetRolesByUserIdResp) GetRoles() []*RoleInfo { + if x != nil { + return x.Roles + } + return nil +} + +type GetMenusByRoleIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + RoleId string `protobuf:"bytes,1,opt,name=roleId,proto3" json:"roleId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMenusByRoleIdReq) Reset() { + *x = GetMenusByRoleIdReq{} + mi := &file_pb_system_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMenusByRoleIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMenusByRoleIdReq) ProtoMessage() {} + +func (x *GetMenusByRoleIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMenusByRoleIdReq.ProtoReflect.Descriptor instead. +func (*GetMenusByRoleIdReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{6} +} + +func (x *GetMenusByRoleIdReq) GetRoleId() string { + if x != nil { + return x.RoleId + } + return "" +} + +type GetMenusByRoleIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Menus []*MenuInfo `protobuf:"bytes,1,rep,name=menus,proto3" json:"menus,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMenusByRoleIdResp) Reset() { + *x = GetMenusByRoleIdResp{} + mi := &file_pb_system_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMenusByRoleIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMenusByRoleIdResp) ProtoMessage() {} + +func (x *GetMenusByRoleIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMenusByRoleIdResp.ProtoReflect.Descriptor instead. +func (*GetMenusByRoleIdResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{7} +} + +func (x *GetMenusByRoleIdResp) GetMenus() []*MenuInfo { + if x != nil { + return x.Menus + } + return nil +} + +type GetClientByIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + ClientId string `protobuf:"bytes,1,opt,name=clientId,proto3" json:"clientId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetClientByIdReq) Reset() { + *x = GetClientByIdReq{} + mi := &file_pb_system_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetClientByIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetClientByIdReq) ProtoMessage() {} + +func (x *GetClientByIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetClientByIdReq.ProtoReflect.Descriptor instead. +func (*GetClientByIdReq) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{8} +} + +func (x *GetClientByIdReq) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +type GetClientByIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Client *ClientInfo `protobuf:"bytes,1,opt,name=client,proto3" json:"client,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetClientByIdResp) Reset() { + *x = GetClientByIdResp{} + mi := &file_pb_system_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetClientByIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetClientByIdResp) ProtoMessage() {} + +func (x *GetClientByIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_system_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetClientByIdResp.ProtoReflect.Descriptor instead. +func (*GetClientByIdResp) Descriptor() ([]byte, []int) { + return file_pb_system_proto_rawDescGZIP(), []int{9} +} + +func (x *GetClientByIdResp) GetClient() *ClientInfo { + if x != nil { + return x.Client + } + return nil +} + +var File_pb_system_proto protoreflect.FileDescriptor + +const file_pb_system_proto_rawDesc = "" + + "\n" + + "\x0fpb/system.proto\x12\x06system\"2\n" + + "\n" + + "CommonResp\x12\x12\n" + + "\x04code\x18\x01 \x01(\x03R\x04code\x12\x10\n" + + "\x03msg\x18\x02 \x01(\tR\x03msg\"V\n" + + "\bRoleInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04code\x18\x03 \x01(\tR\x04code\x12\x12\n" + + "\x04sort\x18\x04 \x01(\x05R\x04sort\"\xb2\x02\n" + + "\bMenuInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + + "\bparentId\x18\x02 \x01(\tR\bparentId\x12\x1a\n" + + "\bcategory\x18\x03 \x01(\x05R\bcategory\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x12\x14\n" + + "\x05title\x18\x05 \x01(\tR\x05title\x12\x12\n" + + "\x04code\x18\x06 \x01(\tR\x04code\x12\x12\n" + + "\x04path\x18\a \x01(\tR\x04path\x12\x1e\n" + + "\n" + + "permission\x18\b \x01(\tR\n" + + "permission\x12\x16\n" + + "\x06locale\x18\t \x01(\tR\x06locale\x12\x12\n" + + "\x04icon\x18\n" + + " \x01(\tR\x04icon\x12\x12\n" + + "\x04sort\x18\v \x01(\x05R\x04sort\x12,\n" + + "\bchildren\x18\f \x03(\v2\x10.system.MenuInfoR\bchildren\"\xb8\x01\n" + + "\n" + + "ClientInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + + "\bclientId\x18\x02 \x01(\tR\bclientId\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x1c\n" + + "\tgrantType\x18\x04 \x01(\tR\tgrantType\x12&\n" + + "\x0eadditionalInfo\x18\x05 \x01(\tR\x0eadditionalInfo\x12$\n" + + "\ractiveTimeout\x18\x06 \x01(\x03R\ractiveTimeout\"-\n" + + "\x13GetRolesByUserIdReq\x12\x16\n" + + "\x06userId\x18\x01 \x01(\tR\x06userId\">\n" + + "\x14GetRolesByUserIdResp\x12&\n" + + "\x05roles\x18\x01 \x03(\v2\x10.system.RoleInfoR\x05roles\"-\n" + + "\x13GetMenusByRoleIdReq\x12\x16\n" + + "\x06roleId\x18\x01 \x01(\tR\x06roleId\">\n" + + "\x14GetMenusByRoleIdResp\x12&\n" + + "\x05menus\x18\x01 \x03(\v2\x10.system.MenuInfoR\x05menus\".\n" + + "\x10GetClientByIdReq\x12\x1a\n" + + "\bclientId\x18\x01 \x01(\tR\bclientId\"?\n" + + "\x11GetClientByIdResp\x12*\n" + + "\x06client\x18\x01 \x01(\v2\x12.system.ClientInfoR\x06client2\xf3\x01\n" + + "\rSystemService\x12M\n" + + "\x10GetRolesByUserId\x12\x1b.system.GetRolesByUserIdReq\x1a\x1c.system.GetRolesByUserIdResp\x12M\n" + + "\x10GetMenusByRoleId\x12\x1b.system.GetMenusByRoleIdReq\x1a\x1c.system.GetMenusByRoleIdResp\x12D\n" + + "\rGetClientById\x12\x18.system.GetClientByIdReq\x1a\x19.system.GetClientByIdRespB\n" + + "Z\b./systemb\x06proto3" + +var ( + file_pb_system_proto_rawDescOnce sync.Once + file_pb_system_proto_rawDescData []byte +) + +func file_pb_system_proto_rawDescGZIP() []byte { + file_pb_system_proto_rawDescOnce.Do(func() { + file_pb_system_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_system_proto_rawDesc), len(file_pb_system_proto_rawDesc))) + }) + return file_pb_system_proto_rawDescData +} + +var file_pb_system_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_pb_system_proto_goTypes = []any{ + (*CommonResp)(nil), // 0: system.CommonResp + (*RoleInfo)(nil), // 1: system.RoleInfo + (*MenuInfo)(nil), // 2: system.MenuInfo + (*ClientInfo)(nil), // 3: system.ClientInfo + (*GetRolesByUserIdReq)(nil), // 4: system.GetRolesByUserIdReq + (*GetRolesByUserIdResp)(nil), // 5: system.GetRolesByUserIdResp + (*GetMenusByRoleIdReq)(nil), // 6: system.GetMenusByRoleIdReq + (*GetMenusByRoleIdResp)(nil), // 7: system.GetMenusByRoleIdResp + (*GetClientByIdReq)(nil), // 8: system.GetClientByIdReq + (*GetClientByIdResp)(nil), // 9: system.GetClientByIdResp +} +var file_pb_system_proto_depIdxs = []int32{ + 2, // 0: system.MenuInfo.children:type_name -> system.MenuInfo + 1, // 1: system.GetRolesByUserIdResp.roles:type_name -> system.RoleInfo + 2, // 2: system.GetMenusByRoleIdResp.menus:type_name -> system.MenuInfo + 3, // 3: system.GetClientByIdResp.client:type_name -> system.ClientInfo + 4, // 4: system.SystemService.GetRolesByUserId:input_type -> system.GetRolesByUserIdReq + 6, // 5: system.SystemService.GetMenusByRoleId:input_type -> system.GetMenusByRoleIdReq + 8, // 6: system.SystemService.GetClientById:input_type -> system.GetClientByIdReq + 5, // 7: system.SystemService.GetRolesByUserId:output_type -> system.GetRolesByUserIdResp + 7, // 8: system.SystemService.GetMenusByRoleId:output_type -> system.GetMenusByRoleIdResp + 9, // 9: system.SystemService.GetClientById:output_type -> system.GetClientByIdResp + 7, // [7:10] is the sub-list for method output_type + 4, // [4:7] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_pb_system_proto_init() } +func file_pb_system_proto_init() { + if File_pb_system_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_system_proto_rawDesc), len(file_pb_system_proto_rawDesc)), + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pb_system_proto_goTypes, + DependencyIndexes: file_pb_system_proto_depIdxs, + MessageInfos: file_pb_system_proto_msgTypes, + }.Build() + File_pb_system_proto = out.File + file_pb_system_proto_goTypes = nil + file_pb_system_proto_depIdxs = nil +} diff --git a/app/system/rpc/system/system_grpc.pb.go b/app/system/rpc/system/system_grpc.pb.go new file mode 100644 index 0000000..086b126 --- /dev/null +++ b/app/system/rpc/system/system_grpc.pb.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v7.34.1 +// source: pb/system.proto + +package system + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SystemService_GetRolesByUserId_FullMethodName = "/system.SystemService/GetRolesByUserId" + SystemService_GetMenusByRoleId_FullMethodName = "/system.SystemService/GetMenusByRoleId" + SystemService_GetClientById_FullMethodName = "/system.SystemService/GetClientById" +) + +// SystemServiceClient is the client API for SystemService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SystemServiceClient interface { + // 获取用户角色列表 + GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) + // 获取角色菜单列表 + GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error) + // 获取客户端信息 + GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error) +} + +type systemServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSystemServiceClient(cc grpc.ClientConnInterface) SystemServiceClient { + return &systemServiceClient{cc} +} + +func (c *systemServiceClient) GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetRolesByUserIdResp) + err := c.cc.Invoke(ctx, SystemService_GetRolesByUserId_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMenusByRoleIdResp) + err := c.cc.Invoke(ctx, SystemService_GetMenusByRoleId_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemServiceClient) GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetClientByIdResp) + err := c.cc.Invoke(ctx, SystemService_GetClientById_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SystemServiceServer is the server API for SystemService service. +// All implementations must embed UnimplementedSystemServiceServer +// for forward compatibility. +type SystemServiceServer interface { + // 获取用户角色列表 + GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error) + // 获取角色菜单列表 + GetMenusByRoleId(context.Context, *GetMenusByRoleIdReq) (*GetMenusByRoleIdResp, error) + // 获取客户端信息 + GetClientById(context.Context, *GetClientByIdReq) (*GetClientByIdResp, error) + mustEmbedUnimplementedSystemServiceServer() +} + +// UnimplementedSystemServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSystemServiceServer struct{} + +func (UnimplementedSystemServiceServer) GetRolesByUserId(context.Context, *GetRolesByUserIdReq) (*GetRolesByUserIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetRolesByUserId not implemented") +} +func (UnimplementedSystemServiceServer) GetMenusByRoleId(context.Context, *GetMenusByRoleIdReq) (*GetMenusByRoleIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetMenusByRoleId not implemented") +} +func (UnimplementedSystemServiceServer) GetClientById(context.Context, *GetClientByIdReq) (*GetClientByIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetClientById not implemented") +} +func (UnimplementedSystemServiceServer) mustEmbedUnimplementedSystemServiceServer() {} +func (UnimplementedSystemServiceServer) testEmbeddedByValue() {} + +// UnsafeSystemServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SystemServiceServer will +// result in compilation errors. +type UnsafeSystemServiceServer interface { + mustEmbedUnimplementedSystemServiceServer() +} + +func RegisterSystemServiceServer(s grpc.ServiceRegistrar, srv SystemServiceServer) { + // If the following call panics, it indicates UnimplementedSystemServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SystemService_ServiceDesc, srv) +} + +func _SystemService_GetRolesByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRolesByUserIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetRolesByUserId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_GetRolesByUserId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetRolesByUserId(ctx, req.(*GetRolesByUserIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetMenusByRoleId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMenusByRoleIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetMenusByRoleId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_GetMenusByRoleId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetMenusByRoleId(ctx, req.(*GetMenusByRoleIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _SystemService_GetClientById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetClientByIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServiceServer).GetClientById(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SystemService_GetClientById_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServiceServer).GetClientById(ctx, req.(*GetClientByIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +// SystemService_ServiceDesc is the grpc.ServiceDesc for SystemService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SystemService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "system.SystemService", + HandlerType: (*SystemServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetRolesByUserId", + Handler: _SystemService_GetRolesByUserId_Handler, + }, + { + MethodName: "GetMenusByRoleId", + Handler: _SystemService_GetMenusByRoleId_Handler, + }, + { + MethodName: "GetClientById", + Handler: _SystemService_GetClientById_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pb/system.proto", +} diff --git a/app/system/rpc/systemservice/systemService.go b/app/system/rpc/systemservice/systemService.go new file mode 100644 index 0000000..f338d23 --- /dev/null +++ b/app/system/rpc/systemservice/systemService.go @@ -0,0 +1,64 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: system.proto + +package systemservice + +import ( + "context" + + "sundynix-micro-go/app/system/rpc/system" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + ClientInfo = system.ClientInfo + CommonResp = system.CommonResp + GetClientByIdReq = system.GetClientByIdReq + GetClientByIdResp = system.GetClientByIdResp + GetMenusByRoleIdReq = system.GetMenusByRoleIdReq + GetMenusByRoleIdResp = system.GetMenusByRoleIdResp + GetRolesByUserIdReq = system.GetRolesByUserIdReq + GetRolesByUserIdResp = system.GetRolesByUserIdResp + MenuInfo = system.MenuInfo + RoleInfo = system.RoleInfo + + SystemService interface { + // 获取用户角色列表 + GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) + // 获取角色菜单列表 + GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error) + // 获取客户端信息 + GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error) + } + + defaultSystemService struct { + cli zrpc.Client + } +) + +func NewSystemService(cli zrpc.Client) SystemService { + return &defaultSystemService{ + cli: cli, + } +} + +// 获取用户角色列表 +func (m *defaultSystemService) GetRolesByUserId(ctx context.Context, in *GetRolesByUserIdReq, opts ...grpc.CallOption) (*GetRolesByUserIdResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.GetRolesByUserId(ctx, in, opts...) +} + +// 获取角色菜单列表 +func (m *defaultSystemService) GetMenusByRoleId(ctx context.Context, in *GetMenusByRoleIdReq, opts ...grpc.CallOption) (*GetMenusByRoleIdResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.GetMenusByRoleId(ctx, in, opts...) +} + +// 获取客户端信息 +func (m *defaultSystemService) GetClientById(ctx context.Context, in *GetClientByIdReq, opts ...grpc.CallOption) (*GetClientByIdResp, error) { + client := system.NewSystemServiceClient(m.cli.Conn()) + return client.GetClientById(ctx, in, opts...) +} diff --git a/app/user/api/etc/user-api.yaml b/app/user/api/etc/user-api.yaml new file mode 100644 index 0000000..49406bf --- /dev/null +++ b/app/user/api/etc/user-api.yaml @@ -0,0 +1,14 @@ +Name: user-api +Host: 0.0.0.0 +Port: 9001 + +Auth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# user-rpc 服务配置 +UserRpc: + Etcd: + Hosts: + - 192.168.100.127:2379 + Key: user.rpc diff --git a/app/user/api/internal/config/config.go b/app/user/api/internal/config/config.go new file mode 100644 index 0000000..33305c0 --- /dev/null +++ b/app/user/api/internal/config/config.go @@ -0,0 +1,18 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package config + +import ( + "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" +) + +type Config struct { + rest.RestConf + Auth struct { + AccessSecret string + AccessExpire int64 + } + UserRpc zrpc.RpcClientConf +} diff --git a/app/user/api/internal/handler/auth/loginByPhoneHandler.go b/app/user/api/internal/handler/auth/loginByPhoneHandler.go new file mode 100644 index 0000000..dbdb1c7 --- /dev/null +++ b/app/user/api/internal/handler/auth/loginByPhoneHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/auth" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 手机号登录 +func LoginByPhoneHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.LoginByPhoneReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := auth.NewLoginByPhoneLogic(r.Context(), svcCtx) + resp, err := l.LoginByPhone(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/user/api/internal/handler/auth/loginHandler.go b/app/user/api/internal/handler/auth/loginHandler.go new file mode 100644 index 0000000..fc33ee2 --- /dev/null +++ b/app/user/api/internal/handler/auth/loginHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/auth" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 账号密码登录 +func LoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.LoginReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := auth.NewLoginLogic(r.Context(), svcCtx) + resp, err := l.Login(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/user/api/internal/handler/auth/miniLoginHandler.go b/app/user/api/internal/handler/auth/miniLoginHandler.go new file mode 100644 index 0000000..5c7f195 --- /dev/null +++ b/app/user/api/internal/handler/auth/miniLoginHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package auth + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/auth" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 微信小程序登录 +func MiniLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MiniLoginReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := auth.NewMiniLoginLogic(r.Context(), svcCtx) + resp, err := l.MiniLogin(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/user/api/internal/handler/routes.go b/app/user/api/internal/handler/routes.go new file mode 100644 index 0000000..189f3e5 --- /dev/null +++ b/app/user/api/internal/handler/routes.go @@ -0,0 +1,89 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package handler + +import ( + "net/http" + + auth "sundynix-micro-go/app/user/api/internal/handler/auth" + user "sundynix-micro-go/app/user/api/internal/handler/user" + "sundynix-micro-go/app/user/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + // 账号密码登录 + Method: http.MethodPost, + Path: "/login", + Handler: auth.LoginHandler(serverCtx), + }, + { + // 手机号登录 + Method: http.MethodPost, + Path: "/loginByPhone", + Handler: auth.LoginByPhoneHandler(serverCtx), + }, + { + // 微信小程序登录 + Method: http.MethodPost, + Path: "/miniLogin", + Handler: auth.MiniLoginHandler(serverCtx), + }, + }, + rest.WithPrefix("/api/user"), + ) + + server.AddRoutes( + []rest.Route{ + { + // 修改密码 + Method: http.MethodPut, + Path: "/changePassword", + Handler: user.ChangePasswordHandler(serverCtx), + }, + { + // 删除用户 + Method: http.MethodDelete, + Path: "/delete", + Handler: user.DeleteUserHandler(serverCtx), + }, + { + // 获取当前用户信息 + Method: http.MethodGet, + Path: "/info", + Handler: user.GetUserInfoHandler(serverCtx), + }, + { + // 用户列表 + Method: http.MethodPost, + Path: "/list", + Handler: user.GetUserListHandler(serverCtx), + }, + { + // 获取位置信息 + Method: http.MethodGet, + Path: "/location", + Handler: user.GetLocationHandler(serverCtx), + }, + { + // 更新用户信息 + Method: http.MethodPut, + Path: "/update", + Handler: user.UpdateUserHandler(serverCtx), + }, + { + // 获取天气信息 + Method: http.MethodGet, + Path: "/weather", + Handler: user.GetWeatherHandler(serverCtx), + }, + }, + rest.WithJwt(serverCtx.Config.Auth.AccessSecret), + rest.WithPrefix("/api/user"), + ) +} diff --git a/app/user/api/internal/handler/user/changePasswordHandler.go b/app/user/api/internal/handler/user/changePasswordHandler.go new file mode 100644 index 0000000..aba68eb --- /dev/null +++ b/app/user/api/internal/handler/user/changePasswordHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 修改密码 +func ChangePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChangePasswordReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := user.NewChangePasswordLogic(r.Context(), svcCtx) + err := l.ChangePassword(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/handler/user/deleteUserHandler.go b/app/user/api/internal/handler/user/deleteUserHandler.go new file mode 100644 index 0000000..6ff4fe3 --- /dev/null +++ b/app/user/api/internal/handler/user/deleteUserHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 删除用户 +func DeleteUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.IdsReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := user.NewDeleteUserLogic(r.Context(), svcCtx) + err := l.DeleteUser(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/handler/user/getLocationHandler.go b/app/user/api/internal/handler/user/getLocationHandler.go new file mode 100644 index 0000000..2889ead --- /dev/null +++ b/app/user/api/internal/handler/user/getLocationHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 获取位置信息 +func GetLocationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.LocationReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := user.NewGetLocationLogic(r.Context(), svcCtx) + err := l.GetLocation(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/handler/user/getUserInfoHandler.go b/app/user/api/internal/handler/user/getUserInfoHandler.go new file mode 100644 index 0000000..afb6640 --- /dev/null +++ b/app/user/api/internal/handler/user/getUserInfoHandler.go @@ -0,0 +1,25 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/common/response" +) + +// 获取当前用户信息 +func GetUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := user.NewGetUserInfoLogic(r.Context(), svcCtx) + resp, err := l.GetUserInfo() + if err != nil { + response.Fail(w, err.Error()) + } else { + response.OkWithData(w, resp) + } + } +} diff --git a/app/user/api/internal/handler/user/getUserListHandler.go b/app/user/api/internal/handler/user/getUserListHandler.go new file mode 100644 index 0000000..22b0547 --- /dev/null +++ b/app/user/api/internal/handler/user/getUserListHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 用户列表 +func GetUserListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UserListReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := user.NewGetUserListLogic(r.Context(), svcCtx) + err := l.GetUserList(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/handler/user/getWeatherHandler.go b/app/user/api/internal/handler/user/getWeatherHandler.go new file mode 100644 index 0000000..00064d1 --- /dev/null +++ b/app/user/api/internal/handler/user/getWeatherHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 获取天气信息 +func GetWeatherHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.WeatherReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := user.NewGetWeatherLogic(r.Context(), svcCtx) + err := l.GetWeather(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/handler/user/updateUserHandler.go b/app/user/api/internal/handler/user/updateUserHandler.go new file mode 100644 index 0000000..f4e0d7d --- /dev/null +++ b/app/user/api/internal/handler/user/updateUserHandler.go @@ -0,0 +1,33 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "sundynix-micro-go/app/user/api/internal/logic/user" + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/common/response" +) + +// 更新用户信息 +func UpdateUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateUserReq + if err := httpx.Parse(r, &req); err != nil { + response.Fail(w, err.Error()) + return + } + + l := user.NewUpdateUserLogic(r.Context(), svcCtx) + err := l.UpdateUser(&req) + if err != nil { + response.Fail(w, err.Error()) + } else { + response.Ok(w) + } + } +} diff --git a/app/user/api/internal/logic/auth/loginByPhoneLogic.go b/app/user/api/internal/logic/auth/loginByPhoneLogic.go new file mode 100644 index 0000000..63280a4 --- /dev/null +++ b/app/user/api/internal/logic/auth/loginByPhoneLogic.go @@ -0,0 +1,100 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package auth + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "time" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/user/rpc/user" + jwtUtil "sundynix-micro-go/common/utils/jwt" + + jwtv5 "github.com/golang-jwt/jwt/v5" + "github.com/zeromicro/go-zero/core/logx" +) + +type LoginByPhoneLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewLoginByPhoneLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginByPhoneLogic { + return &LoginByPhoneLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *LoginByPhoneLogic) LoginByPhone(req *types.LoginByPhoneReq) (resp *types.LoginResp, err error) { + // 1. 调用微信接口获取手机号 + // TODO: 从配置中获取access_token + accessToken := "" // 需要通过微信API获取 + apiURL := "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken + + data := map[string]interface{}{"code": req.Code} + jsonData, _ := json.Marshal(data) + + httpResp, err := http.Post(apiURL, "application/json", nil) + if err != nil { + l.Errorf("获取手机号失败: %v", err) + return nil, fmt.Errorf("获取手机号失败") + } + defer httpResp.Body.Close() + + body, _ := io.ReadAll(httpResp.Body) + var dataMap map[string]interface{} + _ = json.Unmarshal(body, &dataMap) + _ = jsonData + _ = url.Values{} + + // 2. 通过 user-rpc 查询用户 + userResp, err := l.svcCtx.UserRpc.GetUserByOpenId(l.ctx, &user.GetUserByOpenIdReq{ + OpenId: req.OpenId, + }) + if err != nil { + return nil, fmt.Errorf("用户不存在") + } + + // 3. 如果需要更新手机号 + phoneInfo, ok := dataMap["phone_info"].(map[string]interface{}) + if ok { + phoneNumber, _ := phoneInfo["phoneNumber"].(string) + if phoneNumber != "" && userResp.User.Phone == "" { + _, _ = l.svcCtx.UserRpc.UpdateUser(l.ctx, &user.UpdateUserReq{ + Id: userResp.User.Id, + Phone: phoneNumber, + }) + userResp.User.Phone = phoneNumber + } + } + + // 4. 生成Token + j := jwtUtil.NewJWT(l.svcCtx.Config.Auth.AccessSecret) + claims := jwtUtil.CustomClaims{ + BaseClaims: jwtUtil.BaseClaims{ + ID: userResp.User.Id, + Account: userResp.User.Account, + }, + BufferTime: 3600, + RegisteredClaims: jwtv5.RegisteredClaims{ + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(l.svcCtx.Config.Auth.AccessExpire) * time.Second)), + Issuer: "sundynix", + }, + } + token, _ := j.CreateToken(claims) + + return &types.LoginResp{ + Token: token, + UserInfo: userResp.User, + }, nil +} diff --git a/app/user/api/internal/logic/auth/loginLogic.go b/app/user/api/internal/logic/auth/loginLogic.go new file mode 100644 index 0000000..1123bbd --- /dev/null +++ b/app/user/api/internal/logic/auth/loginLogic.go @@ -0,0 +1,68 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package auth + +import ( + "context" + "fmt" + "time" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/user/rpc/user" + jwtUtil "sundynix-micro-go/common/utils/jwt" + + jwtv5 "github.com/golang-jwt/jwt/v5" + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type LoginLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginLogic { + return &LoginLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *LoginLogic) Login(req *types.LoginReq) (resp *types.LoginResp, err error) { + // 通过 user-rpc 查询用户 (account登录暂用GetUserByOpenId的方式,后续需补充account查询RPC) + // 这里简化处理:直接在api层查询并验证密码 + // TODO: 后续应该在user-rpc中增加LoginByAccount方法 + + _ = req + _ = l + + return nil, status.Error(codes.Unimplemented, "账号密码登录功能开发中") +} + +// generateToken 生成JWT Token的辅助方法 +func generateToken(config svc.ServiceContext, userInfo *user.UserInfo) (string, error) { + j := jwtUtil.NewJWT(config.Config.Auth.AccessSecret) + claims := jwtUtil.CustomClaims{ + BaseClaims: jwtUtil.BaseClaims{ + ID: userInfo.Id, + Account: userInfo.Account, + }, + BufferTime: 3600, + RegisteredClaims: jwtv5.RegisteredClaims{ + Audience: jwtv5.ClaimStrings{"sundynix"}, + NotBefore: jwtv5.NewNumericDate(time.Now().Add(-1000)), + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(config.Config.Auth.AccessExpire) * time.Second)), + Issuer: "sundynix", + }, + } + token, err := j.CreateToken(claims) + if err != nil { + return "", fmt.Errorf("生成Token失败: %w", err) + } + return token, nil +} diff --git a/app/user/api/internal/logic/auth/miniLoginLogic.go b/app/user/api/internal/logic/auth/miniLoginLogic.go new file mode 100644 index 0000000..bb7e41c --- /dev/null +++ b/app/user/api/internal/logic/auth/miniLoginLogic.go @@ -0,0 +1,126 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package auth + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "time" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + "sundynix-micro-go/app/user/rpc/user" + jwtUtil "sundynix-micro-go/common/utils/jwt" + + jwtv5 "github.com/golang-jwt/jwt/v5" + "github.com/zeromicro/go-zero/core/logx" +) + +type MiniLoginLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 微信小程序登录 +func NewMiniLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniLoginLogic { + return &MiniLoginLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +// WxCode2SessionResp 微信code2session响应 +type WxCode2SessionResp struct { + Openid string `json:"openid"` + SessionKey string `json:"session_key"` + Unionid string `json:"unionid"` + Errcode int `json:"errcode"` + Errmsg string `json:"errmsg"` +} + +func (l *MiniLoginLogic) MiniLogin(req *types.MiniLoginReq) (resp *types.LoginResp, err error) { + // 1. 调用微信接口获取openid和session_key + // TODO: 从配置中获取AppId和AppSecret,当前先用固定值 + appID := "wxb463820bf36dd5d6" + appSecret := "731784a74c76c6d31fa00bb847af2c7d" + + params := url.Values{} + params.Set("appid", appID) + params.Set("secret", appSecret) + params.Set("js_code", req.Code) + params.Set("grant_type", "authorization_code") + fullURL := "https://api.weixin.qq.com/sns/jscode2session?" + params.Encode() + + httpResp, err := http.Get(fullURL) + if err != nil { + l.Errorf("微信登录接口请求失败: %v", err) + return nil, fmt.Errorf("微信登录接口请求失败") + } + defer httpResp.Body.Close() + + body, err := io.ReadAll(httpResp.Body) + if err != nil { + l.Errorf("读取微信接口响应失败: %v", err) + return nil, fmt.Errorf("读取微信登录接口响应失败") + } + + var wxResp WxCode2SessionResp + if err = json.Unmarshal(body, &wxResp); err != nil { + l.Errorf("解析微信接口响应失败: %v", err) + return nil, fmt.Errorf("解析微信登录接口响应失败") + } + + if wxResp.Errcode != 0 { + l.Errorf("微信接口返回错误: errcode=%d, errmsg=%s", wxResp.Errcode, wxResp.Errmsg) + return nil, fmt.Errorf("微信登录失败: %s", wxResp.Errmsg) + } + + if wxResp.Openid == "" { + return nil, fmt.Errorf("openid为空") + } + + // 2. 通过 user-rpc 创建或获取用户 + createResp, err := l.svcCtx.UserRpc.CreateUser(l.ctx, &user.CreateUserReq{ + Name: "", + OpenId: wxResp.Openid, + SessionKey: wxResp.SessionKey, + ClientId: req.ClientId, + }) + if err != nil { + l.Errorf("创建用户失败: %v", err) + return nil, fmt.Errorf("登录失败") + } + + // 3. 生成JWT Token + j := jwtUtil.NewJWT(l.svcCtx.Config.Auth.AccessSecret) + claims := jwtUtil.CustomClaims{ + BaseClaims: jwtUtil.BaseClaims{ + ID: createResp.User.Id, + Account: createResp.User.Account, + }, + BufferTime: 3600, + RegisteredClaims: jwtv5.RegisteredClaims{ + Audience: jwtv5.ClaimStrings{"sundynix"}, + NotBefore: jwtv5.NewNumericDate(time.Now().Add(-1000)), + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(time.Duration(l.svcCtx.Config.Auth.AccessExpire) * time.Second)), + Issuer: "sundynix", + }, + } + token, err := j.CreateToken(claims) + if err != nil { + l.Errorf("生成Token失败: %v", err) + return nil, fmt.Errorf("登录失败") + } + + return &types.LoginResp{ + Token: token, + UserInfo: createResp.User, + }, nil +} diff --git a/app/user/api/internal/logic/user/changePasswordLogic.go b/app/user/api/internal/logic/user/changePasswordLogic.go new file mode 100644 index 0000000..869c5cc --- /dev/null +++ b/app/user/api/internal/logic/user/changePasswordLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type ChangePasswordLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 修改密码 +func NewChangePasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangePasswordLogic { + return &ChangePasswordLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *ChangePasswordLogic) ChangePassword(req *types.ChangePasswordReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/user/api/internal/logic/user/deleteUserLogic.go b/app/user/api/internal/logic/user/deleteUserLogic.go new file mode 100644 index 0000000..a2a1b11 --- /dev/null +++ b/app/user/api/internal/logic/user/deleteUserLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DeleteUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 删除用户 +func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic { + return &DeleteUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *DeleteUserLogic) DeleteUser(req *types.IdsReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/user/api/internal/logic/user/getLocationLogic.go b/app/user/api/internal/logic/user/getLocationLogic.go new file mode 100644 index 0000000..1d2df51 --- /dev/null +++ b/app/user/api/internal/logic/user/getLocationLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetLocationLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 获取位置信息 +func NewGetLocationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLocationLogic { + return &GetLocationLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetLocationLogic) GetLocation(req *types.LocationReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/user/api/internal/logic/user/getUserInfoLogic.go b/app/user/api/internal/logic/user/getUserInfoLogic.go new file mode 100644 index 0000000..1c3930a --- /dev/null +++ b/app/user/api/internal/logic/user/getUserInfoLogic.go @@ -0,0 +1,55 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + "encoding/json" + "fmt" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + pb "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserInfoLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic { + return &GetUserInfoLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetUserInfoLogic) GetUserInfo() (resp *types.LoginResp, err error) { + // 从JWT claims中获取userId + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + if userId == "" || userId == "" { + return nil, fmt.Errorf("用户未登录") + } + + userResp, err := l.svcCtx.UserRpc.GetUserById(l.ctx, &pb.GetUserByIdReq{ + Id: userId, + }) + if err != nil { + l.Errorf("获取用户信息失败: %v", err) + return nil, fmt.Errorf("获取用户信息失败") + } + + // 将proto消息转换为map以便JSON序列化 + userJSON, _ := json.Marshal(userResp.User) + var userInfo interface{} + _ = json.Unmarshal(userJSON, &userInfo) + + return &types.LoginResp{ + UserInfo: userInfo, + }, nil +} diff --git a/app/user/api/internal/logic/user/getUserListLogic.go b/app/user/api/internal/logic/user/getUserListLogic.go new file mode 100644 index 0000000..b25e865 --- /dev/null +++ b/app/user/api/internal/logic/user/getUserListLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserListLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 用户列表 +func NewGetUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserListLogic { + return &GetUserListLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetUserListLogic) GetUserList(req *types.UserListReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/user/api/internal/logic/user/getWeatherLogic.go b/app/user/api/internal/logic/user/getWeatherLogic.go new file mode 100644 index 0000000..312964d --- /dev/null +++ b/app/user/api/internal/logic/user/getWeatherLogic.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetWeatherLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +// 获取天气信息 +func NewGetWeatherLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWeatherLogic { + return &GetWeatherLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetWeatherLogic) GetWeather(req *types.WeatherReq) error { + // todo: add your logic here and delete this line + + return nil +} diff --git a/app/user/api/internal/logic/user/updateUserLogic.go b/app/user/api/internal/logic/user/updateUserLogic.go new file mode 100644 index 0000000..761e610 --- /dev/null +++ b/app/user/api/internal/logic/user/updateUserLogic.go @@ -0,0 +1,51 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package user + +import ( + "context" + "fmt" + + "sundynix-micro-go/app/user/api/internal/svc" + "sundynix-micro-go/app/user/api/internal/types" + pb "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateUserLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { + return &UpdateUserLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *UpdateUserLogic) UpdateUser(req *types.UpdateUserReq) error { + userId := fmt.Sprintf("%v", l.ctx.Value("userId")) + if userId == "" || userId == "" { + return fmt.Errorf("用户未登录") + } + + _, err := l.svcCtx.UserRpc.UpdateUser(l.ctx, &pb.UpdateUserReq{ + Id: userId, + Name: req.Name, + Account: req.Account, + Phone: req.Phone, + AvatarId: req.AvatarId, + NickName: req.NickName, + }) + if err != nil { + l.Errorf("更新用户失败: %v", err) + return fmt.Errorf("更新用户失败") + } + + return nil +} diff --git a/app/user/api/internal/svc/serviceContext.go b/app/user/api/internal/svc/serviceContext.go new file mode 100644 index 0000000..f1efd7d --- /dev/null +++ b/app/user/api/internal/svc/serviceContext.go @@ -0,0 +1,23 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package svc + +import ( + "sundynix-micro-go/app/user/api/internal/config" + "sundynix-micro-go/app/user/rpc/userservice" + + "github.com/zeromicro/go-zero/zrpc" +) + +type ServiceContext struct { + Config config.Config + UserRpc userservice.UserService +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config: c, + UserRpc: userservice.NewUserService(zrpc.MustNewClient(c.UserRpc)), + } +} diff --git a/app/user/api/internal/types/types.go b/app/user/api/internal/types/types.go new file mode 100644 index 0000000..6eb033e --- /dev/null +++ b/app/user/api/internal/types/types.go @@ -0,0 +1,62 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 + +package types + +type ChangePasswordReq struct { + OldPassword string `json:"oldPassword"` + NewPassword string `json:"newPassword"` +} + +type IdReq struct { + Id string `json:"id"` +} + +type IdsReq struct { + Ids []string `json:"ids"` +} + +type LocationReq struct { + Longitude string `form:"longitude"` + Latitude string `form:"latitude"` +} + +type LoginByPhoneReq struct { + Code string `json:"code"` + OpenId string `json:"openId"` + ClientId string `json:"clientId"` +} + +type LoginReq struct { + Account string `json:"account"` + Password string `json:"password"` +} + +type LoginResp struct { + Token string `json:"token"` + UserInfo interface{} `json:"userInfo"` +} + +type MiniLoginReq struct { + Code string `json:"code"` + ClientId string `json:"clientId"` +} + +type UpdateUserReq struct { + Name string `json:"name,optional"` + Account string `json:"account,optional"` + Phone string `json:"phone,optional"` + AvatarId string `json:"avatarId,optional"` + NickName string `json:"nickName,optional"` +} + +type UserListReq struct { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Account string `json:"account,optional"` + Phone string `json:"phone,optional"` +} + +type WeatherReq struct { + Adcode string `form:"adcode"` +} diff --git a/app/user/api/user.api b/app/user/api/user.api new file mode 100644 index 0000000..200efae --- /dev/null +++ b/app/user/api/user.api @@ -0,0 +1,125 @@ +syntax = "v1" + +info ( + title: "用户服务API" + desc: "用户登录、信息管理等HTTP接口" + author: "sundynix" + version: "v1.0.0" +) + +type ( + // 微信小程序登录 + MiniLoginReq { + Code string `json:"code"` + ClientId string `json:"clientId"` + } + // 手机号登录 + LoginByPhoneReq { + Code string `json:"code"` + OpenId string `json:"openId"` + ClientId string `json:"clientId"` + } + // 账号密码登录 + LoginReq { + Account string `json:"account"` + Password string `json:"password"` + } + // 登录响应 + LoginResp { + Token string `json:"token"` + UserInfo interface{} `json:"userInfo"` + } + // 更新用户 + UpdateUserReq { + Name string `json:"name,optional"` + Account string `json:"account,optional"` + Phone string `json:"phone,optional"` + AvatarId string `json:"avatarId,optional"` + NickName string `json:"nickName,optional"` + } + // 修改密码 + ChangePasswordReq { + OldPassword string `json:"oldPassword"` + NewPassword string `json:"newPassword"` + } + // 用户列表查询 + UserListReq { + Current int `json:"current,optional"` + PageSize int `json:"pageSize,optional"` + Account string `json:"account,optional"` + Phone string `json:"phone,optional"` + } + // 通用ID请求 + IdReq { + Id string `json:"id"` + } + // 批量ID请求 + IdsReq { + Ids []string `json:"ids"` + } + // 获取位置 + LocationReq { + Longitude string `form:"longitude"` + Latitude string `form:"latitude"` + } + // 获取天气 + WeatherReq { + Adcode string `form:"adcode"` + } +) + +// ========== 无需鉴权的接口 ========== +@server ( + prefix: /api/user + group: auth +) +service user-api { + @doc "微信小程序登录" + @handler MiniLogin + post /miniLogin (MiniLoginReq) returns (LoginResp) + + @doc "手机号登录" + @handler LoginByPhone + post /loginByPhone (LoginByPhoneReq) returns (LoginResp) + + @doc "账号密码登录" + @handler Login + post /login (LoginReq) returns (LoginResp) +} + +// ========== 需要鉴权的接口 ========== +@server ( + prefix: /api/user + group: user + jwt: Auth +) +service user-api { + @doc "获取当前用户信息" + @handler GetUserInfo + get /info returns (LoginResp) + + @doc "更新用户信息" + @handler UpdateUser + put /update (UpdateUserReq) + + @doc "修改密码" + @handler ChangePassword + put /changePassword (ChangePasswordReq) + + @doc "用户列表" + @handler GetUserList + post /list (UserListReq) + + @doc "删除用户" + @handler DeleteUser + delete /delete (IdsReq) + + @doc "获取位置信息" + @handler GetLocation + get /location (LocationReq) + + @doc "获取天气信息" + @handler GetWeather + get /weather (WeatherReq) +} + diff --git a/app/user/api/user.go b/app/user/api/user.go new file mode 100644 index 0000000..958ee3d --- /dev/null +++ b/app/user/api/user.go @@ -0,0 +1,34 @@ +// Code scaffolded by goctl. Safe to edit. +// goctl 1.10.1 + +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/user/api/internal/config" + "sundynix-micro-go/app/user/api/internal/handler" + "sundynix-micro-go/app/user/api/internal/svc" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/rest" +) + +var configFile = flag.String("f", "etc/user-api.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + server := rest.MustNewServer(c.RestConf) + defer server.Stop() + + ctx := svc.NewServiceContext(c) + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/app/user/model/user_model.go b/app/user/model/user_model.go new file mode 100644 index 0000000..d9b0284 --- /dev/null +++ b/app/user/model/user_model.go @@ -0,0 +1,42 @@ +package model + +import ( + "sundynix-micro-go/common/model" + "time" +) + +// SundynixUser 用户基础表(仅存储认证和通用信息) +type SundynixUser struct { + model.BaseModel + TenantID string `gorm:"size:20;column:tenant_id" json:"tenantId"` + ClientID string `gorm:"size:20;column:client_id" json:"clientId"` + Name string `gorm:"size:100;column:name" json:"name"` + Account string `gorm:"size:50;column:account" json:"account"` + Password string `gorm:"size:100;column:password" json:"-"` + NickName string `gorm:"size:100;column:nick_name" json:"nickName"` + Phone string `gorm:"size:20;column:phone" json:"phone"` + SessionKey string `gorm:"size:80;column:session_key" json:"-"` + UnionID string `gorm:"size:80;column:union_id" json:"unionId"` + OpenID string `gorm:"size:80;column:open_id;index" json:"openId"` + SaOpenID string `gorm:"size:80;column:sa_open_id" json:"saOpenId"` + AvatarID string `gorm:"size:50;column:avatar_id" json:"avatarId"` + Gender int `gorm:"default:0;column:gender" json:"gender"` + LastLoginIP string `gorm:"size:20;column:last_login_ip" json:"lastLoginIp"` + LastLoginAt *time.Time `gorm:"column:last_login_at" json:"lastLoginAt"` +} + +// TableName 指定表名 +func (SundynixUser) TableName() string { + return "sundynix_user" +} + +// SundynixUserRole 用户角色关联表 +type SundynixUserRole struct { + UserID string `gorm:"size:50;primaryKey;column:user_id" json:"userId"` + RoleID string `gorm:"size:50;primaryKey;column:role_id" json:"roleId"` +} + +// TableName 指定表名 +func (SundynixUserRole) TableName() string { + return "sundynix_user_role" +} diff --git a/app/user/rpc/etc/user.yaml b/app/user/rpc/etc/user.yaml new file mode 100644 index 0000000..6105a7e --- /dev/null +++ b/app/user/rpc/etc/user.yaml @@ -0,0 +1,26 @@ +Name: user.rpc +ListenOn: 0.0.0.0:9101 +Etcd: + Hosts: + - 192.168.100.127:2379 + Key: user.rpc + +# MySQL +DB: + DataSource: root:root@tcp(192.168.100.127:3307)/sundynix_micro_go?charset=utf8mb4&parseTime=True&loc=Local + +# Redis +Cache: + - Host: 127.0.0.1:6379 + Pass: sundynix + Type: node + +# JWT +JwtAuth: + AccessSecret: 9149f2eb-d517-4a50-a03a-231dbcf0d872 + AccessExpire: 7200 + +# 微信小程序配置 +WxMini: + AppId: wxb463820bf36dd5d6 + AppSecret: 731784a74c76c6d31fa00bb847af2c7d diff --git a/app/user/rpc/internal/config/config.go b/app/user/rpc/internal/config/config.go new file mode 100755 index 0000000..7120865 --- /dev/null +++ b/app/user/rpc/internal/config/config.go @@ -0,0 +1,23 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf + DB struct { + DataSource string + } + Cache []struct { + Host string + Pass string + Type string + } + JwtAuth struct { + AccessSecret string + AccessExpire int64 + } + WxMini struct { + AppId string + AppSecret string + } +} diff --git a/app/user/rpc/internal/logic/createUserLogic.go b/app/user/rpc/internal/logic/createUserLogic.go new file mode 100644 index 0000000..979fdc6 --- /dev/null +++ b/app/user/rpc/internal/logic/createUserLogic.go @@ -0,0 +1,81 @@ +package logic + +import ( + "context" + "errors" + + "sundynix-micro-go/app/user/model" + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" + "sundynix-micro-go/common/utils/hash" + "sundynix-micro-go/common/utils/uniqueid" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type CreateUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic { + return &CreateUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 创建用户 +func (l *CreateUserLogic) CreateUser(in *user.CreateUserReq) (*user.CreateUserResp, error) { + // 如果有OpenID,先检查是否存在 + if in.OpenId != "" { + var existing model.SundynixUser + err := l.svcCtx.DB.Where("open_id = ?", in.OpenId).First(&existing).Error + if err == nil { + // 用户已存在,更新session_key + if in.SessionKey != "" { + l.svcCtx.DB.Model(&existing).UpdateColumn("session_key", in.SessionKey) + } + return &user.CreateUserResp{ + User: convertUserToProto(&existing), + }, nil + } + if !errors.Is(err, gorm.ErrRecordNotFound) { + l.Errorf("查询用户失败: %v", err) + return nil, status.Error(codes.Internal, "查询用户失败") + } + } + + // 创建新用户 + name := in.Name + if name == "" { + name = uniqueid.GenerateName("用户") + } + + newUser := model.SundynixUser{ + Name: name, + OpenID: in.OpenId, + SessionKey: in.SessionKey, + ClientID: in.ClientId, + Phone: in.Phone, + } + + // 如果有密码则加密 + if in.Phone != "" { + newUser.Password = hash.BcryptHash(in.Phone) // 默认密码为手机号 + } + + if err := l.svcCtx.DB.Create(&newUser).Error; err != nil { + l.Errorf("创建用户失败: %v", err) + return nil, status.Error(codes.Internal, "创建用户失败") + } + + return &user.CreateUserResp{ + User: convertUserToProto(&newUser), + }, nil +} diff --git a/app/user/rpc/internal/logic/getUserByIdLogic.go b/app/user/rpc/internal/logic/getUserByIdLogic.go new file mode 100644 index 0000000..989d9dd --- /dev/null +++ b/app/user/rpc/internal/logic/getUserByIdLogic.go @@ -0,0 +1,70 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/user/model" + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type GetUserByIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByIdLogic { + return &GetUserByIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 根据ID获取用户信息 +func (l *GetUserByIdLogic) GetUserById(in *user.GetUserByIdReq) (*user.GetUserByIdResp, error) { + var u model.SundynixUser + err := l.svcCtx.DB.Where("id = ?", in.Id).First(&u).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return nil, status.Error(codes.NotFound, "用户不存在") + } + l.Errorf("查询用户失败: %v", err) + return nil, status.Error(codes.Internal, "查询用户失败") + } + + return &user.GetUserByIdResp{ + User: convertUserToProto(&u), + }, nil +} + +// convertUserToProto 将GORM模型转换为proto消息 +func convertUserToProto(u *model.SundynixUser) *user.UserInfo { + info := &user.UserInfo{ + Id: u.ID, + TenantId: u.TenantID, + ClientId: u.ClientID, + Name: u.Name, + Account: u.Account, + NickName: u.NickName, + Phone: u.Phone, + SessionKey: u.SessionKey, + UnionId: u.UnionID, + OpenId: u.OpenID, + SaOpenId: u.SaOpenID, + AvatarId: u.AvatarID, + Gender: int32(u.Gender), + CreatedAt: u.CreatedAt.Unix(), + UpdatedAt: u.UpdatedAt.Unix(), + } + if u.LastLoginAt != nil { + info.LastLoginAt = u.LastLoginAt.Unix() + } + return info +} diff --git a/app/user/rpc/internal/logic/getUserByOpenIdLogic.go b/app/user/rpc/internal/logic/getUserByOpenIdLogic.go new file mode 100644 index 0000000..b3f9b2f --- /dev/null +++ b/app/user/rpc/internal/logic/getUserByOpenIdLogic.go @@ -0,0 +1,45 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/user/model" + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "gorm.io/gorm" +) + +type GetUserByOpenIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserByOpenIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByOpenIdLogic { + return &GetUserByOpenIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 根据OpenId获取用户信息 +func (l *GetUserByOpenIdLogic) GetUserByOpenId(in *user.GetUserByOpenIdReq) (*user.GetUserByOpenIdResp, error) { + var u model.SundynixUser + err := l.svcCtx.DB.Where("open_id = ?", in.OpenId).First(&u).Error + if err != nil { + if err == gorm.ErrRecordNotFound { + return nil, status.Error(codes.NotFound, "用户不存在") + } + l.Errorf("查询用户失败: %v", err) + return nil, status.Error(codes.Internal, "查询用户失败") + } + + return &user.GetUserByOpenIdResp{ + User: convertUserToProto(&u), + }, nil +} diff --git a/app/user/rpc/internal/logic/updateUserLogic.go b/app/user/rpc/internal/logic/updateUserLogic.go new file mode 100644 index 0000000..045e499 --- /dev/null +++ b/app/user/rpc/internal/logic/updateUserLogic.go @@ -0,0 +1,64 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/user/model" + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/logx" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type UpdateUserLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserLogic { + return &UpdateUserLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 更新用户信息 +func (l *UpdateUserLogic) UpdateUser(in *user.UpdateUserReq) (*user.CommonResp, error) { + var u model.SundynixUser + if err := l.svcCtx.DB.Where("id = ?", in.Id).First(&u).Error; err != nil { + return nil, status.Error(codes.NotFound, "用户不存在") + } + + updates := map[string]interface{}{} + if in.Name != "" { + updates["name"] = in.Name + } + if in.Account != "" { + updates["account"] = in.Account + } + if in.Phone != "" { + updates["phone"] = in.Phone + } + if in.AvatarId != "" { + updates["avatar_id"] = in.AvatarId + } + if in.NickName != "" { + updates["nick_name"] = in.NickName + } + + if len(updates) > 0 { + if err := l.svcCtx.DB.Model(&u).Updates(updates).Error; err != nil { + l.Errorf("更新用户失败: %v", err) + return nil, status.Error(codes.Internal, "更新用户失败") + } + } + + return &user.CommonResp{ + Code: 200, + Msg: "更新成功", + }, nil +} diff --git a/app/user/rpc/internal/logic/verifyTokenLogic.go b/app/user/rpc/internal/logic/verifyTokenLogic.go new file mode 100644 index 0000000..e954f3c --- /dev/null +++ b/app/user/rpc/internal/logic/verifyTokenLogic.go @@ -0,0 +1,52 @@ +package logic + +import ( + "context" + + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type VerifyTokenLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewVerifyTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VerifyTokenLogic { + return &VerifyTokenLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 验证Token有效性 +func (l *VerifyTokenLogic) VerifyToken(in *user.VerifyTokenReq) (*user.VerifyTokenResp, error) { + claims, err := l.svcCtx.JWT.ParseToken(in.Token) + if err != nil { + return &user.VerifyTokenResp{ + Valid: false, + }, nil + } + + // 检查Redis黑名单 + if l.svcCtx.Redis != nil { + blacklistKey := "jwt:blacklist:" + claims.BaseClaims.ID + val, _ := l.svcCtx.Redis.Get(l.ctx, blacklistKey).Result() + if val == in.Token { + return &user.VerifyTokenResp{ + Valid: false, + }, nil + } + } + + return &user.VerifyTokenResp{ + Valid: true, + UserId: claims.BaseClaims.ID, + Account: claims.BaseClaims.Account, + ExpiresAt: claims.ExpiresAt.Unix(), + }, nil +} diff --git a/app/user/rpc/internal/server/userServiceServer.go b/app/user/rpc/internal/server/userServiceServer.go new file mode 100644 index 0000000..e598f09 --- /dev/null +++ b/app/user/rpc/internal/server/userServiceServer.go @@ -0,0 +1,54 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: user.proto + +package server + +import ( + "context" + + "sundynix-micro-go/app/user/rpc/internal/logic" + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" +) + +type UserServiceServer struct { + svcCtx *svc.ServiceContext + user.UnimplementedUserServiceServer +} + +func NewUserServiceServer(svcCtx *svc.ServiceContext) *UserServiceServer { + return &UserServiceServer{ + svcCtx: svcCtx, + } +} + +// 根据ID获取用户信息 +func (s *UserServiceServer) GetUserById(ctx context.Context, in *user.GetUserByIdReq) (*user.GetUserByIdResp, error) { + l := logic.NewGetUserByIdLogic(ctx, s.svcCtx) + return l.GetUserById(in) +} + +// 根据OpenId获取用户信息 +func (s *UserServiceServer) GetUserByOpenId(ctx context.Context, in *user.GetUserByOpenIdReq) (*user.GetUserByOpenIdResp, error) { + l := logic.NewGetUserByOpenIdLogic(ctx, s.svcCtx) + return l.GetUserByOpenId(in) +} + +// 验证Token有效性 +func (s *UserServiceServer) VerifyToken(ctx context.Context, in *user.VerifyTokenReq) (*user.VerifyTokenResp, error) { + l := logic.NewVerifyTokenLogic(ctx, s.svcCtx) + return l.VerifyToken(in) +} + +// 创建用户 +func (s *UserServiceServer) CreateUser(ctx context.Context, in *user.CreateUserReq) (*user.CreateUserResp, error) { + l := logic.NewCreateUserLogic(ctx, s.svcCtx) + return l.CreateUser(in) +} + +// 更新用户信息 +func (s *UserServiceServer) UpdateUser(ctx context.Context, in *user.UpdateUserReq) (*user.CommonResp, error) { + l := logic.NewUpdateUserLogic(ctx, s.svcCtx) + return l.UpdateUser(in) +} diff --git a/app/user/rpc/internal/svc/serviceContext.go b/app/user/rpc/internal/svc/serviceContext.go new file mode 100644 index 0000000..3f26150 --- /dev/null +++ b/app/user/rpc/internal/svc/serviceContext.go @@ -0,0 +1,52 @@ +package svc + +import ( + "sundynix-micro-go/app/user/model" + "sundynix-micro-go/app/user/rpc/internal/config" + "sundynix-micro-go/common/utils/jwt" + + "github.com/redis/go-redis/v9" + "github.com/zeromicro/go-zero/core/logx" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +type ServiceContext struct { + Config config.Config + DB *gorm.DB + Redis *redis.Client + JWT *jwt.JWT +} + +func NewServiceContext(c config.Config) *ServiceContext { + // 初始化GORM + db, err := gorm.Open(mysql.Open(c.DB.DataSource), &gorm.Config{}) + if err != nil { + logx.Errorf("连接数据库失败: %v", err) + panic(err) + } + + // 自动迁移 + if err := db.AutoMigrate(&model.SundynixUser{}, &model.SundynixUserRole{}); err != nil { + logx.Errorf("数据库迁移失败: %v", err) + } + + // 初始化Redis + var rdb *redis.Client + if len(c.Cache) > 0 { + rdb = redis.NewClient(&redis.Options{ + Addr: c.Cache[0].Host, + Password: c.Cache[0].Pass, + }) + } + + // 初始化JWT + jwtUtil := jwt.NewJWT(c.JwtAuth.AccessSecret) + + return &ServiceContext{ + Config: c, + DB: db, + Redis: rdb, + JWT: jwtUtil, + } +} diff --git a/app/user/rpc/pb/user.proto b/app/user/rpc/pb/user.proto new file mode 100644 index 0000000..b3df709 --- /dev/null +++ b/app/user/rpc/pb/user.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; + +package user; + +option go_package = "./user"; + +// ---------- 通用消息 ---------- + +message CommonResp { + int64 code = 1; + string msg = 2; +} + +// ---------- 用户信息 ---------- + +message UserInfo { + string id = 1; + string tenantId = 2; + string clientId = 3; + string name = 4; + string account = 5; + string nickName = 6; + string phone = 7; + string sessionKey = 8; + string unionId = 9; + string openId = 10; + string saOpenId = 11; + string avatarId = 12; + int32 gender = 13; + string country = 14; + string province = 15; + string city = 16; + string language = 17; + int32 isVip = 18; + int64 vipExpireAt = 19; + string lastLoginIp = 20; + int64 lastLoginAt = 21; + int64 createdAt = 22; + int64 updatedAt = 23; + string avatarUrl = 24; +} + +// ---------- 请求/响应消息 ---------- + +message GetUserByIdReq { + string id = 1; +} + +message GetUserByIdResp { + UserInfo user = 1; +} + +message GetUserByOpenIdReq { + string openId = 1; +} + +message GetUserByOpenIdResp { + UserInfo user = 1; +} + +message VerifyTokenReq { + string token = 1; +} + +message VerifyTokenResp { + bool valid = 1; + string userId = 2; + string account = 3; + int64 expiresAt = 4; +} + +message CreateUserReq { + string name = 1; + string openId = 2; + string sessionKey = 3; + string clientId = 4; + string phone = 5; +} + +message CreateUserResp { + UserInfo user = 1; +} + +message UpdateUserReq { + string id = 1; + string name = 2; + string account = 3; + string phone = 4; + string avatarId = 5; + string nickName = 6; +} + +// ---------- 服务定义 ---------- + +service UserService { + // 根据ID获取用户信息 + rpc GetUserById(GetUserByIdReq) returns (GetUserByIdResp); + // 根据OpenId获取用户信息 + rpc GetUserByOpenId(GetUserByOpenIdReq) returns (GetUserByOpenIdResp); + // 验证Token有效性 + rpc VerifyToken(VerifyTokenReq) returns (VerifyTokenResp); + // 创建用户 + rpc CreateUser(CreateUserReq) returns (CreateUserResp); + // 更新用户信息 + rpc UpdateUser(UpdateUserReq) returns (CommonResp); +} diff --git a/app/user/rpc/user.go b/app/user/rpc/user.go new file mode 100644 index 0000000..29eef58 --- /dev/null +++ b/app/user/rpc/user.go @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + "sundynix-micro-go/app/user/rpc/internal/config" + "sundynix-micro-go/app/user/rpc/internal/server" + "sundynix-micro-go/app/user/rpc/internal/svc" + "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/user.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + user.RegisterUserServiceServer(grpcServer, server.NewUserServiceServer(ctx)) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/app/user/rpc/user/user.pb.go b/app/user/rpc/user/user.pb.go new file mode 100644 index 0000000..6ba5997 --- /dev/null +++ b/app/user/rpc/user/user.pb.go @@ -0,0 +1,943 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: pb/user.proto + +package user + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CommonResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CommonResp) Reset() { + *x = CommonResp{} + mi := &file_pb_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CommonResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommonResp) ProtoMessage() {} + +func (x *CommonResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead. +func (*CommonResp) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{0} +} + +func (x *CommonResp) GetCode() int64 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *CommonResp) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +type UserInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + TenantId string `protobuf:"bytes,2,opt,name=tenantId,proto3" json:"tenantId,omitempty"` + ClientId string `protobuf:"bytes,3,opt,name=clientId,proto3" json:"clientId,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Account string `protobuf:"bytes,5,opt,name=account,proto3" json:"account,omitempty"` + NickName string `protobuf:"bytes,6,opt,name=nickName,proto3" json:"nickName,omitempty"` + Phone string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty"` + SessionKey string `protobuf:"bytes,8,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"` + UnionId string `protobuf:"bytes,9,opt,name=unionId,proto3" json:"unionId,omitempty"` + OpenId string `protobuf:"bytes,10,opt,name=openId,proto3" json:"openId,omitempty"` + SaOpenId string `protobuf:"bytes,11,opt,name=saOpenId,proto3" json:"saOpenId,omitempty"` + AvatarId string `protobuf:"bytes,12,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + Gender int32 `protobuf:"varint,13,opt,name=gender,proto3" json:"gender,omitempty"` + Country string `protobuf:"bytes,14,opt,name=country,proto3" json:"country,omitempty"` + Province string `protobuf:"bytes,15,opt,name=province,proto3" json:"province,omitempty"` + City string `protobuf:"bytes,16,opt,name=city,proto3" json:"city,omitempty"` + Language string `protobuf:"bytes,17,opt,name=language,proto3" json:"language,omitempty"` + IsVip int32 `protobuf:"varint,18,opt,name=isVip,proto3" json:"isVip,omitempty"` + VipExpireAt int64 `protobuf:"varint,19,opt,name=vipExpireAt,proto3" json:"vipExpireAt,omitempty"` + LastLoginIp string `protobuf:"bytes,20,opt,name=lastLoginIp,proto3" json:"lastLoginIp,omitempty"` + LastLoginAt int64 `protobuf:"varint,21,opt,name=lastLoginAt,proto3" json:"lastLoginAt,omitempty"` + CreatedAt int64 `protobuf:"varint,22,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UpdatedAt int64 `protobuf:"varint,23,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` + AvatarUrl string `protobuf:"bytes,24,opt,name=avatarUrl,proto3" json:"avatarUrl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserInfo) Reset() { + *x = UserInfo{} + mi := &file_pb_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserInfo) ProtoMessage() {} + +func (x *UserInfo) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserInfo.ProtoReflect.Descriptor instead. +func (*UserInfo) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{1} +} + +func (x *UserInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UserInfo) GetTenantId() string { + if x != nil { + return x.TenantId + } + return "" +} + +func (x *UserInfo) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *UserInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserInfo) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *UserInfo) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +func (x *UserInfo) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *UserInfo) GetSessionKey() string { + if x != nil { + return x.SessionKey + } + return "" +} + +func (x *UserInfo) GetUnionId() string { + if x != nil { + return x.UnionId + } + return "" +} + +func (x *UserInfo) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +func (x *UserInfo) GetSaOpenId() string { + if x != nil { + return x.SaOpenId + } + return "" +} + +func (x *UserInfo) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +func (x *UserInfo) GetGender() int32 { + if x != nil { + return x.Gender + } + return 0 +} + +func (x *UserInfo) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *UserInfo) GetProvince() string { + if x != nil { + return x.Province + } + return "" +} + +func (x *UserInfo) GetCity() string { + if x != nil { + return x.City + } + return "" +} + +func (x *UserInfo) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +func (x *UserInfo) GetIsVip() int32 { + if x != nil { + return x.IsVip + } + return 0 +} + +func (x *UserInfo) GetVipExpireAt() int64 { + if x != nil { + return x.VipExpireAt + } + return 0 +} + +func (x *UserInfo) GetLastLoginIp() string { + if x != nil { + return x.LastLoginIp + } + return "" +} + +func (x *UserInfo) GetLastLoginAt() int64 { + if x != nil { + return x.LastLoginAt + } + return 0 +} + +func (x *UserInfo) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *UserInfo) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +func (x *UserInfo) GetAvatarUrl() string { + if x != nil { + return x.AvatarUrl + } + return "" +} + +type GetUserByIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByIdReq) Reset() { + *x = GetUserByIdReq{} + mi := &file_pb_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByIdReq) ProtoMessage() {} + +func (x *GetUserByIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByIdReq.ProtoReflect.Descriptor instead. +func (*GetUserByIdReq) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserByIdReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetUserByIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByIdResp) Reset() { + *x = GetUserByIdResp{} + mi := &file_pb_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByIdResp) ProtoMessage() {} + +func (x *GetUserByIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByIdResp.ProtoReflect.Descriptor instead. +func (*GetUserByIdResp) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUserByIdResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type GetUserByOpenIdReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + OpenId string `protobuf:"bytes,1,opt,name=openId,proto3" json:"openId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByOpenIdReq) Reset() { + *x = GetUserByOpenIdReq{} + mi := &file_pb_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByOpenIdReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByOpenIdReq) ProtoMessage() {} + +func (x *GetUserByOpenIdReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByOpenIdReq.ProtoReflect.Descriptor instead. +func (*GetUserByOpenIdReq) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{4} +} + +func (x *GetUserByOpenIdReq) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +type GetUserByOpenIdResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserByOpenIdResp) Reset() { + *x = GetUserByOpenIdResp{} + mi := &file_pb_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserByOpenIdResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByOpenIdResp) ProtoMessage() {} + +func (x *GetUserByOpenIdResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserByOpenIdResp.ProtoReflect.Descriptor instead. +func (*GetUserByOpenIdResp) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{5} +} + +func (x *GetUserByOpenIdResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type VerifyTokenReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyTokenReq) Reset() { + *x = VerifyTokenReq{} + mi := &file_pb_user_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyTokenReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyTokenReq) ProtoMessage() {} + +func (x *VerifyTokenReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyTokenReq.ProtoReflect.Descriptor instead. +func (*VerifyTokenReq) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{6} +} + +func (x *VerifyTokenReq) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type VerifyTokenResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` + ExpiresAt int64 `protobuf:"varint,4,opt,name=expiresAt,proto3" json:"expiresAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VerifyTokenResp) Reset() { + *x = VerifyTokenResp{} + mi := &file_pb_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VerifyTokenResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyTokenResp) ProtoMessage() {} + +func (x *VerifyTokenResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyTokenResp.ProtoReflect.Descriptor instead. +func (*VerifyTokenResp) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{7} +} + +func (x *VerifyTokenResp) GetValid() bool { + if x != nil { + return x.Valid + } + return false +} + +func (x *VerifyTokenResp) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *VerifyTokenResp) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *VerifyTokenResp) GetExpiresAt() int64 { + if x != nil { + return x.ExpiresAt + } + return 0 +} + +type CreateUserReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OpenId string `protobuf:"bytes,2,opt,name=openId,proto3" json:"openId,omitempty"` + SessionKey string `protobuf:"bytes,3,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"` + ClientId string `protobuf:"bytes,4,opt,name=clientId,proto3" json:"clientId,omitempty"` + Phone string `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserReq) Reset() { + *x = CreateUserReq{} + mi := &file_pb_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserReq) ProtoMessage() {} + +func (x *CreateUserReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead. +func (*CreateUserReq) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{8} +} + +func (x *CreateUserReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateUserReq) GetOpenId() string { + if x != nil { + return x.OpenId + } + return "" +} + +func (x *CreateUserReq) GetSessionKey() string { + if x != nil { + return x.SessionKey + } + return "" +} + +func (x *CreateUserReq) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *CreateUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +type CreateUserResp struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserResp) Reset() { + *x = CreateUserResp{} + mi := &file_pb_user_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserResp) ProtoMessage() {} + +func (x *CreateUserResp) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserResp.ProtoReflect.Descriptor instead. +func (*CreateUserResp) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{9} +} + +func (x *CreateUserResp) GetUser() *UserInfo { + if x != nil { + return x.User + } + return nil +} + +type UpdateUserReq struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` + Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"` + AvatarId string `protobuf:"bytes,5,opt,name=avatarId,proto3" json:"avatarId,omitempty"` + NickName string `protobuf:"bytes,6,opt,name=nickName,proto3" json:"nickName,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserReq) Reset() { + *x = UpdateUserReq{} + mi := &file_pb_user_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserReq) ProtoMessage() {} + +func (x *UpdateUserReq) ProtoReflect() protoreflect.Message { + mi := &file_pb_user_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead. +func (*UpdateUserReq) Descriptor() ([]byte, []int) { + return file_pb_user_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdateUserReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateUserReq) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateUserReq) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *UpdateUserReq) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *UpdateUserReq) GetAvatarId() string { + if x != nil { + return x.AvatarId + } + return "" +} + +func (x *UpdateUserReq) GetNickName() string { + if x != nil { + return x.NickName + } + return "" +} + +var File_pb_user_proto protoreflect.FileDescriptor + +const file_pb_user_proto_rawDesc = "" + + "\n" + + "\rpb/user.proto\x12\x04user\"2\n" + + "\n" + + "CommonResp\x12\x12\n" + + "\x04code\x18\x01 \x01(\x03R\x04code\x12\x10\n" + + "\x03msg\x18\x02 \x01(\tR\x03msg\"\x90\x05\n" + + "\bUserInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + + "\btenantId\x18\x02 \x01(\tR\btenantId\x12\x1a\n" + + "\bclientId\x18\x03 \x01(\tR\bclientId\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x12\x18\n" + + "\aaccount\x18\x05 \x01(\tR\aaccount\x12\x1a\n" + + "\bnickName\x18\x06 \x01(\tR\bnickName\x12\x14\n" + + "\x05phone\x18\a \x01(\tR\x05phone\x12\x1e\n" + + "\n" + + "sessionKey\x18\b \x01(\tR\n" + + "sessionKey\x12\x18\n" + + "\aunionId\x18\t \x01(\tR\aunionId\x12\x16\n" + + "\x06openId\x18\n" + + " \x01(\tR\x06openId\x12\x1a\n" + + "\bsaOpenId\x18\v \x01(\tR\bsaOpenId\x12\x1a\n" + + "\bavatarId\x18\f \x01(\tR\bavatarId\x12\x16\n" + + "\x06gender\x18\r \x01(\x05R\x06gender\x12\x18\n" + + "\acountry\x18\x0e \x01(\tR\acountry\x12\x1a\n" + + "\bprovince\x18\x0f \x01(\tR\bprovince\x12\x12\n" + + "\x04city\x18\x10 \x01(\tR\x04city\x12\x1a\n" + + "\blanguage\x18\x11 \x01(\tR\blanguage\x12\x14\n" + + "\x05isVip\x18\x12 \x01(\x05R\x05isVip\x12 \n" + + "\vvipExpireAt\x18\x13 \x01(\x03R\vvipExpireAt\x12 \n" + + "\vlastLoginIp\x18\x14 \x01(\tR\vlastLoginIp\x12 \n" + + "\vlastLoginAt\x18\x15 \x01(\x03R\vlastLoginAt\x12\x1c\n" + + "\tcreatedAt\x18\x16 \x01(\x03R\tcreatedAt\x12\x1c\n" + + "\tupdatedAt\x18\x17 \x01(\x03R\tupdatedAt\x12\x1c\n" + + "\tavatarUrl\x18\x18 \x01(\tR\tavatarUrl\" \n" + + "\x0eGetUserByIdReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"5\n" + + "\x0fGetUserByIdResp\x12\"\n" + + "\x04user\x18\x01 \x01(\v2\x0e.user.UserInfoR\x04user\",\n" + + "\x12GetUserByOpenIdReq\x12\x16\n" + + "\x06openId\x18\x01 \x01(\tR\x06openId\"9\n" + + "\x13GetUserByOpenIdResp\x12\"\n" + + "\x04user\x18\x01 \x01(\v2\x0e.user.UserInfoR\x04user\"&\n" + + "\x0eVerifyTokenReq\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\"w\n" + + "\x0fVerifyTokenResp\x12\x14\n" + + "\x05valid\x18\x01 \x01(\bR\x05valid\x12\x16\n" + + "\x06userId\x18\x02 \x01(\tR\x06userId\x12\x18\n" + + "\aaccount\x18\x03 \x01(\tR\aaccount\x12\x1c\n" + + "\texpiresAt\x18\x04 \x01(\x03R\texpiresAt\"\x8d\x01\n" + + "\rCreateUserReq\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06openId\x18\x02 \x01(\tR\x06openId\x12\x1e\n" + + "\n" + + "sessionKey\x18\x03 \x01(\tR\n" + + "sessionKey\x12\x1a\n" + + "\bclientId\x18\x04 \x01(\tR\bclientId\x12\x14\n" + + "\x05phone\x18\x05 \x01(\tR\x05phone\"4\n" + + "\x0eCreateUserResp\x12\"\n" + + "\x04user\x18\x01 \x01(\v2\x0e.user.UserInfoR\x04user\"\x9b\x01\n" + + "\rUpdateUserReq\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n" + + "\aaccount\x18\x03 \x01(\tR\aaccount\x12\x14\n" + + "\x05phone\x18\x04 \x01(\tR\x05phone\x12\x1a\n" + + "\bavatarId\x18\x05 \x01(\tR\bavatarId\x12\x1a\n" + + "\bnickName\x18\x06 \x01(\tR\bnickName2\xbb\x02\n" + + "\vUserService\x12:\n" + + "\vGetUserById\x12\x14.user.GetUserByIdReq\x1a\x15.user.GetUserByIdResp\x12F\n" + + "\x0fGetUserByOpenId\x12\x18.user.GetUserByOpenIdReq\x1a\x19.user.GetUserByOpenIdResp\x12:\n" + + "\vVerifyToken\x12\x14.user.VerifyTokenReq\x1a\x15.user.VerifyTokenResp\x127\n" + + "\n" + + "CreateUser\x12\x13.user.CreateUserReq\x1a\x14.user.CreateUserResp\x123\n" + + "\n" + + "UpdateUser\x12\x13.user.UpdateUserReq\x1a\x10.user.CommonRespB\bZ\x06./userb\x06proto3" + +var ( + file_pb_user_proto_rawDescOnce sync.Once + file_pb_user_proto_rawDescData []byte +) + +func file_pb_user_proto_rawDescGZIP() []byte { + file_pb_user_proto_rawDescOnce.Do(func() { + file_pb_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pb_user_proto_rawDesc), len(file_pb_user_proto_rawDesc))) + }) + return file_pb_user_proto_rawDescData +} + +var file_pb_user_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_pb_user_proto_goTypes = []any{ + (*CommonResp)(nil), // 0: user.CommonResp + (*UserInfo)(nil), // 1: user.UserInfo + (*GetUserByIdReq)(nil), // 2: user.GetUserByIdReq + (*GetUserByIdResp)(nil), // 3: user.GetUserByIdResp + (*GetUserByOpenIdReq)(nil), // 4: user.GetUserByOpenIdReq + (*GetUserByOpenIdResp)(nil), // 5: user.GetUserByOpenIdResp + (*VerifyTokenReq)(nil), // 6: user.VerifyTokenReq + (*VerifyTokenResp)(nil), // 7: user.VerifyTokenResp + (*CreateUserReq)(nil), // 8: user.CreateUserReq + (*CreateUserResp)(nil), // 9: user.CreateUserResp + (*UpdateUserReq)(nil), // 10: user.UpdateUserReq +} +var file_pb_user_proto_depIdxs = []int32{ + 1, // 0: user.GetUserByIdResp.user:type_name -> user.UserInfo + 1, // 1: user.GetUserByOpenIdResp.user:type_name -> user.UserInfo + 1, // 2: user.CreateUserResp.user:type_name -> user.UserInfo + 2, // 3: user.UserService.GetUserById:input_type -> user.GetUserByIdReq + 4, // 4: user.UserService.GetUserByOpenId:input_type -> user.GetUserByOpenIdReq + 6, // 5: user.UserService.VerifyToken:input_type -> user.VerifyTokenReq + 8, // 6: user.UserService.CreateUser:input_type -> user.CreateUserReq + 10, // 7: user.UserService.UpdateUser:input_type -> user.UpdateUserReq + 3, // 8: user.UserService.GetUserById:output_type -> user.GetUserByIdResp + 5, // 9: user.UserService.GetUserByOpenId:output_type -> user.GetUserByOpenIdResp + 7, // 10: user.UserService.VerifyToken:output_type -> user.VerifyTokenResp + 9, // 11: user.UserService.CreateUser:output_type -> user.CreateUserResp + 0, // 12: user.UserService.UpdateUser:output_type -> user.CommonResp + 8, // [8:13] is the sub-list for method output_type + 3, // [3:8] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_pb_user_proto_init() } +func file_pb_user_proto_init() { + if File_pb_user_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_pb_user_proto_rawDesc), len(file_pb_user_proto_rawDesc)), + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pb_user_proto_goTypes, + DependencyIndexes: file_pb_user_proto_depIdxs, + MessageInfos: file_pb_user_proto_msgTypes, + }.Build() + File_pb_user_proto = out.File + file_pb_user_proto_goTypes = nil + file_pb_user_proto_depIdxs = nil +} diff --git a/app/user/rpc/user/user_grpc.pb.go b/app/user/rpc/user/user_grpc.pb.go new file mode 100644 index 0000000..cfb82a0 --- /dev/null +++ b/app/user/rpc/user/user_grpc.pb.go @@ -0,0 +1,283 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v7.34.1 +// source: pb/user.proto + +package user + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + UserService_GetUserById_FullMethodName = "/user.UserService/GetUserById" + UserService_GetUserByOpenId_FullMethodName = "/user.UserService/GetUserByOpenId" + UserService_VerifyToken_FullMethodName = "/user.UserService/VerifyToken" + UserService_CreateUser_FullMethodName = "/user.UserService/CreateUser" + UserService_UpdateUser_FullMethodName = "/user.UserService/UpdateUser" +) + +// UserServiceClient is the client API for UserService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type UserServiceClient interface { + // 根据ID获取用户信息 + GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) + // 根据OpenId获取用户信息 + GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) + // 验证Token有效性 + VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) + // 创建用户 + CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) + // 更新用户信息 + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) +} + +type userServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { + return &userServiceClient{cc} +} + +func (c *userServiceClient) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserByIdResp) + err := c.cc.Invoke(ctx, UserService_GetUserById_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserByOpenIdResp) + err := c.cc.Invoke(ctx, UserService_GetUserByOpenId_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(VerifyTokenResp) + err := c.cc.Invoke(ctx, UserService_VerifyToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateUserResp) + err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CommonResp) + err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserServiceServer is the server API for UserService service. +// All implementations must embed UnimplementedUserServiceServer +// for forward compatibility. +type UserServiceServer interface { + // 根据ID获取用户信息 + GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdResp, error) + // 根据OpenId获取用户信息 + GetUserByOpenId(context.Context, *GetUserByOpenIdReq) (*GetUserByOpenIdResp, error) + // 验证Token有效性 + VerifyToken(context.Context, *VerifyTokenReq) (*VerifyTokenResp, error) + // 创建用户 + CreateUser(context.Context, *CreateUserReq) (*CreateUserResp, error) + // 更新用户信息 + UpdateUser(context.Context, *UpdateUserReq) (*CommonResp, error) + mustEmbedUnimplementedUserServiceServer() +} + +// UnimplementedUserServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedUserServiceServer struct{} + +func (UnimplementedUserServiceServer) GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserById not implemented") +} +func (UnimplementedUserServiceServer) GetUserByOpenId(context.Context, *GetUserByOpenIdReq) (*GetUserByOpenIdResp, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserByOpenId not implemented") +} +func (UnimplementedUserServiceServer) VerifyToken(context.Context, *VerifyTokenReq) (*VerifyTokenResp, error) { + return nil, status.Error(codes.Unimplemented, "method VerifyToken not implemented") +} +func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserReq) (*CreateUserResp, error) { + return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserReq) (*CommonResp, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} +func (UnimplementedUserServiceServer) testEmbeddedByValue() {} + +// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserServiceServer will +// result in compilation errors. +type UnsafeUserServiceServer interface { + mustEmbedUnimplementedUserServiceServer() +} + +func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + // If the following call panics, it indicates UnimplementedUserServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&UserService_ServiceDesc, srv) +} + +func _UserService_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUserById(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUserById_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUserById(ctx, req.(*GetUserByIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUserByOpenId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByOpenIdReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUserByOpenId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUserByOpenId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUserByOpenId(ctx, req.(*GetUserByOpenIdReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_VerifyToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyTokenReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).VerifyToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_VerifyToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).VerifyToken(ctx, req.(*VerifyTokenReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CreateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_UpdateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserReq)) + } + return interceptor(ctx, in, info, handler) +} + +// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "user.UserService", + HandlerType: (*UserServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetUserById", + Handler: _UserService_GetUserById_Handler, + }, + { + MethodName: "GetUserByOpenId", + Handler: _UserService_GetUserByOpenId_Handler, + }, + { + MethodName: "VerifyToken", + Handler: _UserService_VerifyToken_Handler, + }, + { + MethodName: "CreateUser", + Handler: _UserService_CreateUser_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _UserService_UpdateUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pb/user.proto", +} diff --git a/app/user/rpc/userservice/userService.go b/app/user/rpc/userservice/userService.go new file mode 100644 index 0000000..231017b --- /dev/null +++ b/app/user/rpc/userservice/userService.go @@ -0,0 +1,81 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.10.1 +// Source: user.proto + +package userservice + +import ( + "context" + + "sundynix-micro-go/app/user/rpc/user" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + CommonResp = user.CommonResp + CreateUserReq = user.CreateUserReq + CreateUserResp = user.CreateUserResp + GetUserByIdReq = user.GetUserByIdReq + GetUserByIdResp = user.GetUserByIdResp + GetUserByOpenIdReq = user.GetUserByOpenIdReq + GetUserByOpenIdResp = user.GetUserByOpenIdResp + UpdateUserReq = user.UpdateUserReq + UserInfo = user.UserInfo + VerifyTokenReq = user.VerifyTokenReq + VerifyTokenResp = user.VerifyTokenResp + + UserService interface { + // 根据ID获取用户信息 + GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) + // 根据OpenId获取用户信息 + GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) + // 验证Token有效性 + VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) + // 创建用户 + CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) + // 更新用户信息 + UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) + } + + defaultUserService struct { + cli zrpc.Client + } +) + +func NewUserService(cli zrpc.Client) UserService { + return &defaultUserService{ + cli: cli, + } +} + +// 根据ID获取用户信息 +func (m *defaultUserService) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdResp, error) { + client := user.NewUserServiceClient(m.cli.Conn()) + return client.GetUserById(ctx, in, opts...) +} + +// 根据OpenId获取用户信息 +func (m *defaultUserService) GetUserByOpenId(ctx context.Context, in *GetUserByOpenIdReq, opts ...grpc.CallOption) (*GetUserByOpenIdResp, error) { + client := user.NewUserServiceClient(m.cli.Conn()) + return client.GetUserByOpenId(ctx, in, opts...) +} + +// 验证Token有效性 +func (m *defaultUserService) VerifyToken(ctx context.Context, in *VerifyTokenReq, opts ...grpc.CallOption) (*VerifyTokenResp, error) { + client := user.NewUserServiceClient(m.cli.Conn()) + return client.VerifyToken(ctx, in, opts...) +} + +// 创建用户 +func (m *defaultUserService) CreateUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error) { + client := user.NewUserServiceClient(m.cli.Conn()) + return client.CreateUser(ctx, in, opts...) +} + +// 更新用户信息 +func (m *defaultUserService) UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*CommonResp, error) { + client := user.NewUserServiceClient(m.cli.Conn()) + return client.UpdateUser(ctx, in, opts...) +} diff --git a/common/consts/consts.go b/common/consts/consts.go new file mode 100644 index 0000000..c1c207c --- /dev/null +++ b/common/consts/consts.go @@ -0,0 +1,10 @@ +package consts + +// 表名前缀 +const TablePrefix = "sundynix_" + +// Redis Key前缀 +const ( + RedisKeyJWTBlacklist = "jwt:blacklist:" // JWT黑名单 + RedisKeyUserToken = "user:token:" // 用户Token +) diff --git a/common/model/base_model.go b/common/model/base_model.go new file mode 100644 index 0000000..e9ffaea --- /dev/null +++ b/common/model/base_model.go @@ -0,0 +1,28 @@ +package model + +import ( + "sundynix-micro-go/common/utils/uniqueid" + "time" + + "gorm.io/gorm" +) + +// BaseModel 基础模型,所有表的公共字段 +type BaseModel struct { + ID string `gorm:"size:50;primaryKey" json:"id"` + CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime"` + UpdatedAt time.Time `json:"updatedAt" gorm:"autoCreateTime;autoUpdateTime"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` +} + +// BeforeCreate 创建前自动生成雪花ID +func (m *BaseModel) BeforeCreate(db *gorm.DB) (err error) { + db.Statement.SetColumn("id", uniqueid.GenerateID()) + return +} + +// BeforeUpdate 更新前自动更新时间 +func (m *BaseModel) BeforeUpdate(db *gorm.DB) (err error) { + db.Statement.SetColumn("updated_at", time.Now()) + return +} diff --git a/common/response/response.go b/common/response/response.go new file mode 100644 index 0000000..b21990f --- /dev/null +++ b/common/response/response.go @@ -0,0 +1,67 @@ +package response + +import ( + "encoding/json" + "net/http" +) + +// Body 统一响应体 +type Body struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data,omitempty"` +} + +func writeJSON(w http.ResponseWriter, body *Body) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(http.StatusOK) + _ = json.NewEncoder(w).Encode(body) +} + +// OkWithData 成功响应(带数据) +func OkWithData(w http.ResponseWriter, data interface{}) { + writeJSON(w, &Body{Code: 200, Msg: "success", Data: data}) +} + +// Ok 成功响应(无数据) +func Ok(w http.ResponseWriter) { + writeJSON(w, &Body{Code: 200, Msg: "success"}) +} + +// OkWithMsg 成功响应(自定义消息) +func OkWithMsg(w http.ResponseWriter, msg string) { + writeJSON(w, &Body{Code: 200, Msg: msg}) +} + +// Fail 失败响应 +func Fail(w http.ResponseWriter, msg string) { + writeJSON(w, &Body{Code: 400, Msg: msg}) +} + +// FailWithCode 失败响应(自定义错误码) +func FailWithCode(w http.ResponseWriter, code int, msg string) { + writeJSON(w, &Body{Code: code, Msg: msg}) +} + +// NoAuth 未授权响应 +func NoAuth(w http.ResponseWriter, msg string) { + writeJSON(w, &Body{Code: 401, Msg: msg}) +} + +// PageResult 分页结果 +type PageResult struct { + List interface{} `json:"list"` + Total int64 `json:"total"` + Current int `json:"current"` + Size int `json:"size"` +} + +// OkWithPage 分页成功响应 +func OkWithPage(w http.ResponseWriter, list interface{}, total int64, current, size int) { + OkWithData(w, PageResult{ + List: list, + Total: total, + Current: current, + Size: size, + }) +} diff --git a/common/utils/hash/hash.go b/common/utils/hash/hash.go new file mode 100644 index 0000000..e37e7fd --- /dev/null +++ b/common/utils/hash/hash.go @@ -0,0 +1,27 @@ +package hash + +import ( + "crypto/md5" + "encoding/hex" + + "golang.org/x/crypto/bcrypt" +) + +// BcryptHash 使用bcrypt对密码进行加密 +func BcryptHash(password string) string { + bytes, _ := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) + return string(bytes) +} + +// BcryptCheck 对比明文密码和数据库的哈希值 +func BcryptCheck(password, hash string) bool { + err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) + return err == nil +} + +// MD5 计算MD5哈希值 +func MD5(str []byte) string { + h := md5.New() + h.Write(str) + return hex.EncodeToString(h.Sum(nil)) +} diff --git a/common/utils/jwt/jwt.go b/common/utils/jwt/jwt.go new file mode 100644 index 0000000..9313772 --- /dev/null +++ b/common/utils/jwt/jwt.go @@ -0,0 +1,97 @@ +package jwt + +import ( + "errors" + "time" + + jwtv5 "github.com/golang-jwt/jwt/v5" +) + +var ( + ErrTokenValid = errors.New("未知错误") + ErrTokenExpired = errors.New("token已过期") + ErrTokenNotValidYet = errors.New("token尚未激活") + ErrTokenMalformed = errors.New("这不是一个token") + ErrTokenSignatureInvalid = errors.New("无效签名") + ErrTokenInvalid = errors.New("无法处理此token") +) + +// BaseClaims 基础Claims +type BaseClaims struct { + ID string `json:"id"` + Account string `json:"account"` +} + +// CustomClaims 自定义Claims +type CustomClaims struct { + BaseClaims + BufferTime int64 `json:"bufferTime"` + jwtv5.RegisteredClaims +} + +// JWT JWT工具 +type JWT struct { + SigningKey []byte +} + +// NewJWT 创建JWT实例 +func NewJWT(signingKey string) *JWT { + return &JWT{ + SigningKey: []byte(signingKey), + } +} + +// CreateClaims 创建Claims +func (j *JWT) CreateClaims(baseClaims BaseClaims, bufferTime, expiresTime time.Duration, issuer string) CustomClaims { + return CustomClaims{ + BaseClaims: baseClaims, + BufferTime: int64(bufferTime / time.Second), + RegisteredClaims: jwtv5.RegisteredClaims{ + Audience: jwtv5.ClaimStrings{"sundynix"}, + NotBefore: jwtv5.NewNumericDate(time.Now().Add(-1000)), + ExpiresAt: jwtv5.NewNumericDate(time.Now().Add(expiresTime)), + Issuer: issuer, + }, + } +} + +// CreateToken 创建token +func (j *JWT) CreateToken(claims CustomClaims) (string, error) { + token := jwtv5.NewWithClaims(jwtv5.SigningMethodHS256, claims) + return token.SignedString(j.SigningKey) +} + +// ParseToken 解析token +func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error) { + token, err := jwtv5.ParseWithClaims(tokenString, &CustomClaims{}, func(token *jwtv5.Token) (interface{}, error) { + return j.SigningKey, nil + }) + if err != nil { + switch { + case errors.Is(err, jwtv5.ErrTokenExpired): + return nil, ErrTokenExpired + case errors.Is(err, jwtv5.ErrTokenNotValidYet): + return nil, ErrTokenNotValidYet + case errors.Is(err, jwtv5.ErrTokenMalformed): + return nil, ErrTokenMalformed + case errors.Is(err, jwtv5.ErrTokenSignatureInvalid): + return nil, ErrTokenSignatureInvalid + default: + return nil, ErrTokenInvalid + } + } + if token != nil { + if claims, ok := token.Claims.(*CustomClaims); ok && token.Valid { + return claims, nil + } + } + return nil, ErrTokenInvalid +} + +// GetTokenFromHeader 从Authorization头中提取token +func GetTokenFromHeader(authHeader string) string { + if len(authHeader) > 7 && authHeader[:7] == "Bearer " { + return authHeader[7:] + } + return authHeader +} diff --git a/common/utils/uniqueid/uniqueid.go b/common/utils/uniqueid/uniqueid.go new file mode 100644 index 0000000..f0a9576 --- /dev/null +++ b/common/utils/uniqueid/uniqueid.go @@ -0,0 +1,54 @@ +package uniqueid + +import ( + "crypto/rand" + "fmt" + "math/big" + "strings" + "time" + + "github.com/google/uuid" +) + +// GenerateID 生成UUID v1作为主键 +func GenerateID() string { + uuidV1, err := uuid.NewUUID() + if err != nil { + panic(err) + } + return uuidV1.String() +} + +// GenerateName 生成随机用户名 +func GenerateName(prefix string) string { + str := uuid.New().String() + return prefix + str[6:12] +} + +// GenerateRandomCode 生成随机码(如邀请码) +func GenerateRandomCode(length int) string { + const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + var sb strings.Builder + for i := 0; i < length; i++ { + n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset)))) + sb.WriteByte(charset[n.Int64()]) + } + return sb.String() +} + +// GenCodeKey 生成邀请码的Redis Key +func GenCodeKey(userID string) string { + return fmt.Sprintf("code:%s", userID) +} + +// GenOrderNo 生成订单号 +func GenOrderNo() string { + now := time.Now() + timePart := now.Format("20060102150405") + machineID := 1 + pid := now.Nanosecond() % 1000 + businessPart := fmt.Sprintf("%02d%03d%01d", machineID, pid, now.Second()%10) + random1 := fmt.Sprintf("%04d", now.Nanosecond()%10000) + random2 := fmt.Sprintf("%04d", (now.Nanosecond()/10000)%10000) + return timePart + businessPart + random1 + random2 +} diff --git a/docs/API_DOCS.md b/docs/API_DOCS.md new file mode 100644 index 0000000..c2c2b51 --- /dev/null +++ b/docs/API_DOCS.md @@ -0,0 +1,402 @@ +# Sundynix 微服务 API 文档 + +> Base URL 约定: 各服务独立部署,通过 Nginx 统一代理 + +--- + +## 一、用户服务 (user-api) — 端口 9001 + +### 1.1 公开接口(无需鉴权) + +#### POST /api/user/miniLogin — 微信小程序登录 +**请求体:** +```json +{ + "code": "微信wx.login获取的code", + "clientId": "客户端标识(plant/radio)" +} +``` +**响应:** +```json +{ + "code": 200, + "msg": "success", + "data": { + "token": "eyJhbGciOiJIUzI1NiIs...", + "userInfo": { + "id": "uuid", + "name": "用户u278bb", + "nickName": "", + "phone": "", + "openId": "oXxx...", + "avatarId": "", + "gender": 0, + "isVip": 0 + } + } +} +``` + +--- + +#### POST /api/user/loginByPhone — 手机号登录 +**请求体:** +```json +{ + "code": "微信getPhoneNumber获取的code", + "openId": "用户openId", + "clientId": "客户端标识" +} +``` +**响应:** 同 miniLogin + +--- + +#### POST /api/user/login — 账号密码登录 +**请求体:** +```json +{ + "account": "账号", + "password": "密码" +} +``` +**响应:** 同 miniLogin + +--- + +### 1.2 鉴权接口(Header: Authorization: Bearer {token}) + +#### GET /api/user/info — 获取当前用户信息 +**响应:** +```json +{ + "code": 200, + "msg": "success", + "data": { + "userInfo": { /* 用户完整信息 */ } + } +} +``` + +--- + +#### PUT /api/user/update — 更新用户信息 +**请求体:** +```json +{ + "name": "新名字", + "account": "新账号", + "phone": "13800138000", + "avatarId": "文件ID", + "nickName": "昵称" +} +``` + +--- + +#### PUT /api/user/changePassword — 修改密码 +```json +{ "oldPassword": "旧密码", "newPassword": "新密码" } +``` + +--- + +#### POST /api/user/list — 用户列表(管理后台) +```json +{ "current": 1, "pageSize": 10, "account": "", "phone": "" } +``` +**响应:** +```json +{ + "code": 200, + "data": { "list": [], "total": 0, "current": 1, "size": 10 } +} +``` + +--- + +#### DELETE /api/user/delete — 删除用户 +```json +{ "ids": ["id1", "id2"] } +``` + +--- + +#### GET /api/user/location?longitude=116.40&latitude=39.90 — 获取位置 + +#### GET /api/user/weather?adcode=110000 — 获取天气 + +--- + +## 二、文件服务 (file-api) — 端口 9002 + +> 所有接口需要鉴权 + +#### POST /api/file/upload — 上传文件 +**请求:** `multipart/form-data`,字段名 `file` +**响应:** +```json +{ + "code": 200, + "data": { + "id": "文件ID", + "name": "filename.jpg", + "url": "https://res.sundynix.cn/...", + "suffix": "jpg", + "md5": "abc123..." + } +} +``` + +--- + +#### DELETE /api/file/delete — 删除文件 +```json +{ "ids": ["fileId1", "fileId2"] } +``` + +--- + +#### POST /api/file/list — 文件列表 +```json +{ "current": 1, "pageSize": 10, "name": "" } +``` + +--- + +#### GET /api/file/:id — 获取文件详情 + +--- + +## 三、系统服务 (system-api) — 端口 9003 + +> 所有接口需要鉴权 + +### 3.1 客户端管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/sys/client/create | 创建客户端 | +| PUT | /api/sys/client/update | 更新客户端 | +| DELETE | /api/sys/client/delete | 删除客户端 | +| POST | /api/sys/client/list | 客户端列表 | + +### 3.2 角色管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/sys/role/create | 创建角色 | +| PUT | /api/sys/role/update | 更新角色 | +| DELETE | /api/sys/role/delete | 删除角色 | +| POST | /api/sys/role/list | 角色列表 | + +### 3.3 菜单管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/sys/menu/create | 创建菜单 | +| PUT | /api/sys/menu/update | 更新菜单 | +| DELETE | /api/sys/menu/delete | 删除菜单 | +| GET | /api/sys/menu/list | 菜单树形列表 | +| POST | /api/sys/menu/byRole | 根据角色获取菜单 | + +### 3.4 操作日志 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/sys/log/list | 操作日志列表 | +| DELETE | /api/sys/log/delete | 删除日志 | + +### 3.5 字典管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/sys/dict/create | 创建字典 | +| PUT | /api/sys/dict/update | 更新字典 | +| DELETE | /api/sys/dict/delete | 删除字典 | +| POST | /api/sys/dict/list | 字典列表 | + +--- + +## 四、植物服务 (plant-api) — 端口 9004 + +### 4.1 公开接口 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/plant/callback/wechatpay | 微信支付回调 | + +### 4.2 我的植物(需鉴权) +| 方法 | 路径 | 说明 | 请求体示例 | +|------|------|------|-----------| +| POST | /api/plant/my/create | 创建植物 | `{name, plantTime, placement, imgIds[]}` | +| PUT | /api/plant/my/update | 更新植物 | `{id, name, status, ...}` | +| DELETE | /api/plant/my/delete | 删除植物 | `{ids[]}` | +| POST | /api/plant/my/list | 植物列表 | `{current, pageSize, name}` | +| GET | /api/plant/my/:id | 植物详情 | — | +| POST | /api/plant/my/carePlan | 添加养护计划 | `{plantId, name, targetAction, period}` | +| POST | /api/plant/my/careRecord | 添加养护记录 | `{plantId, planId, action}` | +| POST | /api/plant/my/growthRecord | 添加成长记录 | `{plantId, content, imgIds[]}` | + +### 4.3 百科 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/plant/wiki/list | 百科列表 | +| GET | /api/plant/wiki/:id | 百科详情 | +| GET | /api/plant/wiki/class/list | 分类列表 | +| POST | /api/plant/wiki/class/create | 创建分类 | +| POST | /api/plant/wiki/star | 收藏/取消百科 | + +### 4.4 社区帖子 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/plant/post/create | 发布帖子 | +| POST | /api/plant/post/list | 帖子列表 | +| GET | /api/plant/post/:id | 帖子详情 | +| DELETE | /api/plant/post/delete | 删除帖子 | +| POST | /api/plant/post/comment | 评论帖子 | +| POST | /api/plant/post/like | 点赞帖子 | + +### 4.5 其他 +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | /api/plant/topic/list | 话题列表 | +| POST | /api/plant/topic/create | 创建话题 | +| POST | /api/plant/ocr/classify | OCR植物识别 | +| POST | /api/plant/exchange/list | 兑换商品列表 | +| POST | /api/plant/exchange/order | 兑换商品 | +| POST | /api/plant/ai/chat | AI问答 | +| GET | /api/plant/ai/history | 聊天历史 | +| GET | /api/plant/profile/info | 获取用户资料 | +| PUT | /api/plant/profile/update | 更新用户资料 | +| POST | /api/plant/config/level/list | 等级配置列表 | +| POST | /api/plant/config/badge/list | 徽章配置列表 | + +--- + +## 五、电台服务 (radio-api) — 端口 9005 + +### 5.1 公开接口 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/callback/wechatpay | 微信支付回调 | + +### 5.2 分类管理(需鉴权) +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/category/create | 创建分类 | +| PUT | /api/radio/category/update | 更新分类 | +| DELETE | /api/radio/category/delete | 删除分类 | +| POST | /api/radio/category/list | 分类列表 | + +### 5.3 频道管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/channel/create | 创建频道 | +| PUT | /api/radio/channel/update | 更新频道 | +| DELETE | /api/radio/channel/delete | 删除频道 | +| POST | /api/radio/channel/list | 频道列表 | +| GET | /api/radio/channel/:id | 频道详情 | + +### 5.4 节目管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/program/create | 创建节目 | +| PUT | /api/radio/program/update | 更新节目 | +| DELETE | /api/radio/program/delete | 删除节目 | +| POST | /api/radio/program/list | 节目列表 | +| GET | /api/radio/program/:id | 节目详情 | +| POST | /api/radio/program/tts | TTS生成音频 | + +### 5.5 音色管理 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/voice/create | 创建音色 | +| PUT | /api/radio/voice/update | 更新音色 | +| DELETE | /api/radio/voice/delete | 删除音色 | +| POST | /api/radio/voice/list | 音色列表 | + +### 5.6 用户互动 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/interaction/like | 点赞/取消 | +| POST | /api/radio/interaction/favorite | 收藏/取消 | +| POST | /api/radio/interaction/comment | 评论节目 | +| POST | /api/radio/interaction/history | 记录播放历史 | +| POST | /api/radio/interaction/history/list | 播放历史 | +| POST | /api/radio/interaction/favorite/list | 收藏列表 | + +### 5.7 订阅/支付/VIP +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | /api/radio/subscription/list | 我的订阅 | +| POST | /api/radio/pay/create | 创建支付订单 | +| POST | /api/radio/vip/list | VIP配置列表 | +| GET | /api/radio/vip/info | 我的VIP信息 | + +### 5.8 数据分析 +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | /api/radio/analytics/overview | 数据概览 | +| POST | /api/radio/analytics/channel | 频道数据 | +| POST | /api/radio/analytics/user | 用户数据 | + +--- + +## 六、统一规约 + +### 6.1 鉴权方式 +所有需要鉴权的接口,请在请求头中携带: +``` +Authorization: Bearer {token} +``` + +### 6.2 统一响应格式 +```json +{ + "code": 200, // 200成功,400失败,401未授权 + "msg": "success", + "data": {} // 具体数据 +} +``` + +### 6.3 分页请求格式 +```json +{ "current": 1, "pageSize": 10 } +``` + +### 6.4 分页响应格式 +```json +{ + "list": [], + "total": 100, + "current": 1, + "size": 10 +} +``` + +### 6.5 删除请求格式 +```json +{ "ids": ["id1", "id2"] } +``` + +--- + +## 七、数据库设计说明 + +### 7.1 用户扩展表设计 + +基础用户表 `sundynix_user` 只存储**认证和通用信息**(账号、密码、OpenID、手机号等),各业务服务通过扩展表存储业务特有的用户数据: + +``` +sundynix_user (基础) + ├── sundynix_plant_user_profile (植物服务扩展:等级、阳光值、养护统计) + └── sundynix_radio_user_profile (电台服务扩展:VIP状态、VIP到期时间) +``` + +**设计原则:** 新增业务产品时,只需创建新的扩展表,无需修改基础用户表。 + +### 7.2 数据库拆分 + +| 数据库 | 包含的表 | +|--------|---------| +| sundynix_user | sundynix_user, sundynix_user_role | +| sundynix_file | sundynix_oss | +| sundynix_system | sundynix_client, sundynix_role, sundynix_menu, sundynix_role_menu, sundynix_user_role, sundynix_dict, sundynix_operation_record | +| sundynix_plant | sundynix_plant_user_profile, sundynix_my_plant, sundynix_care_plan, sundynix_care_record, sundynix_care_task, sundynix_growth_record, sundynix_wiki, sundynix_wiki_class, sundynix_post, sundynix_post_comment, sundynix_post_like, sundynix_post_topic, sundynix_user_star, sundynix_exchange_item, sundynix_exchange_order, sundynix_level_config, sundynix_badge_config, sundynix_user_badge, sundynix_ai_chat_history | +| sundynix_radio | sundynix_radio_user_profile, sundynix_radio_category, sundynix_radio_channel, sundynix_radio_program, sundynix_radio_voice, sundynix_radio_like, sundynix_radio_favorite, sundynix_radio_comment, sundynix_radio_history, sundynix_radio_subscription, sundynix_radio_subscription_order, sundynix_radio_pay_notify, sundynix_radio_vip_config, sundynix_radio_listen_log | + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..88097d7 --- /dev/null +++ b/go.mod @@ -0,0 +1,118 @@ +module sundynix-micro-go + +go 1.26.2 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 + github.com/google/uuid v1.6.0 + github.com/minio/minio-go/v7 v7.0.100 + github.com/redis/go-redis/v9 v9.18.0 + github.com/zeromicro/go-zero v1.10.1 + golang.org/x/crypto v0.50.0 + google.golang.org/grpc v1.80.0 + google.golang.org/protobuf v1.36.11 + gorm.io/driver/mysql v1.6.0 + gorm.io/gorm v1.31.1 +) + +require ( + filippo.io/edwards25519 v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/go-sql-driver/mysql v1.9.3 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic-models v0.7.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/grafana/pyroscope-go v1.2.8 // indirect + github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.18.2 // indirect + github.com/klauspost/cpuid/v2 v2.2.11 // indirect + github.com/klauspost/crc32 v1.3.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/minio/crc64nvme v1.1.1 // indirect + github.com/minio/md5-simd v1.1.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/openzipkin/zipkin-go v0.4.3 // indirect + github.com/pelletier/go-toml/v2 v2.3.0 // indirect + github.com/philhofer/fwd v1.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.23.2 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.66.1 // indirect + github.com/prometheus/procfs v0.16.1 // indirect + github.com/rs/xid v1.6.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/tinylib/msgp v1.6.1 // indirect + github.com/titanous/json5 v1.0.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.etcd.io/etcd/api/v3 v3.5.21 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.21 // indirect + go.etcd.io/etcd/client/v3 v3.5.21 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/otel v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/zipkin v1.40.0 // indirect + go.opentelemetry.io/otel/metric v1.40.0 // indirect + go.opentelemetry.io/otel/sdk v1.40.0 // indirect + go.opentelemetry.io/otel/trace v1.40.0 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect + go.uber.org/mock v0.6.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + go.uber.org/zap v1.24.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/net v0.52.0 // indirect + golang.org/x/oauth2 v0.34.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/term v0.42.0 // indirect + golang.org/x/text v0.36.0 // indirect + golang.org/x/time v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/api v0.34.3 // indirect + k8s.io/apimachinery v0.34.3 // indirect + k8s.io/client-go v0.34.3 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect + k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..5e690f4 --- /dev/null +++ b/go.sum @@ -0,0 +1,327 @@ +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/alicebob/miniredis/v2 v2.37.0 h1:RheObYW32G1aiJIj81XVt78ZHJpHonHLHW7OLIshq68= +github.com/alicebob/miniredis/v2 v2.37.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= +github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= +github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= +github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grafana/pyroscope-go v1.2.8 h1:UvCwIhlx9DeV7F6TW/z8q1Mi4PIm3vuUJ2ZlCEvmA4M= +github.com/grafana/pyroscope-go v1.2.8/go.mod h1:SSi59eQ1/zmKoY/BKwa5rSFsJaq+242Bcrr4wPix1g8= +github.com/grafana/pyroscope-go/godeltaprof v0.1.9 h1:c1Us8i6eSmkW+Ez05d3co8kasnuOY813tbMN8i/a3Og= +github.com/grafana/pyroscope-go/godeltaprof v0.1.9/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk= +github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= +github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= +github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM= +github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI= +github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= +github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= +github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= +github.com/minio/minio-go/v7 v7.0.100 h1:ShkWi8Tyj9RtU57OQB2HIXKz4bFgtVib0bbT1sbtLI8= +github.com/minio/minio-go/v7 v7.0.100/go.mod h1:EtGNKtlX20iL2yaYnxEigaIvj0G0GwSDnifnG8ClIdw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= +github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= +github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= +github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= +github.com/pelletier/go-toml/v2 v2.3.0 h1:k59bC/lIZREW0/iVaQR8nDHxVq8OVlIzYCOJf421CaM= +github.com/pelletier/go-toml/v2 v2.3.0/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= +github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/redis/go-redis/v9 v9.18.0 h1:pMkxYPkEbMPwRdenAzUNyFNrDgHx9U+DrBabWNfSRQs= +github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQmscfkCoDA0= +github.com/robertkrimen/otto v0.2.1 h1:FVP0PJ0AHIjC+N4pKCG9yCDz6LHNPCwi/GKID5pGGF0= +github.com/robertkrimen/otto v0.2.1/go.mod h1:UPwtJ1Xu7JrLcZjNWN8orJaM5n5YEtqL//farB5FlRY= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tinylib/msgp v1.6.1 h1:ESRv8eL3u+DNHUoSAAQRE50Hm162zqAnBoGv9PzScPY= +github.com/tinylib/msgp v1.6.1/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= +github.com/titanous/json5 v1.0.0 h1:hJf8Su1d9NuI/ffpxgxQfxh/UiBFZX7bMPid0rIL/7s= +github.com/titanous/json5 v1.0.0/go.mod h1:7JH1M8/LHKc6cyP5o5g3CSaRj+mBrIimTxzpvmckH8c= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= +github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= +github.com/zeromicro/go-zero v1.10.1 h1:1nM3ilvYx97GUqyaNH2IQPtfNyK7tp5JvN63c7m6QKU= +github.com/zeromicro/go-zero v1.10.1/go.mod h1:z41DXmO6gx/Se7Ow5UIwPxcUmpVj3ebhoNCcZ1gfp5k= +go.etcd.io/etcd/api/v3 v3.5.21 h1:A6O2/JDb3tvHhiIz3xf9nJ7REHvtEFJJ3veW3FbCnS8= +go.etcd.io/etcd/api/v3 v3.5.21/go.mod h1:c3aH5wcvXv/9dqIw2Y810LDXJfhSYdHQ0vxmP3CCHVY= +go.etcd.io/etcd/client/pkg/v3 v3.5.21 h1:lPBu71Y7osQmzlflM9OfeIV2JlmpBjqBNlLtcoBqUTc= +go.etcd.io/etcd/client/pkg/v3 v3.5.21/go.mod h1:BgqT/IXPjK9NkeSDjbzwsHySX3yIle2+ndz28nVsjUs= +go.etcd.io/etcd/client/v3 v3.5.21 h1:T6b1Ow6fNjOLOtM0xSoKNQt1ASPCLWrF9XMHcH9pEyY= +go.etcd.io/etcd/client/v3 v3.5.21/go.mod h1:mFYy67IOqmbRf/kRUvsHixzo3iG+1OF2W2+jVIQRAnU= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms= +go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 h1:DvJDOPmSWQHWywQS6lKL+pb8s3gBLOZUtw4N+mavW1I= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0/go.mod h1:EtekO9DEJb4/jRyN4v4Qjc2yA7AtfCBuz2FynRUWTXs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 h1:wVZXIWjQSeSmMoxF74LzAnpVQOAFDo3pPji9Y4SOFKc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0/go.mod h1:khvBS2IggMFNwZK/6lEeHg/W57h/IX6J4URh57fuI40= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0 h1:MzfofMZN8ulNqobCmCAVbqVL5syHw+eB2qPRkCMA/fQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0/go.mod h1:E73G9UFtKRXrxhBsHtG00TB5WxX57lpsQzogDkqBTz8= +go.opentelemetry.io/otel/exporters/zipkin v1.40.0 h1:zu+I4j+FdO6xIxBVPeuncQVbjxUM4LiMgv6GwGe9REE= +go.opentelemetry.io/otel/exporters/zipkin v1.40.0/go.mod h1:zS6cC4nFBYXbu18e7aLfMzubBjOiN7ZcROu477qtMf8= +go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g= +go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc= +go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8= +go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE= +go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw= +go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg= +go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw= +go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= +go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= +golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= +golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= +google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= +google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= +gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= +gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg= +gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo= +gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg= +gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs= +k8s.io/api v0.34.3 h1:D12sTP257/jSH2vHV2EDYrb16bS7ULlHpdNdNhEw2S4= +k8s.io/api v0.34.3/go.mod h1:PyVQBF886Q5RSQZOim7DybQjAbVs8g7gwJNhGtY5MBk= +k8s.io/apimachinery v0.34.3 h1:/TB+SFEiQvN9HPldtlWOTp0hWbJ+fjU+wkxysf/aQnE= +k8s.io/apimachinery v0.34.3/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/client-go v0.34.3 h1:wtYtpzy/OPNYf7WyNBTj3iUA0XaBHVqhv4Iv3tbrF5A= +k8s.io/client-go v0.34.3/go.mod h1:OxxeYagaP9Kdf78UrKLa3YZixMCfP6bgPwPwNBQBzpM= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts= +k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM= +k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/scripts/fix_handlers.sh b/scripts/fix_handlers.sh new file mode 100644 index 0000000..630bd45 --- /dev/null +++ b/scripts/fix_handlers.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# 批量修复所有handler,统一使用response包 +set -e + +APP_DIR="/Users/zhangjianmin/sourceCode/GolandProjects/src/sundynix-micro-go/app" + +find "$APP_DIR" -name "*Handler.go" -path "*/handler/*" | while read -r file; do + # 跳过已经修复的文件(已导入response包) + if grep -q "sundynix-micro-go/common/response" "$file"; then + continue + fi + + # 检查是否有需要替换的内容 + if ! grep -q 'httpx.Ok(w)\|httpx.ErrorCtx' "$file"; then + continue + fi + + echo "修复: $file" + + # 1. 添加 response 导入 + sed -i '' 's|"github.com/zeromicro/go-zero/rest/httpx"|"github.com/zeromicro/go-zero/rest/httpx"\ + "sundynix-micro-go/common/response"|' "$file" + + # 2. 替换 httpx.ErrorCtx(r.Context(), w, err) -> response.Fail(w, err.Error()) + sed -i '' 's|httpx.ErrorCtx(r.Context(), w, err)|response.Fail(w, err.Error())|g' "$file" + + # 3. 替换 httpx.Ok(w) -> response.Ok(w) + sed -i '' 's|httpx.Ok(w)|response.Ok(w)|g' "$file" +done + +echo "===全部修复完成==="