Commit c5555f6b by 李定达

1.允许重复节点的配置;

parent 7f43dd49
debug/
*.user
Makefile
Makefile.Debug
Makefile.Release
...@@ -99,7 +99,7 @@ bool control::checkbaseinfo(std::string data, std::string &error) ...@@ -99,7 +99,7 @@ bool control::checkbaseinfo(std::string data, std::string &error)
} }
} }
bool control::AddSigntoJson(std::string &data, std::string error) bool control::AddSigntoJson(std::string &data, std::string &error)
{ {
if(Tool::ReadCfg(QString(CFG_SECTION_ADDSIGN), 1).toInt() == 0) if(Tool::ReadCfg(QString(CFG_SECTION_ADDSIGN), 1).toInt() == 0)
return true; return true;
...@@ -115,22 +115,20 @@ bool control::AddSigntoJson(std::string &data, std::string error) ...@@ -115,22 +115,20 @@ bool control::AddSigntoJson(std::string &data, std::string error)
if(!s.HasMember(JSON_STOREID_POS)) if(!s.HasMember(JSON_STOREID_POS))
{ {
error = std::string(ERROR_MSG_1105); error = std::string(ERROR_MSG_1106);
return false;
}
if(!s.HasMember(JSON_PARTNERID_POS))
{
error = std::string(ERROR_MSG_1107);
return false; return false;
} }
rapidjson::Value &stordid = s[JSON_STOREID_POS]; rapidjson::Value &stordid = s[JSON_STOREID_POS];
rapidjson::Value &partid = s[JSON_PARTNERID_POS]; //rapidjson::Value &partid = s[JSON_PARTNERID_POS];
if(stordid.IsString() && partid.IsInt()) QString parid = Tool::ReadCfg(QString(CFG_SECTION_PARTNERID), "0000").toString();
if(stordid.IsString())
{ {
stm << stordid.GetString() << partid.GetInt() << DEFAULT_SIGN; QString key = Tool::ReadCfg(QString(CFG_SECTION_KEY), "AABB729B20E347CD92EFA4331D0DAAAA").toString();
stm << stordid.GetString() << parid.toUtf8().data() << key.toUtf8().data();
QLOG_INFO() << "sign up data : " << stm.str().c_str(); QLOG_INFO() << "sign up data : " << stm.str().c_str();
...@@ -571,7 +569,7 @@ void control::recv_data_pos(QByteArray data) ...@@ -571,7 +569,7 @@ void control::recv_data_pos(QByteArray data)
if(!checkneedhead(data)) if(!checkneedhead(data))
{ {
QLOG_ERROR() << "checkneedhead failed"; QLOG_ERROR() << "checkneedhead failed";
recv_error_pos(QString::fromLocal8Bit(ERROR_REQ_HEADER)); recv_error_pos(QString::fromLocal8Bit(ERROR_MSG_1201));
return ; return ;
} }
......
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
void checkneedrollback(); void checkneedrollback();
bool AddSigntoJson(std::string &data, std::string error); bool AddSigntoJson(std::string &data, std::string &error);
bool getrealurl(QString &url, int reqtype); bool getrealurl(QString &url, int reqtype);
......
...@@ -9,7 +9,7 @@ QT += core network ...@@ -9,7 +9,7 @@ QT += core network
QT -= gui QT -= gui
TARGET = fmcoupon TARGET = fmcoupon
CONFIG += console CONFIG -= console
CONFIG -= app_bundle CONFIG -= app_bundle
TEMPLATE = app TEMPLATE = app
...@@ -22,6 +22,8 @@ SOURCES += main.cpp \ ...@@ -22,6 +22,8 @@ SOURCES += main.cpp \
network.cpp \ network.cpp \
control.cpp control.cpp
RC_FILE += fmcoupon.rc
HEADERS += \ HEADERS += \
config.h \ config.h \
global.h \ global.h \
...@@ -30,3 +32,5 @@ HEADERS += \ ...@@ -30,3 +32,5 @@ HEADERS += \
control.h \ control.h \
Calc.hpp \ Calc.hpp \
fm_xmltojson.hpp fm_xmltojson.hpp
#if defined(UNDER_CE)
#include <winbase.h>
#else
#include <winver.h>
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0"
BEGIN
VALUE "CompanyName", "ShangHai Freemud Co., Ltd."
VALUE "FileDescription", "FREEMUD Manager System"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "FREEMUD"
VALUE "LegalCopyright", "Copyright (C)2017-2020"
VALUE "OriginalFilename", "fmcoupon.exe"
VALUE "ProductName", "fmcoupon"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200
END
END
\ No newline at end of file
#ifndef FM_GLOBAL_H #ifndef FM_GLOBAL_H
#define FM_GLOBAL_H #define FM_GLOBAL_H
// //
...@@ -24,11 +24,15 @@ ...@@ -24,11 +24,15 @@
#define ERROR_MSG_1200 "请先设置营业日" #define ERROR_MSG_1200 "请先设置营业日"
#define ERROR_MSG_1201 "POS请求数据消息头异常或缺失"
//cfg section //cfg section
#define CFG_SECTION_SERVERHOST "all/serverhost" #define CFG_SECTION_SERVERHOST "all/serverhost"
#define CFG_SECTION_LISTENPORT "all/listenport" #define CFG_SECTION_LISTENPORT "all/listenport"
#define CFG_SECTION_BASEINFO "all/baseinfo" #define CFG_SECTION_BASEINFO "all/baseinfo"
#define CFG_SECTION_KEY "all/key"
#define CFG_SECTION_PARTNERID "all/partnerid"
#define CFG_SECTION_CHECKBASEINFO "all/checkbaseinfo" #define CFG_SECTION_CHECKBASEINFO "all/checkbaseinfo"
#define CFG_SECTION_CHECKHEADER "all/checkheader" #define CFG_SECTION_CHECKHEADER "all/checkheader"
#define CFG_SECTION_ADDSIGN "all/addsign" #define CFG_SECTION_ADDSIGN "all/addsign"
...@@ -39,7 +43,7 @@ ...@@ -39,7 +43,7 @@
#define ERRRO_JSON_FMCONPON "{\"status_code\":210, \"msg\":\"%1\"}" #define ERRRO_JSON_FMCONPON "{\"status_code\":210, \"msg\":\"%1\"}"
#define SUCCESS_JSON_FMCONPON "{\"status_code\":100, \"msg\":\"营业日设置成功\"}" #define SUCCESS_JSON_FMCONPON "{\"status_code\":100, \"msg\":\"营业日设置成功\"}"
#define EMPTY_JSON_FMCONPON "{\"status_code\":211, \"msg\":\"服务端返回数据异常\"}" #define EMPTY_JSON_FMCONPON "{\"status_code\":211, \"msg\":\"服务端返回数据异常\"}"
#define ERROR_REQ_HEADER "{\"status_code\":212, \"msg\":\"POS请求数据消息头异常或缺失\"}" //#define ERROR_REQ_HEADER "{\"status_code\":212, \"msg\":\"POS请求数据消息头异常或缺失\"}"
#define ROLLBACK_FILL "rollback.txt" #define ROLLBACK_FILL "rollback.txt"
......
...@@ -5,10 +5,46 @@ ...@@ -5,10 +5,46 @@
#include "config.h" #include "config.h"
#include "control.h" #include "control.h"
#ifdef WIN32
#include <Windows.h>
#else
#endif
#ifdef FM_TEST #ifdef FM_TEST
int checkonly()
{
#ifdef WIN32
HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"Global\\fmTakeaway" );
if(m_hMutex != NULL)
{
if (GetLastError() == ERROR_ALREADY_EXISTS||GetLastError() == ERROR_ACCESS_DENIED) {
CloseHandle(m_hMutex);
m_hMutex = NULL;
return -1;
}
}
else{
return -1;
}
#else
#endif
return 0;
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(checkonly() == -1)
return 1;
QCoreApplication a(argc, argv); QCoreApplication a(argc, argv);
QString logDir = QString("%1/log").arg(QCoreApplication::applicationDirPath()); QString logDir = QString("%1/log").arg(QCoreApplication::applicationDirPath());
......
...@@ -179,7 +179,7 @@ void NetWork::on_new_connection_come() ...@@ -179,7 +179,7 @@ void NetWork::on_new_connection_come()
return ; return ;
} }
QLOG_INFO() << "recv data : " << data.data(); QLOG_INFO() << "recv data : " << data.toHex();
emit recv_data_ready(data); emit recv_data_ready(data);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment