From 1ab8477c6faf9215f12a7981b62b12615dff2e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9C=BC=E7=A5=9E=E4=B8=8D=E6=92=92=E6=97=A6?= Date: Thu, 16 Jan 2025 16:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=AE=9A=E7=82=B9=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 眼神不撒旦 --- services/src/form_data_mgr.cpp | 3 ++- services/src/form_event_util.cpp | 1 + services/src/form_mgr_adapter.cpp | 19 ++++++------------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/services/src/form_data_mgr.cpp b/services/src/form_data_mgr.cpp index 43a7fd0f69..9047bdbba8 100644 --- a/services/src/form_data_mgr.cpp +++ b/services/src/form_data_mgr.cpp @@ -1454,6 +1454,7 @@ void FormDataMgr::ParseUpdateConfig(FormRecord &record, const FormItemInfo &info if (configDuration > 0) { ParseIntervalConfig(record, configDuration); } else { + record.isEnableUpdate = false; ParseAtTimerConfig(record, info); ParseMultiUpdateTimeConfig(record, info); } @@ -1510,6 +1511,7 @@ void FormDataMgr::ParseMultiUpdateTimeConfig(FormRecord &record, const FormItemI HILOG_INFO("parseAsUpdateAt updateAtTimes size:%{public}zu", updateAtTimes.size()); if (updateAtTimes.size() > 0) { record.updateAtTimes = updateAtTimes; + record.isEnableUpdate = true; } } @@ -1520,7 +1522,6 @@ void FormDataMgr::ParseMultiUpdateTimeConfig(FormRecord &record, const FormItemI */ void FormDataMgr::ParseAtTimerConfig(FormRecord &record, const FormItemInfo &info) const { - record.isEnableUpdate = false; record.updateDuration = 0; std::string configAtTime = info.GetScheduledUpdateTime(); HILOG_INFO("parseAsUpdateAt updateAt:%{public}s", configAtTime.c_str()); diff --git a/services/src/form_event_util.cpp b/services/src/form_event_util.cpp index 68093c82c9..2059873fda 100644 --- a/services/src/form_event_util.cpp +++ b/services/src/form_event_util.cpp @@ -430,6 +430,7 @@ void FormEventUtil::SetTimerCfgByMultUpdate(const std::string &configMultUpdateA } if (updateAtTimes.size() > 0) { cfg.updateAtTimes = updateAtTimes; + cfg.enableUpdate = true; } } diff --git a/services/src/form_mgr_adapter.cpp b/services/src/form_mgr_adapter.cpp index 1895f36bc7..8a37db5026 100644 --- a/services/src/form_mgr_adapter.cpp +++ b/services/src/form_mgr_adapter.cpp @@ -1721,23 +1721,16 @@ ErrCode FormMgrAdapter::AddFormTimer(const FormRecord &formRecord) updateDuration, formRecord.providerUserId); return ret ? ERR_OK : ERR_APPEXECFWK_FORM_COMMON_CODE; } - bool scheduledUpdateFlag = false; - bool result1 = true; - if (formRecord.updateAtHour >= 0 && formRecord.updateAtMin >= 0) { - scheduledUpdateFlag = true; - result1 = FormTimerMgr::GetInstance().AddFormTimer(formRecord.formId, - formRecord.updateAtHour, formRecord.updateAtMin, formRecord.providerUserId); - } - bool result2 = true; std::vector> updateAtTimes = formRecord.updateAtTimes; if (updateAtTimes.size() > 0) { - scheduledUpdateFlag = true; HILOG_INFO("updateAtTimes size:%{public}zu", updateAtTimes.size()); - result2 = FormTimerMgr::GetInstance().AddFormTimerForMultiUpdate(formRecord.formId, + bool ret = FormTimerMgr::GetInstance().AddFormTimerForMultiUpdate(formRecord.formId, updateAtTimes, formRecord.providerUserId); - } - if (scheduledUpdateFlag) { - return (result1 && result2)? ERR_OK : ERR_APPEXECFWK_FORM_COMMON_CODE; + return ret ? ERR_OK : ERR_APPEXECFWK_FORM_COMMON_CODE; + } else if (formRecord.updateAtHour >= 0 && formRecord.updateAtMin >= 0) { + bool ret = FormTimerMgr::GetInstance().AddFormTimer(formRecord.formId, + formRecord.updateAtHour, formRecord.updateAtMin, formRecord.providerUserId); + return ret ? ERR_OK : ERR_APPEXECFWK_FORM_COMMON_CODE; } HILOG_INFO("no need add form timer"); return ERR_OK; -- Gitee