Merge pull request #89 from onerain88/file_upload_callback
chore: 支持文件上传结果回调 API
commit
bf3e690618
|
@ -79,6 +79,7 @@ namespace LeanCloud.Storage {
|
||||||
string key = uploadToken["key"] as string;
|
string key = uploadToken["key"] as string;
|
||||||
string token = uploadToken["token"] as string;
|
string token = uploadToken["token"] as string;
|
||||||
string provider = uploadToken["provider"] as string;
|
string provider = uploadToken["provider"] as string;
|
||||||
|
try {
|
||||||
if (provider == "s3") {
|
if (provider == "s3") {
|
||||||
// AWS
|
// AWS
|
||||||
LCAWSUploader uploader = new LCAWSUploader(uploadUrl, MimeType, data);
|
LCAWSUploader uploader = new LCAWSUploader(uploadUrl, MimeType, data);
|
||||||
|
@ -92,6 +93,17 @@ namespace LeanCloud.Storage {
|
||||||
}
|
}
|
||||||
LCObjectData objectData = LCObjectData.Decode(uploadToken);
|
LCObjectData objectData = LCObjectData.Decode(uploadToken);
|
||||||
Merge(objectData);
|
Merge(objectData);
|
||||||
|
_ = LCApplication.HttpClient.Post<Dictionary<string, object>>("fileCallback", data: new Dictionary<string, object> {
|
||||||
|
{ "result", true },
|
||||||
|
{ "token", token }
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
_ = LCApplication.HttpClient.Post<Dictionary<string, object>>("fileCallback", data: new Dictionary<string, object> {
|
||||||
|
{ "result", false },
|
||||||
|
{ "token", token }
|
||||||
|
});
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue