コード例 #1
0
ファイル: FileUploadService.cs プロジェクト: lulzzz/WCloud
        async Task __upload_to_qiniu__(FileUploadEntity model, byte[] bs)
        {
            var qiniu_key = model.QiniuKey;

            if (await this.__file_exist_in_qiniu__(qiniu_key))
            {
                return;
            }
            var res = await this._uploadHelper.Upload(bs, qiniu_key);

            res.Should().NotBeNullOrEmpty();
        }
コード例 #2
0
ファイル: FileUploadService.cs プロジェクト: lulzzz/WCloud
        FileUploadEntity __map__(string file_name, byte[] bs, string catalog)
        {
            var res = new FileUploadEntity()
            {
                OriginFileName  = file_name,
                FileSize        = bs.Length,
                Extension       = this.__extension__(file_name),
                FileHash        = this.__file_hash__(bs),
                StorageProvider = this._uploadHelper.StorageProvider ?? "shared-qiniu",
                Catalog         = catalog ?? string.Empty
            };

            var QiniuKey = res.QiniuKey;

            res.Url       = this._uploadHelper.ConcatUrl(QiniuKey);
            res.ExtraData = new
            {
                debug_info = this._uploadHelper.DebugInfo(),
                QiniuKey
            }.ToJson();

            return(res);
        }