Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmtakeout
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
李定达
fmtakeout
Commits
c73ece29
Commit
c73ece29
authored
Nov 20, 2018
by
朱博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改网络错误提示
parent
fe831517
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
76 additions
and
2 deletions
+76
-2
.gitignore
+3
-0
takeout/base/Config/configstoremanage.cpp
+7
-0
takeout/base/Config/configstoremanage.h
+12
-0
takeout/control/ordergetwork.cpp
+2
-0
takeout/control/orderpushwork.cpp
+25
-0
takeout/control/orderpushwork.h
+3
-1
takeout/event/posevent.cpp
+1
-0
takeout/event/posevent.h
+2
-1
takeout/preDefine.h
+2
-0
takeout/view/loginform.cpp
+2
-0
takeout/view/mainForm.cpp
+17
-0
No files found.
.gitignore
View file @
c73ece29
fmtakeout.pro.user
build-takeout-Desktop_Qt_5_5_1_MSVC2010_32bit-Debug/
build-takeout-Desktop_Qt_5_5_1_MSVC2010_32bit-Release/
*.user
takeout/base/Config/configstoremanage.cpp
0 → 100644
View file @
c73ece29
#include "configstoremanage.h"
configStoreManage
::
configStoreManage
()
{
}
takeout/base/Config/configstoremanage.h
0 → 100644
View file @
c73ece29
#ifndef CONFIGSTOREMANAGE_H
#define CONFIGSTOREMANAGE_H
#include <QSettings>
class
configStoreManage
{
public
:
configStoreManage
();
};
#endif // CONFIGSTOREMANAGE_H
takeout/control/ordergetwork.cpp
View file @
c73ece29
...
...
@@ -279,6 +279,8 @@ bool OrderGetWork::PullOrder(unsigned int timeout, QString &error)
if
(
!
BillSocket
::
S_Request
(
json
,
recvjson
,
realurl
,
error
))
{
error
=
QString
::
fromLocal8Bit
(
"拉单失败,网络错误:"
).
append
(
error
);
//QVariantMap value;
//POSTEVENTTYPE(PosEvent::s_network_outtime,value,QVariantMap);
QLOG_ERROR
()
<<
"pullorder failed : "
<<
error
;
return
false
;
}
...
...
takeout/control/orderpushwork.cpp
View file @
c73ece29
...
...
@@ -23,6 +23,7 @@ OrderPushWork::OrderPushWork(QObject *parent) : QObject(parent)
_token
=
QString
(
""
);
_serurl
.
clear
();
_istimeout
=
true
;
_networkstatic_index
=
1
;
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_token_change
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_login_storeinfo
);
...
...
@@ -251,6 +252,25 @@ bool OrderPushWork::loginTcpServer()
return
false
;
}
void
OrderPushWork
::
networkouttime
(
bool
networkstatus
)
{
if
(
networkstatus
)
{
_networkstatic_index
=
0
;
QVariantMap
map
;
map
.
insert
(
EVENT_KEY_NETWORKSTATUS
,
networkstatus
);
POSTEVENTTYPE
(
PosEvent
::
s_network_outtime
,
map
,
QVariantMap
);
}
else
if
(
!
networkstatus
&&
_networkstatic_index
==
0
){
_networkstatic_index
++
;
QVariantMap
map
;
map
.
insert
(
EVENT_KEY_NETWORKSTATUS
,
networkstatus
);
POSTEVENTTYPE
(
PosEvent
::
s_network_outtime
,
map
,
QVariantMap
);
QLOG_INFO
()
<<
"static: s_network_outtime ..."
;
}
}
void
OrderPushWork
::
heartBeatTcpService
()
{
while
(
_stopflag
&&
!
_needlogin
)
...
...
@@ -498,8 +518,13 @@ void OrderPushWork::workStart()
{
if
(
!
connectTcpServer
())
{
//QVariantMap value;
//POSTEVENTTYPE(PosEvent::s_network_outtime,value,QVariantMap);
networkouttime
(
false
);
QLOG_ERROR
()
<<
"connectTcpServer failed"
;
break
;
}
else
{
networkouttime
(
true
);
}
if
(
!
loginTcpServer
())
...
...
takeout/control/orderpushwork.h
View file @
c73ece29
...
...
@@ -145,7 +145,7 @@ public:
private
:
bool
GetServiceList
();
void
networkouttime
(
bool
networkstatus
);
public
slots
:
//推模式入口
void
workStart
();
...
...
@@ -181,6 +181,8 @@ private:
QMutex
_token_lock
;
//获取服务器列表地址
QString
_serurl
;
//网络失败提示的个数
int
_networkstatic_index
;
};
...
...
takeout/event/posevent.cpp
View file @
c73ece29
...
...
@@ -20,6 +20,7 @@ QEvent::Type PosEvent::s_show_float = static_cast<QEvent::Type>(QEvent::register
QEvent
::
Type
PosEvent
::
s_show_mainform
=
static_cast
<
QEvent
::
Type
>
(
QEvent
::
registerEventType
());
QEvent
::
Type
PosEvent
::
s_show_prtform
=
static_cast
<
QEvent
::
Type
>
(
QEvent
::
registerEventType
());
QEvent
::
Type
PosEvent
::
s_show_login
=
static_cast
<
QEvent
::
Type
>
(
QEvent
::
registerEventType
());
QEvent
::
Type
PosEvent
::
s_network_outtime
=
static_cast
<
QEvent
::
Type
>
(
QEvent
::
registerEventType
());
PosEvent
::
PosEvent
(
Type
e
)
:
QEvent
(
e
)
{
...
...
takeout/event/posevent.h
View file @
c73ece29
...
...
@@ -96,7 +96,8 @@ public:
static
Type
s_show_prtform
;
//登录界面显示
static
Type
s_show_login
;
//网络超时
static
Type
s_network_outtime
;
private
:
//事件携带的信息,该内存你应当在堆中分配
void
*
_info
;
...
...
takeout/preDefine.h
View file @
c73ece29
...
...
@@ -189,6 +189,8 @@
#define EVENT_KEY_SEASION "reason"
#define EVENT_KEY_ORDERSTATUS "orderstatus"
#define EVENT_KEY_NETWORKSTATUS "networkstatus"
#define TCPJSON_KEY_STOREID "storeId"
#define TCPJSON_KEY_TOKEN "token"
...
...
takeout/view/loginform.cpp
View file @
c73ece29
...
...
@@ -50,6 +50,8 @@ LoginForm::LoginForm(QWidget *parent) :
m_alertForm
=
new
AlertForm
(
this
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_login_status
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_opt_status
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_show_login
);
...
...
takeout/view/mainForm.cpp
View file @
c73ece29
...
...
@@ -46,6 +46,7 @@ MainForm::MainForm(QWidget *parent) :
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_delete_order
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_login_storeinfo
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_show_mainform
);
FMApplication
::
subscibeEvent
(
this
,
PosEvent
::
s_network_outtime
);
// 初始化界面
...
...
@@ -77,6 +78,7 @@ void MainForm::MyShow()
m_detailForm
=
new
DetailForm
(
this
);
connect
(
m_detailForm
,
&
DetailForm
::
showAlert
,
this
,
&
MainForm
::
onShowAlert
);
m_padForm
=
new
PadForm
(
this
);
m_padForm
->
move
(
pos
().
x
()
+
width
()
-
300
,
pos
().
y
()
+
height
()
-
438
);
m_padForm
->
hide
();
...
...
@@ -186,6 +188,21 @@ bool MainForm::event(QEvent *e)
}
return
true
;
}
if
(
e
->
type
()
==
PosEvent
::
s_network_outtime
)
{
QVariantMap
value
;
GETEVENTINFO
(
value
,
e
,
QVariantMap
);
if
(
value
.
contains
(
EVENT_KEY_NETWORKSTATUS
)
&&
value
[
EVENT_KEY_NETWORKSTATUS
].
toBool
()
==
true
)
{
onSetNetStatus
(
QString
::
fromLocal8Bit
(
"网络正常"
));
}
else
{
QLOG_INFO
()
<<
"STATIC: EVENT_KEY_NETWORKSTATUS:false"
;
onSetNetStatus
(
QString
::
fromLocal8Bit
(
"网络异常"
));
onShowAlert
(
AlertForm
::
ERROR
,
QString
::
fromLocal8Bit
(
"网络异常,请检查网络链接!"
));
}
return
true
;
}
return
QWidget
::
event
(
e
);
}
...
...
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