我正在编程与外部API(房地产)的集成。我有一份CRON工作,计划在凌晨1点完成。它运行得很好,因为我使用的是服务器CRON initialize,而不是WP-CRON-standard,所以它在正确的时间运行。
这是我的计划作业功能:
function wcs_cron_system_update() {
wcs_cron_start_update();
$wcs_cron_actions = new WCS_Cron_Actions();
$wcs_cron_helpers = new WCS_Cron_Helpers();
$wcs_cron_actions->real_estate_cleaning();
$wcs_cron_helpers->remove_unused_images();
$wcs_cron_actions->investments_insert_sql();
$wcs_cron_actions->apartments_insert_sql();
$wcs_cron_actions->commerce_insert_sql();
$wcs_cron_actions->investments_insert();
$wcs_cron_actions->real_estate_insert();
$wcs_cron_actions->investment_update_by_single_real_easte();
$wcs_cron_actions->real_estate_update_by_single_investment();
$wcs_cron_actions->investment_update_by_all_real_easte();
$wcs_cron_actions->search_index_update();
}
我正在一个接一个地执行一些函数,因为在执行下一个函数之前,我需要一些数据。我不能单独安排CRON作业(我不知道该怎么做),因为我有一些情况,某些函数在我有必要的数据之前就运行了(因为有些函数在应该运行之前就运行了)我的函数包含一系列任务(函数)。
问题:这是正确的方法吗?也许我应该换一种方式?怎样
谢谢