瀏覽代碼

时间

master
xxe 2 年之前
父節點
當前提交
f14ea9d642
共有 6 個檔案被更改,包括 33 行新增5 行删除
  1. +2
    -0
      HKCardOUT/Bootstrapper.cs
  2. +1
    -1
      HKCardOUT/Helper/BigScreen/DataCenter.cs
  3. +4
    -0
      HKCardOUT/Helper/DataBus.cs
  4. +25
    -0
      HKCardOUT/Logic/RemoteService.cs
  5. +0
    -1
      HKCardOUT/Logic/Service/HKCore.cs
  6. +1
    -3
      HKCardOUT/Views/RootView.xaml.cs

+ 2
- 0
HKCardOUT/Bootstrapper.cs 查看文件

@@ -48,6 +48,8 @@ namespace HKCardOUT
}
Thread.Sleep(3000);
}), "循环状态监测线程", false);
HKLogImport.Init("HKCardOUT");
HKLogImport.WriteInfo("程序初始化,时间:"+DateTime.Now);
}

protected override void ConfigureIoC(IStyletIoCBuilder builder)


+ 1
- 1
HKCardOUT/Helper/BigScreen/DataCenter.cs 查看文件

@@ -8,6 +8,7 @@ using HKCardOUT.Helper;
using HKCardOUT.Logic.Service;
using HKControl;
using HKLib.Dto;
using HKLog;
using ImTools;
using Newtonsoft.Json;
using System;
@@ -43,7 +44,6 @@ namespace Helper.BigScreen
HKLog.HKLogImport.WriteInfo(param);
});


ThreadManage.GetInstance().StartLong(() =>
{
var model = new HKCore().GetDayData();


+ 4
- 0
HKCardOUT/Helper/DataBus.cs 查看文件

@@ -46,6 +46,10 @@ namespace HKCardOUT.Helper
public static int Span { get; set; }
public static int Count { get; set; }
public static string MQTT { get; set; }
/// <summary>
/// 当天时间
/// </summary>
public static DateTime TodayTime { get; set; }
public static List<string> Admin { get; set; }
public static TimeSpilte Times { get; set; }
public static StoreInfoResponse StoreInfo { get; set; }


+ 25
- 0
HKCardOUT/Logic/RemoteService.cs 查看文件

@@ -7,8 +7,10 @@ using Logic.RemoteModel;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Markup;
@@ -169,5 +171,28 @@ namespace HKCardOUT.Logic

}
}

/// <summary>
/// 获取网络服务器时间
/// </summary>
public static void GetNetWorkTime() {

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.baidu.com");
request.Method = "HEAD";
request.AllowAutoRedirect = false;
HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
string cc = reponse.GetResponseHeader("date");
reponse.Close();
DateTime time;
bool s = GMTStrParse(cc, out time);
var dt_time = time.AddHours(8); //GMT要加8个小时才是北京时间
DataBus.TodayTime= dt_time;
}
public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串,这里转成datetime
{
CultureInfo enUS = new CultureInfo("en-US");
bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
return s;
}
}
}

+ 0
- 1
HKCardOUT/Logic/Service/HKCore.cs 查看文件

@@ -299,7 +299,6 @@ namespace HKCardOUT.Logic.Service
public Dictionary<string, int> GetDayData()
{
var today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
HKLogImport.WriteInfo("当前时间:"+ today);
var count = DbContext.Context.Queryable<SaleLog>().Select(t => t.Location).ToList();
return count.GroupBy(t => t).ToDictionary(t => t.Key, t => t.Count());
}


+ 1
- 3
HKCardOUT/Views/RootView.xaml.cs 查看文件

@@ -16,9 +16,7 @@ namespace HKCardOUT.Views
public partial class RootView : HandyControl.Controls.Window
{
public RootView()
{
HKLogImport.Init("HKCardOUT");
HKLogImport.WriteInfo("程序初始化");
{
InitializeComponent();
MessageLog.GetInstance.NotifyShow = new Action<string>((s) =>
{


Loading…
取消
儲存