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
d0824442
Commit
d0824442
authored
Aug 12, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.签到,支付,退款修改完成
parent
14d81a4a
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
137 additions
and
67 deletions
+137
-67
sbkpay/control.cpp
+14
-11
sbkpay/fmtool.h
+3
-3
sbkpay/global.h
+0
-5
sbkpay/hostwidget.cpp
+62
-22
sbkpay/hostwidget.h
+2
-0
sbkpay/jsonfactory.h
+6
-4
sbkpay/main.cpp
+37
-8
sbkpay/rspfactory.h
+0
-1
sbkpay/sbkpay.pro
+2
-0
sbkpay/sbkpay.pro.user
+11
-13
No files found.
sbkpay/control.cpp
View file @
d0824442
#include "control.h"
#
include
"control.h"
#include "global.h"
#include "global.h"
#include "fmtool.h"
#include "fmtool.h"
#include "fmerror.h"
#include "fmerror.h"
...
@@ -55,7 +55,7 @@ void Control::Start(const char *indata, char *outdata)
...
@@ -55,7 +55,7 @@ void Control::Start(const char *indata, char *outdata)
memcpy
(
outdata
,
(
char
*
)(
&
_response
),
sizeof
(
struct
AlipayResponse
));
memcpy
(
outdata
,
(
char
*
)(
&
_response
),
sizeof
(
struct
AlipayResponse
));
outdata
[
sizeof
(
struct
AlipayResponse
)]
=
0
;
outdata
[
sizeof
(
struct
AlipayResponse
)]
=
0
;
QLOG_INFO
()
<<
"return data to pos :
"
<<
outdata
;
QLOG_INFO
()
<<
"return data to pos :
"
<<
outdata
;
}
}
void
Control
::
SetResPonseWithMessage
(
QString
code
,
const
QString
&
message
)
void
Control
::
SetResPonseWithMessage
(
QString
code
,
const
QString
&
message
)
...
@@ -102,14 +102,14 @@ bool Control::SendMessageToPayMent(const QJsonObject &json, QByteArray &outdata,
...
@@ -102,14 +102,14 @@ bool Control::SendMessageToPayMent(const QJsonObject &json, QByteArray &outdata,
else
else
{
{
QLOG_ERROR
()
<<
"get function (GetRSACret) failed"
;
QLOG_ERROR
()
<<
"get function (GetRSACret) failed"
;
error
=
QString
(
ERROR_LOAD_DLL2
);
error
=
QString
::
fromLocal8Bit
(
"加载基础组件(fun)失败"
);
}
}
}
}
else
else
{
{
QLOG_ERROR
()
<<
"load dll failed"
;
QLOG_ERROR
()
<<
"load dll failed"
;
error
=
QString
(
ERROR_LOAD_DLL1
);
error
=
QString
::
fromLocal8Bit
(
"加载基础组件(dll)失败"
);
}
}
return
false
;
return
false
;
...
@@ -135,12 +135,9 @@ bool Control::GetRSA(QString &error)
...
@@ -135,12 +135,9 @@ bool Control::GetRSA(QString &error)
int
i
=
FMTool
::
GetString
(
_request
.
Reserved1
,
48
).
toInt
();
int
i
=
FMTool
::
GetString
(
_request
.
Reserved1
,
48
).
toInt
();
QString
storeID
=
FMTool
::
GetString
(
_request
.
StoreNo
,
20
);
QString
storeID
=
FMTool
::
GetString
(
_request
.
StoreNo
,
20
);
QString
PosNO
=
FMTool
::
GetString
(
_request
.
DeviceNo
,
6
);
QString
PosNO
=
FMTool
::
GetString
(
_request
.
DeviceNo
,
6
);
rlt
=
getrsacret
(
i
,
storeID
.
toLatin1
().
data
(),
PosNO
.
toLatin1
().
data
());
rlt
=
getrsacret
(
i
,
storeID
.
toLatin1
().
data
(),
PosNO
.
toLatin1
().
data
());
if
(
!
rlt
)
if
(
!
rlt
)
error
=
QString
(
ERROR_LOAD_FAILED
);
error
=
QString
::
fromLocal8Bit
(
"获取服务端返回数据失败"
);
loop
.
exit
();
loop
.
exit
();
});
});
...
@@ -149,14 +146,14 @@ bool Control::GetRSA(QString &error)
...
@@ -149,14 +146,14 @@ bool Control::GetRSA(QString &error)
else
else
{
{
QLOG_ERROR
()
<<
"get function (GetRSACret) failed"
;
QLOG_ERROR
()
<<
"get function (GetRSACret) failed"
;
error
=
QString
(
ERROR_LOAD_DLL2
);
error
=
QString
::
fromLocal8Bit
(
"加载基础组件(fun)失败"
);
}
}
}
}
else
else
{
{
QLOG_ERROR
()
<<
"load dll failed"
;
QLOG_ERROR
()
<<
"load dll failed"
;
error
=
QString
(
ERROR_LOAD_DLL1
);
error
=
QString
::
fromLocal8Bit
(
"加载基础组件(dll)失败"
);
}
}
return
rlt
;
return
rlt
;
}
}
...
@@ -165,6 +162,12 @@ void Control::RequestSign()
...
@@ -165,6 +162,12 @@ void Control::RequestSign()
{
{
QString
error
;
QString
error
;
bool
rlt
=
GetRSA
(
error
);
bool
rlt
=
GetRSA
(
error
);
if
(
rlt
)
SetResPonseWithMessage
(
"100"
,
QString
::
fromLocal8Bit
(
"签名成功"
));
else
SetResPonseWithMessage
(
"22"
,
QString
::
fromLocal8Bit
(
"签名失败"
));
_lock
.
lock
();
_lock
.
lock
();
if
(
_widget
!=
NULL
)
if
(
_widget
!=
NULL
)
_widget
->
ShowWiteMGS
(
sign
,
rlt
,
error
);
_widget
->
ShowWiteMGS
(
sign
,
rlt
,
error
);
...
@@ -178,7 +181,7 @@ bool Control::GetJson(ReqType type,QJsonObject &json, const QByteArray array, QS
...
@@ -178,7 +181,7 @@ bool Control::GetJson(ReqType type,QJsonObject &json, const QByteArray array, QS
if
(
jsonDocument
.
isNull
()
)
if
(
jsonDocument
.
isNull
()
)
{
{
QLOG_ERROR
()
<<
"server return not json"
;
QLOG_ERROR
()
<<
"server return not json"
;
error
=
QString
(
"服务端返回数据异常"
);
error
=
QString
::
fromLocal8Bit
(
"服务端返回数据异常"
);
return
false
;
return
false
;
}
}
...
...
sbkpay/fmtool.h
View file @
d0824442
...
@@ -100,7 +100,7 @@ public:
...
@@ -100,7 +100,7 @@ public:
strncpy
(
buf
,
(
char
*
)
beginptr
,
size
);
strncpy
(
buf
,
(
char
*
)
beginptr
,
size
);
qDebug
()
<<
buf
;
//
qDebug() << buf;
for
(
int
i
=
strlen
(
buf
)
-
1
;
i
>=
0
;
--
i
)
for
(
int
i
=
strlen
(
buf
)
-
1
;
i
>=
0
;
--
i
)
{
{
...
@@ -120,7 +120,7 @@ public:
...
@@ -120,7 +120,7 @@ public:
if
(
GBKToUTF8
((
unsigned
char
*
)
tmpbuf
,
strlen
(
tmpbuf
),
(
unsigned
char
*
)
utfbuf
,
len
+
1
)
>
0
)
if
(
GBKToUTF8
((
unsigned
char
*
)
tmpbuf
,
strlen
(
tmpbuf
),
(
unsigned
char
*
)
utfbuf
,
len
+
1
)
>
0
)
tmp
=
QString
(
utfbuf
);
tmp
=
QString
(
utfbuf
);
qDebug
()
<<
tmp
.
toLatin1
().
data
();
//
qDebug() << tmp.toLatin1().data();
return
QString
(
tmpbuf
);
return
QString
(
tmpbuf
);
}
}
...
@@ -142,7 +142,7 @@ public:
...
@@ -142,7 +142,7 @@ public:
strncpy
((
char
*
)
beginptr
,
tmpbuf
,
len
-
1
);
strncpy
((
char
*
)
beginptr
,
tmpbuf
,
len
-
1
);
qDebug
()
<<
tmpbuf
;
//
qDebug() << tmpbuf;
}
}
...
...
sbkpay/global.h
View file @
d0824442
...
@@ -52,10 +52,5 @@
...
@@ -52,10 +52,5 @@
#define JSON_REQTYPE_PRINTER 85
#define JSON_REQTYPE_PRINTER 85
#define JSON_REQTYPE_find 2
#define JSON_REQTYPE_find 2
#define ERROR_LOAD_DLL1 "加载基础组件(dll)失败"
#define ERROR_LOAD_DLL2 "加载基础组件(fun)失败"
#define ERROR_LOAD_FAILED "获取服务端返回数据失败"
#endif // GLOBAL
#endif // GLOBAL
sbkpay/hostwidget.cpp
View file @
d0824442
#include "hostwidget.h"
#
include
"hostwidget.h"
#include "ui_hostwidget.h"
#include "ui_hostwidget.h"
#include "QKeyEvent"
#include "QKeyEvent"
#include "QsLog.h"
#include "QsLog.h"
...
@@ -28,7 +28,7 @@ HostWidget::HostWidget(QWidget *parent) :
...
@@ -28,7 +28,7 @@ HostWidget::HostWidget(QWidget *parent) :
InitWidget
();
InitWidget
();
_label_pay_timer
=
new
LabelsTimer
(
ui
->
label_pay_time
,
60
,
"% 秒"
);
_label_pay_timer
=
new
LabelsTimer
(
ui
->
label_pay_time
,
60
,
QString
::
fromLocal8Bit
(
"%1 秒"
)
);
connect
(
_label_pay_timer
,
&
LabelsTimer
::
timeout
,
this
,
&
HostWidget
::
on_TimeOut
);
connect
(
_label_pay_timer
,
&
LabelsTimer
::
timeout
,
this
,
&
HostWidget
::
on_TimeOut
);
...
@@ -48,7 +48,7 @@ void HostWidget::ShowWidget(QWidget *showwidget)
...
@@ -48,7 +48,7 @@ void HostWidget::ShowWidget(QWidget *showwidget)
ui
->
lineEdit_pay_code
->
setFocus
();
ui
->
lineEdit_pay_code
->
setFocus
();
ui
->
label_pay_msg_time
->
setVisible
(
false
);
ui
->
label_pay_msg_time
->
setVisible
(
false
);
_label_pay_timer
->
start
(
10
,
"%1 秒"
);
_label_pay_timer
->
start
(
60
,
QString
::
fromLocal8Bit
(
"%1 秒"
)
);
}
}
for
(
int
i
=
0
;
i
<
_widgetlist
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
_widgetlist
.
size
();
++
i
)
...
@@ -89,16 +89,24 @@ void HostWidget::keyPressEvent(QKeyEvent *ke)
...
@@ -89,16 +89,24 @@ void HostWidget::keyPressEvent(QKeyEvent *ke)
{
{
ui
->
btn_pay_exit
->
hide
();
ui
->
btn_pay_exit
->
hide
();
ui
->
label_pay_money
->
hide
();
ui
->
label_pay_money
->
hide
();
ui
->
label_pay_title
->
setText
(
"支付宝支付中..."
);
_label_pay_timer
->
start
(
60
,
"%1 秒"
);
_label_pay_timer
->
start
(
60
,
QString
::
fromLocal8Bit
(
"%1 秒"
)
);
QStringList
list
;
QStringList
list
;
list
.
append
(
ui
->
lineEdit_pay_code
->
text
());
list
.
append
(
ui
->
lineEdit_pay_code
->
text
());
QLOG_INFO
()
<<
list
;
QLOG_INFO
()
<<
list
;
if
(
_type
==
pay
)
{
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"支付宝支付中..."
));
emit
RequestWithType
(
pay
,
list
);
emit
RequestWithType
(
pay
,
list
);
}
else
{
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"支付宝退款中..."
));
emit
RequestWithType
(
refund
,
list
);
}
}
else
}
else
emit
Exits
();
emit
Exits
();
}
}
...
@@ -123,18 +131,24 @@ void HostWidget::ShowWithRequest(AlipayRequest request)
...
@@ -123,18 +131,24 @@ void HostWidget::ShowWithRequest(AlipayRequest request)
if
(
reqtype
.
compare
(
"30"
)
==
0
)
if
(
reqtype
.
compare
(
"30"
)
==
0
)
{
{
_type
=
pay
;
ShowWidget
(
ui
->
pay
);
ShowWidget
(
ui
->
pay
);
_curr_show_widget
=
ui
->
pay
;
_curr_show_widget
=
ui
->
pay
;
double
Amount
=
FMTool
::
GetString
(
_data
.
Amount
,
12
).
toInt
()
/
100.0
;
double
Amount
=
FMTool
::
GetString
(
_data
.
Amount
,
12
).
toInt
()
/
100.0
;
ui
->
label_pay_money
->
setText
(
QString
(
"需收取 ¥ %1"
).
arg
(
Amount
));
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"请扫描输入支付宝二维码"
));
ui
->
btn_pay_exit
->
setText
(
QString
::
fromLocal8Bit
(
"取消支付"
));
ui
->
label_pay_money
->
setText
(
QString
::
fromLocal8Bit
(
"需收取 ¥ %1"
).
arg
(
Amount
));
}
}
if
(
reqtype
.
compare
(
"40"
)
==
0
)
if
(
reqtype
.
compare
(
"40"
)
==
0
)
{
{
_type
=
refund
;
ShowWidget
(
ui
->
pay
);
ShowWidget
(
ui
->
pay
);
_curr_show_widget
=
ui
->
pay
;
_curr_show_widget
=
ui
->
pay
;
double
Amount
=
FMTool
::
GetString
(
_data
.
Amount
,
12
).
toInt
()
/
100.0
;
double
Amount
=
FMTool
::
GetString
(
_data
.
Amount
,
12
).
toInt
()
/
100.0
;
ui
->
label_pay_money
->
setText
(
QString
(
"退款 ¥ %1"
).
arg
(
Amount
));
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"请扫描退款凭证号"
));
ui
->
btn_pay_exit
->
setText
(
QString
::
fromLocal8Bit
(
"取消退款"
));
ui
->
label_pay_money
->
setText
(
QString
::
fromLocal8Bit
(
"退款 ¥ %1"
).
arg
(
Amount
));
}
}
if
(
reqtype
.
compare
(
"80"
)
==
0
)
if
(
reqtype
.
compare
(
"80"
)
==
0
)
...
@@ -152,14 +166,13 @@ void HostWidget::ShowWithRequest(AlipayRequest request)
...
@@ -152,14 +166,13 @@ void HostWidget::ShowWithRequest(AlipayRequest request)
void
HostWidget
::
ShowWiteMGS
(
ReqType
type
,
bool
flag
,
QString
message
)
void
HostWidget
::
ShowWiteMGS
(
ReqType
type
,
bool
flag
,
QString
message
)
{
{
if
(
type
==
sign
)
if
(
type
==
sign
)
{
{
_need_exit
=
true
;
if
(
flag
)
if
(
flag
)
ui
->
label_sign_title
->
setText
(
"获取签名成功"
);
ui
->
label_sign_title
->
setText
(
QString
::
fromLocal8Bit
(
"获取签名成功"
)
);
else
else
ui
->
label_sign_title
->
setText
(
"获取签名失败"
);
ui
->
label_sign_title
->
setText
(
QString
::
fromLocal8Bit
(
"获取签名失败"
)
);
ui
->
label_sign_msg
->
setText
(
message
);
ui
->
label_sign_msg
->
setText
(
message
);
...
@@ -167,7 +180,6 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
...
@@ -167,7 +180,6 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
ShowWidget
(
ui
->
sign
);
ShowWidget
(
ui
->
sign
);
return
;
return
;
}
}
if
(
type
==
pay
&&
_curr_show_widget
==
ui
->
pay
)
if
(
type
==
pay
&&
_curr_show_widget
==
ui
->
pay
)
{
{
_need_exit
=
true
;
_need_exit
=
true
;
...
@@ -176,19 +188,44 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
...
@@ -176,19 +188,44 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
ui
->
label_pay_money
->
setVisible
(
true
);
ui
->
label_pay_money
->
setVisible
(
true
);
ui
->
label_pay_money
->
setText
(
message
);
ui
->
label_pay_money
->
setText
(
message
);
ui
->
btn_pay_exit
->
setVisible
(
true
);
ui
->
btn_pay_exit
->
setVisible
(
true
);
ui
->
btn_pay_exit
->
setText
(
QString
::
fromLocal8Bit
(
"确认"
));
if
(
flag
)
{
ui
->
label_pay_msg_time
->
setVisible
(
true
);
_label_pay_timer
->
setLabel
(
ui
->
label_pay_msg_time
);
_label_pay_timer
->
start
(
3
);
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"支付成功"
));
ui
->
label_pay_time
->
setPixmap
(
QPixmap
(
":res/success.png"
));
}
else
{
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"支付失败"
));
ui
->
label_pay_time
->
setPixmap
(
QPixmap
(
":res/warning.png"
));
}
return
;
}
if
(
type
==
refund
&&
_curr_show_widget
==
ui
->
pay
)
{
_need_exit
=
true
;
_label_pay_timer
->
stop
();
ui
->
label_pay_time_load
->
setVisible
(
false
);
ui
->
label_pay_money
->
setVisible
(
true
);
ui
->
label_pay_money
->
setText
(
message
);
ui
->
btn_pay_exit
->
setVisible
(
true
);
ui
->
btn_pay_exit
->
setText
(
"确认"
);
ui
->
btn_pay_exit
->
setText
(
"确认"
);
if
(
flag
)
{
if
(
flag
)
{
ui
->
label_pay_msg_time
->
setVisible
(
true
);
ui
->
label_pay_msg_time
->
setVisible
(
true
);
_label_pay_timer
->
setLabel
(
ui
->
label_pay_msg_time
);
_label_pay_timer
->
setLabel
(
ui
->
label_pay_msg_time
);
_label_pay_timer
->
start
(
3
0
);
_label_pay_timer
->
start
(
3
);
ui
->
label_pay_title
->
setText
(
"支付成功"
);
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"退款成功"
)
);
ui
->
label_pay_time
->
setPixmap
(
QPixmap
(
":res/success.png"
));
ui
->
label_pay_time
->
setPixmap
(
QPixmap
(
":res/success.png"
));
}
else
{
}
else
{
ui
->
label_pay_title
->
setText
(
"支付失败"
);
ui
->
label_pay_title
->
setText
(
QString
::
fromLocal8Bit
(
"退款失败"
)
);
ui
->
label_pay_time
->
setPixmap
(
QPixmap
(
":res/warning.png"
));
ui
->
label_pay_time
->
setPixmap
(
QPixmap
(
":res/warning.png"
));
}
}
return
;
}
}
}
}
void
HostWidget
::
on_btn_mananger_register_clicked
()
void
HostWidget
::
on_btn_mananger_register_clicked
()
...
@@ -197,7 +234,7 @@ void HostWidget::on_btn_mananger_register_clicked()
...
@@ -197,7 +234,7 @@ void HostWidget::on_btn_mananger_register_clicked()
ShowWidget
(
ui
->
sign
);
ShowWidget
(
ui
->
sign
);
ui
->
btn_sign_sign
->
hide
();
ui
->
btn_sign_sign
->
hide
();
ui
->
label_sign_title
->
setText
(
"签到中..."
);
ui
->
label_sign_title
->
setText
(
QString
::
fromLocal8Bit
(
"签到中..."
)
);
ui
->
label_sign_msg
->
setText
(
""
);
ui
->
label_sign_msg
->
setText
(
""
);
ui
->
label_sign_storeid
->
setText
(
FMTool
::
GetString
(
_data
.
StoreNo
,
20
));
ui
->
label_sign_storeid
->
setText
(
FMTool
::
GetString
(
_data
.
StoreNo
,
20
));
emit
RequestWithType
(
sign
,
list
);
emit
RequestWithType
(
sign
,
list
);
...
@@ -222,13 +259,13 @@ void HostWidget::on_TimeOut()
...
@@ -222,13 +259,13 @@ void HostWidget::on_TimeOut()
if
(
_need_exit
)
if
(
_need_exit
)
emit
Exits
();
emit
Exits
();
else
else
emit
ExitWithMSG
(
"01"
,
QString
(
"操作超时"
));
emit
ExitWithMSG
(
"01"
,
QString
::
fromLocal8Bit
(
"操作超时"
));
}
}
void
HostWidget
::
on_btn_mananger_exit_clicked
()
void
HostWidget
::
on_btn_mananger_exit_clicked
()
{
{
this
->
hide
();
this
->
hide
();
emit
ExitWithMSG
(
"02"
,
QString
(
"收银员取消"
));
emit
ExitWithMSG
(
"02"
,
QString
::
fromLocal8Bit
(
"收银员取消"
));
}
}
void
HostWidget
::
on_btn_pay_exit_clicked
()
void
HostWidget
::
on_btn_pay_exit_clicked
()
...
@@ -237,19 +274,22 @@ void HostWidget::on_btn_pay_exit_clicked()
...
@@ -237,19 +274,22 @@ void HostWidget::on_btn_pay_exit_clicked()
if
(
_need_exit
)
if
(
_need_exit
)
emit
Exits
();
emit
Exits
();
else
else
emit
ExitWithMSG
(
"02"
,
QString
(
"收银员取消"
));
emit
ExitWithMSG
(
"02"
,
QString
::
fromLocal8Bit
(
"收银员取消"
));
}
}
void
HostWidget
::
on_btn_find_exit_clicked
()
void
HostWidget
::
on_btn_find_exit_clicked
()
{
{
this
->
hide
();
this
->
hide
();
emit
ExitWithMSG
(
"02"
,
QString
(
"收银员取消"
));
emit
ExitWithMSG
(
"02"
,
QString
::
fromLocal8Bit
(
"收银员取消"
));
}
}
void
HostWidget
::
on_btn_sign_exit_clicked
()
void
HostWidget
::
on_btn_sign_exit_clicked
()
{
{
this
->
hide
();
this
->
hide
();
emit
ExitWithMSG
(
"02"
,
QString
(
"收银员取消"
));
if
(
_need_exit
)
emit
Exits
();
else
emit
ExitWithMSG
(
"01"
,
QString
::
fromLocal8Bit
(
"收银员取消"
));
}
}
void
HostWidget
::
on_btn_sign_sign_clicked
()
void
HostWidget
::
on_btn_sign_sign_clicked
()
...
...
sbkpay/hostwidget.h
View file @
d0824442
...
@@ -77,6 +77,8 @@ private:
...
@@ -77,6 +77,8 @@ private:
QMovie
*
_label_pay_movie
;
QMovie
*
_label_pay_movie
;
bool
_need_exit
;
bool
_need_exit
;
ReqType
_type
;
};
};
#endif // HOSTWIDGET_H
#endif // HOSTWIDGET_H
sbkpay/jsonfactory.h
View file @
d0824442
...
@@ -71,11 +71,13 @@ private:
...
@@ -71,11 +71,13 @@ private:
json
.
insert
(
JSON_KEY_TRANSAMOUNT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_TRANSAMOUNT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_UNAMOUNT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
non_sale_Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_UNAMOUNT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
non_sale_Amount
),
12
).
toInt
());
QString
len
=
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
item_line_qty
),
2
);
int
len
=
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
item_line_qty
),
2
).
toInt
(
);
QJsonArray
prod
;
QJsonArray
prod
;
for
(
int
i
=
0
;
i
<
len
.
toInt
();
++
i
)
qDebug
()
<<
"--------"
<<
len
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
{
QJsonObject
object
;
QJsonObject
object
;
...
@@ -109,13 +111,13 @@ private:
...
@@ -109,13 +111,13 @@ private:
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_VER
,
DEFAULT_JSON_VER_VALUE
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_REFUND
);
json
.
insert
(
JSON_KEY_REQTYPE
,
JSON_REQTYPE_REFUND
);
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Reserved1
),
48
));
json
.
insert
(
JSON_KEY_PARTNERID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Reserved1
),
48
)
.
toInt
()
);
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STOREID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
StoreNo
),
20
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_STATIONID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
DeviceNo
),
6
));
json
.
insert
(
JSON_KEY_OPERATORID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashierNo
),
6
));
json
.
insert
(
JSON_KEY_OPERATORID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashierNo
),
6
));
json
.
insert
(
JSON_KEY_TRANSID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashTraceNo
),
6
));
json
.
insert
(
JSON_KEY_TRANSID
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
CashTraceNo
),
6
));
json
.
insert
(
JSON_KEY_BUSINESSDATE
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
BusinessDay
),
8
));
json
.
insert
(
JSON_KEY_BUSINESSDATE
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
BusinessDay
),
8
));
json
.
insert
(
JSON_KEY_
CODE
,
list
[
0
]);
json
.
insert
(
JSON_KEY_
FMID
,
list
[
0
]);
json
.
insert
(
JSON_KEY_REFUNDAMOUT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Amount
),
12
).
toInt
());
json
.
insert
(
JSON_KEY_REFUNDAMOUT
,
FMTool
::
GetString
((
const
void
*
)
&
(
request
.
Amount
),
12
).
toInt
());
return
true
;
return
true
;
...
...
sbkpay/main.cpp
View file @
d0824442
#ifdef FM_TEST
#ifdef FM_TEST
#include "control.h"
#include "control.h"
...
@@ -14,7 +14,7 @@ void TestSetString()
...
@@ -14,7 +14,7 @@ void TestSetString()
{
{
AlipayResponse
repon
;
AlipayResponse
repon
;
FMTool
::
SetString
(
repon
.
ResponseMsg
,
40
,
QString
(
"傻逼
"
));
FMTool
::
SetString
(
repon
.
ResponseMsg
,
40
,
QString
::
fromLocal8Bit
(
"sb
"
));
}
}
void
TestSetPinter
()
void
TestSetPinter
()
...
@@ -22,7 +22,7 @@ void TestSetPinter()
...
@@ -22,7 +22,7 @@ void TestSetPinter()
AlipayResponse
repon
;
AlipayResponse
repon
;
QJsonObject
obj
,
json
;
QJsonObject
obj
,
json
;
obj
.
insert
(
"print"
,
"
为了宽宏大量分开打女生短发设计开发
"
);
obj
.
insert
(
"print"
,
"
dasdas
"
);
json
.
insert
(
"ext"
,
obj
);
json
.
insert
(
"ext"
,
obj
);
...
@@ -37,19 +37,19 @@ void TestGetResPonseJson()
...
@@ -37,19 +37,19 @@ void TestGetResPonseJson()
AlipayResponse
repon
;
AlipayResponse
repon
;
QJsonObject
obj
,
json
;
QJsonObject
obj
,
json
;
obj
.
insert
(
"print"
,
"
为了宽宏大量分开打女生短发设计开发
"
);
obj
.
insert
(
"print"
,
"
dasdas
"
);
json
.
insert
(
"ext"
,
obj
);
json
.
insert
(
"ext"
,
obj
);
json
.
insert
(
"fmId"
,
"asdashdgajshdg11111111111111111"
);
json
.
insert
(
"fmId"
,
"asdashdgajshdg11111111111111111"
);
json
.
insert
(
"statusCode"
,
100
);
json
.
insert
(
"statusCode"
,
100
);
json
.
insert
(
"message"
,
"
哇哈哈
"
);
json
.
insert
(
"message"
,
"
asdasd
"
);
RspFactory
::
GetResPonseJson
(
pay
,
repon
,
json
);
RspFactory
::
GetResPonseJson
(
pay
,
repon
,
json
);
qDebug
()
<<
"lalal"
;
qDebug
()
<<
"lalal"
;
json
.
insert
(
"statusCode"
,
204
);
json
.
insert
(
"statusCode"
,
204
);
json
.
insert
(
"message"
,
"
哇哈哈有毒
"
);
json
.
insert
(
"message"
,
"
asdasd
"
);
RspFactory
::
GetResPonseJson
(
refund
,
repon
,
json
);
RspFactory
::
GetResPonseJson
(
refund
,
repon
,
json
);
...
@@ -61,7 +61,7 @@ void TestGetResPonseWithError()
...
@@ -61,7 +61,7 @@ void TestGetResPonseWithError()
{
{
AlipayResponse
repon
;
AlipayResponse
repon
;
RspFactory
::
GetResPonseWithError
(
repon
,
"201"
,
"
山茶花
"
);
RspFactory
::
GetResPonseWithError
(
repon
,
"201"
,
"
asdasd
"
);
qDebug
()
<<
"lalal"
;
qDebug
()
<<
"lalal"
;
...
@@ -101,12 +101,41 @@ int main(int argc, char *argv[])
...
@@ -101,12 +101,41 @@ int main(int argc, char *argv[])
AlipayRequest
req
;
AlipayRequest
req
;
FMTool
::
SetString
(
req
.
BusinessDay
,
8
,
QString
(
"20170908"
));
FMTool
::
SetString
(
req
.
BusinessDay
,
8
,
QString
(
"20170908"
));
FMTool
::
SetString
(
req
.
TransType
,
2
,
QString
(
"
4
0"
));
FMTool
::
SetString
(
req
.
TransType
,
2
,
QString
(
"
1
0"
));
FMTool
::
SetString
(
req
.
Reserved1
,
64
,
QString
(
"1443"
));
FMTool
::
SetString
(
req
.
Reserved1
,
64
,
QString
(
"1443"
));
FMTool
::
SetString
(
req
.
StoreNo
,
20
,
QString
(
"17607"
));
FMTool
::
SetString
(
req
.
StoreNo
,
20
,
QString
(
"17607"
));
FMTool
::
SetString
(
req
.
DeviceNo
,
6
,
QString
(
"1"
));
FMTool
::
SetString
(
req
.
DeviceNo
,
6
,
QString
(
"1"
));
FMTool
::
SetString
(
req
.
CashierNo
,
6
,
QString
(
"0123"
));
FMTool
::
SetString
(
req
.
CashierNo
,
6
,
QString
(
"0123"
));
FMTool
::
SetString
(
req
.
CashTraceNo
,
6
,
QString
(
"123123"
));
FMTool
::
SetString
(
req
.
CashTraceNo
,
6
,
QString
(
"123123"
));
FMTool
::
SetString
(
req
.
Amount
,
12
,
QString
(
"1"
));
req
.
item_line_qty
[
0
]
=
'9'
;
req
.
item_line_qty
[
1
]
=
'9'
;
// struct product{
// char productID[8]; //商品id
// char buyCount[4]; //购买数量
// char unitPrice[8]; //单件商品价格
// char isCombo[1]; //默认为0
// char isNonsale[1]; //(废弃)
// char productName[20]; //商品名字
// };
for
(
int
i
=
0
;
i
<
99
;
++
i
)
{
struct
product
*
pro
=
(
struct
product
*
)
req
.
item_information
[
i
];
FMTool
::
SetString
(
pro
->
productID
,
8
,
QString
::
number
(
i
+
1
));
FMTool
::
SetString
(
pro
->
buyCount
,
4
,
QString
::
number
(
i
+
1
));
FMTool
::
SetString
(
pro
->
unitPrice
,
8
,
QString
::
number
(
i
+
1
));
FMTool
::
SetString
(
pro
->
isCombo
,
1
,
QString
::
number
(
i
%
2
));
FMTool
::
SetString
(
pro
->
isNonsale
,
1
,
QString
::
number
(
i
+
1
));
FMTool
::
SetString
(
pro
->
productName
,
20
,
QString
::
fromLocal8Bit
(
"asdasdasd"
));
}
char
as
[
MAX_BUF_LEN
]
=
{
0
};
char
as
[
MAX_BUF_LEN
]
=
{
0
};
...
...
sbkpay/rspfactory.h
View file @
d0824442
...
@@ -77,7 +77,6 @@ private:
...
@@ -77,7 +77,6 @@ private:
static
bool
GetDayEndResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
static
bool
GetDayEndResponse
(
AlipayResponse
&
response
,
const
QJsonObject
&
json
)
{
{
return
false
;
return
false
;
}
}
...
...
sbkpay/sbkpay.pro
View file @
d0824442
...
@@ -36,5 +36,7 @@ HEADERS += hostwidget.h \
...
@@ -36,5 +36,7 @@ HEADERS += hostwidget.h \
FORMS
+=
hostwidget
.
ui
FORMS
+=
hostwidget
.
ui
LIBS
+=
-
luser32
RESOURCES
+=
\
RESOURCES
+=
\
res
.
qrc
res
.
qrc
sbkpay/sbkpay.pro.user
View file @
d0824442
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-08-1
1T14:08:55
. -->
<!-- Written by QtCreator 3.5.1, 2017-08-1
2T12:26:37
. -->
<qtcreator>
<qtcreator>
<data>
<data>
<variable>
EnvironmentId
</variable>
<variable>
EnvironmentId
</variable>
...
@@ -58,14 +58,14 @@
...
@@ -58,14 +58,14 @@
<data>
<data>
<variable>
ProjectExplorer.Project.Target.0
</variable>
<variable>
ProjectExplorer.Project.Target.0
</variable>
<valuemap
type=
"QVariantMap"
>
<valuemap
type=
"QVariantMap"
>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Desktop Qt 5.5.1 M
inGW
32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Desktop Qt 5.5.1 M
SVC2010
32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
>
Desktop Qt 5.5.1 M
inGW
32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
>
Desktop Qt 5.5.1 M
SVC2010
32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
qt.55.win32_m
ingw492
_kit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
qt.55.win32_m
svc2010
_kit
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveBuildConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveBuildConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveDeployConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveDeployConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveRunConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveRunConfiguration"
>
0
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.0"
>
<value
type=
"QString"
key=
"ProjectExplorer.BuildConfiguration.BuildDirectory"
>
D:/gitcode/sbkpay/build-sbkpay-Desktop_Qt_5_5_1_M
inGW
_32bit-Debug
</value>
<value
type=
"QString"
key=
"ProjectExplorer.BuildConfiguration.BuildDirectory"
>
D:/gitcode/sbkpay/build-sbkpay-Desktop_Qt_5_5_1_M
SVC2010
_32bit-Debug
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildConfiguration.BuildStepList.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildConfiguration.BuildStepList.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildStepList.Step.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildStepList.Step.0"
>
<value
type=
"bool"
key=
"ProjectExplorer.BuildStep.Enabled"
>
true
</value>
<value
type=
"bool"
key=
"ProjectExplorer.BuildStep.Enabled"
>
true
</value>
...
@@ -120,7 +120,7 @@
...
@@ -120,7 +120,7 @@
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild"
>
true
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild"
>
true
</value>
</valuemap>
</valuemap>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.1"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.1"
>
<value
type=
"QString"
key=
"ProjectExplorer.BuildConfiguration.BuildDirectory"
>
D:/gitcode/sbkpay/build-sbkpay-Desktop_Qt_5_5_1_M
inGW
_32bit-Release
</value>
<value
type=
"QString"
key=
"ProjectExplorer.BuildConfiguration.BuildDirectory"
>
D:/gitcode/sbkpay/build-sbkpay-Desktop_Qt_5_5_1_M
SVC2010
_32bit-Release
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildConfiguration.BuildStepList.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildConfiguration.BuildStepList.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildStepList.Step.0"
>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildStepList.Step.0"
>
<value
type=
"bool"
key=
"ProjectExplorer.BuildStep.Enabled"
>
true
</value>
<value
type=
"bool"
key=
"ProjectExplorer.BuildStep.Enabled"
>
true
</value>
...
@@ -226,14 +226,12 @@
...
@@ -226,14 +226,12 @@
</valuelist>
</valuelist>
<value
type=
"int"
key=
"PE.EnvironmentAspect.Base"
>
2
</value>
<value
type=
"int"
key=
"PE.EnvironmentAspect.Base"
>
2
</value>
<valuelist
type=
"QVariantList"
key=
"PE.EnvironmentAspect.Changes"
/>
<valuelist
type=
"QVariantList"
key=
"PE.EnvironmentAspect.Changes"
/>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
sbkpay
</value>
<value
type=
"QString"
key=
"ProjectExplorer.CustomExecutableRunConfiguration.Arguments"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.CustomExecutableRunConfiguration.Executable"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory"
>
%{buildDir}
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
自定义执行档
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.Qt4RunConfiguration:D:/gitcode/sbkpay/sbkpay/sbkpay.pro
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
ProjectExplorer.CustomExecutableRunConfiguration
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"
></value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.ProFile"
>
sbkpay.pro
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix"
>
false
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"
>
false
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"
></value>
<value
type=
"uint"
key=
"RunConfiguration.QmlDebugServerPort"
>
3768
</value>
<value
type=
"uint"
key=
"RunConfiguration.QmlDebugServerPort"
>
3768
</value>
<value
type=
"bool"
key=
"RunConfiguration.UseCppDebugger"
>
false
</value>
<value
type=
"bool"
key=
"RunConfiguration.UseCppDebugger"
>
false
</value>
<value
type=
"bool"
key=
"RunConfiguration.UseCppDebuggerAuto"
>
true
</value>
<value
type=
"bool"
key=
"RunConfiguration.UseCppDebuggerAuto"
>
true
</value>
...
...
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