Commit f586ae8c by wangonghui

添加log日志和添加捕获异常

parent 472a3e7d
...@@ -5,5 +5,8 @@ ...@@ -5,5 +5,8 @@
<add key="vizIpMain" value=""/> <add key="vizIpMain" value=""/>
<add key="vizIpBack" value=""/> <add key="vizIpBack" value=""/>
<add key="leagueId" value="401"/> <add key="leagueId" value="401"/>
<add key="AppID" value="100001"/>
<add key="AppKey" value="ffrw7ilc8i6r3pkzvl"/>
<add key="newUrl" value="http://180.184.78.246:18080/miku/api/open_api/proxy_api/beitai/api/schedule/getdayschedule"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
using DevExpress.ClipboardSource.SpreadsheetML; using DevExpress.ClipboardSource.SpreadsheetML;
using DevExpress.Mvvm;
using log4net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -11,24 +15,25 @@ namespace VIZ.TVP.CBA.Module.Common ...@@ -11,24 +15,25 @@ namespace VIZ.TVP.CBA.Module.Common
{ {
public static class JsonHelper public static class JsonHelper
{ {
/// <summary>
/// 日志
/// </summary>
private static readonly ILog Log = LogManager.GetLogger(typeof(JsonHelper));
/// <summary> /// <summary>
/// 根据POST方法请求获取 /// 根据POST方法请求获取
/// </summary> /// </summary>
/// <param name="url"></param> /// <param name="url"></param>
/// <param name="dic"></param> /// <param name="dic"></param>
/// <returns></returns> /// <returns></returns>
public static string Post(string url, Dictionary<string, string> dic) public static string Post(string url, Dictionary<string, string> dic,string key)
{ {
string result = null; string result = "";
try
//try {
//{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST"; req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded"; req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("App-Authorization", key);
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
int i = 0; int i = 0;
foreach (var item in dic) foreach (var item in dic)
...@@ -51,15 +56,12 @@ namespace VIZ.TVP.CBA.Module.Common ...@@ -51,15 +56,12 @@ namespace VIZ.TVP.CBA.Module.Common
{ {
result = reader.ReadToEnd(); result = reader.ReadToEnd();
} }
// }
//catch (Exception ex) }
//{ catch(Exception ex)
// log.Error(ex); {
//} Log.Error(ex.Message);
//finally }
//{
// LogRequest(url, result);
//}
return result; return result;
} }
...@@ -73,15 +75,23 @@ namespace VIZ.TVP.CBA.Module.Common ...@@ -73,15 +75,23 @@ namespace VIZ.TVP.CBA.Module.Common
public static string GetResult(string url) public static string GetResult(string url)
{ {
string data = ""; string data = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Headers["Accept-Encoding"] = "gzip,deflate"; try
req.AutomaticDecompression = DecompressionMethods.GZip; {
HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
Stream stream = resp.GetResponseStream(); req.Headers["Accept-Encoding"] = "gzip,deflate";
//获取内容 req.AutomaticDecompression = DecompressionMethods.GZip;
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
data = reader.ReadToEnd();
}
}
catch(Exception ex)
{ {
data = reader.ReadToEnd(); Log.Error(ex.Message);
} }
return data; return data;
......
...@@ -34,6 +34,34 @@ namespace VIZ.TVP.CBA.Module.Common ...@@ -34,6 +34,34 @@ namespace VIZ.TVP.CBA.Module.Common
} }
/// <summary> /// <summary>
/// 艾果的密钥加密
/// </summary>
/// <param name="appId"></param>
/// <param name="appKey"></param>
/// <returns></returns>
public static string GetKey(string appId,string appKey)
{
int random = new Random().Next(0, 100);
long timeStamp = DateToTicks(DateTime.Now);
string key = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0},{1},{2},{3}",appId,appKey,timeStamp,random)));
return key;
}
/// <summary>
/// 获取时间戳
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static long DateToTicks(DateTime? time)
{
return ((time.HasValue ? time.Value.Ticks : DateTime.Parse("1990-01-01").Ticks) - 621355968000000000) / 10000;
}
/// <summary>
/// 设置主队和客队球员技术数据统计 /// 设置主队和客队球员技术数据统计
/// </summary> /// </summary>
/// <param name="mainViewModel"></param> /// <param name="mainViewModel"></param>
......
using System; using log4net;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.IO; using System.IO;
...@@ -11,6 +12,8 @@ namespace VIZ.TVP.CBA.Module ...@@ -11,6 +12,8 @@ namespace VIZ.TVP.CBA.Module
{ {
public static class ConfigManage public static class ConfigManage
{ {
private static ILog Log = LogManager.GetLogger(typeof(ConfigManage));
#region 1.获取当前类库的文件配置 #region 1.获取当前类库的文件配置
public static Configuration InitLogConfig() public static Configuration InitLogConfig()
...@@ -35,8 +38,9 @@ namespace VIZ.TVP.CBA.Module ...@@ -35,8 +38,9 @@ namespace VIZ.TVP.CBA.Module
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new Exception(ex.Message); //throw new Exception(ex.Message);
Log.Error(ex.Message);
return null;
} }
#endregion #endregion
......
...@@ -9,15 +9,21 @@ using VIZ.TVP.CBA.Module.Common; ...@@ -9,15 +9,21 @@ using VIZ.TVP.CBA.Module.Common;
using VIZ.TVP.CBA.Module.DayMatch.Model; using VIZ.TVP.CBA.Module.DayMatch.Model;
using VIZ.TVP.CBA.Module.TempEnum; using VIZ.TVP.CBA.Module.TempEnum;
using VIZ.TVP.CBA.Domain; using VIZ.TVP.CBA.Domain;
using log4net;
namespace VIZ.TVP.CBA.Module.DayMatch.ViewModel namespace VIZ.TVP.CBA.Module.DayMatch.ViewModel
{ {
public class DayMatchViewModel : ViewModelBase public class DayMatchViewModel : ViewModelBase
{ {
/// <summary>
/// 日志
/// </summary>
private static ILog Log= LogManager.GetLogger(typeof(DayMatchViewModel));
public DayMatchViewModel() public DayMatchViewModel()
{ {
BtnCmd = new VCommand(BtnCommand); BtnCmd = new VCommand(BtnCommand);
BtnMatchDayUp = new VCommand(BtnMatchDayUpData); BtnMatchDayUp = new VCommand(BtnMatchDayUpData);
matchDate = DateTime.Today.ToShortDateString(); matchDate = DateTime.Today.ToShortDateString();
...@@ -55,7 +61,7 @@ namespace VIZ.TVP.CBA.Module.DayMatch.ViewModel ...@@ -55,7 +61,7 @@ namespace VIZ.TVP.CBA.Module.DayMatch.ViewModel
/// </summary> /// </summary>
private void BtnMatchDayUpData() private void BtnMatchDayUpData()
{ {
Log.Info("比赛日期上版和数据:"+ CombineMatchData());
ApplicationDomainEx.VizEngineModel.STAGE_START("Default/JRSCBEN", "Data", CombineMatchData()); ApplicationDomainEx.VizEngineModel.STAGE_START("Default/JRSCBEN", "Data", CombineMatchData());
} }
...@@ -115,37 +121,48 @@ namespace VIZ.TVP.CBA.Module.DayMatch.ViewModel ...@@ -115,37 +121,48 @@ namespace VIZ.TVP.CBA.Module.DayMatch.ViewModel
/// </summary> /// </summary>
private void GetSchedule() private void GetSchedule()
{ {
string date = Convert.ToDateTime(matchDate).ToString("yyyy-MM-dd"); try
{
var dayschedules = JsonModel.TomorrowMatch_Path(date);
// matchData.AddRange(dayschedules.dayschedule); string date = Convert.ToDateTime(matchDate).ToString("yyyy-MM-dd");
MatchData = new ObservableCollection<Dayschedule>(); var dayschedules = JsonModel.TomorrowMatch_Path(date);
foreach (var dayschedule in dayschedules.dayschedule)
{ if (dayschedules == null) return;
if (dayschedule.Status == "1")
{ // matchData.AddRange(dayschedules.dayschedule);
dayschedule.Status = "未开赛";
} MatchData = new ObservableCollection<Dayschedule>();
else if (dayschedule.Status == "2") foreach (var dayschedule in dayschedules.dayschedule)
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "3")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "4")
{
dayschedule.Status = "已结束";
}
else if (dayschedule.Status == "5")
{ {
dayschedule.Status = "延期"; if (dayschedule.Status == "1")
{
dayschedule.Status = "未开赛";
}
else if (dayschedule.Status == "2")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "3")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "4")
{
dayschedule.Status = "已结束";
}
else if (dayschedule.Status == "5")
{
dayschedule.Status = "延期";
}
MatchData.Add(dayschedule);
} }
}
MatchData.Add(dayschedule); catch(Exception ex)
{
Log.Error(ex.Message);
} }
} }
......
...@@ -10,12 +10,18 @@ using VIZ.TVP.CBA.Module.DayMatch.Model; ...@@ -10,12 +10,18 @@ using VIZ.TVP.CBA.Module.DayMatch.Model;
using VIZ.TVP.CBA.Module.RoundMatch.Model; using VIZ.TVP.CBA.Module.RoundMatch.Model;
using VIZ.TVP.CBA.Module.TempEnum; using VIZ.TVP.CBA.Module.TempEnum;
using VIZ.TVP.CBA.Domain; using VIZ.TVP.CBA.Domain;
using log4net;
namespace VIZ.TVP.CBA.Module.RoundMatch.ViewModel namespace VIZ.TVP.CBA.Module.RoundMatch.ViewModel
{ {
public class RoundMatchViewModel: ViewModelBase public class RoundMatchViewModel: ViewModelBase
{ {
/// <summary>
/// 日志
/// </summary>
private static ILog Log=LogManager.GetLogger(typeof(RoundMatchViewModel));
public RoundMatchViewModel() public RoundMatchViewModel()
{ {
RoundMatchs = new ObservableCollection<int>(); RoundMatchs = new ObservableCollection<int>();
...@@ -153,7 +159,7 @@ namespace VIZ.TVP.CBA.Module.RoundMatch.ViewModel ...@@ -153,7 +159,7 @@ namespace VIZ.TVP.CBA.Module.RoundMatch.ViewModel
private void BtnCmdDataUp() private void BtnCmdDataUp()
{ {
Log.Info("轮次比赛上版信息和数据:" + CombineMatchData());
ApplicationDomainEx.VizEngineModel.STAGE_START("Default/JRSCBEN", "Data", CombineMatchData()); ApplicationDomainEx.VizEngineModel.STAGE_START("Default/JRSCBEN", "Data", CombineMatchData());
} }
...@@ -209,6 +215,8 @@ namespace VIZ.TVP.CBA.Module.RoundMatch.ViewModel ...@@ -209,6 +215,8 @@ namespace VIZ.TVP.CBA.Module.RoundMatch.ViewModel
public void BtnCommand() public void BtnCommand()
{ {
var roundSchedules = JsonModel.GetGameRound_Path(roundMatchItem.ToString()); var roundSchedules = JsonModel.GetGameRound_Path(roundMatchItem.ToString());
if (roundSchedules == null) return;
RoundMatchData = new ObservableCollection<RoundSchedule>(); RoundMatchData = new ObservableCollection<RoundSchedule>();
foreach(var rudData in roundSchedules.schedulelist) foreach(var rudData in roundSchedules.schedulelist)
......
...@@ -9,13 +9,20 @@ using VIZ.TVP.CBA.Module.Common; ...@@ -9,13 +9,20 @@ using VIZ.TVP.CBA.Module.Common;
using VIZ.TVP.CBA.Module.DayMatch.Model; using VIZ.TVP.CBA.Module.DayMatch.Model;
using VIZ.TVP.CBA.Module.TeamStandings.Model; using VIZ.TVP.CBA.Module.TeamStandings.Model;
using VIZ.TVP.CBA.Domain; using VIZ.TVP.CBA.Domain;
using log4net;
namespace VIZ.TVP.CBA.Module.TeamStandings.ViewModel namespace VIZ.TVP.CBA.Module.TeamStandings.ViewModel
{ {
public class TeamStandingViewModel: ViewModelBase public class TeamStandingViewModel: ViewModelBase
{ {
/// <summary>
/// 日志
/// </summary>
private static ILog Log= LogManager.GetLogger(typeof(TeamStandingViewModel));
/// <summary>
/// 球队排名初始化排名
/// </summary>
public TeamStandingViewModel() public TeamStandingViewModel()
{ {
//TeamRanksModel = new ObservableCollection<Model.Teamrank>() //TeamRanksModel = new ObservableCollection<Model.Teamrank>()
...@@ -143,7 +150,7 @@ namespace VIZ.TVP.CBA.Module.TeamStandings.ViewModel ...@@ -143,7 +150,7 @@ namespace VIZ.TVP.CBA.Module.TeamStandings.ViewModel
private void BtmCommand() private void BtmCommand()
{ {
var teamStands = JsonModel.TeamScoreData_Path(); var teamStands = JsonModel.TeamScoreData_Path();
if (teamStands == null) return;
TeamRanksModel = new ObservableCollection<Teamrank>(); TeamRanksModel = new ObservableCollection<Teamrank>();
int i = 1; int i = 1;
foreach(var teamRank in teamStands.teamrank) foreach(var teamRank in teamStands.teamrank)
...@@ -174,6 +181,7 @@ namespace VIZ.TVP.CBA.Module.TeamStandings.ViewModel ...@@ -174,6 +181,7 @@ namespace VIZ.TVP.CBA.Module.TeamStandings.ViewModel
{ {
if(TeamRanksModel!=null) if(TeamRanksModel!=null)
{ {
Log.Info("球队排名上版信息和数据:"+ CombineTeamStandingData());
ApplicationDomainEx.VizEngineModel.STAGE_START("Default/JFB", "Data", CombineTeamStandingData()); ApplicationDomainEx.VizEngineModel.STAGE_START("Default/JFB", "Data", CombineTeamStandingData());
} }
} }
......
...@@ -10,15 +10,18 @@ using VIZ.TVP.CBA.Module.TempEnum; ...@@ -10,15 +10,18 @@ using VIZ.TVP.CBA.Module.TempEnum;
namespace VIZ.TVP.CBA.Module.TeamStats.Model namespace VIZ.TVP.CBA.Module.TeamStats.Model
{ {
/// <summary>
/// 技术统计类
/// </summary>
public class MatchStatsNumbers:ViewModelBase public class MatchStatsNumbers:ViewModelBase
{ {
// public string HomeName { get; set; } // public string HomeName { get; set; }
/// <summary>
/// 主队得分
/// </summary>
private string homeScore; private string homeScore;
public string HomeScore public string HomeScore
...@@ -28,7 +31,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model ...@@ -28,7 +31,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model
set { homeScore = value; this.RaisePropertiesChanged(nameof(HomeScore)); } set { homeScore = value; this.RaisePropertiesChanged(nameof(HomeScore)); }
} }
/// <summary>
/// 主队赛季得分
/// </summary>
private string hSeasonScore; private string hSeasonScore;
public string HSeasonScore public string HSeasonScore
{ {
...@@ -40,7 +45,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model ...@@ -40,7 +45,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model
//public string AwayName { get; set; } //public string AwayName { get; set; }
/// <summary>
/// 客场得分
/// </summary>
private string awayScore; private string awayScore;
public string AwayScore public string AwayScore
{ {
...@@ -49,7 +56,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model ...@@ -49,7 +56,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model
} }
/// <summary>
/// 客场赛季得分
/// </summary>
private string aSeasonScore; private string aSeasonScore;
public string ASeasonScore public string ASeasonScore
{ {
...@@ -68,7 +77,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model ...@@ -68,7 +77,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model
set { light = value; this.RaisePropertiesChanged(nameof(Light)); } set { light = value; this.RaisePropertiesChanged(nameof(Light)); }
} }
/// <summary>
/// 技术统计
/// </summary>
private TechStats techStats = TechStats.Goal; private TechStats techStats = TechStats.Goal;
...@@ -78,7 +89,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model ...@@ -78,7 +89,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model
set { techStats = value; this.RaisePropertiesChanged(nameof(TechStats)); } set { techStats = value; this.RaisePropertiesChanged(nameof(TechStats)); }
} }
/// <summary>
/// 选中行是否高亮
/// </summary>
private string selectLight = "不高亮"; private string selectLight = "不高亮";
public string SelectLight public string SelectLight
{ {
...@@ -86,7 +99,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model ...@@ -86,7 +99,9 @@ namespace VIZ.TVP.CBA.Module.TeamStats.Model
set { selectLight = value; this.RaisePropertyChanged(nameof(SelectLight)); } set { selectLight = value; this.RaisePropertyChanged(nameof(SelectLight)); }
} }
/// <summary>
/// 技术统计名称
/// </summary>
private string techStatsName; private string techStatsName;
public string TechStatsName public string TechStatsName
{ {
......
...@@ -15,12 +15,15 @@ using VIZ.TVP.CBA.Domain; ...@@ -15,12 +15,15 @@ using VIZ.TVP.CBA.Domain;
using VIZ.TVP.CBA.Module.SeasonData; using VIZ.TVP.CBA.Module.SeasonData;
using VIZ.TVP.CBA.Module.OnAirData; using VIZ.TVP.CBA.Module.OnAirData;
using System.ComponentModel; using System.ComponentModel;
using log4net;
namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
{ {
public class TeamStatsViewModel : ViewModelBase public class TeamStatsViewModel : ViewModelBase
{ {
private static ILog Log=LogManager.GetLogger(typeof(TeamStatsViewModel));
private static TeamStatsViewModel _createInstance = null; private static TeamStatsViewModel _createInstance = null;
public static TeamStatsViewModel CreateInstance public static TeamStatsViewModel CreateInstance
...@@ -35,8 +38,6 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -35,8 +38,6 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
} }
} }
public TeamStatsViewModel() public TeamStatsViewModel()
{ {
BtnCommand = new VCommand(BtnCmd); BtnCommand = new VCommand(BtnCmd);
...@@ -233,10 +234,14 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -233,10 +234,14 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
/// </summary> /// </summary>
public TeamSeasonData TeamSeasonData = new TeamSeasonData(); public TeamSeasonData TeamSeasonData = new TeamSeasonData();
/// <summary>
/// 实时直播数据
/// </summary>
public OnAirDataModel onAirDataModel = new OnAirDataModel(); public OnAirDataModel onAirDataModel = new OnAirDataModel();
/// <summary>
/// 技术统计项
/// </summary>
private string matchStatsId; private string matchStatsId;
public string MatchStatsId public string MatchStatsId
...@@ -446,6 +451,8 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -446,6 +451,8 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
{ {
//CombineTeamComData(); //CombineTeamComData();
Log.Info("球队对比数据:"+CombineTeamComData());
ApplicationDomainEx.VizEngineModel.STAGE_START("Default/SQD", "dqyData", CombineTeamComData()); ApplicationDomainEx.VizEngineModel.STAGE_START("Default/SQD", "dqyData", CombineTeamComData());
} }
...@@ -522,7 +529,7 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -522,7 +529,7 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
private void BtnCmd() private void BtnCmd()
{ {
onAirDataModel = JsonModel.OnAirData_Path(ScheduleID); onAirDataModel = JsonModel.OnAirData_Path(ScheduleID);
if (onAirDataModel == null) return;
Utils.SetHomeTeamDictionary(this); Utils.SetHomeTeamDictionary(this);
Utils.SetVisitTeamDictionary(this); Utils.SetVisitTeamDictionary(this);
Utils.SetHData(this); Utils.SetHData(this);
...@@ -537,6 +544,7 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -537,6 +544,7 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
ScheduleID = SetMatchDict[SelectMatchItems]; ScheduleID = SetMatchDict[SelectMatchItems];
onAirDataModel = JsonModel.OnAirData_Path(ScheduleID); onAirDataModel = JsonModel.OnAirData_Path(ScheduleID);
if (onAirDataModel == null) return;
if (onAirDataModel != null) if (onAirDataModel != null)
{ {
...@@ -564,6 +572,7 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -564,6 +572,7 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
AwayTeam = onAirDataModel.liveTeamInfo.VisitingTeamCNAlias; AwayTeam = onAirDataModel.liveTeamInfo.VisitingTeamCNAlias;
TeamSeasonData = JsonModel.TeamSeasonData_Path(Matchtypeid); TeamSeasonData = JsonModel.TeamSeasonData_Path(Matchtypeid);
SetTeamSeasonDictionary(); SetTeamSeasonDictionary();
Utils.SetHomeTeamDictionary(this); Utils.SetHomeTeamDictionary(this);
...@@ -574,12 +583,13 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -574,12 +583,13 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
} }
/// <summary>
/// 设置球队赛季数据字典集合
/// </summary>
private void SetTeamSeasonDictionary() private void SetTeamSeasonDictionary()
{ {
CNAliasVisitSportsDictionary.Clear(); CNAliasVisitSportsDictionary.Clear();
if (TeamSeasonData == null) return;
foreach (var teamSeasonData in TeamSeasonData.teamstats) foreach (var teamSeasonData in TeamSeasonData.teamstats)
{ {
...@@ -618,57 +628,66 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel ...@@ -618,57 +628,66 @@ namespace VIZ.TVP.CBA.Module.TeamStats.ViewModel
private void GetSchedule() private void GetSchedule()
{ {
MatchItems = new ObservableCollection<string>(); try
string date = Convert.ToDateTime(matchDate).ToString("yyyy-MM-dd");
var dayschedules = JsonModel.TomorrowMatch_Path(date);
// matchData.AddRange(dayschedules.dayschedule);
//MatchData = new ObservableCollection<Dayschedule>();
if (dayschedules != null)
{ {
dayschedules.dayschedule = dayschedules.dayschedule.OrderBy(a => Convert.ToDateTime(a.time)).ToList(); MatchItems = new ObservableCollection<string>();
} string date = Convert.ToDateTime(matchDate).ToString("yyyy-MM-dd");
SetMatchDict.Clear(); var dayschedules = JsonModel.TomorrowMatch_Path(date);
MatchItems.Clear();
foreach (var dayschedule in dayschedules.dayschedule) if (dayschedules == null) return;
{ // matchData.AddRange(dayschedules.dayschedule);
if (dayschedule.Status == "1") //MatchData = new ObservableCollection<Dayschedule>();
{
dayschedule.Status = "未开赛";
}
else if (dayschedule.Status == "2")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "3")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "4")
{
dayschedule.Status = "已结束";
}
else if (dayschedule.Status == "5")
{
dayschedule.Status = "延期";
}
if (!SetMatchDict.ContainsKey(dayschedule.time + dayschedule.HomeTeamName
+ "VS" + dayschedule.VisitingTeamName))
{
SetMatchDict.Add(dayschedule.time + dayschedule.HomeTeamName
+ "VS" + dayschedule.VisitingTeamName, dayschedule.ScheduleID);
}
Matchtypeid = dayschedule.ScheduleTypeID;
MatchItems.Add(dayschedule.time + dayschedule.HomeTeamName //if (dayschedules != null)
+ "VS" + dayschedule.VisitingTeamName); //{
dayschedules.dayschedule = dayschedules.dayschedule.OrderBy(a => Convert.ToDateTime(a.time)).ToList();
// }
SetMatchDict.Clear();
MatchItems.Clear();
foreach (var dayschedule in dayschedules.dayschedule)
{
if (dayschedule.Status == "1")
{
dayschedule.Status = "未开赛";
}
else if (dayschedule.Status == "2")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "3")
{
dayschedule.Status = "进行中";
}
else if (dayschedule.Status == "4")
{
dayschedule.Status = "已结束";
}
else if (dayschedule.Status == "5")
{
dayschedule.Status = "延期";
}
if (!SetMatchDict.ContainsKey(dayschedule.time + dayschedule.HomeTeamName
+ "VS" + dayschedule.VisitingTeamName))
{
SetMatchDict.Add(dayschedule.time + dayschedule.HomeTeamName
+ "VS" + dayschedule.VisitingTeamName, dayschedule.ScheduleID);
}
Matchtypeid = dayschedule.ScheduleTypeID;
MatchItems.Add(dayschedule.time + dayschedule.HomeTeamName
+ "VS" + dayschedule.VisitingTeamName);
}
}
catch(Exception ex)
{
Log.Error(ex.Message);
} }
} }
......
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
......
...@@ -12,5 +12,11 @@ namespace VIZ.MIGU.CBA ...@@ -12,5 +12,11 @@ namespace VIZ.MIGU.CBA
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
public App()
{
string configPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.config");
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(configPath));
}
} }
} }
...@@ -61,8 +61,13 @@ ...@@ -61,8 +61,13 @@
<Reference Include="DevExpress.Xpf.Core.v22.1" /> <Reference Include="DevExpress.Xpf.Core.v22.1" />
<Reference Include="DevExpress.Xpf.Themes.Office2019Colorful.v22.1" /> <Reference Include="DevExpress.Xpf.Themes.Office2019Colorful.v22.1" />
<Reference Include="DevExpress.Drawing.v22.1" /> <Reference Include="DevExpress.Drawing.v22.1" />
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -114,6 +119,10 @@ ...@@ -114,6 +119,10 @@
<None Include="App.config"> <None Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="log.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="errorAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="ERROR" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\err.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="infoAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\info.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="debugAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="DEBUG" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\debug.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="perfAppender" type="log4net.Appender.RollingFileAppender">
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="INFO" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<file value="Logs\perf.log" />
<encoding value="utf-8"/>
<preserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="errorAppender" />
<appender-ref ref="infoAppender" />
<appender-ref ref="debugAppender" />
</root>
<logger name="Performance" additivity="false">
<level value="ALL" />
<appender-ref ref="perfAppender" />
</logger>
</log4net>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.14" targetFramework="net48" />
</packages>
\ No newline at end of file
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