filter not existed url.
This commit is contained in:
parent
0b6ccfd841
commit
303f89d345
@ -126,22 +126,24 @@ Application::Application(const std::string &path)
|
||||
auto rootJson = boost::json::parse(request.body());
|
||||
auto &root = rootJson.as_object();
|
||||
std::string url;
|
||||
std::string visitorUuid;
|
||||
std::string userAgent;
|
||||
if (root.contains("url")) {
|
||||
url = root["url"].as_string();
|
||||
}
|
||||
|
||||
auto database = Amass::Singleton<Database>::instance();
|
||||
if (std::filesystem::exists("amass_blog" + url)) {
|
||||
std::string visitorUuid;
|
||||
if (root.contains("visitor_uuid")) {
|
||||
visitorUuid = root["visitor_uuid"].as_string();
|
||||
}
|
||||
std::string userAgent;
|
||||
if (root.contains("user_agent")) {
|
||||
userAgent = root["user_agent"].as_string();
|
||||
}
|
||||
|
||||
auto database = Amass::Singleton<Database>::instance();
|
||||
auto now = std::chrono::system_clock::now();
|
||||
std::time_t now_time = std::chrono::system_clock::to_time_t(now);
|
||||
database->updateVisitCount(url, visitorUuid, userAgent, now_time);
|
||||
}
|
||||
auto data = database->visitAnalysisData(std::string(url));
|
||||
auto total = database->siteVisitAnalysisData();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user