Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.TVP.CBA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.TVP.CBA
Commits
e897be50
Commit
e897be50
authored
Jan 09, 2023
by
wangonghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CBA添加配置文件以及访问接口异步
parent
c5cdcb92
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
565 additions
and
60 deletions
+565
-60
VIZ.MIGU.CBA.Module/Common/JsonHelper.cs
+4
-4
VIZ.MIGU.CBA.Module/Common/JsonModel.cs
+65
-40
VIZ.MIGU.CBA.Module/DayMatch/ViewModel/DayMatchViewModel.cs
+2
-2
VIZ.MIGU.CBA.Module/Main/MainView.xaml
+11
-0
VIZ.MIGU.CBA.Module/Main/MainView.xaml.cs
+1
-0
VIZ.MIGU.CBA.Module/Main/ViewModel/MainViewModel.cs
+2
-0
VIZ.MIGU.CBA.Module/PlayerCompare/ViewModel/PlayerCompareViewModel.cs
+5
-5
VIZ.MIGU.CBA.Module/Setting/HttpUrl/HttpUrlPluginLifeCycle.cs
+50
-0
VIZ.MIGU.CBA.Module/Setting/HttpUrl/View/HttpUrlConfigView.xaml
+51
-0
VIZ.MIGU.CBA.Module/Setting/HttpUrl/View/HttpUrlConfigView.xaml.cs
+40
-0
VIZ.MIGU.CBA.Module/Setting/HttpUrl/ViewModel/HttpUrlConfigViewModel.cs
+140
-0
VIZ.MIGU.CBA.Module/SinglePlayer/ViewModel/SinglePlayerViewModel.cs
+5
-5
VIZ.MIGU.CBA.Module/Storge/AppSetup_InitCBALiteDB.cs
+71
-0
VIZ.MIGU.CBA.Module/Storge/CBALocalDbContext.cs
+58
-0
VIZ.MIGU.CBA.Module/Storge/HttpUrlConfigEntity.cs
+38
-0
VIZ.MIGU.CBA.Module/TeamStats/ViewModel/TeamStatsViewModel.cs
+4
-4
VIZ.MIGU.CBA.Module/VIZ.TVP.CBA.Module.csproj
+16
-0
VIZ.MIGU.CBA.Module/packages.config
+2
-0
No files found.
VIZ.MIGU.CBA.Module/Common/JsonHelper.cs
View file @
e897be50
...
@@ -72,16 +72,16 @@ namespace VIZ.TVP.CBA.Module
...
@@ -72,16 +72,16 @@ namespace VIZ.TVP.CBA.Module
/// <param name="url"></param>
/// <param name="url"></param>
/// <returns></returns>
/// <returns></returns>
public
static
string
GetResult
(
string
url
)
public
static
string
GetResult
(
string
url
)
{
{
string
data
=
""
;
string
data
=
""
;
try
try
{
{
HttpWebRequest
req
=
(
HttpWebRequest
)
WebRequest
.
Create
(
url
);
HttpWebRequest
req
=
(
HttpWebRequest
)
WebRequest
.
Create
(
url
);
req
.
Headers
[
"Accept-Encoding"
]
=
"gzip,deflate"
;
req
.
Headers
[
"Accept-Encoding"
]
=
"gzip,deflate"
;
req
.
AutomaticDecompression
=
DecompressionMethods
.
GZip
;
req
.
AutomaticDecompression
=
DecompressionMethods
.
GZip
;
HttpWebResponse
resp
=
(
HttpWebResponse
)
req
.
GetResponse
();
HttpWebResponse
resp
=
(
HttpWebResponse
)
req
.
GetResponse
();
Stream
stream
=
resp
.
GetResponseStream
();
Stream
stream
=
resp
.
GetResponseStream
();
//获取内容
//获取内容
using
(
StreamReader
reader
=
new
StreamReader
(
stream
,
Encoding
.
UTF8
))
using
(
StreamReader
reader
=
new
StreamReader
(
stream
,
Encoding
.
UTF8
))
...
@@ -94,7 +94,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -94,7 +94,7 @@ namespace VIZ.TVP.CBA.Module
Log
.
Error
(
ex
.
Message
);
Log
.
Error
(
ex
.
Message
);
}
}
return
data
;
return
data
;
}
}
}
}
}
}
VIZ.MIGU.CBA.Module/Common/JsonModel.cs
View file @
e897be50
using
log4net
;
using
DevExpress.DirectX.Common.Direct2D
;
using
DevExpress.Xpf
;
using
log4net
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -9,7 +11,7 @@ using System.Security.Policy;
...
@@ -9,7 +11,7 @@ using System.Security.Policy;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Input
;
using
System.Windows.Input
;
using
VIZ.Package.Domain
;
namespace
VIZ.TVP.CBA.Module
namespace
VIZ.TVP.CBA.Module
{
{
...
@@ -24,16 +26,23 @@ namespace VIZ.TVP.CBA.Module
...
@@ -24,16 +26,23 @@ namespace VIZ.TVP.CBA.Module
//AppConfigUtil.GetAppConfig("leagueId")
//AppConfigUtil.GetAppConfig("leagueId")
//读取配置文件
//读取配置文件
public
static
AppSettingsSection
sd
=
ConfigManage
.
InitLogConfig
()?.
AppSettings
;
//
public static AppSettingsSection sd = ConfigManage.InitLogConfig()?.AppSettings;
//读取url
//读取url
private
static
string
httpStr
=
sd
?.
Settings
[
"url"
].
Value
.
ToString
();
private
static
AppSetup_InitCBALiteDB
appSetup_InitCBALiteDB
=
AppSetup_InitCBALiteDB
.
CreateInstance
;
private
static
string
httpStr
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
.
Url
;
//ApplicationDomainEx.HttpUrlConfig.Url;
//ApplicationDomainEx.HttpUrlConfig.Url;
//sd?.Settings["url"].Value.ToString();
/// <summary>
/// <summary>
/// 读取艾果的数据平台的配置项
/// 读取艾果的数据平台的配置项
/// </summary>
/// </summary>
private
static
string
appID
=
sd
.
Settings
[
"AppID"
].
Value
.
ToString
();
private
static
string
appID
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
.
AppId
;
private
static
string
appKey
=
sd
.
Settings
[
"AppKey"
].
Value
.
ToString
();
//sd.Settings["AppID"].Value.ToString();
private
static
string
strUrl
=
sd
.
Settings
[
"newUrl"
].
Value
.
ToString
();
private
static
string
appKey
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
.
AppKey
;
//sd.Settings["AppKey"].Value.ToString();
// private static string strUrl = sd.Settings["newUrl"].Value.ToString();
private
static
string
leagueid
=
"401"
;
private
static
string
leagueid
=
"401"
;
private
static
string
customer
=
"migu"
;
private
static
string
customer
=
"migu"
;
...
@@ -47,7 +56,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -47,7 +56,7 @@ namespace VIZ.TVP.CBA.Module
/// 明日赛程数据服务器接口
/// 明日赛程数据服务器接口
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
static
Dayschedules
TomorrowMatch_Path
(
string
date
)
public
async
static
Task
<
Dayschedules
>
TomorrowMatch_Path
(
string
date
)
{
{
//Dictionary<string, string> dict = new Dictionary<string, string>();
//Dictionary<string, string> dict = new Dictionary<string, string>();
...
@@ -60,26 +69,30 @@ namespace VIZ.TVP.CBA.Module
...
@@ -60,26 +69,30 @@ namespace VIZ.TVP.CBA.Module
//string newKey = Utils.GetKey(appID,appKey);
//string newKey = Utils.GetKey(appID,appKey);
//var str = JsonHelper.Post(strUrl, dict, newKey);
//var str = JsonHelper.Post(strUrl, dict, newKey);
Dayschedules
dayschedules
=
new
Dayschedules
();
try
try
{
{
string
TomorrowMatchPath
=
httpStr
+
"schedule/getdayschedule?leagueid="
await
Task
.
Run
(()
=>
+
leagueid
+
"&date="
+
date
+
"&customer="
+
customer
+
"&key="
+
key
+
"&encrypted="
{
string
TomorrowMatchPath
=
httpStr
+
"schedule/getdayschedule?leagueid="
+
leagueid
+
"&date="
+
date
+
"&customer="
+
customer
+
"&key="
+
key
+
"&encrypted="
+
Utils
.
GetMD5
(
key
+
encrypted
+
random
)
+
"&random="
+
random
;
+
Utils
.
GetMD5
(
key
+
encrypted
+
random
)
+
"&random="
+
random
;
//MessageBox.Show(TomorrowMatchPath);
//MessageBox.Show(TomorrowMatchPath);
Console
.
WriteLine
(
"明日赛程数据接口新新:=======>:"
+
TomorrowMatchPath
);
Console
.
WriteLine
(
"明日赛程数据接口新新:=======>:"
+
TomorrowMatchPath
);
string
result
=
JsonHelper
.
GetResult
(
TomorrowMatchPath
);
Log
.
Info
(
"明日赛程数据接口新:=======>:"
+
result
);
string
result
=
JsonHelper
.
GetResult
(
TomorrowMatchPath
);
JsonSerializerSettings
settings
=
new
JsonSerializerSettings
();
settings
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
Dayschedules
dayschedules
=
JsonConvert
.
DeserializeObject
<
Dayschedules
>(
result
,
settings
);
// Dayschedules aguodayschedules = JsonConvert.DeserializeObject<Dayschedules>(str,settings);
Log
.
Info
(
"明日赛程数据接口新:=======>:"
+
result
);
JsonSerializerSettings
settings
=
new
JsonSerializerSettings
();
settings
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
dayschedules
=
JsonConvert
.
DeserializeObject
<
Dayschedules
>(
result
,
settings
);
// Dayschedules aguodayschedules = JsonConvert.DeserializeObject<Dayschedules>(str,settings);
});
return
dayschedules
;
return
dayschedules
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -141,24 +154,29 @@ namespace VIZ.TVP.CBA.Module
...
@@ -141,24 +154,29 @@ namespace VIZ.TVP.CBA.Module
/// </summary>
/// </summary>
/// <param name="matchtypeid"></param>
/// <param name="matchtypeid"></param>
/// <returns></returns>
/// <returns></returns>
public
static
PlayerSeasonData
PlayerSeasonData_Path
(
string
matchtypeid
)
public
async
static
Task
<
PlayerSeasonData
>
PlayerSeasonData_Path
(
string
matchtypeid
)
{
{
PlayerSeasonData
playerSeasonData
=
new
PlayerSeasonData
();
try
try
{
{
string
PlayerSeasonDataPath
=
httpStr
+
"player/getplayerstats?leagueid="
await
Task
.
Run
(()
=>
+
leagueid
+
"&matchtypeid="
+
matchtypeid
+
"&customer="
+
customer
+
"&key="
+
key
+
"&encrypted="
{
+
Utils
.
GetMD5
(
key
+
encrypted
+
random
)
+
"&random="
+
random
;
string
PlayerSeasonDataPath
=
httpStr
+
"player/getplayerstats?leagueid="
//MessageBox.Show(PlayerSeasonDataPath);
+
leagueid
+
"&matchtypeid="
+
matchtypeid
+
"&customer="
+
customer
+
"&key="
+
key
+
"&encrypted="
Console
.
WriteLine
(
"球员赛季数据的服务器接口地址====>:"
+
PlayerSeasonDataPath
);
+
Utils
.
GetMD5
(
key
+
encrypted
+
random
)
+
"&random="
+
random
;
//MessageBox.Show(PlayerSeasonDataPath);
Console
.
WriteLine
(
"球员赛季数据的服务器接口地址====>:"
+
PlayerSeasonDataPath
);
string
result
=
JsonHelper
.
GetResult
(
PlayerSeasonDataPath
);
string
result
=
JsonHelper
.
GetResult
(
PlayerSeasonDataPath
);
JsonSerializerSettings
settings
=
new
JsonSerializerSettings
();
JsonSerializerSettings
settings
=
new
JsonSerializerSettings
();
settings
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
settings
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
PlayerSeasonData
playerSeasonData
=
JsonConvert
.
DeserializeObject
<
PlayerSeasonData
>(
result
);
playerSeasonData
=
JsonConvert
.
DeserializeObject
<
PlayerSeasonData
>(
result
);
Log
.
Info
(
result
);
});
Log
.
Info
(
result
);
return
playerSeasonData
;
return
playerSeasonData
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -236,22 +254,29 @@ namespace VIZ.TVP.CBA.Module
...
@@ -236,22 +254,29 @@ namespace VIZ.TVP.CBA.Module
/// 球队赛季数据服务器地址
/// 球队赛季数据服务器地址
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
static
TeamSeasonData
TeamSeasonData_Path
(
string
matchtypeid
)
public
async
static
Task
<
TeamSeasonData
>
TeamSeasonData_Path
(
string
matchtypeid
)
{
{
TeamSeasonData
teamSeasonData
=
new
TeamSeasonData
();
try
try
{
{
string
TeamSeasonDataPath
=
httpStr
+
"team/getteamstats?leagueid="
+
leagueid
+
"&matchtypeid="
+
matchtypeid
+
"&customer="
+
customer
+
"&key="
+
key
+
"&encrypted="
+
Utils
.
GetMD5
(
key
+
encrypted
+
random
)
+
"&random="
+
random
;
Console
.
WriteLine
(
"球队赛季接口数据==>:"
+
TeamSeasonDataPath
);
string
result
=
JsonHelper
.
GetResult
(
TeamSeasonDataPath
);
await
Task
.
Run
(()
=>
Log
.
Info
(
result
);
{
string
TeamSeasonDataPath
=
httpStr
+
"team/getteamstats?leagueid="
+
leagueid
+
"&matchtypeid="
+
matchtypeid
+
"&customer="
+
customer
+
"&key="
+
key
+
"&encrypted="
+
Utils
.
GetMD5
(
key
+
encrypted
+
random
)
+
"&random="
+
random
;
Console
.
WriteLine
(
"球队赛季接口数据==>:"
+
TeamSeasonDataPath
);
string
result
=
JsonHelper
.
GetResult
(
TeamSeasonDataPath
);
Log
.
Info
(
result
);
JsonSerializerSettings
settings
=
new
JsonSerializerSettings
();
settings
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
teamSeasonData
=
JsonConvert
.
DeserializeObject
<
TeamSeasonData
>(
result
,
settings
);
});
JsonSerializerSettings
settings
=
new
JsonSerializerSettings
();
settings
.
NullValueHandling
=
NullValueHandling
.
Ignore
;
TeamSeasonData
teamSeasonData
=
JsonConvert
.
DeserializeObject
<
TeamSeasonData
>(
result
,
settings
);
return
teamSeasonData
;
return
teamSeasonData
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
VIZ.MIGU.CBA.Module/DayMatch/ViewModel/DayMatchViewModel.cs
View file @
e897be50
...
@@ -115,7 +115,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -115,7 +115,7 @@ namespace VIZ.TVP.CBA.Module
/// <summary>
/// <summary>
/// 获取赛程信息
/// 获取赛程信息
/// </summary>
/// </summary>
private
void
GetSchedule
()
private
async
void
GetSchedule
()
{
{
try
try
{
{
...
@@ -123,7 +123,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -123,7 +123,7 @@ namespace VIZ.TVP.CBA.Module
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
var
dayschedules
=
JsonModel
.
TomorrowMatch_Path
(
date
);
var
dayschedules
=
await
JsonModel
.
TomorrowMatch_Path
(
date
);
if
(
dayschedules
==
null
)
return
;
if
(
dayschedules
==
null
)
return
;
...
...
VIZ.MIGU.CBA.Module/Main/MainView.xaml
View file @
e897be50
...
@@ -131,6 +131,15 @@
...
@@ -131,6 +131,15 @@
</dx:DXTabControl>-->
</dx:DXTabControl>-->
<TabControl Grid.Row="1" >
<TabControl Grid.Row="1" >
<TabItem Header="设置" FontSize="20">
<Grid>
<moduel:HttpUrlConfigView>
</moduel:HttpUrlConfigView>
</Grid>
</TabItem>
<TabItem Header="今日赛程" FontSize="20">
<TabItem Header="今日赛程" FontSize="20">
<Grid >
<Grid >
<moduel:DayMatchView>
<moduel:DayMatchView>
...
@@ -180,6 +189,8 @@
...
@@ -180,6 +189,8 @@
</Grid>
</Grid>
</TabItem>
</TabItem>
</TabControl>
</TabControl>
</Grid>
</Grid>
...
...
VIZ.MIGU.CBA.Module/Main/MainView.xaml.cs
View file @
e897be50
...
@@ -12,6 +12,7 @@ using System.Windows.Media.Imaging;
...
@@ -12,6 +12,7 @@ using System.Windows.Media.Imaging;
using
System.Windows.Navigation
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
namespace
VIZ.TVP.CBA.Module
namespace
VIZ.TVP.CBA.Module
{
{
...
...
VIZ.MIGU.CBA.Module/Main/ViewModel/MainViewModel.cs
View file @
e897be50
...
@@ -41,6 +41,8 @@ namespace VIZ.TVP.CBA.Module
...
@@ -41,6 +41,8 @@ namespace VIZ.TVP.CBA.Module
InitProperty
();
InitProperty
();
}
}
// private string matchDate;
// private string matchDate;
...
...
VIZ.MIGU.CBA.Module/PlayerCompare/ViewModel/PlayerCompareViewModel.cs
View file @
e897be50
...
@@ -853,7 +853,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -853,7 +853,7 @@ namespace VIZ.TVP.CBA.Module
/// 根据日期获取赛程
/// 根据日期获取赛程
/// </summary>
/// </summary>
private
void
GetSchedule
()
private
async
void
GetSchedule
()
{
{
try
try
...
@@ -861,7 +861,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -861,7 +861,7 @@ namespace VIZ.TVP.CBA.Module
MatchItems
=
new
ObservableCollection
<
string
>();
MatchItems
=
new
ObservableCollection
<
string
>();
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
var
dayschedules
=
JsonModel
.
TomorrowMatch_Path
(
date
);
var
dayschedules
=
await
JsonModel
.
TomorrowMatch_Path
(
date
);
if
(
dayschedules
==
null
)
return
;
if
(
dayschedules
==
null
)
return
;
// matchData.AddRange(dayschedules.dayschedule);
// matchData.AddRange(dayschedules.dayschedule);
...
@@ -921,14 +921,14 @@ namespace VIZ.TVP.CBA.Module
...
@@ -921,14 +921,14 @@ namespace VIZ.TVP.CBA.Module
/// <summary>
/// <summary>
/// 获得赛季球队数据
/// 获得赛季球队数据
/// </summary>
/// </summary>
private
void
GetSeasonData
()
private
async
void
GetSeasonData
()
{
{
try
try
{
{
PlayerSeasonData
=
JsonModel
.
PlayerSeasonData_Path
(
Matchtypeid
);
PlayerSeasonData
=
await
JsonModel
.
PlayerSeasonData_Path
(
Matchtypeid
);
TeamSeasonData
=
JsonModel
.
TeamSeasonData_Path
(
Matchtypeid
);
TeamSeasonData
=
await
JsonModel
.
TeamSeasonData_Path
(
Matchtypeid
);
CNAliasPlayerSportsDictionary
.
Clear
();
CNAliasPlayerSportsDictionary
.
Clear
();
...
...
VIZ.MIGU.CBA.Module/Setting/HttpUrl/HttpUrlPluginLifeCycle.cs
0 → 100644
View file @
e897be50
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Module
;
namespace
VIZ.TVP.CBA.Module
{
/// <summary>
/// 数据访问配置
/// </summary>
public
class
HttpUrlPluginLifeCycle
:
IPluginLifeCycle
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public
const
string
PLUGIN_ID
=
"HttpUrlConfigView"
;
/// <summary>
/// 插件名称
/// </summary>
public
const
string
PLUGIN_NAME
=
"数据访问配置"
;
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public
PluginInfo
Register
()
{
PluginInfo
info
=
new
PluginInfo
();
info
.
ID
=
PLUGIN_ID
;
info
.
Name
=
PLUGIN_NAME
;
info
.
SettingViewType
=
typeof
(
HttpUrlConfigView
);
return
info
;
}
/// <summary>
/// 销毁
/// </summary>
public
void
Dispose
()
{
}
}
}
VIZ.MIGU.CBA.Module/Setting/HttpUrl/View/HttpUrlConfigView.xaml
0 → 100644
View file @
e897be50
<UserControl x:Class="VIZ.TVP.CBA.Module.HttpUrlConfigView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:VIZ.TVP.CBA.Module"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<Grid>
<!-- 数据访问设置 -->
<GroupBox Header="数据访问配置" Margin="10" Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!-- 地址 -->
<TextBlock Text="地址:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Column="1" Height="30"
EditValue="{Binding Path=Url,Mode=TwoWay}"></dxe:TextEdit>
<!-- 艾果平台 -->
<TextBlock Text="应用Id:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Grid.Row="1"></TextBlock>
<dxe:TextEdit Grid.Column="1" Height="30" Grid.Row="1"
EditValue="{Binding Path=AppID,Mode=TwoWay}"></dxe:TextEdit>
<!-- 地址 -->
<TextBlock Text="应用Key:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Grid.Row="2"></TextBlock>
<dxe:TextEdit Grid.Column="1" Height="30" Grid.Row="2"
EditValue="{Binding Path=AppKey,Mode=TwoWay}"></dxe:TextEdit>
</Grid>
</GroupBox>
</Grid>
</UserControl>
VIZ.MIGU.CBA.Module/Setting/HttpUrl/View/HttpUrlConfigView.xaml.cs
0 → 100644
View file @
e897be50
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Module
;
namespace
VIZ.TVP.CBA.Module
{
/// <summary>
/// Interaction logic for HttpUrlConfigView.xaml
/// </summary>
public
partial
class
HttpUrlConfigView
:
UserControl
{
public
HttpUrlConfigView
()
{
InitializeComponent
();
WPFHelper
.
BindingViewModel
(
this
,
new
HttpUrlConfigViewModel
());
}
/// <summary>
/// 保存
/// </summary>
public
void
Save
()
{
HttpUrlConfigViewModel
vm
=
this
.
DataContext
as
HttpUrlConfigViewModel
;
vm
.
Save
();
}
}
}
VIZ.MIGU.CBA.Module/Setting/HttpUrl/ViewModel/HttpUrlConfigViewModel.cs
0 → 100644
View file @
e897be50
using
DevExpress.Mvvm.POCO
;
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Markup
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Module
;
namespace
VIZ.TVP.CBA.Module
{
/// <summary>
/// 数据访问接口配置
/// </summary>
public
class
HttpUrlConfigViewModel
:
ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
MediaSettingViewModel
));
private
static
AppSetup_InitCBALiteDB
appSetup_InitCBALiteDB
=
AppSetup_InitCBALiteDB
.
CreateInstance
;
/// <summary>
/// 媒资库配置设置视图模型
/// </summary>
public
HttpUrlConfigViewModel
()
{
// 初始化命令
this
.
InitCommand
();
// HttpUrlConfigEntity config = AppSetup_InitCBALiteDB.HttpUrlConfigEntity;
}
/// <summary>
/// 初始化命令
/// </summary>
private
void
InitCommand
()
{
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
}
// =========================================================================
// Property
// =========================================================================
#
region
Url
--
地址
private
string
url
;
/// <summary>
/// 地址
/// </summary>
public
string
Url
{
get
{
return
url
;
}
set
{
url
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Url
));
}
}
#
endregion
#
region
应用
Id
/// <summary>
/// 艾果平台应用Id
/// </summary>
private
string
appId
;
public
string
AppId
{
get
{
return
appId
;
}
set
{
appId
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AppId
));
}
}
#
endregion
#
region
平台
Key
/// <summary>
/// 艾果应用平台Key
/// </summary>
private
string
appKey
;
public
string
AppKey
{
get
{
return
appKey
;
}
set
{
appKey
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
AppKey
));
}
}
#
endregion
// =========================================================================
// Command
// =========================================================================
#
region
LoadedCommand
--
加载命令
/// <summary>
/// 加载命令
/// </summary>
public
VCommand
LoadedCommand
{
get
;
set
;
}
/// <summary>
/// 加载
/// </summary>
private
void
Loaded
()
{
this
.
Url
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
.
Url
;
this
.
AppId
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
.
AppId
;
this
.
AppKey
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
.
AppKey
;
}
#
endregion
// =========================================================================
// Public Function
// =========================================================================
/// <summary>
/// 保存
/// </summary>
public
void
Save
()
{
HttpUrlConfigEntity
config
=
AppSetup_InitCBALiteDB
.
HttpUrlConfigEntity
;
config
.
Url
=
this
.
Url
;
}
}
}
VIZ.MIGU.CBA.Module/SinglePlayer/ViewModel/SinglePlayerViewModel.cs
View file @
e897be50
...
@@ -971,14 +971,14 @@ namespace VIZ.TVP.CBA.Module
...
@@ -971,14 +971,14 @@ namespace VIZ.TVP.CBA.Module
/// 获取日期类型
/// 获取日期类型
/// </summary>
/// </summary>
private
void
GetSchedule
()
private
async
void
GetSchedule
()
{
{
try
try
{
{
MatchItems
=
new
ObservableCollection
<
string
>();
MatchItems
=
new
ObservableCollection
<
string
>();
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
var
dayschedules
=
JsonModel
.
TomorrowMatch_Path
(
date
);
var
dayschedules
=
await
JsonModel
.
TomorrowMatch_Path
(
date
);
if
(
dayschedules
==
null
)
return
;
if
(
dayschedules
==
null
)
return
;
...
@@ -1045,13 +1045,13 @@ namespace VIZ.TVP.CBA.Module
...
@@ -1045,13 +1045,13 @@ namespace VIZ.TVP.CBA.Module
/// <summary>
/// <summary>
/// 获得赛季数据
/// 获得赛季数据
/// </summary>
/// </summary>
private
void
GetSeasonData
()
private
async
void
GetSeasonData
()
{
{
try
try
{
{
PlayerSeasonData
=
JsonModel
.
PlayerSeasonData_Path
(
Matchtypeid
);
PlayerSeasonData
=
await
JsonModel
.
PlayerSeasonData_Path
(
Matchtypeid
);
TeamSeasonData
=
JsonModel
.
TeamSeasonData_Path
(
Matchtypeid
);
TeamSeasonData
=
await
JsonModel
.
TeamSeasonData_Path
(
Matchtypeid
);
if
(
PlayerSeasonData
==
null
)
return
;
if
(
PlayerSeasonData
==
null
)
return
;
CNAliasPlayerSportsDictionary
.
Clear
();
CNAliasPlayerSportsDictionary
.
Clear
();
...
...
VIZ.MIGU.CBA.Module/Storge/AppSetup_InitCBALiteDB.cs
0 → 100644
View file @
e897be50
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Module
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Module
;
using
VIZ.Package.Storage
;
namespace
VIZ.TVP.CBA.Module
{
public
class
AppSetup_InitCBALiteDB
{
private
static
AppSetup_InitCBALiteDB
_createInstance
=
null
;
public
static
AppSetup_InitCBALiteDB
CreateInstance
{
get
{
if
(
null
==
_createInstance
)
{
_createInstance
=
new
AppSetup_InitCBALiteDB
();
}
return
_createInstance
;
}
}
/// <summary>
/// 日志
/// </summary>
private
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_InitCBALiteDB
));
/// <summary>
/// 描述
/// </summary>
public
static
string
Detail
{
get
;
}
=
"应用程序启动 -- 初始化LiteDB"
;
/// <summary>
/// CBA数据库Context
/// </summary>
public
CBALocalDbContext
cBALocalDbContext
{
get
;
set
;
}
public
static
HttpUrlConfigEntity
HttpUrlConfigEntity
{
get
;
set
;
}
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public
AppSetup_InitCBALiteDB
()
{
string
folder
=
System
.
IO
.
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"db"
);
if
(!
System
.
IO
.
Directory
.
Exists
(
folder
))
{
System
.
IO
.
Directory
.
CreateDirectory
(
folder
);
}
string
path
=
System
.
IO
.
Path
.
Combine
(
folder
,
"CBAcache.db"
);
log
.
Error
(
path
);
cBALocalDbContext
=
new
CBALocalDbContext
(
path
);
HttpUrlConfigEntity
=
cBALocalDbContext
.
HttpUrlConfig
.
FindAll
().
FirstOrDefault
()??
new
HttpUrlConfigEntity
();
}
}
}
VIZ.MIGU.CBA.Module/Storge/CBALocalDbContext.cs
0 → 100644
View file @
e897be50
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Package.Storage
;
using
LiteDB
;
namespace
VIZ.TVP.CBA.Module
{
public
class
CBALocalDbContext
{
/// <summary>
/// 日志
/// </summary>
private
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
LocalDbContext
));
/// <summary>
/// 数据库
/// </summary>
private
ILiteDatabase
Database
;
/// <summary>
/// LiteDB数据库
/// </summary>
/// <param name="path">数据库路径</param>
public
CBALocalDbContext
(
string
path
)
{
this
.
Path
=
path
;
this
.
Database
=
new
LiteDatabase
(
path
);
this
.
HttpUrlConfig
=
this
.
Database
.
GetCollection
<
HttpUrlConfigEntity
>();
}
/// <summary>
/// 数据库文件路径
/// </summary>
public
string
Path
{
get
;
private
set
;
}
/// <summary>
/// 数据访问接口配置
/// </summary>
public
ILiteCollection
<
HttpUrlConfigEntity
>
HttpUrlConfig
{
get
;
private
set
;
}
/// <summary>
/// 销毁
/// </summary>
public
void
Dispose
()
{
this
.
HttpUrlConfig
=
null
;
this
.
Database
?.
Dispose
();
}
}
}
VIZ.MIGU.CBA.Module/Storge/HttpUrlConfigEntity.cs
0 → 100644
View file @
e897be50
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.TVP.CBA.Module
{
/// <summary>
/// 数据访问配置
/// </summary>
public
class
HttpUrlConfigEntity
{
/// <summary>
/// 编号
/// </summary>
[
BsonId
(
true
)]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 地址
/// </summary>
public
string
Url
{
get
;
set
;
}
=
"http://sportsdata.misports.cn/beitai/api/"
;
/// <summary>
/// 应用程序Id
/// </summary>
public
string
AppId
{
get
;
set
;
}
/// <summary>
/// 应用程序Key
/// </summary>
public
string
AppKey
{
get
;
set
;
}
}
}
VIZ.MIGU.CBA.Module/TeamStats/ViewModel/TeamStatsViewModel.cs
View file @
e897be50
...
@@ -529,7 +529,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -529,7 +529,7 @@ namespace VIZ.TVP.CBA.Module
private
void
SetTeamData
()
private
async
void
SetTeamData
()
{
{
if
(
SelectMatchItems
==
null
)
return
;
if
(
SelectMatchItems
==
null
)
return
;
ScheduleID
=
SetMatchDict
[
SelectMatchItems
];
ScheduleID
=
SetMatchDict
[
SelectMatchItems
];
...
@@ -562,7 +562,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -562,7 +562,7 @@ namespace VIZ.TVP.CBA.Module
AwayTeam
=
onAirDataModel
.
liveTeamInfo
.
VisitingTeamCNAlias
;
AwayTeam
=
onAirDataModel
.
liveTeamInfo
.
VisitingTeamCNAlias
;
TeamSeasonData
=
JsonModel
.
TeamSeasonData_Path
(
Matchtypeid
);
TeamSeasonData
=
await
JsonModel
.
TeamSeasonData_Path
(
Matchtypeid
);
SetTeamSeasonDictionary
();
SetTeamSeasonDictionary
();
...
@@ -617,7 +617,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -617,7 +617,7 @@ namespace VIZ.TVP.CBA.Module
/// 获取日期类型
/// 获取日期类型
/// </summary>
/// </summary>
private
void
GetSchedule
()
private
async
void
GetSchedule
()
{
{
try
try
...
@@ -625,7 +625,7 @@ namespace VIZ.TVP.CBA.Module
...
@@ -625,7 +625,7 @@ namespace VIZ.TVP.CBA.Module
MatchItems
=
new
ObservableCollection
<
string
>();
MatchItems
=
new
ObservableCollection
<
string
>();
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
string
date
=
Convert
.
ToDateTime
(
matchDate
).
ToString
(
"yyyy-MM-dd"
);
var
dayschedules
=
JsonModel
.
TomorrowMatch_Path
(
date
);
var
dayschedules
=
await
JsonModel
.
TomorrowMatch_Path
(
date
);
if
(
dayschedules
==
null
)
return
;
if
(
dayschedules
==
null
)
return
;
// matchData.AddRange(dayschedules.dayschedule);
// matchData.AddRange(dayschedules.dayschedule);
...
...
VIZ.MIGU.CBA.Module/VIZ.TVP.CBA.Module.csproj
View file @
e897be50
...
@@ -86,6 +86,9 @@
...
@@ -86,6 +86,9 @@
<Reference Include="DevExpress.Xpf.LayoutControl.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.LayoutControl.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<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="LiteDB, Version=5.0.15.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.15\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<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>
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
</Reference>
...
@@ -143,12 +146,20 @@
...
@@ -143,12 +146,20 @@
<Compile Include="SeasonData\Playerstats.cs" />
<Compile Include="SeasonData\Playerstats.cs" />
<Compile Include="SeasonData\SportsLiveTeamInfo.cs" />
<Compile Include="SeasonData\SportsLiveTeamInfo.cs" />
<Compile Include="SeasonData\TeamSeasonData.cs" />
<Compile Include="SeasonData\TeamSeasonData.cs" />
<Compile Include="Setting\HttpUrl\HttpUrlPluginLifeCycle.cs" />
<Compile Include="Setting\HttpUrl\ViewModel\HttpUrlConfigViewModel.cs" />
<Compile Include="Setting\HttpUrl\View\HttpUrlConfigView.xaml.cs">
<DependentUpon>HttpUrlConfigView.xaml</DependentUpon>
</Compile>
<Compile Include="SinglePlayer\Model\SinglePlayerModel.cs" />
<Compile Include="SinglePlayer\Model\SinglePlayerModel.cs" />
<Compile Include="SinglePlayer\SinglePlayerPlugin.cs" />
<Compile Include="SinglePlayer\SinglePlayerPlugin.cs" />
<Compile Include="SinglePlayer\ViewModel\SinglePlayerViewModel.cs" />
<Compile Include="SinglePlayer\ViewModel\SinglePlayerViewModel.cs" />
<Compile Include="SinglePlayer\View\SinglePlayerView.xaml.cs">
<Compile Include="SinglePlayer\View\SinglePlayerView.xaml.cs">
<DependentUpon>SinglePlayerView.xaml</DependentUpon>
<DependentUpon>SinglePlayerView.xaml</DependentUpon>
</Compile>
</Compile>
<Compile Include="Storge\AppSetup_InitCBALiteDB.cs" />
<Compile Include="Storge\CBALocalDbContext.cs" />
<Compile Include="Storge\HttpUrlConfigEntity.cs" />
<Compile Include="TeamStandings\Model\Teamrank.cs" />
<Compile Include="TeamStandings\Model\Teamrank.cs" />
<Compile Include="TeamStandings\Model\TeamRanks.cs" />
<Compile Include="TeamStandings\Model\TeamRanks.cs" />
<Compile Include="TeamStandings\TeamStandingPlugin.cs" />
<Compile Include="TeamStandings\TeamStandingPlugin.cs" />
...
@@ -281,6 +292,10 @@
...
@@ -281,6 +292,10 @@
<SubType>Designer</SubType>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
</Page>
</Page>
<Page Include="Setting\HttpUrl\View\HttpUrlConfigView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SinglePlayer\View\SinglePlayerView.xaml">
<Page Include="SinglePlayer\View\SinglePlayerView.xaml">
<SubType>Designer</SubType>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
...
@@ -314,6 +329,7 @@
...
@@ -314,6 +329,7 @@
<Install>false</Install>
<Install>false</Install>
</BootstrapperPackage>
</BootstrapperPackage>
</ItemGroup>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
VIZ.MIGU.CBA.Module/packages.config
View file @
e897be50
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"LiteDB"
version
=
"5.0.15"
targetFramework
=
"net48"
/>
<
package
id
=
"log4net"
version
=
"2.0.14"
targetFramework
=
"net48"
/>
<
package
id
=
"log4net"
version
=
"2.0.14"
targetFramework
=
"net48"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net48"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net48"
/>
</
packages
>
</
packages
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment