分类:
    ASP.NET
1.public dynamic GetFilePath(long nameid, string oid,int dnum)
        {
            if (string.IsNullOrEmpty(oid))
            {
                return CommonService.GetErrorResult(Const.ParamErrorTip);
            }
            try
            {
                //检查redis
                string downurl = CommonService.Redis.StringHelper.StringGet<string>(Const.DownOssFileUrl + ":" + oid);
                if (!string.IsNullOrEmpty(downurl))
                {
                    return CommonService.GetSuccessResult(downurl);
                }
                OrderFile orderFile = _orderService.GetOrderFileModelBySystemNo(oid);
                OssClient client = new OssClient(endPoint, accessKeyId, accessKeySecret);
                //获取访问url
                // 设置URL过期时间为50年,图片最好设置为1天过期,源文件1小时过期,图片获取的时候循环判断是否过期,源文件下载的时候判断过期
                DateTime expiration = DateTime.Now.AddMinutes(30);
                Uri uri = client.GeneratePresignedUri(Const.DesignerBucketName, orderFile.PrintOSSPath, expiration);
                string url = uri.ToString();
                CommonService.Redis.StringHelper.StringSet<string>(Const.DownOssFileUrl + ":" + oid, url, TimeSpan.FromMinutes(30));
                //标记下载过
                if (dnum == 0)
                {
                    try
                    {
                        _orderService.UpdateFactoryDown(nameid, oid);
                    }
                    catch { }
                }
                return CommonService.GetSuccessResult(url);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("获取下载地址错误", ex);
                return CommonService.GetErrorResult("获取下载地址错误");
            }
        }评价
    
                    排名
                
                
                    6
                
            
                    文章
                
                
                    6
                
            
                    粉丝
                
                
                    16
                
            
                    评论
                
                
                    8
                
            
            {{item.articleTitle}}
            
    {{item.blogName}} : {{item.content}}
        
            ICP备案  :渝ICP备18016597号-1
        
        
            网站信息:2018-2025TNBLOG.NET
        
        
            技术交流:群号656732739
        
        
            联系我们:contact@tnblog.net
        
        
            公网安备:
50010702506256
        
    
50010702506256
        
        
            欢迎加群交流技术