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
f3aa75b6
Commit
f3aa75b6
authored
Jul 15, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.导出RES接口函数RESGetValue;2.修复已知bug
parent
74df51c9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
11 deletions
+70
-11
ZH_Client.suo
+0
-0
ZH_Client/ZH_Client.vcxproj
+1
-1
ZH_Client/fmglobal.h
+1
-0
ZH_Client/resdata.cpp
+2
-2
ZH_Client/sbk_client.cpp
+63
-5
ZH_Client/testresdata.cpp
+3
-3
No files found.
ZH_Client.suo
View file @
f3aa75b6
No preview for this file type
ZH_Client/ZH_Client.vcxproj
View file @
f3aa75b6
...
...
@@ -18,7 +18,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>
Application
</ConfigurationType>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
...
...
ZH_Client/fmglobal.h
View file @
f3aa75b6
...
...
@@ -19,6 +19,7 @@
#define DES3_KEY "ABCD@#9876DFSAAWKLDEOPDD"
#define CRET_FILE_NAME "client.p12"
#define JSON_KEY_ONLY "partnerOrderId"
#define JSON_KEY_FMTEST "test"
#define CFG_KEY "template"
#define TMP_JSON "json.ini"
...
...
ZH_Client/resdata.cpp
View file @
f3aa75b6
...
...
@@ -259,7 +259,7 @@ bool Response0ToRES(const string &indata, string &outdata)
//paymentMethod
json_t
*
paymentMethod
=
json_object_get
(
root
,
"paymentMethod"
);
if
(
message
!=
NULL
||
json_is_string
(
paymentMethod
))
if
(
paymentMethod
!=
NULL
||
json_is_string
(
paymentMethod
))
{
rsp
.
data
[
9
]
=
json_string_value
(
paymentMethod
);
}
...
...
@@ -551,7 +551,7 @@ bool Response71ToRES(const string &indata, string &outdata)
//paymentMethod
json_t
*
paymentMethod
=
json_object_get
(
root
,
"paymentMethod"
);
if
(
message
!=
NULL
||
json_is_string
(
paymentMethod
))
if
(
paymentMethod
!=
NULL
||
json_is_string
(
paymentMethod
))
{
rsp
.
data
[
9
]
=
json_string_value
(
paymentMethod
);
}
...
...
ZH_Client/sbk_client.cpp
View file @
f3aa75b6
...
...
@@ -21,7 +21,7 @@
int
_reqType
=
-
1
;
#define FM_TEST
//
#define FM_TEST
//#define FM_TESTS
#include "testdataprocess.h"
...
...
@@ -418,6 +418,10 @@ int ProcessPosReqData(const char *indata, string &in, int *needrbk, int *reqType
if
(
type
!=
3
)
json_object_set
(
root
,
JSON_KEY_ONLY
,
json_string
(
tmps
.
str
().
c_str
()));
#ifdef FM_TEST
json_object_set
(
root
,
JSON_KEY_FMTEST
,
json_string
(
"test"
));
#endif
if
(
type
==
71
)
{
tmpkey
<<
codestr
<<
transIdstr
<<
json_integer_value
(
partnerId
)
<<
json_string_value
(
storeId
)
<<
json_string_value
(
stationId
);
...
...
@@ -749,6 +753,56 @@ endflag:
return
1
;
}
}
extern
"C"
{
__declspec
(
dllexport
)
int
_stdcall
RESGetValue
(
char
*
indata
,
char
*
outdata
)
{
char
buf
[
MAX_BUF_LEN
]
=
{
0
};
strcpy_s
(
buf
,
strlen
(
indata
)
+
1
,
indata
);
string
tmpin
(
buf
);
string
out
;
LOG
()
<<
"get RES indata : "
<<
indata
;
if
(
!
RESToJson
(
tmpin
,
out
)
&&
out
.
size
()
>=
MAX_BUF_LEN
)
{
string
outstr
;
JsonToRES
(
string
(
ERROR_INDATA
),
outstr
);
strcpy
(
outdata
,
outstr
.
data
());
LOG
()
<<
"send RES outdata : "
<<
outdata
;
return
0
;
}
char
bufin
[
MAX_BUF_LEN
]
=
{
0
};
char
bufout
[
MAX_BUF_LEN
]
=
{
0
};
strcpy
(
bufin
,
out
.
data
());
GetValue
(
bufin
,
bufout
);
string
strin
(
bufout
);
string
strout
;
if
(
!
JsonToRES
(
strin
,
strout
)
&&
strout
.
size
()
>=
MAX_BUF_LEN
)
{
string
outstr
;
JsonToRES
(
string
(
ERROR_OUTDATA
),
outstr
);
strcpy
(
outdata
,
outstr
.
data
());
LOG
()
<<
"send RES outdata : "
<<
outdata
;
return
0
;
}
strcpy
(
outdata
,
strout
.
data
());
LOG
()
<<
"send RES outdata : "
<<
outdata
;
return
1
;
}
};
size_t
GetDataForServer
(
void
*
buffer
,
size_t
size
,
size_t
nmemb
,
void
*
userdata
)
{
unsigned
int
i
=
size
*
nmemb
;
...
...
@@ -1156,6 +1210,10 @@ void testinitclient()
//char a[] = "{\"businessDate\":\"20170526\",\"code\":\"7310180009462033\",\"operatorId\":\"90001\",\"partnerId\":1443,\"products\":[{\"consume_num\":1,\"discount\":0,\"name\":\"Coffee\",\"number\":0,\"payment\":null,\"pid\":\"3488\",\"price\":3100,\"priceAct\":0,\"salesType\":\"Normal\",\"scope\":null}],\"promotionTag\":null,\"reqType\":71,\"stationId\":\"3\",\"storeId\":\"1713\",\"transAmount\":3100,\"transId\":\"6460\",\"undiscountAmount\":0,\"ver\":1}";
//char a[] = "{\r\n \"ver\": 1,\r\n \"reqType\": 71,\r\n \"partnerId\": 1443,\r\n \"stationId\": \"1\",\r\n \"storeId\": \"12344\",\r\n \"operatorId\": \"9\",\r\n \"code\": \"adadadada\"\r\n}";
char
a
[]
=
"{
\r\n
\"
businessDate
\"
:
\"
20170601
\"
,
\r\n
\"
code
\"
:
\"
7310188850000277
\"
,
\r\n
\"
operatorId
\"
:
\"
90001
\"
,
\r\n
\"
partnerId
\"
: 1443,
\r\n
\"
partnerOrderId
\"
:
\"
1443171223323
\"
,
\r\n
\"
products
\"
: [
\r\n
{
\r\n
\"
consume_num
\"
: 1,
\r\n
\"
discount
\"
: 0,
\r\n
\"
name
\"
:
\"
Coffee
\"
,
\r\n
\"
number
\"
: 0,
\r\n
\"
payment
\"
: null,
\r\n
\"
pid
\"
:
\"
3488
\"
,
\r\n
\"
price
\"
: 3100,
\r\n
\"
priceAct
\"
: 0,
\r\n
\"
salesType
\"
:
\"
Normal
\"
,
\r\n
\"
scope
\"
: null
\r\n
}
\r\n
],
\r\n
\"
promotionTag
\"
: null,
\r\n
\"
reqType
\"
: 102,
\r\n
\"
stationId
\"
:
\"
9
\"
,
\r\n
\"
storeId
\"
:
\"
12344
\"
,
\r\n
\"
transAmount
\"
: 29,
\r\n
\"
transId
\"
:
\"
1
\"
,
\r\n
\"
undiscountAmount
\"
: 0,
\r\n
\"
ver
\"
: 1
\r\n
}"
;
char
ls
[]
=
"0|1443|99999|1|01|13245678998|END|"
;
char
ls1
[]
=
"3|1443|99999|1|01|13245678998|20170714||8888|END|"
;
char
ls2
[]
=
"71|1443|99999|1|01|13245678998|20170714||8888|END|"
;
void
testCheckRollbackData
()
{
InitClient
();
...
...
@@ -1166,13 +1224,11 @@ int main()
{
_reqType
=
3
;
TestRESToJson
();
TestJsonToRES
();
//
TestRESToJson();
//
TestJsonToRES();
char
storeid
[]
=
"12344"
;
char
posno
[]
=
"01"
;
//TestComplementJson();
//Test_RSASign();
...
...
@@ -1187,6 +1243,8 @@ int main()
char
b
[
MAX_BUF_LEN
];
RESGetValue
(
ls2
,
b
);
//char c[MAX_BUF_LEN] = { 0 };
//strcpy(c, TEST_CG);
...
...
ZH_Client/testresdata.cpp
View file @
f3aa75b6
...
...
@@ -10,9 +10,9 @@ using std::string;
//char buf[] = "\{\"a\": 8}";
char
buf
[]
=
"{
\n
\"
ext
\"
: {
\n
\"
hint
\"
:
\"
shiping85zheyouhuiquan 7310183410017522691
\"\n
},
\n
\"
paymentMethodCode
\"
:
\"
80022
\"
,
\n
\"
actInfo
\"
: {
\n
\"
actId
\"
:
\"
1402007
\"
,
\n
\"
actName
\"
:
\"
zhekouquan20000451
\"
,
\n
\"
code
\"
:
\"
7310183410017522691=4F28F2E86561C03F
\"\n
},
\n
\"
fmId
\"
:
\"
2691170714Z10000001
\"
,
\n
\"
ver
\"
: 1,
\n
\"
paymentMethod
\"
:
\"
dianzhiquan-zhekoquan
\"
,
\n
\"
message
\"
:
\"
chenggong
\"
,
\n
\"
type
\"
: 3,
\n
\"
statusCode
\"
: 100
\n
}"
;
char
ls
[]
=
"0|1443|0001|FOE13|01|123456789987654321|END|"
;
char
ls1
[]
=
"3|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|"
;
char
ls2
[]
=
"71|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|"
;
static
char
ls
[]
=
"0|1443|0001|FOE13|01|123456789987654321|END|"
;
static
char
ls1
[]
=
"3|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|"
;
static
char
ls2
[]
=
"71|1443|0001|FOE13|01|123456789987654321|20170714||8888|END|"
;
void
TestRESToJson
()
...
...
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