feat: 更新上传接口,使用新的上传表单结构并添加价格字段
This commit is contained in:
@@ -13,8 +13,6 @@ import (
|
||||
// @provider
|
||||
type Common struct{}
|
||||
|
||||
// Upload file
|
||||
//
|
||||
// @Router /v1/upload [post]
|
||||
// @Summary Upload file
|
||||
// @Description Upload file
|
||||
@@ -22,22 +20,22 @@ type Common struct{}
|
||||
// @Accept multipart/form-data
|
||||
// @Produce json
|
||||
// @Param file formData file true "File"
|
||||
// @Param type formData string false "Type enum(image, video, audio)"
|
||||
// @Param form formData dto.UploadForm true "Upload form"
|
||||
// @Success 200 {object} dto.UploadResult
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind file file
|
||||
// @Bind typeArg body key(type)
|
||||
// @Bind form body
|
||||
func (c *Common) Upload(
|
||||
ctx fiber.Ctx,
|
||||
user *models.User,
|
||||
file *multipart.FileHeader,
|
||||
typeArg *string,
|
||||
form *dto.UploadForm,
|
||||
) (*dto.UploadResult, error) {
|
||||
val := ""
|
||||
if typeArg != nil {
|
||||
val = *typeArg
|
||||
if form != nil {
|
||||
val = form.Type
|
||||
}
|
||||
return services.Common.Upload(ctx, user.ID, file, val)
|
||||
return services.Common.Upload(ctx.Context(), user.ID, file, val)
|
||||
}
|
||||
|
||||
// Get options (enums)
|
||||
|
||||
Reference in New Issue
Block a user