perf.添加一些日志,优化部分简单逻辑

This commit is contained in:
MistEO
2021-11-05 00:31:48 +08:00
parent 7f1eff2188
commit 09cb5b271a
12 changed files with 93 additions and 16 deletions

View File

@@ -5,6 +5,7 @@
#include "InfrastMoodImageAnalyzer.h"
#include "Resource.h"
#include "Controller.h"
#include "Logger.hpp"
const std::string asst::InfrastDormTask::FacilityName = "Dorm";
@@ -35,6 +36,7 @@ bool asst::InfrastDormTask::run()
const auto& image = ctrler.get_image();
InfrastMoodImageAnalyzer mood_analyzer(image);
if (!mood_analyzer.analyze()) {
log.error("mood analyze faild!");
return false;
}
mood_analyzer.sort_result();
@@ -46,6 +48,7 @@ bool asst::InfrastDormTask::run()
return false;
}
if (quantity_selected >= MaxNumOfOpers) {
log.trace("quantity_selected:", quantity_selected, ", just break");
break;
}
switch (mood_info.smiley.type)
@@ -53,6 +56,7 @@ bool asst::InfrastDormTask::run()
case InfrastSmileyType::Rest:
// 如果当前页面休息完成的人数超过5个说明已经已经把所有心情不满的滑过一遍、没有更多的了直接退出即可
if (++quantity_resting > MaxNumOfOpers) {
log.trace("quantity_resting:", quantity_resting, ", confirm");
click_confirm_button();
return true;
}
@@ -66,6 +70,7 @@ bool asst::InfrastDormTask::run()
{
ctrler.click(mood_info.rect);
if (++quantity_selected >= MaxNumOfOpers) {
log.trace("quantity_selected:", quantity_selected, ", just break");
break;
}
}
@@ -75,6 +80,7 @@ bool asst::InfrastDormTask::run()
}
}
if (quantity_selected >= MaxNumOfOpers) {
log.trace("quantity_selected:", quantity_selected, ", just break");
break;
}
sync_swipe_of_operlist();
@@ -87,6 +93,8 @@ bool asst::InfrastDormTask::run()
bool asst::InfrastDormTask::click_confirm_button()
{
LogTraceFunction;
const auto task_ptr = std::dynamic_pointer_cast<OcrTaskInfo>(
resource.task().task_ptr("InfrastConfirmButton"));
ctrler.click(task_ptr->specific_rect);