File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,8 @@ class Cloud {
91
91
/**
92
92
* 调用云函数
93
93
*/
94
- async invokeFunction < T = any > ( functionName : string , data : any , debug = false ) : Promise < T > {
95
- let url = this . funcBaseUrl + `/invoke/${ functionName } `
96
- if ( debug ) {
97
- url = url + `?debug=true`
98
- }
94
+ async invokeFunction < T = any > ( functionName : string , data : any ) : Promise < T > {
95
+ const url = this . funcBaseUrl + `/${ functionName } `
99
96
const res = await this
100
97
. _request
101
98
. request ( url , data )
@@ -105,12 +102,18 @@ class Cloud {
105
102
106
103
/**
107
104
* 上传文件
105
+ * @deprecated 此函数已弃用,请通过文件上传地址,自行实现上传
106
+ * @param file 文件对象(File)
107
+ * @param bucket Bucket 名字
108
+ * @param auto_naming 文件名是否由服务端自动生成,默认为 1(自动生成),0(保留原文件名)
109
+ * @returns
108
110
*/
109
- async uploadFile ( file : UploadFile , bucket = 'public' ) {
111
+ async uploadFile ( file : UploadFile , bucket : string , auto_naming = 1 ) {
112
+ const auto = auto_naming ? 1 : 0
110
113
const res = await this
111
114
. _request
112
115
. upload ( {
113
- url : this . fileBaseUrl + `/upload/ ${ bucket } ` ,
116
+ url : this . fileBaseUrl + `/${ bucket } ?auto= ${ auto } ` ,
114
117
files : [ file ]
115
118
} )
116
119
You can’t perform that action at this time.
0 commit comments