Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkpay
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
zhenfei.zhang
sbkpay
Commits
35113112
Commit
35113112
authored
Sep 07, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 整合master分支 [
bc2e9cbb
] 代码。
parent
77a629d0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
8 deletions
+74
-8
sbkpay/control.cpp
+62
-3
sbkpay/control.h
+2
-0
sbkpay/fmp_settings.cpp
+2
-1
sbkpay/global.h
+1
-1
sbkpay/main.cpp
+1
-1
sbkpay/rspfactory.h
+5
-1
sbkpay/version.h
+1
-1
No files found.
sbkpay/control.cpp
View file @
35113112
...
...
@@ -68,7 +68,7 @@ void Control::Start(const char *indata, char *outdata)
ToolS
::
GetProcPath
(
pathStr
);
appPath
=
QString
::
fromLocal8Bit
(
pathStr
);
appPath
=
appPath
.
replace
(
"
\\
"
,
"/"
);
QFontDatabase
::
addApplicationFont
(
appPath
+
"
/
msyh.ttf"
);
QFontDatabase
::
addApplicationFont
(
appPath
+
"msyh.ttf"
);
QFont
ft
(
"Microsoft YaHei UI Light"
);
qApp
->
setFont
(
ft
);
...
...
@@ -193,7 +193,8 @@ bool Control::SendMessageToServer(const QJsonObject &json, QByteArray &outdata,
}
if
(
!
_isinterrupt
&&
!
isOk
)
{
if
(
tmpjson
.
contains
(
JSON_KEY_PARTORDERID
)
&&
!
tmpjson
[
JSON_KEY_PARTORDERID
].
toString
().
isEmpty
())
//如果没有点击取消支付按钮直接写数据库异步冲正
if
(
tmpjson
.
contains
(
JSON_KEY_REQTYPE
)
&&
tmpjson
[
JSON_KEY_REQTYPE
].
toInt
()
==
72
)
{
QByteArray
data
=
QJsonDocument
(
tmpjson
).
toJson
(
QJsonDocument
::
Compact
);
QVariantHash
hash
;
...
...
@@ -327,6 +328,64 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
return
true
;
}
bool
Control
::
RollHttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
)
{
QString
path
;
ToolS
::
GetPath
(
path
);
QString
host
=
QSettings
(
path
+
"
\\
"
+
USERCONFIG_NAME
,
QSettings
::
IniFormat
).
value
(
VALUE_HOST
).
toString
();
QEventLoop
loop
;
QTimer
timer
;
QSslConfiguration
config
=
QSslConfiguration
::
defaultConfiguration
();
config
.
setPeerVerifyMode
(
QSslSocket
::
VerifyNone
);
QNetworkAccessManager
manger
;
QNetworkRequest
request
(
url
);
request
.
setSslConfiguration
(
config
);
request
.
setRawHeader
(
"Content-Type"
,
content
.
toUtf8
());
request
.
setRawHeader
(
"Accept"
,
accept
.
toUtf8
());
request
.
setRawHeader
(
"Host"
,
host
.
toUtf8
());
request
.
setRawHeader
(
"Authorization"
,
"Basic dXBzLWNsaWVudDo2VGk4TjBXNzRyb1A="
);
QNetworkReply
*
reply
=
manger
.
post
(
request
,
indata
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
&
manger
,
&
QNetworkAccessManager
::
finished
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
_widget
,
&
HostWidget
::
Interrupt
,
&
loop
,
&
QEventLoop
::
quit
);
connect
(
reply
,
static_cast
<
void
(
QNetworkReply
::*
)(
QNetworkReply
::
NetworkError
)
>
(
&
QNetworkReply
::
error
),
&
loop
,
&
QEventLoop
::
quit
);
timer
.
start
(
timeout
*
1000
);
loop
.
exec
();
reply
->
deleteLater
();
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
error
=
QString
::
fromLocal8Bit
(
"网络异常,获取服务端返回数据失败"
);
QLOG_INFO
()
<<
reply
->
errorString
()
<<
"Contents: "
<<
reply
->
readAll
();
return
false
;
}
outdata
=
reply
->
readAll
();
if
(
outdata
.
isEmpty
())
{
error
=
QString
::
fromLocal8Bit
(
"网络异常,获取服务端返回数据为空"
);
QLOG_INFO
()
<<
reply
->
errorString
()
<<
"Contents: "
<<
reply
->
readAll
();
return
false
;
}
QLOG_INFO
()
<<
outdata
.
data
();
return
true
;
}
bool
Control
::
SendMessageToSBKAPI
(
const
QJsonObject
&
json
,
QByteArray
&
outdata
,
QString
&
error
,
int
timeout
,
bool
isReversal
)
{
...
...
@@ -368,7 +427,7 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
QFile
f
(
qApp
->
applicationDirPath
()
+
QString
(
"/test_spcc/%1.txt"
).
arg
(
type
));
f
.
open
(
QIODevice
::
ReadOnly
);
strcpy
(
out
,
f
.
readAll
().
data
());
Sleep
(
1000
*
10
);
Sleep
(
1000
*
3
);
QLOG_DEBUG
()
<<
"=========================================== End read debug data. ===================================="
;
int
result
=
0
;
...
...
sbkpay/control.h
View file @
35113112
...
...
@@ -59,6 +59,8 @@ private:
bool
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
);
bool
RollHttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
);
void
InitPOSReqJsonObj
(
const
char
*
indata
);
public
slots
:
...
...
sbkpay/fmp_settings.cpp
View file @
35113112
#
include
"fmp_settings.h"
#include "global.h"
#include "DataProcess/tools.h"
#include "tools.h"
#include "fmglobal.h"
#include <QSettings>
#include <QDebug>
...
...
sbkpay/global.h
View file @
35113112
...
...
@@ -14,7 +14,7 @@
#define PRINT_FILE_NAME "print.txt"
#define USERCONFIG_NAME "config.ini"
//
#define USERCONFIG_NAME "config.ini"
#define ENCODE_FIRST "encode/first"
#define ENCODE_END "encode/end"
...
...
sbkpay/main.cpp
View file @
35113112
...
...
@@ -427,7 +427,7 @@ int main(int argc, char *argv[])
// control.Start(as, b);
char
spccIn
[
MAX_BUF_LEN
]
=
"{
\"
fmId
\"
:
\"
11971709011000000002
\"
,
\"
reqType
\"
:35
2
,
\"
storeId
\"
:
\"
17607
\"
,
\"
stationId
\"
:
\"
1
\"
,
\"
partnerId
\"
:1443,
\"
operatorId
\"
:
\"
0123
\"
,
\"
transId
\"
:301439,
\"
transAmount
\"
:1,
\"
partnerOrderId
\"
:
\"
909911039990170830002
\"
,
\"
businessDate
\"
:
\"
20170508
\"
,
\"
products
\"
:[{
\"
pid
\"
:
\"
123
\"
,
\"
name
\"
:
\"
中杯拿铁
\"
,
\"
price
\"
:321,
\"
salesType
\"
:
\"
NORMAL
\"
}]}"
;
char
spccIn
[
MAX_BUF_LEN
]
=
"{
\"
fmId
\"
:
\"
11971709011000000002
\"
,
\"
reqType
\"
:35
1
,
\"
storeId
\"
:
\"
17607
\"
,
\"
stationId
\"
:
\"
1
\"
,
\"
partnerId
\"
:1443,
\"
operatorId
\"
:
\"
0123
\"
,
\"
transId
\"
:301439,
\"
transAmount
\"
:1,
\"
partnerOrderId
\"
:
\"
909911039990170830002
\"
,
\"
businessDate
\"
:
\"
20170508
\"
,
\"
products
\"
:[{
\"
pid
\"
:
\"
123
\"
,
\"
name
\"
:
\"
中杯拿铁
\"
,
\"
price
\"
:321,
\"
salesType
\"
:
\"
NORMAL
\"
}]}"
;
// char spccIn[MAX_BUF_LEN] = "{\"reqType\":452,\"storeId\":\"17607\",\"stationId\":\"1\",\"partnerId\":1443,\"operatorId\":\"0123\",\"transId\":301439,\"transAmount\":1,\"partnerOrderId\":\"1365670843098735011753\",\"businessDate\":\"20170830\"}";
// char spccIn[MAX_BUF_LEN] = "{\"fmId\":\"64761709011000001002\",\"reqType\":453,\"storeId\":\"17607\",\"stationId\":\"1\",\"partnerId\":1443,\"operatorId\":\"0123\",\"transId\":301439,\"transAmount\":1,\"partnerOrderId\":\"1365670843098735011754\",\"businessDate\":\"20170830\"}";
control
.
Start
(
spccIn
,
b
);
...
...
sbkpay/rspfactory.h
View file @
35113112
...
...
@@ -364,7 +364,11 @@ private:
QString
printFileName
=
setting
.
GetValue
(
configKey
,
PRINT_FILE_NAME
).
toString
();
QString
filePath
=
path
+
"/"
+
printFileName
;
QString
filePath
=
path
;
if
(
!
filePath
.
endsWith
(
'/'
)
&&
!
filePath
.
endsWith
(
'\\'
))
{
filePath
.
append
(
'\\'
);
}
filePath
.
append
(
printFileName
);
response
[
JSON_KEY_PRINTPATH
]
=
filePath
;
QFile
file
(
filePath
);
...
...
sbkpay/version.h
View file @
35113112
...
...
@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 3
6
#define VER_BUILD 3
7
//! Convert version numbers to string
#define _STR(S) #S
...
...
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