mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-30 18:16:36 +08:00
增加文件相关API
This commit is contained in:
@@ -64,13 +64,16 @@ func (this *FileDAO) FindEnabledFile(tx *dbs.Tx, id int64) (*File, error) {
|
||||
}
|
||||
|
||||
// 创建文件
|
||||
func (this *FileDAO) CreateFile(tx *dbs.Tx, businessType, description string, filename string, size int64) (int64, error) {
|
||||
func (this *FileDAO) CreateFile(tx *dbs.Tx, adminId int64, userId int64, businessType, description string, filename string, size int64, isPublic bool) (int64, error) {
|
||||
op := NewFileOperator()
|
||||
op.AdminId = adminId
|
||||
op.UserId = userId
|
||||
op.Type = businessType
|
||||
op.Description = description
|
||||
op.State = FileStateEnabled
|
||||
op.Size = size
|
||||
op.Filename = filename
|
||||
op.IsPublic = isPublic
|
||||
err := this.Save(tx, op)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
||||
@@ -13,6 +13,7 @@ type File struct {
|
||||
Type string `field:"type"` // 类型
|
||||
State uint8 `field:"state"` // 状态
|
||||
IsFinished uint8 `field:"isFinished"` // 是否已完成上传
|
||||
IsPublic uint8 `field:"isPublic"` // 是否可以公开访问
|
||||
}
|
||||
|
||||
type FileOperator struct {
|
||||
@@ -27,6 +28,7 @@ type FileOperator struct {
|
||||
Type interface{} // 类型
|
||||
State interface{} // 状态
|
||||
IsFinished interface{} // 是否已完成上传
|
||||
IsPublic interface{} // 是否可以公开访问
|
||||
}
|
||||
|
||||
func NewFileOperator() *FileOperator {
|
||||
|
||||
Reference in New Issue
Block a user