Exemple #1
0
        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();
        }
Exemple #2
0
        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);
        }