Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
G
GS.Terminal.VisitorSelfService
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
终端组
GS.Terminal.VisitorSelfService
Commits
b2228e25
Commit
b2228e25
authored
Jul 18, 2021
by
姜春辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正token 失效的bug
parent
939974cd
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
46 additions
and
22 deletions
+46
-22
Views.dll
Publish/Addons/GS.Terminal.LogicShell/Views/Views.dll
+0
-0
MainShellWindowStyle.xaml
....Theme/CommonResourceDictionary/MainShellWindowStyle.xaml
+1
-0
Config.xml
...sh/Addons/GS.Terminal.VisitorSelfService.Logic/Config.xml
+1
-1
GS.Terminal.VisitorSelfService.Logic.dll
...elfService.Logic/GS.Terminal.VisitorSelfService.Logic.dll
+0
-0
MainShellWindowStyle.xaml
....Theme/CommonResourceDictionary/MainShellWindowStyle.xaml
+1
-0
Config.xml
...ice/Logic/GS.Terminal.VisitorSelfService.Logic/Config.xml
+1
-1
AuthenticationPageHandler.cs
...isitorSelfService.Logic/Core/AuthenticationPageHandler.cs
+5
-1
MenuPageHandler.cs
...Terminal.VisitorSelfService.Logic/Core/MenuPageHandler.cs
+1
-1
Program.cs
...ice/Logic/GS.Terminal.VisitorSelfService.Logic/Program.cs
+6
-2
WebApi.cs
...gic/GS.Terminal.VisitorSelfService.Logic/Remote/WebApi.cs
+25
-11
Index.xaml
...iewModelView/Views/Pages/AppointmentDetailPage/Index.xaml
+3
-3
Index.xaml
...ewModelView/Views/Pages/HistoryAppointmentPage/Index.xaml
+2
-2
No files found.
Publish/Addons/GS.Terminal.LogicShell/Views/Views.dll
View file @
b2228e25
No preview for this file type
Publish/Addons/GS.Terminal.Theme/CommonResourceDictionary/MainShellWindowStyle.xaml
View file @
b2228e25
...
...
@@ -13,6 +13,7 @@
<!-- 底部背景颜色-->
<Style x:Key="MainShell_FootBackground" TargetType="Grid">
<Setter Property="Background" Value="#121212"></Setter>
<Setter Property="Opacity" Value="0"/>
<Setter Property="Height" Value="45"></Setter>
</Style>
<Style x:Key="MainShell_FullBackground" TargetType="Grid">
...
...
Publish/Addons/GS.Terminal.VisitorSelfService.Logic/Config.xml
View file @
b2228e25
...
...
@@ -5,7 +5,7 @@
<Key
Caption=
"人脸识别阀值"
Name=
"FaceMinValue"
Value=
"0.85"
/>
<Key
Caption=
"人证比对阀值"
Name=
"FaceCardMatch"
Value=
"0"
/>
<Key
Caption=
"心跳端口"
Name=
"HeartPort"
Value=
"18083"
/>
<Key
Caption=
"远程认证地址"
Name=
"FaceWebSocket"
Value=
"ws://192.168.1.7:1505
6
/face/sdk2?persontype=访客"
/>
<Key
Caption=
"远程认证地址"
Name=
"FaceWebSocket"
Value=
"ws://192.168.1.7:1505
5
/face/sdk2?persontype=访客"
/>
</Dict>
<Dict
Caption=
"识别方式配置"
Name=
"authenticationconfig"
>
<Key
Caption=
"人脸识别"
Name=
"EnableFace"
Value=
"true"
/>
...
...
Publish/Addons/GS.Terminal.VisitorSelfService.Logic/GS.Terminal.VisitorSelfService.Logic.dll
View file @
b2228e25
No preview for this file type
Src/GS.Terminal.VisitorSelfService/GS.Terminal.VisitorSelfService/Addons/GS.Terminal.Theme/CommonResourceDictionary/MainShellWindowStyle.xaml
View file @
b2228e25
...
...
@@ -13,6 +13,7 @@
<!-- 底部背景颜色-->
<Style x:Key="MainShell_FootBackground" TargetType="Grid">
<Setter Property="Background" Value="#121212"></Setter>
<Setter Property="Opacity" Value="0"/>
<Setter Property="Height" Value="45"></Setter>
</Style>
<Style x:Key="MainShell_FullBackground" TargetType="Grid">
...
...
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Config.xml
View file @
b2228e25
...
...
@@ -5,7 +5,7 @@
<Key
Caption=
"人脸识别阀值"
Name=
"FaceMinValue"
Value=
"0.85"
/>
<Key
Caption=
"人证比对阀值"
Name=
"FaceCardMatch"
Value=
"0"
/>
<Key
Caption=
"心跳端口"
Name=
"HeartPort"
Value=
"18083"
/>
<Key
Caption=
"远程认证地址"
Name=
"FaceWebSocket"
Value=
"ws://192.168.1.7:1505
6
/face/sdk2?persontype=访客"
/>
<Key
Caption=
"远程认证地址"
Name=
"FaceWebSocket"
Value=
"ws://192.168.1.7:1505
5
/face/sdk2?persontype=访客"
/>
</Dict>
<Dict
Caption=
"识别方式配置"
Name=
"authenticationconfig"
>
<Key
Caption=
"人脸识别"
Name=
"EnableFace"
Value=
"true"
/>
...
...
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Core/AuthenticationPageHandler.cs
View file @
b2228e25
...
...
@@ -112,6 +112,10 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
catch
(
Exception
ex
)
{
Program
.
_Context
.
Logger
.
Error
(
$"查询有效预约单异常"
,
ex
);
if
(
ex
.
InnerException
!=
null
)
{
Program
.
_Context
.
Logger
.
Error
(
$"查询有效预约单异常Inner"
,
ex
.
InnerException
);
}
MainShell
.
ShowPrompt
(
$"通讯异常"
);
_faceValidating
=
false
;
}
...
...
@@ -193,7 +197,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
if
(
fid
==
_fid
)
{
if
(
result
==
1
)
_faceWebSocket
.
Send
(
_currentFeature
,
0
,
_currentFeature
.
Length
);
_faceWebSocket
?
.
Send
(
_currentFeature
,
0
,
_currentFeature
.
Length
);
else
MainShell
.
ShowPrompt
(
$"面部识别失败,正在重试..."
);
}
...
...
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Core/MenuPageHandler.cs
View file @
b2228e25
...
...
@@ -54,7 +54,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
{
Handlers
.
GetHandler
<
AppointmentDetailPageHandler
>()?.
ShowDetail
(
findResult
,
mode
==
AuthenticationMode
.
IdCard
?
((
dynamic
)
data
).
cardid
:
""
,
mode
==
AuthenticationMode
.
IdCard
?
File
.
ReadAllBytes
(((
dynamic
)
data
).
poto
)
:
""
);
mode
==
AuthenticationMode
.
IdCard
?
File
.
ReadAllBytes
(((
dynamic
)
data
).
poto
)
:
null
);
}
else
{
...
...
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Program.cs
View file @
b2228e25
...
...
@@ -18,7 +18,7 @@ namespace GS.Terminal.VisitorSelfService.Logic
internal
static
IAddonContext
_Context
;
internal
static
IObjectSpace
_ObjectSpace
;
internal
static
Locator
vmLocator
;
internal
static
string
_logicVersion
=
"0
528.17
"
;
internal
static
string
_logicVersion
=
"0
718.15
"
;
public
void
Start
(
IAddonContext
Context
)
{
...
...
@@ -47,12 +47,16 @@ namespace GS.Terminal.VisitorSelfService.Logic
Handlers
.
Product
();
Task
.
Run
(
async
()
=>
{
RETRY
:
var
signature
=
await
WebApi
.
SignatureAsync
();
if
(!
signature
.
success
)
{
var
ex
=
new
Exception
(
$"终端注册失败,失败原因:
{
signature
.
message
}
"
);
_Context
.
Logger
.
Error
(
"启动失败"
,
ex
);
throw
ex
;
//throw ex;
MainShell
.
ShowPrompt
(
"终端注册失败,正在重试.."
);
await
Task
.
Delay
(
5000
);
goto
RETRY
;
}
TerminalConsole
.
StartHeart
(
LocalSetting
.
AppConfig
.
ServerIP
,
LocalSetting
.
AddonDefaultConfig
.
HeartPort
,
30
*
1000
);
ThirdAddon
.
LogicShell
.
ShowView
(
vmLocator
.
MenuPage
);
...
...
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Remote/WebApi.cs
View file @
b2228e25
...
...
@@ -13,6 +13,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
{
private
static
SafeObjectPool
.
ObjectPool
<
HttpClient
>
_httpclientPool
=
null
;
private
static
string
_token
=
""
;
private
static
TerminalToken
_terminaltoken
=
null
;
static
WebApi
()
{
_httpclientPool
=
new
SafeObjectPool
.
ObjectPool
<
HttpClient
>(
10
,
()
=>
...
...
@@ -28,6 +29,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
}
public
static
async
Task
<
T
>
GetTAsync
<
T
>(
string
service
)
{
CheckToken
();
var
_clientPoolObject
=
await
_httpclientPool
.
GetAsync
();
var
_client
=
_clientPoolObject
.
Value
;
try
...
...
@@ -36,6 +38,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
if
(
result
.
IsSuccessStatusCode
)
{
var
responseBody
=
await
result
.
Content
.
ReadAsStringAsync
();
Program
.
_Context
.
Logger
.
Debug
(
$"GET
{
service
}
<br />
{
responseBody
}
"
);
return
JsonConvert
.
DeserializeObject
<
T
>(
responseBody
);
}
else
...
...
@@ -53,13 +56,14 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
}
finally
{
_httpclientPool
.
Return
(
_clientPoolObject
);
_httpclientPool
.
Return
(
_clientPoolObject
,
isReset
:
true
);
}
return
default
(
T
);
}
public
static
async
Task
<
T
>
PostAsync
<
T
>(
string
service
,
object
requestBody
)
{
CheckToken
();
var
bodyString
=
JsonConvert
.
SerializeObject
(
requestBody
);
var
content
=
new
StringContent
(
bodyString
);
content
.
Headers
.
ContentType
=
new
System
.
Net
.
Http
.
Headers
.
MediaTypeHeaderValue
(
"application/json"
);
...
...
@@ -71,6 +75,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
if
(
result
.
IsSuccessStatusCode
)
{
var
responseBody
=
await
result
.
Content
.
ReadAsStringAsync
();
Program
.
_Context
.
Logger
.
Debug
(
$"POST
{
service
}
<br />
{
responseBody
}
"
);
return
JsonConvert
.
DeserializeObject
<
T
>(
responseBody
);
}
else
...
...
@@ -87,13 +92,14 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
}
finally
{
_httpclientPool
.
Return
(
_clientPoolObject
);
_httpclientPool
.
Return
(
_clientPoolObject
,
isReset
:
true
);
}
return
default
(
T
);
}
public
static
T
Post
<
T
>(
string
service
,
object
requestBody
)
{
CheckToken
();
var
bodyString
=
JsonConvert
.
SerializeObject
(
requestBody
);
var
content
=
new
StringContent
(
bodyString
);
var
_clientPoolObject
=
_httpclientPool
.
Get
();
...
...
@@ -116,7 +122,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
}
finally
{
_httpclientPool
.
Return
(
_clientPoolObject
);
_httpclientPool
.
Return
(
_clientPoolObject
,
isReset
:
true
);
}
return
default
(
T
);
}
...
...
@@ -134,21 +140,29 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
/// <returns></returns>
public
static
(
bool
success
,
string
message
)
Signature
()
{
var
token
=
GetTAsync
<
TerminalToken
>(
$"/api/GS.WebApi.Terminal/TerminalConsole/Signature?tCode=
{
LocalSetting
.
AppConfig
.
tCode
}
&tMacCode=
{
GetMACAddress
()}
"
).
Result
;
if
(
token
==
null
)
return
(
false
,
"网络异常,设备注册失败"
);
if
(!
token
.
Status
)
return
(
false
,
$"设备注册失败.原因:
{
token
.
Message
}
"
);
_token
=
token
.
tToken
;
_terminal
token
=
GetTAsync
<
TerminalToken
>(
$"/api/GS.WebApi.Terminal/TerminalConsole/Signature?tCode=
{
LocalSetting
.
AppConfig
.
tCode
}
&tMacCode=
{
GetMACAddress
()}
"
).
Result
;
if
(
_terminal
token
==
null
)
return
(
false
,
"网络异常,设备注册失败"
);
if
(!
_terminaltoken
.
Status
)
return
(
false
,
$"设备注册失败.原因:
{
_terminal
token
.
Message
}
"
);
_token
=
_terminal
token
.
tToken
;
return
(
true
,
_token
);
}
public
static
async
Task
<(
bool
success
,
string
message
)>
SignatureAsync
()
{
var
token
=
await
GetTAsync
<
TerminalToken
>(
$"/api/GS.WebApi.Terminal/TerminalConsole/Signature?tCode=
{
LocalSetting
.
AppConfig
.
tCode
}
&tMacCode=
{
GetMACAddress
()}
"
);
if
(
token
==
null
)
return
(
false
,
"网络异常,设备注册失败"
);
if
(!
token
.
Status
)
return
(
false
,
$"设备注册失败.原因:
{
token
.
Message
}
"
);
_token
=
token
.
tToken
;
_terminal
token
=
await
GetTAsync
<
TerminalToken
>(
$"/api/GS.WebApi.Terminal/TerminalConsole/Signature?tCode=
{
LocalSetting
.
AppConfig
.
tCode
}
&tMacCode=
{
GetMACAddress
()}
"
);
if
(
_terminal
token
==
null
)
return
(
false
,
"网络异常,设备注册失败"
);
if
(!
_terminaltoken
.
Status
)
return
(
false
,
$"设备注册失败.原因:
{
_terminal
token
.
Message
}
"
);
_token
=
_terminal
token
.
tToken
;
return
(
true
,
_token
);
}
private
static
void
CheckToken
()
{
if
(
_terminaltoken
!=
null
&&
_terminaltoken
.
expDate
.
AddMinutes
(-
30
)
<
DateTime
.
Now
)
{
Signature
();
}
}
}
public
class
TerminalToken
{
...
...
Src/GS.Terminal.VisitorSelfService/ViewModelView/Views/Pages/AppointmentDetailPage/Index.xaml
View file @
b2228e25
...
...
@@ -89,7 +89,7 @@
<!--信息-->
<Grid Grid.Row="1" Margin="130,70,130,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2
4
5"/>
<ColumnDefinition Width="2
0
5"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
...
...
@@ -111,8 +111,8 @@
<ContentControl Grid.Row="2" Template="{StaticResource AppointmentDetailPage_Line}" Grid.ColumnSpan="2"/>
<TextBlock Text="来访
日期
" Grid.Row="3" Style="{StaticResource AppointmentDetailPage_Title}"/>
<TextBlock Grid.Row="3" Style="{StaticResource AppointmentDetailPage_Value}"><Run Text="{Binding Appointment.startDate, StringFormat=\{0:yyyy-MM-dd
\}}"/><Run Text=" "/><Run Text=" 到 "/><Run Text=" "/><Run Text="{Binding Appointment.endDate, StringFormat=\{0:yyyy-MM-dd
\}}"/></TextBlock>
<TextBlock Text="来访
时间
" Grid.Row="3" Style="{StaticResource AppointmentDetailPage_Title}"/>
<TextBlock Grid.Row="3" Style="{StaticResource AppointmentDetailPage_Value}"><Run Text="{Binding Appointment.startDate, StringFormat=\{0:yyyy-MM-dd
HH:mm\}}"/><Run Text=" ~ "/><Run Text="{Binding Appointment.endDate, StringFormat=\{0:yyyy-MM-dd HH:mm
\}}"/></TextBlock>
<TextBlock Text="来访区域" Grid.Row="4" Style="{StaticResource AppointmentDetailPage_Title}"/>
<TextBlock Text="{Binding Appointment.areaName}" Grid.Row="4" Style="{StaticResource AppointmentDetailPage_Value}"/>
...
...
Src/GS.Terminal.VisitorSelfService/ViewModelView/Views/Pages/HistoryAppointmentPage/Index.xaml
View file @
b2228e25
...
...
@@ -76,9 +76,9 @@
<TextBlock HorizontalAlignment="Right" FontSize="30" Margin="0,20,0,0" Text="{Binding Phone}"/>
<TextBlock HorizontalAlignment="Right" FontSize="30" Margin="0,20,0,0" Text="{Binding VisitPerson}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
<TextBlock HorizontalAlignment="Right" FontSize="30" Margin="0,20,0,0" >
<Run Text="{Binding StartDate,StringFormat='yyyy
年MM月dd日
'}"/>
<Run Text="{Binding StartDate,StringFormat='yyyy
-MM-dd HH:mm
'}"/>
<Run Text=" 到 "/>
<Run Text="{Binding EndDate,StringFormat='yyyy
年MM月dd日
'}"/>
<Run Text="{Binding EndDate,StringFormat='yyyy
-MM-dd HH:mm
'}"/>
</TextBlock>
<TextBlock x:Name="PART_STATUS" HorizontalAlignment="Right" FontSize="40" Margin="0,26,0,0" FontWeight="Black" />
</StackPanel>
...
...
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