5
5
"crypto/md5"
6
6
"encoding/hex"
7
7
"fmt"
8
- store "github.com/TBXark/sphere/storage"
8
+ "github.com/TBXark/sphere/storage/models "
9
9
"github.com/qiniu/go-sdk/v7/auth/qbox"
10
10
"github.com/qiniu/go-sdk/v7/storage"
11
11
"io"
@@ -109,7 +109,7 @@ func (n *Qiniu) ExtractKeyFromURL(uri string) string {
109
109
return key
110
110
}
111
111
112
- func (n * Qiniu ) GenerateUploadToken (fileName string , dir string , nameBuilder func (fileName string , dir ... string ) string ) store .FileUploadToken {
112
+ func (n * Qiniu ) GenerateUploadToken (fileName string , dir string , nameBuilder func (fileName string , dir ... string ) string ) models .FileUploadToken {
113
113
fileExt := path .Ext (fileName )
114
114
sum := md5 .Sum ([]byte (fileName ))
115
115
nameMd5 := hex .EncodeToString (sum [:])
@@ -120,14 +120,14 @@ func (n *Qiniu) GenerateUploadToken(fileName string, dir string, nameBuilder fun
120
120
InsertOnly : 1 ,
121
121
MimeLimit : "image/*;video/*" ,
122
122
}
123
- return store .FileUploadToken {
123
+ return models .FileUploadToken {
124
124
Token : put .UploadToken (n .mac ),
125
125
Key : key ,
126
126
URL : n .GenerateURL (key ),
127
127
}
128
128
}
129
129
130
- func (n * Qiniu ) UploadFile (ctx context.Context , file io.Reader , size int64 , key string ) (* store .FileUploadResult , error ) {
130
+ func (n * Qiniu ) UploadFile (ctx context.Context , file io.Reader , size int64 , key string ) (* models .FileUploadResult , error ) {
131
131
put := & storage.PutPolicy {
132
132
Scope : n .config .Bucket ,
133
133
}
@@ -140,12 +140,12 @@ func (n *Qiniu) UploadFile(ctx context.Context, file io.Reader, size int64, key
140
140
if err != nil {
141
141
return nil , err
142
142
}
143
- return & store .FileUploadResult {
143
+ return & models .FileUploadResult {
144
144
Key : ret .Key ,
145
145
}, nil
146
146
}
147
147
148
- func (n * Qiniu ) UploadLocalFile (ctx context.Context , file string , key string ) (* store .FileUploadResult , error ) {
148
+ func (n * Qiniu ) UploadLocalFile (ctx context.Context , file string , key string ) (* models .FileUploadResult , error ) {
149
149
put := & storage.PutPolicy {
150
150
Scope : n .config .Bucket ,
151
151
}
@@ -158,7 +158,7 @@ func (n *Qiniu) UploadLocalFile(ctx context.Context, file string, key string) (*
158
158
if err != nil {
159
159
return nil , err
160
160
}
161
- return & store .FileUploadResult {
161
+ return & models .FileUploadResult {
162
162
Key : ret .Key ,
163
163
}, nil
164
164
}
0 commit comments