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
Hide 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 "fmtools.h"
#include "QsLog.h"
#include "QsLog.h"
#include "fmdefine.h"
#include "fmdefine.h"
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
FmControl
::
FmControl
()
FmControl
::
FmControl
()
{
{
bool
m_init_flag
=
true
;
int
m_keepsleeptime
=
0
;
m_keepTimer
.
setInterval
(
KEEP_INTERVAL
);
m_keepTimer
.
setInterval
(
KEEP_INTERVAL
);
connect
(
&
m_keepTimer
,
&
QTimer
::
timeout
,
this
,
&
FmControl
::
onKeepProcess
);
connect
(
&
m_keepTimer
,
&
QTimer
::
timeout
,
this
,
&
FmControl
::
onKeepProcess
);
}
}
...
@@ -41,6 +43,35 @@ void FmControl::onKeepProcess()
...
@@ -41,6 +43,35 @@ void FmControl::onKeepProcess()
{
{
QString
error
;
QString
error
;
QStringList
diedProcList
;
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
))
if
(
!
_GetDiedProcess
(
FmTools
::
GetInstance
().
GetKeepExes
(),
diedProcList
,
error
))
{
{
QLOG_ERROR
()
<<
QString
(
"get died process failed [%1]"
).
arg
(
error
);
QLOG_ERROR
()
<<
QString
(
"get died process failed [%1]"
).
arg
(
error
);
...
@@ -52,6 +83,7 @@ void FmControl::onKeepProcess()
...
@@ -52,6 +83,7 @@ void FmControl::onKeepProcess()
{
{
QString
exePath
=
QString
(
"%1/%2"
).
arg
(
m_appDir
,
path
);
QString
exePath
=
QString
(
"%1/%2"
).
arg
(
m_appDir
,
path
);
QLOG_INFO
()
<<
QString
(
"launch [%1]"
).
arg
(
exePath
);
QLOG_INFO
()
<<
QString
(
"launch [%1]"
).
arg
(
exePath
);
if
(
!
_LaunchProcess
(
exePath
,
error
))
if
(
!
_LaunchProcess
(
exePath
,
error
))
{
{
QLOG_ERROR
()
<<
QString
(
"launch process failed [%1]"
).
arg
(
error
);
QLOG_ERROR
()
<<
QString
(
"launch process failed [%1]"
).
arg
(
error
);
...
...
fmscupd/fmcontrol.h
View file @
565b27de
...
@@ -18,6 +18,10 @@ public:
...
@@ -18,6 +18,10 @@ public:
void
Start
();
void
Start
();
private
:
private
:
// 初始化标志位
bool
m_init_flag
;
// 停止启动程序计数器
int
m_keepsleeptime
;
// 程序守护定时器
// 程序守护定时器
QTimer
m_keepTimer
;
QTimer
m_keepTimer
;
// 记录程序所在的目录
// 记录程序所在的目录
...
...
fmscupd/fmdefine.h
View file @
565b27de
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#define INIPATH_TIMEOUT1 "SoftInfo/timeout1"
#define INIPATH_TIMEOUT1 "SoftInfo/timeout1"
#define SERVICE_NAME "Fmupdate"
#define SERVICE_NAME "Fmupdate"
#define SERVICE_DESC "
用于非码程序的升级服务
"
#define SERVICE_DESC "
using freemud mcdmanager.exe guard
"
#define KEEP_INTERVAL 5*1000
#define KEEP_INTERVAL 5*1000
#define CHECK_INTERVAL 10*60*1000
#define CHECK_INTERVAL 10*60*1000
...
...
fmscupd/fmscupd.pro
View file @
565b27de
...
@@ -2,7 +2,7 @@ include("QsLog/QsLog.pri")
...
@@ -2,7 +2,7 @@ include("QsLog/QsLog.pri")
include
(
"QtService/src/qtservice.pri"
)
include
(
"QtService/src/qtservice.pri"
)
include
(
"Quazip/quazip.pri"
)
include
(
"Quazip/quazip.pri"
)
QT
+=
core
network
sql
xml
QT
+=
core
network
QT
-=
gui
QT
-=
gui
CONFIG
+=
c
++
11
CONFIG
+=
c
++
11
...
...
fmscupd/fmtools.cpp
View file @
565b27de
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
#include "fmdefine.h"
#include "fmdefine.h"
#include <QJsonObject>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonDocument>
#include <QSqlDatabase>
//
#include <QSqlDatabase>
#include <QDomComment>
//
#include <QDomComment>
#include <QDomElement>
//
#include <QDomElement>
#include <QSqlQuery>
//
#include <QSqlQuery>
#include <QFile>
#include <QFile>
#include <QDir>
#include <QDir>
...
@@ -22,82 +22,82 @@ FmTools::FmTools()
...
@@ -22,82 +22,82 @@ FmTools::FmTools()
#ifdef BALIBEITIAN
#ifdef BALIBEITIAN
#define MY_CFG "FMPOS.ini"
//
#define MY_CFG "FMPOS.ini"
QFile
file
(
"C:/SPCINT/DATA/DBPOS/SHOPINFO.INI"
);
//
QFile file("C:/SPCINT/DATA/DBPOS/SHOPINFO.INI");
if
(
file
.
exists
())
//
if(file.exists())
m_siIniPath
=
"C:/SPCINT/DATA/DBPOS/SHOPINFO.INI"
;
//
m_siIniPath = "C:/SPCINT/DATA/DBPOS/SHOPINFO.INI";
else
//
else
{
//
{
m_siIniPath
=
qApp
->
applicationDirPath
()
+
"/"
+
MY_CFG
;
//
m_siIniPath = qApp->applicationDirPath() + "/" + MY_CFG;
m_partnerId
=
"1321"
;
//
m_partnerId = "1321";
m_keyStoreId
=
"SHOPINFO/STORECD"
;
//
m_keyStoreId = "SHOPINFO/STORECD";
m_keyPosId
=
"SHOPINFO/POSNO"
;;
//
m_keyPosId = "SHOPINFO/POSNO";;
QString
tmppath
=
"C:/SPC/POS/INI/PosConfig.ini"
;
//
QString tmppath = "C:/SPC/POS/INI/PosConfig.ini";
QDomDocument
doc
;
//
QDomDocument doc;
QFile
file
(
tmppath
);
//
QFile file(tmppath);
if
(
!
file
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
//
if(!file.open(QFile::ReadOnly | QFile::Text))
{
//
{
return
;
//
return ;
}
//
}
QString
strs
;
//
QString strs;
int
line
,
row
;
//
int line, row;
if
(
!
doc
.
setContent
(
&
file
,
&
strs
,
&
line
,
&
row
))
//
if(!doc.setContent(&file, &strs, &line, &row))
{
//
{
file
.
close
();
//
file.close();
return
;
//
return ;
}
//
}
file
.
close
();
//
file.close();
QDomElement
root
=
doc
.
documentElement
();
//
QDomElement root = doc.documentElement();
if
(
root
.
tagName
().
compare
(
"MESSAGE"
,
Qt
::
CaseInsensitive
)
!=
0
)
//
if(root.tagName().compare("MESSAGE", Qt::CaseInsensitive) != 0)
{
//
{
return
;
//
return ;
}
//
}
QDomNode
n
=
root
.
firstChild
();
//
QDomNode n = root.firstChild();
QString
tmpposno
,
tmpstoreid
;
//
QString tmpposno, tmpstoreid;
while
(
!
n
.
isNull
())
//
while(!n.isNull())
{
//
{
QDomElement
e
=
n
.
toElement
();
//
QDomElement e = n.toElement();
if
(
e
.
nodeName
().
compare
(
"pos"
,
Qt
::
CaseInsensitive
)
==
0
)
//
if(e.nodeName().compare("pos", Qt::CaseInsensitive) == 0)
{
//
{
QDomNode
ser
=
e
.
firstChild
();
//
QDomNode ser = e.firstChild();
while
(
!
ser
.
isNull
())
//
while(!ser.isNull())
{
//
{
QDomElement
na
=
ser
.
toElement
();
//
QDomElement na = ser.toElement();
if
(
na
.
nodeName
().
compare
(
"StoreNo"
,
Qt
::
CaseInsensitive
)
==
0
)
//
if(na.nodeName().compare("StoreNo", Qt::CaseInsensitive) == 0)
{
//
{
tmpstoreid
=
na
.
firstChild
().
nodeValue
();
//
tmpstoreid = na.firstChild().nodeValue();
}
//
}
if
(
na
.
nodeName
().
compare
(
"PosNo"
,
Qt
::
CaseInsensitive
)
==
0
)
//
if(na.nodeName().compare("PosNo", Qt::CaseInsensitive) == 0)
{
//
{
tmpposno
=
na
.
firstChild
().
nodeValue
();
//
tmpposno = na.firstChild().nodeValue();
}
//
}
ser
=
ser
.
nextSibling
();
//
ser = ser.nextSibling();
}
//
}
}
//
}
n
=
n
.
nextSibling
();
//
n = n.nextSibling();
}
//
}
QSettings
set
(
m_siIniPath
,
QSettings
::
IniFormat
);
//
QSettings set(m_siIniPath, QSettings::IniFormat);
set
.
setValue
(
m_keyStoreId
,
tmpstoreid
);
//
set.setValue(m_keyStoreId, tmpstoreid);
set
.
setValue
(
m_keyPosId
,
tmpposno
);
//
set.setValue(m_keyPosId, tmpposno);
}
//
}
m_partnerId
=
"1321"
;
//
m_partnerId = "1321";
m_keyStoreId
=
"SHOPINFO/STORECD"
;
//
m_keyStoreId = "SHOPINFO/STORECD";
m_keyPosId
=
"SHOPINFO/POSNO"
;
//
m_keyPosId = "SHOPINFO/POSNO";
#endif
#endif
#ifdef SHIQIJIA
#ifdef SHIQIJIA
QSqlDatabase
db
=
QSqlDatabase
::
addDatabase
(
"QODBC"
);
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