116 lines
4.0 KiB
C#
116 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Quartz;
|
|
using Quartz.Impl;
|
|
using System.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
using model;
|
|
|
|
namespace wwsync
|
|
{
|
|
class Program
|
|
{
|
|
public static List<IScheduler> Schedulers = new List<IScheduler>();
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
//test();
|
|
initcord();
|
|
Console.WriteLine("Main()-initcord().");
|
|
//
|
|
QuartzStart();
|
|
Console.WriteLine("Main()-QuartzStart().");
|
|
//
|
|
new kafkatool().kafka_consume();
|
|
Console.WriteLine("Main()-kafka_consume().");
|
|
//
|
|
|
|
if (appsetteings.binituser)
|
|
{
|
|
Console.WriteLine("Main()-InitUser().");
|
|
new organsync().InitUser();
|
|
}
|
|
|
|
while (true)
|
|
System.Threading.Thread.Sleep(1000*5);
|
|
}
|
|
|
|
static async void test()
|
|
{
|
|
object data = new { userid = "aaa", external_userid = "bbb", description = $"{DateTime.Now}@id@20220206" };
|
|
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(data));
|
|
Console.WriteLine("Hello World!");
|
|
using (var client = new System.Net.Http.HttpClient())
|
|
{
|
|
var p1 = await client.GetStringAsync(appsetteings.URL_extuserinfo);
|
|
var d = JObject.Parse(p1);
|
|
Console.WriteLine(d["errcode"]);
|
|
var users = JArray.Parse(@"['身份证','银行卡','门禁卡','张三']");
|
|
d["follow_user"] = users;
|
|
Console.WriteLine(d.ContainsKey("follow_user"));
|
|
foreach (var user in d["follow_user"])
|
|
{
|
|
Console.WriteLine(user);
|
|
}
|
|
Dictionary<string, string> openWith = new Dictionary<string, string>();
|
|
openWith["aaa"] = "va";
|
|
openWith["bbb"] = "vb";
|
|
foreach (var item in openWith)
|
|
Console.WriteLine(item.Key + ":" + item.Value);
|
|
}
|
|
}
|
|
|
|
static void QuartzStart()
|
|
{
|
|
StdSchedulerFactory factory = new StdSchedulerFactory();
|
|
IScheduler scheduler = factory.GetScheduler().Result;
|
|
Schedulers.Add(scheduler);
|
|
scheduler.Start();
|
|
}
|
|
|
|
static void initcord()
|
|
{
|
|
model.ww_corp[] corps = new model.ww_corp[] {
|
|
new model.ww_corp()
|
|
{
|
|
corpid="wwb9c94b6d51580360",
|
|
corpname="东方高圣",
|
|
khsecret="bA4oTcDacYQK8yT9VXvOV9ogeg2k1_jgv5XD3YZdpRY",
|
|
txlsecret="u3B3cOH4nsh6vOtZ1l-A6OgIg46_K9FVokgNDShAAa0"
|
|
},
|
|
new model.ww_corp()
|
|
{
|
|
corpid="wwd4cd11d60db47118",
|
|
corpname="懂牛股票通",
|
|
khsecret="_DsTIG8Gr2azmxeie5Qsdd9WPNoo3RlYpO3gUmFeEWQ",
|
|
txlsecret="28Yget2-mabtpKHGCpAXgT7Ppy1vuDRGxrLC5Ue9U1Q"
|
|
},
|
|
new model.ww_corp()
|
|
{
|
|
corpid="ww796732d1128554fc",
|
|
corpname="懂牛股票",
|
|
khsecret="ZHp1MK1ZJKBV913NRyoqNtNW4dVBm_9_EnsHUDQh8Mg",
|
|
txlsecret="MfML_YjsCZ9FwClwmKfpMNDJLPqNPMi9WqMo293RO0U"
|
|
},
|
|
new model.ww_corp()
|
|
{
|
|
corpid="ww89347c2378b6e050",
|
|
corpname="北京高圣投资顾问",
|
|
khsecret="3D6v9AbQdpZStGampk4EHopxlDTkTo3VnxnQTrJ_-Xw",
|
|
txlsecret="f748Ekhn40yK9NSL7pBeWvj5_97A2_h4epv4wpogRds"
|
|
}
|
|
};
|
|
using(DataContext context = new DataContext())
|
|
{
|
|
foreach(var corp in corps)
|
|
if(context.ww_corps.FirstOrDefault(x=>x.corpid==corp.corpid)==null)
|
|
{
|
|
context.Add(corp);
|
|
context.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|