Files
stat_center/api/fileApi/file.go
T
rootandClaude Opus 5 01d9f7bc86 新增广告V2模块,双端下载落地页调整
- 新增 advitise v2: info/location/bind/click-stat/day-click-stat 模型与
  对应的 service、api、router、proto 定义
- models/index.go 注册 5 个新模型的索引初始化
- 鉴权白名单: /rsdownload/ 改为 /download/,放行 advitise v2 的
  get/click 接口
- statg/config: proxyUrl 增加 fileRes1
- common/genId: lid 生成逻辑补充
- 新增 91fans / huangguo 的 mobileconfig 描述文件
- 新增 deploy/nginx/cpcdownload.mfcg.me.conf 网关配置

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 16:53:23 +08:00

39 lines
812 B
Go

package fileApi
import (
"stat/common/file"
"stat/common/stdLog"
"stat/statg"
"github.com/gin-gonic/gin"
)
// @Tags 文件上传
// @Summary 文件上传
// @Description 文件上传
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Param file formData file true "文件数据"
// @Success 200 {string}} string "成功"
// @Failure 400 {string} string "失败"
// @Router /api/stat/file/upload [POST]
func FileUpload(ctx *gin.Context) {
f, err := ctx.FormFile("file")
if err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
// 上传到桶2
data, err := file.PutObject(ctx, statg.Conf.ProxyUrl.FileRes1, &file.FileObject{
File: f,
})
if err != nil {
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
}
stdLog.ServerJSON(ctx, stdLog.Success, data)
return
}