Files
qitongxue-api/internal/controller/attachment.go
2026-09-30 17:01:18 +08:00

33 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package controller
import (
"context"
adminv1 "tool-api/api/admin/v1"
"tool-api/internal/logic"
)
// ============================================================================
// 附件管理控制器(迭代-2026-09-29):管理端上传 / 列表 / 删除
// ============================================================================
// cAdminAttachment 管理端附件接口(需管理员登录)
type cAdminAttachment struct{}
// AdminAttachment 管理端附件对象(挂 AdminAuth 组)
var AdminAttachment = &cAdminAttachment{}
// Upload 管理端上传(multipart):scene=cover|attachment,文件字段名 file。
// GoFrame 已把 multipart 表单绑定进 req(含 scene 字段校验 in:cover,attachment)。
func (c *cAdminAttachment) Upload(ctx context.Context, req *adminv1.AdminUploadReq) (res *adminv1.AdminUploadRes, err error) {
return logic.AdminUploadFromRequest(ctx, req.Scene)
}
func (c *cAdminAttachment) AttachmentList(ctx context.Context, req *adminv1.AdminAttachmentListReq) (res *adminv1.AdminAttachmentListRes, err error) {
return logic.AdminAttachmentList(ctx, req)
}
func (c *cAdminAttachment) AttachmentDelete(ctx context.Context, req *adminv1.AdminAttachmentDeleteReq) (res *adminv1.AdminAttachmentDeleteRes, err error) {
return logic.AdminAttachmentDelete(ctx, req.Id)
}