Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmcoupon-linux
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
李定达
fmcoupon-linux
Commits
10af7420
Commit
10af7420
authored
Jun 16, 2020
by
xiaojing.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset client.xml
parent
6c2ee258
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
+31
-16
fm_xmltojson.hpp
+31
-16
No files found.
fm_xmltojson.hpp
View file @
10af7420
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
#include "global.h"
#include "global.h"
#include "QsLog.h"
#include "QsLog.h"
#include <QFile>
#define XML_FREEMUD_CLIENT "Client.xml"
#define XML_FREEMUD_CLIENT "Client.xml"
//extern char XML_FREEMUD_CLIENT[256];
//extern char XML_FREEMUD_CLIENT[256];
...
@@ -1356,7 +1358,8 @@ public:
...
@@ -1356,7 +1358,8 @@ public:
static
bool
JsonConvertFront
(
const
Document
&
srcdoc
,
Document
&
desdoc
,
string
&
key
,
string
&
values
,
string
&
lasterror
)
static
bool
JsonConvertFront
(
const
Document
&
srcdoc
,
Document
&
desdoc
,
string
&
key
,
string
&
values
,
string
&
lasterror
)
{
{
xml_document
<>
doc
;
xml_document
<>
doc
;
string
posxml
;
//string posxml;
string
currPath
;
stringstream
error
;
stringstream
error
;
if
(
srcdoc
.
HasParseError
()
||
desdoc
.
HasParseError
()
||
srcdoc
.
IsNull
())
if
(
srcdoc
.
HasParseError
()
||
desdoc
.
HasParseError
()
||
srcdoc
.
IsNull
())
...
@@ -1369,19 +1372,24 @@ public:
...
@@ -1369,19 +1372,24 @@ public:
if
(
desdoc
.
IsNull
())
if
(
desdoc
.
IsNull
())
desdoc
.
Parse
<
0
>
(
"{}"
);
desdoc
.
Parse
<
0
>
(
"{}"
);
GetProcPath
(
posxml
);
GetProcPath
(
currPath
);
string
realPath
=
currPath
;
QString
filename
=
Tool
::
ReadCfg
(
CFG_SECTION_XMLFILENAME
,
XML_FREEMUD_CLIENT
).
toString
();
QString
filename
=
Tool
::
ReadCfg
(
CFG_SECTION_XMLFILENAME
,
XML_FREEMUD_CLIENT
).
toString
();
posxml
.
append
(
filename
.
toStdString
());
realPath
.
append
(
filename
.
toStdString
());
if
(
!
QFile
::
exists
(
QString
::
fromStdString
(
realPath
)))
{
realPath
=
currPath
+
XML_FREEMUD_CLIENT
;
}
QLOG_DEBUG
()
<<
"JsonConvertFront xml name :"
<<
QString
::
fromStdString
(
posxml
);
QLOG_DEBUG
()
<<
"JsonConvertFront xml name :"
<<
QString
::
fromStdString
(
realPath
);
#ifdef WIN32
#ifdef WIN32
if
(
_access
(
posxml
.
data
(),
0
)
==
-
1
)
if
(
_access
(
realPath
.
data
(),
0
)
==
-
1
)
#else
#else
if
(
access
(
posxml
.
data
(),
F_OK
)
==
-
1
)
if
(
access
(
realPath
.
data
(),
F_OK
)
==
-
1
)
#endif
#endif
{
{
error
<<
posxml
<<
" not found"
;
error
<<
realPath
<<
" not found"
;
lasterror
=
error
.
str
();
lasterror
=
error
.
str
();
return
false
;
return
false
;
}
}
...
@@ -1389,7 +1397,7 @@ public:
...
@@ -1389,7 +1397,7 @@ public:
try
try
{
{
file
<>
fdoc
(
posxml
.
c_str
());
file
<>
fdoc
(
realPath
.
c_str
());
if
(
GetXMLDocumentHandle
(
fdoc
,
doc
,
error
)
==
false
)
if
(
GetXMLDocumentHandle
(
fdoc
,
doc
,
error
)
==
false
)
...
@@ -1417,7 +1425,8 @@ public:
...
@@ -1417,7 +1425,8 @@ public:
static
bool
JsonConvertPost
(
const
Document
&
srcdoc
,
Document
&
desdoc
,
string
key
,
string
values
,
string
&
lasterror
)
static
bool
JsonConvertPost
(
const
Document
&
srcdoc
,
Document
&
desdoc
,
string
key
,
string
values
,
string
&
lasterror
)
{
{
xml_document
<>
doc
;
xml_document
<>
doc
;
string
posxml
;
//string posxml;
string
currPath
;
stringstream
error
;
stringstream
error
;
if
(
key
.
empty
()
||
values
.
empty
())
if
(
key
.
empty
()
||
values
.
empty
())
...
@@ -1434,25 +1443,31 @@ public:
...
@@ -1434,25 +1443,31 @@ public:
return
false
;
return
false
;
}
}
GetProcPath
(
posxml
);
GetProcPath
(
currPath
);
string
realPath
=
currPath
;
QString
filename
=
Tool
::
ReadCfg
(
CFG_SECTION_XMLFILENAME
,
XML_FREEMUD_CLIENT
).
toString
();
QString
filename
=
Tool
::
ReadCfg
(
CFG_SECTION_XMLFILENAME
,
XML_FREEMUD_CLIENT
).
toString
();
posxml
.
append
(
filename
.
toStdString
());
realPath
.
append
(
filename
.
toStdString
());
QLOG_DEBUG
()
<<
"JsonConvertPost xml name :"
<<
QString
::
fromStdString
(
posxml
);
if
(
!
QFile
::
exists
(
QString
::
fromStdString
(
realPath
)))
{
realPath
=
currPath
+
XML_FREEMUD_CLIENT
;
}
QLOG_DEBUG
()
<<
"JsonConvertPost xml name :"
<<
QString
::
fromStdString
(
realPath
);
#ifdef WIN32
#ifdef WIN32
if
(
_access
(
posxml
.
data
(),
0
)
==
-
1
)
if
(
_access
(
realPath
.
data
(),
0
)
==
-
1
)
#else
#else
if
(
access
(
posxml
.
data
(),
F_OK
)
==
-
1
)
if
(
access
(
realPath
.
data
(),
F_OK
)
==
-
1
)
#endif
#endif
{
{
error
<<
posxml
<<
" not found"
;
error
<<
realPath
<<
" not found"
;
lasterror
=
error
.
str
();
lasterror
=
error
.
str
();
return
false
;
return
false
;
}
}
try
try
{
{
file
<>
fdoc
(
posxml
.
c_str
());
file
<>
fdoc
(
realPath
.
c_str
());
if
(
GetXMLDocumentHandle
(
fdoc
,
doc
,
error
)
==
false
)
if
(
GetXMLDocumentHandle
(
fdoc
,
doc
,
error
)
==
false
)
{
{
...
...
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