Skip to content

Commit

Permalink
增加七牛云上传状态检测。
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjusss committed Sep 11, 2018
1 parent 4ea4a7e commit a079b0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Backup2Cloud/Backup2Cloud.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<NeutralLanguage></NeutralLanguage>
<AssemblyVersion>0.0.2.0910</AssemblyVersion>
<FileVersion>0.0.2.0910</FileVersion>
<Version>0.0.2.0910</Version>
<AssemblyVersion>0.0.2.0911</AssemblyVersion>
<FileVersion>0.0.2.0911</FileVersion>
<Version>0.0.2.0911</Version>
<Authors>sanjusss</Authors>
<Company />
<Description>定时将服务器上的文件备份到云存储。</Description>
Expand Down
8 changes: 5 additions & 3 deletions Backup2Cloud/Worker/QiniuUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using Qiniu.IO.Model;
using Qiniu.Util;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Backup2Cloud.Worker
Expand Down Expand Up @@ -100,7 +98,11 @@ public async Task Upload(string file, string suffix)
string json = putPolicy.ToJsonString();
string token = Auth.CreateUploadToken(mac, json);
UploadManager um = new UploadManager();
await um.UploadFileAsync(file, key, token);
var result = await um.UploadFileAsync(file, key, token);
if (result.Code != 200)
{
throw new Exception("上传失败,服务器返回错误信息:" + result.Text);
}
}
}
}

0 comments on commit a079b0e

Please sign in to comment.