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)
}
}
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)
return true;
......@@ -115,22 +115,20 @@ bool control::AddSigntoJson(std::string &data, std::string error)
if(!s.HasMember(JSON_STOREID_POS))
{
error = std::string(ERROR_MSG_1105);
return false;
}
if(!s.HasMember(JSON_PARTNERID_POS))
{
error = std::string(ERROR_MSG_1107);
error = std::string(ERROR_MSG_1106);
return false;
}
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();
......@@ -571,7 +569,7 @@ void control::recv_data_pos(QByteArray data)
if(!checkneedhead(data))
{
QLOG_ERROR() << "checkneedhead failed";
recv_error_pos(QString::fromLocal8Bit(ERROR_REQ_HEADER));
recv_error_pos(QString::fromLocal8Bit(ERROR_MSG_1201));
return ;
}
......
......@@ -29,7 +29,7 @@ public:
void checkneedrollback();
bool AddSigntoJson(std::string &data, std::string error);
bool AddSigntoJson(std::string &data, std::string &error);
bool getrealurl(QString &url, int reqtype);
......
......@@ -10,12 +10,12 @@
#include <xmlrapid/rapidxml_utils.hpp>
#include <xmlrapid/rapidxml_print.hpp>
#include <rapidjson/document.h>
#include <rapidjson/prettywriter.h>
#include <rapidjson/filereadstream.h>
#include <rapidjson/filewritestream.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <../include/rapidjson/document.h>
#include <../include/rapidjson/prettywriter.h>
#include <../include/rapidjson/filereadstream.h>
#include <../include/rapidjson/filewritestream.h>
#include <../include/rapidjson/stringbuffer.h>
#include <../include/rapidjson/writer.h>
#include "Calc.hpp"
......@@ -210,7 +210,7 @@ private:
int curPos;
char pathBuf[MAX_PATH] = { 0 };
GetModuleFileName((HMODULE)&__ImageBase, pathBuf, MAX_PATH);
GetModuleFileNameA((HMODULE)&__ImageBase, pathBuf, MAX_PATH);
curPos = strlen(pathBuf) - 1;
......@@ -654,59 +654,80 @@ private:
}
static void InsertValueToJson(xml_node<> *node, Document &desdoc, Value &dval, const Value &sval, const Value &sparentvalue, string sparentname = string(""))
{
if(node == NULL)
return ;
static void InsertValueToJson(xml_node<> *node, Document &desdoc, Value &dval, const Value &sval, const Value &sparentvalue, string sparentname = string(""))
{
if(node == NULL)
return ;
if(node->first_attribute(XML_ATT_TYPE) == NULL)
return ;
if(node->first_attribute(XML_ATT_TYPE) == NULL)
return ;
char *pkey = node->name();
char *pkey = node->name();
do
{
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_INT).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
do
{
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_INT).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
if(node->value() == NULL || string(node->value()).empty())
return ;
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atoi(node->value()), desdoc.GetAllocator());
break ;
}
if(node->value() == NULL || string(node->value()).empty())
return ;
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_DOUBLE).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atoi(node->value()), desdoc.GetAllocator());
break ;
}
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_DOUBLE).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
if(node->value() == NULL || string(node->value()).empty())
return ;
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atof(node->value()), desdoc.GetAllocator());
break ;
}
if(node->value() == NULL || string(node->value()).empty())
return ;
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_STRING).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atof(node->value()), desdoc.GetAllocator());
break ;
}
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_STRING).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
if(node->value() == NULL || string(node->value()).empty())
return ;
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), Value().SetString(node->value(), strlen(node->value()), desdoc.GetAllocator()), desdoc.GetAllocator());
break ;
}
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_ARRAY).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(node->value() == NULL || string(node->value()).empty())
return ;
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), Value().SetString(node->value(), strlen(node->value()), desdoc.GetAllocator()), desdoc.GetAllocator());
break ;
}
//无映射节点默认添加一个元素
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_ARRAY).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
if(node->first_node()->name() != NULL && string(XML_NODE_OBJECT).compare(node->first_node()->name()) ==0 )
{
Value arrayvalue(rapidjson::kArrayType);
Value arrayvalue;
if(dval.HasMember(pkey) && dval[pkey].IsArray())
{
arrayvalue.CopyFrom(dval[pkey], desdoc.GetAllocator());
}
else
{
arrayvalue.SetArray();
}
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
......@@ -717,18 +738,29 @@ private:
for(xml_node<> * attrs = attr->first_node(); attrs != NULL; attrs = attrs->next_sibling())
{
InsertValueToJson(attrs, desdoc, objectvalue, sval, sparentvalue);
}
arrayvalue.PushBack(objectvalue, desdoc.GetAllocator());
}
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), arrayvalue, desdoc.GetAllocator());
break ;
}
else
{
Value arrayvalue(rapidjson::kArrayType);
Value arrayvalue;
if(dval.HasMember(pkey) && dval[pkey].IsArray())
{
arrayvalue.CopyFrom(dval[pkey], desdoc.GetAllocator());
}
else
{
arrayvalue.SetArray();
}
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
......@@ -736,166 +768,272 @@ private:
InsertValueToJson(attr, desdoc, objectvalue, sval, sparentvalue);
}
arrayvalue.PushBack(objectvalue, desdoc.GetAllocator());
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), arrayvalue, desdoc.GetAllocator());
break ;
}
}
}
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_OBJ).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(node->first_attribute(XML_ATT_OKEY) == NULL && string(JSON_TYPE_OBJ).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
Value objectvalue(rapidjson::kObjectType);
Value objectvalue;
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, sparentvalue);
}
if(dval.HasMember(pkey) && ((const Value &)dval[pkey]).IsObject())
{
objectvalue.CopyFrom(dval[pkey], desdoc.GetAllocator());
}
else
{
objectvalue.SetObject();
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), objectvalue, desdoc.GetAllocator());
break ;
}
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, sparentvalue);
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_INT).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(node->value() != NULL && !string(node->value()).empty())
{
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atoi(node->value()), desdoc.GetAllocator());
break;
}
else
{
string values;
if(!GetJsonValue(string(node->first_attribute(XML_ATT_OKEY)->value()), values, sval, sparentvalue, sparentname))
return ;
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
GetMaping(node, values);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), objectvalue, desdoc.GetAllocator());
break ;
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atoi(values.c_str()), desdoc.GetAllocator());
break ;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_INT).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
}
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_DOUBLE).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(node->value() != NULL && !string(node->value()).empty())
{
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atof(node->value()), desdoc.GetAllocator());
break;
}
else
{
string values;
if(!GetJsonValue(string(node->first_attribute(XML_ATT_OKEY)->value()), values, sval, sparentvalue, sparentname))
return ;
if(node->value() != NULL && !string(node->value()).empty())
{
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
GetMaping(node, values);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atoi(node->value()), desdoc.GetAllocator());
break;
}
else
{
string values;
if(!GetJsonValue(string(node->first_attribute(XML_ATT_OKEY)->value()), values, sval, sparentvalue, sparentname))
return ;
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atof(values.c_str()), desdoc.GetAllocator());
break ;
}
GetMaping(node, values);
}
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_STRING).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(node->value() != NULL && !string(node->value()).empty())
{
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), Value().SetString(node->value(), strlen(node->value()), desdoc.GetAllocator()), desdoc.GetAllocator());
break;
}
else
{
string values;
if(!GetJsonValue(string(node->first_attribute(XML_ATT_OKEY)->value()), values, sval, sparentvalue, sparentname))
return ;
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atoi(values.c_str()), desdoc.GetAllocator());
break ;
}
GetMaping(node, values);
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), Value().SetString(values.c_str(), strlen(values.c_str()), desdoc.GetAllocator()), desdoc.GetAllocator());
break ;
}
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_DOUBLE).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
}
if(node->value() != NULL && !string(node->value()).empty())
{
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_ARRAY).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
Document docs;
Value valus;
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atof(node->value()), desdoc.GetAllocator());
break;
}
else
{
string values;
if(!GetJsonValue(string(node->first_attribute(XML_ATT_OKEY)->value()), values, sval, sparentvalue, sparentname))
return ;
if(GetParentNodeVale(string(node->first_attribute(XML_ATT_OKEY)->value()), docs, valus, sval, sparentvalue, sparentname) == false)
break;
GetMaping(node, values);
if(valus.IsArray())
{
Value arrayvalue(rapidjson::kArrayType);
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
for (unsigned int i = 0; i < valus.Size(); ++i)
{
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus.GetArray()[i], string(node->first_attribute(XML_ATT_OKEY)->value()));
}
arrayvalue.PushBack(objectvalue, desdoc.GetAllocator());
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), arrayvalue, desdoc.GetAllocator());
break;
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), std::atof(values.c_str()), desdoc.GetAllocator());
break ;
}
if(valus.IsObject())
{
Value arrayvalue(rapidjson::kArrayType);
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus, string(node->first_attribute(XML_ATT_OKEY)->value()));
}
arrayvalue.PushBack(objectvalue, desdoc.GetAllocator());
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), arrayvalue, desdoc.GetAllocator());
break;
}
break;
}
}
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_OBJ).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
Document docs;
Value valus;
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_STRING).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
if(GetParentNodeVale(string(node->first_attribute(XML_ATT_OKEY)->value()), docs, valus, sval, sparentvalue, sparentname) == false)
break;
if(node->value() != NULL && !string(node->value()).empty())
{
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), Value().SetString(node->value(), strlen(node->value()), desdoc.GetAllocator()), desdoc.GetAllocator());
break;
}
else
{
string values;
if(!GetJsonValue(string(node->first_attribute(XML_ATT_OKEY)->value()), values, sval, sparentvalue, sparentname))
return ;
if(valus.IsArray())
{
GetMaping(node, values);
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus.GetArray()[0], string(node->first_attribute(XML_ATT_OKEY)->value()));
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), objectvalue, desdoc.GetAllocator());
break;
}
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
if(valus.IsObject())
{
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus, string(node->first_attribute(XML_ATT_OKEY)->value()));
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), objectvalue, desdoc.GetAllocator());
break;
}
break;
}
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), Value().SetString(values.c_str(), strlen(values.c_str()), desdoc.GetAllocator()), desdoc.GetAllocator());
break ;
}
}
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_ARRAY).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
Document docs;
Value valus;
if(GetParentNodeVale(string(node->first_attribute(XML_ATT_OKEY)->value()), docs, valus, sval, sparentvalue, sparentname) == false)
break;
if(valus.IsArray())
{
Value arrayvalue;
if(dval.HasMember(pkey) && dval[pkey].IsArray())
{
arrayvalue.CopyFrom(dval[pkey], desdoc.GetAllocator());
}
else
{
arrayvalue.SetArray();
}
for (unsigned int i = 0; i < valus.Size(); ++i)
{
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus.GetArray()[i], string(node->first_attribute(XML_ATT_OKEY)->value()));
}
arrayvalue.PushBack(objectvalue, desdoc.GetAllocator());
}
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), arrayvalue, desdoc.GetAllocator());
break;
}
if(valus.IsObject())
{
Value arrayvalue;
if(dval.HasMember(pkey) && ((const Value &)dval[pkey]).IsArray())
{
arrayvalue.CopyFrom(dval[pkey], desdoc.GetAllocator());
}
else
{
arrayvalue.SetArray();
}
Value objectvalue(rapidjson::kObjectType);
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus, string(node->first_attribute(XML_ATT_OKEY)->value()));
}
arrayvalue.PushBack(objectvalue, desdoc.GetAllocator());
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), arrayvalue, desdoc.GetAllocator());
break;
}
break;
}
if(node->first_attribute(XML_ATT_OKEY) != NULL && string(JSON_TYPE_OBJ).compare(node->first_attribute(XML_ATT_TYPE)->value()) == 0)
{
if(!CheckNodeNeed(node, sval, sparentvalue, sparentname))
break;
Document docs;
Value valus;
if(GetParentNodeVale(string(node->first_attribute(XML_ATT_OKEY)->value()), docs, valus, sval, sparentvalue, sparentname) == false)
break;
if(valus.IsArray())
{
Value objectvalue;
if(dval.HasMember(pkey) && ((const Value &)dval[pkey]).IsArray() && ((const Value &)dval[pkey]).GetArray().Size() >= 1)
{
objectvalue.CopyFrom(dval[pkey][0], desdoc.GetAllocator());
}
else
{
objectvalue.SetObject();
}
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus.GetArray()[0], string(node->first_attribute(XML_ATT_OKEY)->value()));
}
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), objectvalue, desdoc.GetAllocator());
break;
}
if(valus.IsObject())
{
Value objectvalue;
if(dval.HasMember(pkey) && ((const Value &)dval[pkey]).IsObject())
{
objectvalue.CopyFrom(dval[pkey], desdoc.GetAllocator());
}
else
{
objectvalue.SetObject();
}
for(xml_node<> * attr = node->first_node(); attr != NULL; attr = attr->next_sibling())
{
InsertValueToJson(attr, desdoc, objectvalue, sval, valus, string(node->first_attribute(XML_ATT_OKEY)->value()));
}
if(dval.HasMember(pkey))
dval.RemoveMember(pkey);
dval.AddMember(Value().SetString(pkey, strlen(pkey), desdoc.GetAllocator()), objectvalue, desdoc.GetAllocator());
break;
}
break;
}
} while (0);
}
} while (0);
}
static void Do_GetJsonWithXML(xml_node<> *node, const Document &srcdoc, Document &desdoc)
{
......
......@@ -9,7 +9,7 @@ QT += core network
QT -= gui
TARGET = fmcoupon
CONFIG += console
CONFIG -= console
CONFIG -= app_bundle
TEMPLATE = app
......@@ -22,6 +22,8 @@ SOURCES += main.cpp \
network.cpp \
control.cpp
RC_FILE += fmcoupon.rc
HEADERS += \
config.h \
global.h \
......@@ -30,3 +32,5 @@ HEADERS += \
control.h \
Calc.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
//
......@@ -24,11 +24,15 @@
#define ERROR_MSG_1200 "请先设置营业日"
#define ERROR_MSG_1201 "POS请求数据消息头异常或缺失"
//cfg section
#define CFG_SECTION_SERVERHOST "all/serverhost"
#define CFG_SECTION_LISTENPORT "all/listenport"
#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_CHECKHEADER "all/checkheader"
#define CFG_SECTION_ADDSIGN "all/addsign"
......@@ -39,7 +43,7 @@
#define ERRRO_JSON_FMCONPON "{\"status_code\":210, \"msg\":\"%1\"}"
#define SUCCESS_JSON_FMCONPON "{\"status_code\":100, \"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"
......
......@@ -5,10 +5,46 @@
#include "config.h"
#include "control.h"
#ifdef WIN32
#include <Windows.h>
#else
#endif
#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[])
{
if(checkonly() == -1)
return 1;
QCoreApplication a(argc, argv);
QString logDir = QString("%1/log").arg(QCoreApplication::applicationDirPath());
......
......@@ -179,7 +179,7 @@ void NetWork::on_new_connection_come()
return ;
}
QLOG_INFO() << "recv data : " << data.data();
QLOG_INFO() << "recv data : " << data.toHex();
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