Commit 221987cc by zhouminghui

appsettings.json update

parent 27ba4d4f
......@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
<PackageReference Include="NPOI" Version="2.4.1" />
<PackageReference Include="Qiniu.Shared" Version="7.2.15" />
......
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using System.Text;
namespace Bailun.DC.Common
{
public class NewConfigHelper
{
public static string GetByName(string name)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
var configuration = builder.Build();
return configuration[name];
}
}
}
......@@ -16,4 +16,10 @@
<ProjectReference Include="..\Bailun.DC.Services\Bailun.DC.Services.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
......@@ -1743,6 +1743,8 @@ AND platform_type = '{item.platform_type}' AND financecategoryname = '{item.fina
}
else
{
Console.WriteLine(Common.NewConfigHelper.GetByName("QiNiu:AccessKey"));
Console.WriteLine(Common.NewConfigHelper.GetByName("QiNiu:SecretKey"));
Console.WriteLine($"{DateTime.Now.ToString("yyyy - MM - dd HH: mm:ss")}不存在需要导出的任务!");
}
}
......@@ -1935,11 +1937,11 @@ AND platform_type = '{item.platform_type}' AND financecategoryname = '{item.fina
var filepath = Directory.GetCurrentDirectory() + "\\Files\\Report\\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
ExcelHelper.DataTableToExcel(table, filepath + filename, true);
var content = File.ReadAllBytes(filepath + filename);
//var accesskey = ConfigHelper.AppSetting("QiNiu:AccessKey");
//var secretkey = ConfigHelper.AppSetting("QiNiu:SecretKey");
//Console.WriteLine($"accesskey:【{accesskey}】");
//Console.WriteLine($"secretkey:【{secretkey}】");
var qiuniu = new QiNiuHelper("QSvtvN4Ons1CiNzaMGqx8XmDaiM1L0ZqSwJ2YoTn", "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm");
var accesskey = Common.NewConfigHelper.GetByName("QiNiu:AccessKey");
var secretkey = Common.NewConfigHelper.GetByName("QiNiu:SecretKey");
Console.WriteLine($"accesskey:【{accesskey}】");
Console.WriteLine($"secretkey:【{secretkey}】");
var qiuniu = new QiNiuHelper(accesskey, secretkey);
return qiuniu.UploadStream(content, filename);
}
#endregion
......
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