Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkclient
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
李定达
sbkclient
Commits
e415a7d5
Commit
e415a7d5
authored
Aug 06, 2021
by
wuyang.zou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 上一版本未考虑 卡券签到的Mac地址 会覆盖 微信支付宝签到的地址,本次版本被要求单独分支: 用来测试兼容双网卡模式
Version: 2.21.8.20
parent
f5d0f587
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
5 deletions
+36
-5
ZH_Client/fmclient.aps
+0
-0
ZH_Client/fmclient.rc
+0
-0
ZH_Client/fmtool.h
+36
-5
No files found.
ZH_Client/fmclient.aps
View file @
e415a7d5
No preview for this file type
ZH_Client/fmclient.rc
View file @
e415a7d5
No preview for this file type
ZH_Client/fmtool.h
View file @
e415a7d5
...
...
@@ -42,7 +42,13 @@ public:
{
char
buff
[
20
]
=
{
0
};
DWORD
bufflen
=
20
;
std
::
string
tmpFirstMac
=
""
;
std
::
string
tmpFirstIp
=
""
;
std
::
string
tmpMac
=
""
;
std
::
string
tmpIp
=
""
;
// If successful, output some information from the data we received
// 兼容特殊场景: MINI Pos (含无线网卡) 插在门店网卡底座自动签到 或 脱离底座处于无线网卡状态触发自动签到, 都会与微信支付宝的签到mac地址相互覆盖,
// 故需要两个程序读取网卡地址的逻辑需一致 , 同时也需要保证 无论机器处于 ①插在网卡底座 还是 ②脱离启用无线网络 时 签到 与 正常交易不会提示 MAC地址错误;
for
(
PIP_ADAPTER_ADDRESSES
pCurrAddresses
=
pAddresses
;
pCurrAddresses
!=
NULL
;
pCurrAddresses
=
pCurrAddresses
->
Next
)
{
// 确保MAC地址的长度为 00-00-00-00-00-00
...
...
@@ -57,7 +63,7 @@ public:
int
(
pCurrAddresses
->
PhysicalAddress
[
4
]),
int
(
pCurrAddresses
->
PhysicalAddress
[
5
]));
macOut
=
acMAC
;
tmpMac
=
acMAC
;
//pCurrAddresses->Dhcpv4Server // 通过 SOCKET_ADDRESS 地址进行 转换获取 准确的IPv4 地址;
PIP_ADAPTER_UNICAST_ADDRESS
pUnicast
=
pCurrAddresses
->
FirstUnicastAddress
;
...
...
@@ -67,7 +73,7 @@ public:
sockaddr_in
*
sa_in
=
(
sockaddr_in
*
)
pUnicast
->
Address
.
lpSockaddr
;
inet_ntop
(
AF_INET
,
&
(
sa_in
->
sin_addr
),
buff
,
bufflen
);
LOG
()
<<
" GetMacIpByAdaptersAddresses IPv4: "
<<
buff
;
ipOut
=
buff
;
tmpIp
=
buff
;
}
else
if
(
pUnicast
->
Address
.
lpSockaddr
->
sa_family
==
AF_INET6
)
{
/*
...
...
@@ -76,19 +82,44 @@ public:
*/
}
else
{
LOG
()
<<
"GetMacIpByAdaptersAddresses sa_family UNSPEC"
;
ipOut
=
"sa_family UNSPEC"
;
tmpIp
=
"sa_family UNSPEC"
;
}
pUnicast
=
pUnicast
->
Next
;
}
}
else
{
LOG
()
<<
" GetMacIpByAdaptersAddresses No Unicast Addresses"
;
ipOut
=
"FirstUnicastAddress Is NULL"
;
tmpIp
=
"FirstUnicastAddress Is NULL"
;
}
// Get First Unicast IP Address From Adapter Finished ;
// Record First Network Interface: Mac Address And Ip Address;
if
(
0
==
tmpFirstMac
.
length
())
{
tmpFirstMac
=
tmpMac
;
tmpFirstIp
=
tmpIp
;
}
/* QLOG_INFO() << " GetMacIpByAdaptersAddresses: :"<<" IfType: "<< pCurrAddresses->IfType // Network Interface Type : 6 -> Ethernet; 71 -> Wirless;
<<" OperStatus: "<< pCurrAddresses->OperStatus; // Network Interface: 1 -> up; 0 -> down;
*/
LOG
()
<<
" GetMacIpByAdaptersAddresses:: Filter Valid One, Mac: "
<<
tmpMac
<<
" Ip: "
<<
tmpIp
<<
" IfType: "
<<
pCurrAddresses
->
IfType
;
// IEEE80211 标识网卡是无线网卡, 底层通信数据逻辑是特殊处理, 使用本机电脑进行验证过;
// 卡券dll自动签到的mac地址与 微信支付宝优先使用无线网卡 签到地址不一致,导致 先支付宝签到 后 卡券自动签到 最后使用 微信支付宝支付 提示mac地址错误;
if
(
IF_TYPE_IEEE80211
==
pCurrAddresses
->
IfType
)
{
if
(
tmpMac
!=
tmpFirstMac
)
{
tmpFirstMac
=
tmpMac
;
}
break
;
}
// break; //遍历全部的网卡,仅当识别无线网卡后,立刻结束遍历.
}
if
(
tmpFirstMac
.
length
())
{
macOut
=
tmpFirstMac
;
ipOut
=
tmpFirstIp
;
ret
=
1
;
break
;
}
}
free
(
pAddresses
);
...
...
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