Commit 36904722 by xiongyuwen

no message

parent e915a044
...@@ -427,6 +427,8 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -427,6 +427,8 @@ namespace Bailun.Discuz.Application.WeiPan
public async Task<string> GetViewFile(string userId, string fileId, string md5, string fileName) public async Task<string> GetViewFile(string userId, string fileId, string md5, string fileName)
{ {
string fileUrl = ""; string fileUrl = "";
try
{
// string fileUrl =(await GetFileUrl(md5))?.QiniuUrl; // string fileUrl =(await GetFileUrl(md5))?.QiniuUrl;
//if (fileUrl == null) //if (fileUrl == null)
// { // {
...@@ -444,8 +446,18 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -444,8 +446,18 @@ namespace Bailun.Discuz.Application.WeiPan
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();
CookieContainer cookieContainer = new CookieContainer(); CookieContainer cookieContainer = new CookieContainer();
Cookie cookie = new Cookie(apiOutput.cookie_name, apiOutput.cookie_value); Cookie cookie = new Cookie(apiOutput.cookie_name, apiOutput.cookie_value);
var domain = apiOutput.download_url.IndexOf("com/"); //var domain = apiOutput.download_url.IndexOf("com/");
cookie.Domain = apiOutput.download_url.Substring(8, domain - 5); //if (domain > -1)
//{
// cookie.Domain = apiOutput.download_url.Substring(8, domain - 5);
//}
//else
//{
// cookie.Domain ="szfront.wxwork.qq.com";
//}
Uri uri = new Uri(apiOutput.download_url);
cookie.Domain = uri.Host;
cookieContainer.Add(cookie); // 加入Cookie cookieContainer.Add(cookie); // 加入Cookie
HttpClientHandler httpClientHandler = new HttpClientHandler() HttpClientHandler httpClientHandler = new HttpClientHandler()
{ {
...@@ -482,6 +494,12 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -482,6 +494,12 @@ namespace Bailun.Discuz.Application.WeiPan
throw new Exception(apiOutput.errmsg); throw new Exception(apiOutput.errmsg);
} }
// } // }
}
catch (Exception ex)
{
Console.WriteLine($"上传七牛云失败,失败原因:{ex.Message}");
}
return fileUrl; return fileUrl;
} }
...@@ -665,11 +683,11 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -665,11 +683,11 @@ namespace Bailun.Discuz.Application.WeiPan
// string userId = "chenzekai"; // string userId = "chenzekai";
List<WeiPanFileList> inserWeiPanFileList = new List<WeiPanFileList>(); List<WeiPanFileList> inserWeiPanFileList = new List<WeiPanFileList>();
//1:获取线上的所有文档数据 //1:获取线上的所有文档数据
var filList=await GetFileList(userId,companyName); var filList=await GetFileList(userId,companyName);//调试注释
//string value = "测试数据"; //string value = "测试数据";
//RedisHelper.Set("key", filList); //RedisHelper.Set("key", filList);
//List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key"); // List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key");
//filList.RemoveAt(1); //filList.RemoveAt(1);
//2:判断当前fileid是否存在于数据库中, 如果不存在则添加 //2:判断当前fileid是否存在于数据库中, 如果不存在则添加
foreach (var file in filList) foreach (var file in filList)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment