yz_server/Server/Program.cs

82 lines
3.8 KiB
C#
Raw Normal View History

2022-04-16 07:48:12 +00:00
using Common.Models.JsonModels;
using Common.Models.SubTables;
using Common.Requests.Lianmengs;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Server.Configs;
using Server.Winforms;
using Server.Winforms.LoginForms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Server
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (string.IsNullOrEmpty(Client.SingleClient.Config.MysqlHost))
{
if (new InitMysqlForm(Client.SingleClient).ShowDialog() != DialogResult.Yes)
{
return;
}
}
//线程池
ThreadPool.SetMinThreads(10, 10);
ThreadPool.SetMaxThreads(150, 150);
//显示启动窗口
var startForm = new StartForm();
//Application.Run(new StartForm());
var th = new Thread(() =>
{
var mainForm = new MainForm();
mainForm.InitCompleteAction = () =>
{
startForm?.Invoke(new Action(() =>
{
startForm.DialogResult = DialogResult.OK;
startForm.Close();
startForm = null;
}));
};
mainForm.Show();
mainForm.Activate();
Application.Run(mainForm);
//强制退出程序,防止意外驻留进程
Environment.Exit(0);
});
th.SetApartmentState(ApartmentState.STA);
th.Start();
if (startForm.ShowDialog() == DialogResult.OK)
{
Application.Run();
}
//强制退出程序,防止意外驻留进程
Environment.Exit(0);
}
public static void Test()
{
var json = @"{'data':{'data':{'cursor':'4737996432465788974','orders':[{'ads_estimated_commission':'100','ads_promotion_rate':'10','ads_real_commission':'100','ads_split_rate':'0','app':'抖音','author_account':'我的昵称','author_buyin_id':'123467','author_openid':'f190e172-5fd8-4b7b-babb-f32323e60f7b','author_short_id':'kodofo','buyer_openid':'f190e172-5fd8-4b7b-babb-f32323e60f7b','commission_rate':'2000','estimated_commission':'165','estimated_tech_service_fee':'12','estimated_total_commission':'2','flow_point':'PAY_SUCC','item_num':'2','media_type':'shop_list','order_id':'4737996432465788974','pay_goods_amount':'1100','pay_success_time':'2006-01-02 15:04:05','pick_source_client_key':'jifji32rnu3jit43','pid_info':{'external_info':'1222_2333','media_type_name':'Live','pid':'dy_1234_33_455'},'product_id':'3450632721376902816','product_img':'https://tosv.boe.byted.org/obj/temai/7e92a281163e33cedef99d8735d1e90bwww828-708','product_name':'测试商品','real_commission':'165','refund_time':'2006-01-02 15:04:05','settle_time':'2006-01-02 15:04:05','settled_goods_amount':'0','settled_tech_service_fee':'12','shop_estimated_commission':'12','shop_id':'1234','shop_name':'我的店铺','shop_real_commission':'12','total_pay_amount':'2100','update_time':'2006-01-02 15:04:05'}]}},'err_no':0,'message':'success','code':10000,'msg':'success','sub_code':'','sub_msg':''}";
var rest = JObject.Parse(json)["data"]["data"]["orders"];
foreach (var item in rest)
{
var order = new DyOrder();
Common.Utils.Util.CopyToObj(item, order);
}
}
}
}