修复bug
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
#include "../Data_Source/Database.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
// https://wiki.jetvision.de/wiki/Radarcape:Software_Features#Aircraft_List_JSON_Service
|
||||
struct Aircraft_List_JSON_Service_O {
|
||||
size_t times; //自定义添加出现的次数 用于显示的优先级
|
||||
@@ -56,7 +59,7 @@ struct Aircraft_List_JSON_Service_O {
|
||||
RET<size_t> nocl; // Number of sensors providing data aircraft
|
||||
RET<std::string> tq; // Time quality of this entry
|
||||
|
||||
static Psc::JSON view_model() {
|
||||
static Psc::JSON build_view_model() {
|
||||
auto columns = Psc::JSON::array();
|
||||
const auto add_column = [&columns](const char* key, const char* label, const char* type,
|
||||
const char* default_sort_order = nullptr,
|
||||
@@ -149,6 +152,35 @@ struct Aircraft_List_JSON_Service_O {
|
||||
return model;
|
||||
}
|
||||
|
||||
static constexpr std::uint32_t view_model_schema_version = 1;
|
||||
|
||||
static const std::string& view_model_schema_hash() {
|
||||
static const std::string hash = [] {
|
||||
auto model = build_view_model();
|
||||
model.append({"schema_version", view_model_schema_version});
|
||||
const auto serialized = model.to_json_string();
|
||||
std::uint64_t value = 14695981039346656037ull;
|
||||
for(const unsigned char byte : serialized) {
|
||||
value ^= byte;
|
||||
value *= 1099511628211ull;
|
||||
}
|
||||
std::ostringstream stream;
|
||||
stream << std::hex << std::setfill('0') << std::setw(16) << value;
|
||||
return stream.str();
|
||||
}();
|
||||
return hash;
|
||||
}
|
||||
|
||||
static const Psc::JSON& view_model() {
|
||||
static const Psc::JSON model = [] {
|
||||
auto value = build_view_model();
|
||||
value.append({"schema_version", view_model_schema_version});
|
||||
value.append({"schema_hash", view_model_schema_hash()});
|
||||
return value;
|
||||
}();
|
||||
return model;
|
||||
}
|
||||
|
||||
Psc::JSON toJson() {
|
||||
auto ret = Psc::JSON::object();
|
||||
ADD_Json(times);
|
||||
|
||||
Reference in New Issue
Block a user