initial commit
This commit is contained in:
30
gallery/internal/logic/createcategorylogic.go
Normal file
30
gallery/internal/logic/createcategorylogic.go
Normal file
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"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 *gallery.CreateCategoryRequest) (*gallery.CreateCategoryResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.CreateCategoryResponse{}, nil
|
||||
}
|
||||
30
gallery/internal/logic/deleteimagelogic.go
Normal file
30
gallery/internal/logic/deleteimagelogic.go
Normal file
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteImageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDeleteImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteImageLogic {
|
||||
return &DeleteImageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteImageLogic) DeleteImage(in *gallery.DeleteImageRequest) (*gallery.DeleteImageResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.DeleteImageResponse{}, nil
|
||||
}
|
||||
31
gallery/internal/logic/generateurllogic.go
Normal file
31
gallery/internal/logic/generateurllogic.go
Normal file
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GenerateUrlLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGenerateUrlLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GenerateUrlLogic {
|
||||
return &GenerateUrlLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 访问控制
|
||||
func (l *GenerateUrlLogic) GenerateUrl(in *gallery.GenerateUrlRequest) (*gallery.GenerateUrlResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.GenerateUrlResponse{}, nil
|
||||
}
|
||||
31
gallery/internal/logic/getcategorytreelogic.go
Normal file
31
gallery/internal/logic/getcategorytreelogic.go
Normal file
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetCategoryTreeLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetCategoryTreeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryTreeLogic {
|
||||
return &GetCategoryTreeLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 分类管理
|
||||
func (l *GetCategoryTreeLogic) GetCategoryTree(in *gallery.CategoryTreeRequest) (*gallery.CategoryTreeResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.CategoryTreeResponse{}, nil
|
||||
}
|
||||
30
gallery/internal/logic/getimagedetaillogic.go
Normal file
30
gallery/internal/logic/getimagedetaillogic.go
Normal file
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetImageDetailLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetImageDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetImageDetailLogic {
|
||||
return &GetImageDetailLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetImageDetailLogic) GetImageDetail(in *gallery.ImageDetailRequest) (*gallery.ImageDetailResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.ImageDetailResponse{}, nil
|
||||
}
|
||||
31
gallery/internal/logic/getimagelistlogic.go
Normal file
31
gallery/internal/logic/getimagelistlogic.go
Normal file
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetImageListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetImageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetImageListLogic {
|
||||
return &GetImageListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 图片元数据操作
|
||||
func (l *GetImageListLogic) GetImageList(in *gallery.ImageListRequest) (*gallery.ImageListResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.ImageListResponse{}, nil
|
||||
}
|
||||
31
gallery/internal/logic/pinglogic.go
Normal file
31
gallery/internal/logic/pinglogic.go
Normal file
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type PingLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
||||
return &PingLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 健康检查
|
||||
func (l *PingLogic) Ping(in *gallery.PingRequest) (*gallery.PingResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.PingResponse{}, nil
|
||||
}
|
||||
30
gallery/internal/logic/updateimagelogic.go
Normal file
30
gallery/internal/logic/updateimagelogic.go
Normal file
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdateImageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUpdateImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateImageLogic {
|
||||
return &UpdateImageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateImageLogic) UpdateImage(in *gallery.UpdateImageRequest) (*gallery.UpdateImageResponse, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &gallery.UpdateImageResponse{}, nil
|
||||
}
|
||||
43
gallery/internal/logic/uploadimagelogic.go
Normal file
43
gallery/internal/logic/uploadimagelogic.go
Normal file
@ -0,0 +1,43 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"godemo/file/file"
|
||||
"godemo/gallery/gallery"
|
||||
"godemo/gallery/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UploadImageLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUploadImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadImageLogic {
|
||||
return &UploadImageLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 图片上传
|
||||
func (l *UploadImageLogic) UploadImage(in *gallery.UploadImageRequest) (*gallery.UploadImageResponse, error) {
|
||||
// 1. 根据 in.CategoryId 查询分类信息,获取分类名称
|
||||
var categoryName string
|
||||
|
||||
// 2. 调用 file rpc Upload 接口,上传文件到MinIO
|
||||
l.svcCtx.FileRpc.Upload(l.ctx, &file.UploadRequest{
|
||||
Filename: in.FileName,
|
||||
Content: in.FileContent,
|
||||
Folder: categoryName,
|
||||
})
|
||||
|
||||
// 3. 图片信息存入数据库
|
||||
|
||||
// 4. 返回接口执行结果
|
||||
return &gallery.UploadImageResponse{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user