实现图片上传到oss

This commit is contained in:
2025-06-06 10:24:49 +08:00
parent 830f9c236b
commit ffc01164f7
12 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package upload

View File

@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package upload
import (
"server/api/upload"
)
type ControllerV1 struct{}
func NewV1() upload.IUploadV1 {
return &ControllerV1{}
}

View File

@ -0,0 +1,17 @@
package upload
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/upload/v1"
)
func (c *ControllerV1) Upload(ctx context.Context, req *v1.UploadReq) (res *v1.UploadRes, err error) {
upload, err := service.Upload().Upload(ctx, &model.UploadIn{File: req.File})
if err != nil {
return nil, err
}
return &v1.UploadRes{Url: upload.Url}, nil
}