Browse Source

VERSION 1.1.7

storage-in-realtime
zhaohe 11 months ago
parent
commit
f46fb9808b
  1. 4
      README.md
  2. 10
      app_protocols/appexception/appexception.hpp
  3. 12
      appsrc/appbase/appevent/app_warning_promopt_event.hpp
  4. 2
      appsrc/appsetting/project_port/basic/zappversion.hpp
  5. 2
      appsrc/baseservice/db/formula_db_dao.cpp
  6. 31
      appsrc/baseservice/front_msg_processer/front_msg_processer.cpp
  7. 12
      appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp
  8. 4
      appsrc/service/app_core.cpp
  9. 11
      appsrc/service/setting_mgr_service.cpp

4
README.md

@ -67,6 +67,10 @@ VERSION 1.1.6
1. 添加批量日志接口 1. 添加批量日志接口
2. 修复测试模式下出现重复消毒日志的BUG 2. 修复测试模式下出现重复消毒日志的BUG
VERSION 1.1.7
1. 修复配方更新接口BUG
2. 修改ackinfo 为 message
TODO: TODO:
添加用户增加用户查重检查 添加用户增加用户查重检查

10
app_protocols/appexception/appexception.hpp

@ -27,8 +27,6 @@ using namespace std;
class appexception : public std::exception { class appexception : public std::exception {
public: public:
int32_t ecode; int32_t ecode;
string fromClass;
string fromFn;
string traceinfo; string traceinfo;
string description; string description;
@ -58,17 +56,13 @@ class appexception : public std::exception {
whatstr = this->traceinfo; whatstr = this->traceinfo;
} }
appexception(ThisClass &thisclass, string func, int32_t ecode, const string &description) {
appexception( int32_t ecode, const string &description) {
this->description = description; this->description = description;
this->ecode = ecode; this->ecode = ecode;
this->fromClass = thisclass.className;
this->fromFn = func;
this->traceinfo = printStackTrace(); this->traceinfo = printStackTrace();
string info; string info;
info += fmt::format("ecode:{}\n", ecode); info += fmt::format("ecode:{}\n", ecode);
info += fmt::format("fromClass:{}\n", fromClass);
info += fmt::format("fromFn:{}\n", fromFn);
info += fmt::format("description:{}\n", description); info += fmt::format("description:{}\n", description);
info += fmt::format("traceInfo:{}\n", traceinfo); info += fmt::format("traceInfo:{}\n", traceinfo);
whatstr = info; whatstr = info;
@ -86,5 +80,5 @@ class appexception : public std::exception {
THROW_APP_EXCEPTION(ecode, info); \ THROW_APP_EXCEPTION(ecode, info); \
} }
#define THROW_APP_EXCEPTION(ecode, info) throw appexception(thisClass, __FUNCTION__, ecode, info);
#define THROW_APP_EXCEPTION(ecode, info) throw appexception(ecode, info);
} // namespace iflytop } // namespace iflytop

12
appsrc/appbase/appevent/app_warning_promopt_event.hpp

@ -5,8 +5,8 @@ namespace iflytop {
class AppWarningPromoptEvent : public IAppEvent { class AppWarningPromoptEvent : public IAppEvent {
private: private:
int32_t ecode; int32_t ecode;
string fromClass;
string fromFn;
// string fromClass;
// string fromFn;
string traceinfo; string traceinfo;
string description; string description;
@ -14,15 +14,15 @@ class AppWarningPromoptEvent : public IAppEvent {
AppWarningPromoptEvent(int ecode) : ecode(ecode) {} AppWarningPromoptEvent(int ecode) : ecode(ecode) {}
AppWarningPromoptEvent(const appexception& e) { AppWarningPromoptEvent(const appexception& e) {
ecode = e.ecode; ecode = e.ecode;
fromClass = e.fromClass;
fromFn = e.fromFn;
// fromClass = e.fromClass;
// fromFn = e.fromFn;
traceinfo = e.traceinfo; traceinfo = e.traceinfo;
description = e.description; description = e.description;
} }
virtual ~AppWarningPromoptEvent() {} virtual ~AppWarningPromoptEvent() {}
int getEcode() { return ecode; } int getEcode() { return ecode; }
const string &getFromClass() { return fromClass; }
const string &getFromFn() { return fromFn; }
// const string &getFromClass() { return fromClass; }
// const string &getFromFn() { return fromFn; }
const string &getTraceinfo() { return traceinfo; } const string &getTraceinfo() { return traceinfo; }
const string &getDescription() { return description; } const string &getDescription() { return description; }
}; };

2
appsrc/appsetting/project_port/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION "1.1.6"
#define VERSION "1.1.7"
#define PROJECT_NAME "TRANSMIT_DM" #define PROJECT_NAME "TRANSMIT_DM"

2
appsrc/baseservice/db/formula_db_dao.cpp

@ -28,7 +28,7 @@ json FormulaDBDao::getAllFormula() {
} }
void FormulaDBDao::updateFormula(string formulaid, json formula) { void FormulaDBDao::updateFormula(string formulaid, json formula) {
formula["formula_id"] = formulaid; formula["formula_id"] = formulaid;
keyvaldb.set(formulaid, formula);
keyvaldb.set(formulaid, formula.dump());
} }
void FormulaDBDao::updateFormula(string formulaid, string key, string val) { void FormulaDBDao::updateFormula(string formulaid, string key, string val) {
json formula = keyvaldb.get(formulaid); json formula = keyvaldb.get(formulaid);

31
appsrc/baseservice/front_msg_processer/front_msg_processer.cpp

@ -83,34 +83,21 @@ void FrontMsgProcesser::processMsg(shared_ptr<MsgProcessContext> cxt) {
} }
if (m_msgProcesserMap.find(key) != m_msgProcesserMap.end()) { if (m_msgProcesserMap.find(key) != m_msgProcesserMap.end()) {
cxt->receipt["fromClass"] = m_msgProcesserMap[key]->className;
cxt->receipt["fromFn"] = m_msgProcesserMap[key]->fnName;
try { try {
m_msgProcesserMap[key]->fn(cxt); m_msgProcesserMap[key]->fn(cxt);
if (cxt->ackcode != 0) {
cxt->receipt["ackcode"] = cxt->ackcode;
}
if (int(cxt->receipt["ackcode"]) != 0) {
cxt->receipt["message"] = fmt::format("{}", ecode2str(cxt->receipt["ackcode"]));
cxt->receipt["extMessage"] = fmt::format("{}", cxt->ackcodeExtMessage);
}
if (cxt->rely.empty() == false) {
cxt->receipt["rely"] = cxt->rely;
}
if (cxt->ackcode != 0) cxt->receipt["ackcode"] = cxt->ackcode;
if (int(cxt->receipt["ackcode"]) != 0) cxt->receipt["message"] = fmt::format("{}", ecode2str(cxt->receipt["ackcode"]) + cxt->ackcodeExtMessage);
if (cxt->rely.empty() == false) cxt->receipt["rely"] = cxt->rely;
} catch (const appexception& e) { } catch (const appexception& e) {
cxt->receipt["ackcode"] = e.ecode;
cxt->receipt["message"] = fmt::format("{}", ecode2str(cxt->receipt["ackcode"]));
cxt->receipt["traceinfo"] = fmt::format("{}", e.traceinfo);
cxt->receipt["description"] = fmt::format("{}", e.description);
cxt->receipt["fromClass"] = fmt::format("{}", e.fromClass);
cxt->receipt["fromFn"] = fmt::format("{}", e.fromFn);
cxt->receipt["ackcode"] = e.ecode;
cxt->receipt["message"] = fmt::format("{}", ecode2str(cxt->receipt["ackcode"]) + e.description);
cxt->receipt["traceinfo"] = fmt::format("{}", e.traceinfo);
logger->error("appexception: {}", e.what()); logger->error("appexception: {}", e.what());
} }
cxt->receipt["fromClass"] = m_msgProcesserMap[key]->className;
cxt->receipt["fromFn"] = m_msgProcesserMap[key]->fnName;
} else { } else {
logger->error("unknown command: {}", key); logger->error("unknown command: {}", key);
cxt->receipt["ackcode"] = err::kappe_cmd_not_support; cxt->receipt["ackcode"] = err::kappe_cmd_not_support;

12
appsrc/baseservice/iflytop_front_end_service/iflytop_front_end_service.cpp

@ -156,36 +156,36 @@ void IflytopFrontEndService::processRxMessage(weak_ptr<WebSocket> webSocket, str
// json parse error // json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext); logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err; receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcodeInfo"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1)); ws->sendText(receipt.dump(1));
} catch (const detail::invalid_iterator& e) { } catch (const detail::invalid_iterator& e) {
// json parse error // json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext); logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err; receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcodeInfo"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1)); ws->sendText(receipt.dump(1));
} catch (const detail::type_error& e) { } catch (const detail::type_error& e) {
// json parse error // json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext); logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err; receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcodeInfo"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1)); ws->sendText(receipt.dump(1));
} catch (const detail::out_of_range& e) { } catch (const detail::out_of_range& e) {
// json parse error // json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext); logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err; receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcodeInfo"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
receipt["message"] = ecode2str(err::kappe_parse_json_err) + "," + e.what();
ws->sendText(receipt.dump(1)); ws->sendText(receipt.dump(1));
} catch (const detail::other_error& e) { } catch (const detail::other_error& e) {
// json parse error // json parse error
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext); logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_parse_json_err; receipt["ackcode"] = err::kappe_parse_json_err;
receipt["ackcodeInfo"] = ecode2str(err::kappe_parse_json_err);
receipt["message"] = ecode2str(err::kappe_parse_json_err);
ws->sendText(receipt.dump(1)); ws->sendText(receipt.dump(1));
} catch (const std::exception& e) { } catch (const std::exception& e) {
logger->error("process rx json failed,exception:{},{}", e.what(), msgtext); logger->error("process rx json failed,exception:{},{}", e.what(), msgtext);
receipt["ackcode"] = err::kappe_std_exception; receipt["ackcode"] = err::kappe_std_exception;
receipt["ackcodeInfo"] = ecode2str(err::kappe_std_exception) + "," + e.what();
receipt["message"] = ecode2str(err::kappe_std_exception) + "," + e.what();
ws->sendText(receipt.dump(1)); ws->sendText(receipt.dump(1));
} }

4
appsrc/service/app_core.cpp

@ -182,8 +182,8 @@ void AppCore::initialize() {
if (appWarningPromoptEvent) { if (appWarningPromoptEvent) {
string extmessage = ""; string extmessage = "";
extmessage += fmt::format("fromClass:{}\n", appWarningPromoptEvent->getFromClass());
extmessage += fmt::format("fromFn:{}\n", appWarningPromoptEvent->getFromFn());
// extmessage += fmt::format("fromClass:{}\n", appWarningPromoptEvent->getFromClass());
// extmessage += fmt::format("fromFn:{}\n", appWarningPromoptEvent->getFromFn());
extmessage += fmt::format("description:{}\n", appWarningPromoptEvent->getDescription()); extmessage += fmt::format("description:{}\n", appWarningPromoptEvent->getDescription());
extmessage += fmt::format("traceinfo:{}\n", appWarningPromoptEvent->getTraceinfo()); extmessage += fmt::format("traceinfo:{}\n", appWarningPromoptEvent->getTraceinfo());

11
appsrc/service/setting_mgr_service.cpp

@ -24,7 +24,7 @@ void SettingMgrService::initialize() {
void SettingMgrService::getAllSetting(shared_ptr<MsgProcessContext> cxt) { void SettingMgrService::getAllSetting(shared_ptr<MsgProcessContext> cxt) {
auto settings = SETTING_DB->getAllSetting(); auto settings = SETTING_DB->getAllSetting();
cxt->rely = settings;
cxt->rely = settings;
} }
void SettingMgrService::setSettingVal(shared_ptr<MsgProcessContext> cxt, string settingName, string settingVal) { void SettingMgrService::setSettingVal(shared_ptr<MsgProcessContext> cxt, string settingName, string settingVal) {
bool suc = SETTING_DB->setSettingVal(settingName, settingVal); bool suc = SETTING_DB->setSettingVal(settingName, settingVal);
@ -34,22 +34,19 @@ void SettingMgrService::getAllFormula(shared_ptr<MsgProcessContext> cxt) { cxt->
void SettingMgrService::addNewFormula(shared_ptr<MsgProcessContext> cxt) { void SettingMgrService::addNewFormula(shared_ptr<MsgProcessContext> cxt) {
auto formula = FORMULA_DB->newFormula(); auto formula = FORMULA_DB->newFormula();
cxt->rely = formula;
cxt->rely = formula;
} }
void SettingMgrService::delFormula(shared_ptr<MsgProcessContext> cxt, string formula_id) { void SettingMgrService::delFormula(shared_ptr<MsgProcessContext> cxt, string formula_id) {
auto param = cxt->cmd["params"];
FORMULA_DB->deleteFormula(param["formula_id"]);
FORMULA_DB->deleteFormula(formula_id);
return; return;
} }
void SettingMgrService::updateFormula(shared_ptr<MsgProcessContext> cxt, string formula_id, json formula) { void SettingMgrService::updateFormula(shared_ptr<MsgProcessContext> cxt, string formula_id, json formula) {
auto param = cxt->cmd["params"];
FORMULA_DB->updateFormula(formula_id, formula); FORMULA_DB->updateFormula(formula_id, formula);
return; return;
} }
void SettingMgrService::updateFormulaIterm(shared_ptr<MsgProcessContext> cxt, string formula_id, string itemName, string val) { void SettingMgrService::updateFormulaIterm(shared_ptr<MsgProcessContext> cxt, string formula_id, string itemName, string val) {
auto param = cxt->cmd["params"];
FORMULA_DB->updateFormula(param["formula_id"], param["itemName"], param["val"]);
FORMULA_DB->updateFormula(formula_id, itemName, val);
return; return;
} }
void SettingMgrService::factoryResetSettings(shared_ptr<MsgProcessContext> cxt) { void SettingMgrService::factoryResetSettings(shared_ptr<MsgProcessContext> cxt) {

Loading…
Cancel
Save