初始化项目框架,完成部分接口开发

This commit is contained in:
2025-07-10 21:04:29 +08:00
commit b2871ec0d2
168 changed files with 6399 additions and 0 deletions

26
utility/oss/oss.go Normal file
View File

@ -0,0 +1,26 @@
package oss
import (
"context"
"server/internal/model"
)
// OssClient 是所有云存储平台要实现的统一接口
type OssClient interface {
UploadFile(ctx context.Context, in *model.OssUploadFileInput) (out *model.OssOutput, err error)
GetFileURL(ctx context.Context, in *model.OssGetFileInput) (out *model.OssOutput, err error)
}
// registry 存储各个平台的实现
var clients = make(map[string]OssClient)
// Register 用于注册平台实现
func Register(name string, client OssClient) {
clients[name] = client
}
// GetClient 获取指定平台的实现
func GetClient(name string) (OssClient, bool) {
client, ok := clients[name]
return client, ok
}