master
IoTcat 5 years ago
parent 813ba0a8eb
commit 752879442c
  1. 16
      lib/ovo.h
  2. 12
      src/feeTable.cpp
  3. 19
      src/main.cpp
  4. 4
      src/park.cpp
  5. 3
      src/park.h

@ -710,6 +710,9 @@ namespace ovo{
std::vector<ovo::data> o;
indexList = this->_getTableIndex(tableName);
if(indexList["_isExist"] == "NO"){
return o;
}
if(indexList["__TABLE_INDEX__" + index] == "undefined"){
return o;
}
@ -734,7 +737,9 @@ namespace ovo{
if(!d.size()) return this->getSQL(tableName);
indexList = this->_getTableIndex(tableName);
if(indexList["_isExist"] == "NO"){
return o;
}
d.forEach([&](string index, string val){
@ -753,6 +758,9 @@ namespace ovo{
std::vector<ovo::data> o;
indexList = this->getData(this->_getTableList(tableName));
if(indexList["_isExist"] == "NO"){
return o;
}
for(auto i : indexList){
@ -768,6 +776,9 @@ namespace ovo{
std::vector<string> v;
indexList = this->_getTableIndex(tableName);
if(indexList["_isExist"] == "NO"){
return 0;
}
if(indexList["__TABLE_INDEX__" + index] == "undefined"){
return 0;
}
@ -891,6 +902,9 @@ namespace ovo{
ovo::data d, o;
d = this->getData(generateTableName(tableName));
if(d["_isExist"] == "NO") return d;
std::vector<string> v;
S.split(d["__OVO_INDEX__"], v, "||$$||");

@ -19,10 +19,8 @@ FeeTable::FeeTable() {
};
FeeTable::~FeeTable() {
this->_d.classify();
db.pushData(g_feeTableID, this->_d);
this->_pushTable();
db.pushData(g_feeTableID + "_Table", this->_tableData);
};
void FeeTable::setTypes(std::vector<string>& v) {
@ -34,6 +32,8 @@ void FeeTable::setTypes(std::vector<string>& v) {
for (auto i : v) {
this->_table[i] = vv;
}
this->_pushTable();
}
void FeeTable::set(std::map<string, std::vector<int>>& m) {
@ -44,6 +44,8 @@ void FeeTable::set(std::map<string, std::vector<int>>& m) {
this->_table[i.first] = this->_classify(i.second);
}
}
this->_pushTable();
}
int const FeeTable::getFee(const string& type, const string& LastInTime,
@ -137,4 +139,8 @@ void FeeTable::_pushTable() {
for (auto i : this->_table) {
this->_tableData[i.first] = this->_vecToStr(i.second);
}
this->_d.classify();
db.pushData(g_feeTableID, this->_d);
db.pushData(g_feeTableID + "_Table", this->_tableData);
}

@ -57,13 +57,22 @@ int main(int argc, char const *argv[]) {
}
p.join();
cout << p._d.showAll();
cout << "Cost" << time(NULL) - t;
p.checkIn("2222", "Ship");
p.checkOut("2222");
string msg = "";
//if(!p.checkIn("2222", "Ship", msg)) cout << "4444";
for(auto i : p.getCarsID()){
//ovo::data d;
//d["date"] = "2019-05-24";
cout << i;
}
//cout << p.checkOut("2222");
ovo::data d;
d["date"] = "2019-05-24";
for(auto i : p.getLog(d)){
cout << i.showAll();
}
//cout << p.getLog(d)[0].showAll();
// cout << p.getLog()

@ -13,7 +13,7 @@ Park::Park() {
this->_threadPointer = false;
this->_d = db.getData(g_ParkID);
cout << _d.showAll();
if (!this->isExist()) return;
this->_threadFinished = false;
@ -428,7 +428,7 @@ int Park::checkOut(const string& licenseNum) {
this->delCar(licenseNum);
this->_storeData();
// this->_threadFinished = true;
//});

@ -82,7 +82,6 @@ class Park {
inline void updateFeeTable(std::map<string, std::vector<int>>& m) {
this->_feeTable.set(m);
this->_feeTable._pushTable();
};
inline const std::vector<string> getPlotsID(const string& type,
@ -211,7 +210,7 @@ class Park {
return db.getSQL(this->_d["log"], d);
};
//private:
private:
ovo::data _d, _carsList, _plotsList;
// ovo::index _isOccupiedIndex, _typeIndex, _levelIndex;
std::vector<string> _types;

Loading…
Cancel
Save