Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmupdate
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
李定达
fmupdate
Commits
565b27de
Commit
565b27de
authored
Nov 14, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.mcdmanager.exe使用守护版本
parent
2701981e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
83 deletions
+119
-83
fmscupd/fmcontrol.cpp
+33
-1
fmscupd/fmcontrol.h
+4
-0
fmscupd/fmdefine.h
+1
-1
fmscupd/fmscupd.pro
+1
-1
fmscupd/fmtools.cpp
+80
-80
No files found.
fmscupd/fmcontrol.cpp
View file @
565b27de
#include "fmcontrol.h"
#include "fmcontrol.h"
#include "fmtools.h"
#include "QsLog.h"
#include "fmdefine.h"
...
...
@@ -19,6 +19,8 @@
FmControl
::
FmControl
()
{
bool
m_init_flag
=
true
;
int
m_keepsleeptime
=
0
;
m_keepTimer
.
setInterval
(
KEEP_INTERVAL
);
connect
(
&
m_keepTimer
,
&
QTimer
::
timeout
,
this
,
&
FmControl
::
onKeepProcess
);
}
...
...
@@ -41,6 +43,35 @@ void FmControl::onKeepProcess()
{
QString
error
;
QStringList
diedProcList
;
QLOG_INFO
()
<<
qApp
->
applicationDirPath
()
+
"/update.flag"
;
if
(
m_init_flag
==
false
)
{
QFile
file
(
qApp
->
applicationDirPath
()
+
"/update.flag"
);
if
(
file
.
exists
())
{
++
m_keepsleeptime
;
m_keepsleeptime
%=
121
;
if
(
m_keepsleeptime
<
120
)
{
QLOG_WARN
()
<<
"update.flag file exit wait times : "
<<
m_keepsleeptime
;
return
;
}
else
{
file
.
remove
();
m_keepsleeptime
=
0
;
}
}
}
m_init_flag
=
false
;
if
(
!
_GetDiedProcess
(
FmTools
::
GetInstance
().
GetKeepExes
(),
diedProcList
,
error
))
{
QLOG_ERROR
()
<<
QString
(
"get died process failed [%1]"
).
arg
(
error
);
...
...
@@ -52,6 +83,7 @@ void FmControl::onKeepProcess()
{
QString
exePath
=
QString
(
"%1/%2"
).
arg
(
m_appDir
,
path
);
QLOG_INFO
()
<<
QString
(
"launch [%1]"
).
arg
(
exePath
);
if
(
!
_LaunchProcess
(
exePath
,
error
))
{
QLOG_ERROR
()
<<
QString
(
"launch process failed [%1]"
).
arg
(
error
);
...
...
fmscupd/fmcontrol.h
View file @
565b27de
...
...
@@ -18,6 +18,10 @@ public:
void
Start
();
private
:
// 初始化标志位
bool
m_init_flag
;
// 停止启动程序计数器
int
m_keepsleeptime
;
// 程序守护定时器
QTimer
m_keepTimer
;
// 记录程序所在的目录
...
...
fmscupd/fmdefine.h
View file @
565b27de
...
...
@@ -11,7 +11,7 @@
#define INIPATH_TIMEOUT1 "SoftInfo/timeout1"
#define SERVICE_NAME "Fmupdate"
#define SERVICE_DESC "
用于非码程序的升级服务
"
#define SERVICE_DESC "
using freemud mcdmanager.exe guard
"
#define KEEP_INTERVAL 5*1000
#define CHECK_INTERVAL 10*60*1000
...
...
fmscupd/fmscupd.pro
View file @
565b27de
...
...
@@ -2,7 +2,7 @@ include("QsLog/QsLog.pri")
include
(
"QtService/src/qtservice.pri"
)
include
(
"Quazip/quazip.pri"
)
QT
+=
core
network
sql
xml
QT
+=
core
network
QT
-=
gui
CONFIG
+=
c
++
11
...
...
fmscupd/fmtools.cpp
View file @
565b27de
...
...
@@ -2,10 +2,10 @@
#include "fmdefine.h"
#include <QJsonObject>
#include <QJsonDocument>
#include <QSqlDatabase>
#include <QDomComment>
#include <QDomElement>
#include <QSqlQuery>
//
#include <QSqlDatabase>
//
#include <QDomComment>
//
#include <QDomElement>
//
#include <QSqlQuery>
#include <QFile>
#include <QDir>
...
...
@@ -22,82 +22,82 @@ FmTools::FmTools()
#ifdef BALIBEITIAN
#define MY_CFG "FMPOS.ini"
QFile
file
(
"C:/SPCINT/DATA/DBPOS/SHOPINFO.INI"
);
if
(
file
.
exists
())
m_siIniPath
=
"C:/SPCINT/DATA/DBPOS/SHOPINFO.INI"
;
else
{
m_siIniPath
=
qApp
->
applicationDirPath
()
+
"/"
+
MY_CFG
;
m_partnerId
=
"1321"
;
m_keyStoreId
=
"SHOPINFO/STORECD"
;
m_keyPosId
=
"SHOPINFO/POSNO"
;;
QString
tmppath
=
"C:/SPC/POS/INI/PosConfig.ini"
;
QDomDocument
doc
;
QFile
file
(
tmppath
);
if
(
!
file
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
{
return
;
}
QString
strs
;
int
line
,
row
;
if
(
!
doc
.
setContent
(
&
file
,
&
strs
,
&
line
,
&
row
))
{
file
.
close
();
return
;
}
file
.
close
();
QDomElement
root
=
doc
.
documentElement
();
if
(
root
.
tagName
().
compare
(
"MESSAGE"
,
Qt
::
CaseInsensitive
)
!=
0
)
{
return
;
}
QDomNode
n
=
root
.
firstChild
();
QString
tmpposno
,
tmpstoreid
;
while
(
!
n
.
isNull
())
{
QDomElement
e
=
n
.
toElement
();
if
(
e
.
nodeName
().
compare
(
"pos"
,
Qt
::
CaseInsensitive
)
==
0
)
{
QDomNode
ser
=
e
.
firstChild
();
while
(
!
ser
.
isNull
())
{
QDomElement
na
=
ser
.
toElement
();
if
(
na
.
nodeName
().
compare
(
"StoreNo"
,
Qt
::
CaseInsensitive
)
==
0
)
{
tmpstoreid
=
na
.
firstChild
().
nodeValue
();
}
if
(
na
.
nodeName
().
compare
(
"PosNo"
,
Qt
::
CaseInsensitive
)
==
0
)
{
tmpposno
=
na
.
firstChild
().
nodeValue
();
}
ser
=
ser
.
nextSibling
();
}
}
n
=
n
.
nextSibling
();
}
QSettings
set
(
m_siIniPath
,
QSettings
::
IniFormat
);
set
.
setValue
(
m_keyStoreId
,
tmpstoreid
);
set
.
setValue
(
m_keyPosId
,
tmpposno
);
}
m_partnerId
=
"1321"
;
m_keyStoreId
=
"SHOPINFO/STORECD"
;
m_keyPosId
=
"SHOPINFO/POSNO"
;
//
#define MY_CFG "FMPOS.ini"
//
QFile file("C:/SPCINT/DATA/DBPOS/SHOPINFO.INI");
//
if(file.exists())
//
m_siIniPath = "C:/SPCINT/DATA/DBPOS/SHOPINFO.INI";
//
else
//
{
//
m_siIniPath = qApp->applicationDirPath() + "/" + MY_CFG;
//
m_partnerId = "1321";
//
m_keyStoreId = "SHOPINFO/STORECD";
//
m_keyPosId = "SHOPINFO/POSNO";;
//
QString tmppath = "C:/SPC/POS/INI/PosConfig.ini";
//
QDomDocument doc;
//
QFile file(tmppath);
//
if(!file.open(QFile::ReadOnly | QFile::Text))
//
{
//
return ;
//
}
//
QString strs;
//
int line, row;
//
if(!doc.setContent(&file, &strs, &line, &row))
//
{
//
file.close();
//
return ;
//
}
//
file.close();
//
QDomElement root = doc.documentElement();
//
if(root.tagName().compare("MESSAGE", Qt::CaseInsensitive) != 0)
//
{
//
return ;
//
}
//
QDomNode n = root.firstChild();
//
QString tmpposno, tmpstoreid;
//
while(!n.isNull())
//
{
//
QDomElement e = n.toElement();
//
if(e.nodeName().compare("pos", Qt::CaseInsensitive) == 0)
//
{
//
QDomNode ser = e.firstChild();
//
while(!ser.isNull())
//
{
//
QDomElement na = ser.toElement();
//
if(na.nodeName().compare("StoreNo", Qt::CaseInsensitive) == 0)
//
{
//
tmpstoreid = na.firstChild().nodeValue();
//
}
//
if(na.nodeName().compare("PosNo", Qt::CaseInsensitive) == 0)
//
{
//
tmpposno = na.firstChild().nodeValue();
//
}
//
ser = ser.nextSibling();
//
}
//
}
//
n = n.nextSibling();
//
}
//
QSettings set(m_siIniPath, QSettings::IniFormat);
//
set.setValue(m_keyStoreId, tmpstoreid);
//
set.setValue(m_keyPosId, tmpposno);
//
}
//
m_partnerId = "1321";
//
m_keyStoreId = "SHOPINFO/STORECD";
//
m_keyPosId = "SHOPINFO/POSNO";
#endif
#ifdef SHIQIJIA
QSqlDatabase
db
=
QSqlDatabase
::
addDatabase
(
"QODBC"
);
...
...
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