Esempio n. 1
0
        public async Task <IResponseOutput> UploadImage([FromForm] DocumentUploadImageInput input)
        {
            var config = _uploadConfig.Document;
            var res    = await _uploadHelper.UploadAsync(input.File, config, new { input.Id });

            if (res.Success)
            {
                //保存文档图片
                var r = await _documentServices.AddImageAsync(
                    new DocumentAddImageInput
                {
                    DocumentId = input.Id,
                    Url        = res.Data.FileRequestPath
                });

                if (r.Success)
                {
                    return(ResponseOutput.Ok(res.Data.FileRequestPath));
                }
            }

            return(ResponseOutput.NotOk("上传失败!"));
        }