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
d9052968
Commit
d9052968
authored
Sep 17, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.区分不同界面网络异常提示
parent
5f164e4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
sbkpay/control.cpp
+19
-4
sbkpay/control.h
+1
-1
No files found.
sbkpay/control.cpp
View file @
d9052968
...
...
@@ -164,12 +164,20 @@ bool Control::SendMessageToPayMent(const QJsonObject &json, QByteArray &outdata,
QJsonObject
tmpjson
=
json
;
CretOperate
::
GetMAC
(
tmpjson
);
CretOperate
::
GetSign
(
tmpjson
);
bool
ispay
=
false
;
QLOG_INFO
()
<<
"send json to payment: "
<<
tmpjson
;
if
(
tmpjson
.
contains
(
JSON_KEY_REQTYPE
)
&&
tmpjson
[
JSON_KEY_REQTYPE
].
toInt
()
==
72
)
ispay
=
true
;
if
(
tmpjson
.
contains
(
JSON_KEY_REQTYPE
)
&&
tmpjson
[
JSON_KEY_REQTYPE
].
toInt
()
==
62
)
ispay
=
true
;
QByteArray
data
=
QJsonDocument
(
tmpjson
).
toJson
(
QJsonDocument
::
Compact
);
if
(
!
Control
::
HttpPost
(
url
,
array
,
data
,
"application/json;charset=utf-8"
,
"application/json"
,
error
,
60
))
if
(
!
Control
::
HttpPost
(
url
,
array
,
data
,
"application/json;charset=utf-8"
,
"application/json"
,
error
,
60
,
ispay
))
{
if
(
!
_isinterrupt
)
{
...
...
@@ -195,7 +203,7 @@ bool Control::SendMessageToPayMent(const QJsonObject &json, QByteArray &outdata,
return
true
;
}
bool
Control
::
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
)
bool
Control
::
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
,
bool
ispay
)
{
QString
path
;
ToolS
::
GetPath
(
path
);
...
...
@@ -241,7 +249,11 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
error
=
QString
::
fromLocal8Bit
(
"网路异常.交易失败.如已扣款将会自动返还"
);
if
(
ispay
)
error
=
QString
::
fromLocal8Bit
(
"网路异常.交易失败.如已扣款将会自动返还"
);
else
error
=
QString
::
fromLocal8Bit
(
"网络异常,请检查网络后重试"
);
QLOG_INFO
()
<<
reply
->
errorString
()
<<
"Contents: "
<<
reply
->
readAll
();
return
false
;
}
...
...
@@ -250,7 +262,10 @@ bool Control::HttpPost(QString url, QByteArray &outdata, const QByteArray &indat
if
(
outdata
.
isEmpty
())
{
error
=
QString
::
fromLocal8Bit
(
"网路异常.交易失败.如已扣款将会自动返还"
);
if
(
ispay
)
error
=
QString
::
fromLocal8Bit
(
"网路异常.交易失败.如已扣款将会自动返还"
);
else
error
=
QString
::
fromLocal8Bit
(
"网络异常,请检查网络后重试"
);
QLOG_INFO
()
<<
reply
->
errorString
()
<<
"Contents: "
<<
reply
->
readAll
();
return
false
;
}
...
...
sbkpay/control.h
View file @
d9052968
...
...
@@ -49,7 +49,7 @@ private:
bool
GetJson
(
ReqType
type
,
QJsonObject
&
json
,
const
QByteArray
array
,
QString
&
error
);
bool
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
);
bool
HttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
,
bool
ispay
=
false
);
bool
RollHttpPost
(
QString
url
,
QByteArray
&
outdata
,
const
QByteArray
&
indata
,
QString
content
,
QString
accept
,
QString
&
error
,
int
timeout
);
...
...
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