56 lines
2.3 KiB
C#
56 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using model;
|
|
using System.IO;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace wwsync
|
|
{
|
|
internal class appsetteings
|
|
{
|
|
public static IConfiguration config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).Build();
|
|
public static string connstr = config.GetConnectionString("mysql");
|
|
//
|
|
static IConfigurationSection weworkapi = config.GetSection("weworkapi");
|
|
public static string URL_access_token = weworkapi["URL_access_token"];
|
|
public static string URL_hhrightuser = weworkapi["URL_hhrightuser"];
|
|
public static string URL_extrightuser = weworkapi["URL_extrightuser"];
|
|
public static string URL_extuserlist = weworkapi["URL_extuserlist"];
|
|
public static string URL_extuserinfo = weworkapi["URL_extuserinfo"];
|
|
public static string URL_userinfo = weworkapi["URL_userinfo"];
|
|
public static string URL_dept = weworkapi["URL_dept"];
|
|
public static string URL_remark = weworkapi["URL_remark"];
|
|
public static string URL_corptaglist = weworkapi["URL_corptaglist"];
|
|
|
|
//
|
|
public static string kafka_server = config.GetSection("kafka")["kafka_server"];
|
|
public static string kafka_wwtopic = config.GetSection("kafka")["wwtopic"];
|
|
public static string kafka_topicgroup = config.GetSection("kafka")["topicgroup"];
|
|
//
|
|
public static bool binituser = config.GetSection("params")["binituser"]== "true";
|
|
public static bool brefreshall = config.GetSection("params")["brefreshall"] == "true";
|
|
|
|
static Dictionary<string, ww_corp> _allcorp = null;
|
|
public static Dictionary<string, ww_corp> allcorp
|
|
{
|
|
get
|
|
{
|
|
if (_allcorp == null)
|
|
{
|
|
_allcorp = new Dictionary<string, ww_corp>();
|
|
using (var context = new DataContext())
|
|
{
|
|
var ls = context.ww_corps.ToList();
|
|
foreach (var c in ls)
|
|
_allcorp.Add(c.corpid, c);
|
|
}
|
|
}
|
|
return _allcorp;
|
|
}
|
|
}
|
|
}
|
|
}
|