我想根据在后台确定的具有促销代码、开始日期和结束日期的单独模型的日期,通过 cronjob 发布或取消部署基于新促销引擎(规则库)构建的促销 Activity 。
我在帮助 hybris 中找不到升级 api 来执行发布和取消部署操作,就像在后台一样。而且项目中也没有找到相关的推广服务。
如有任何帮助,我们将不胜感激。
最佳答案
以下是在 Groovy 中发布促销 Activity 的示例:
import de.hybris.platform.core.Registry
def activateAllPromotions()
{
def maintenanceService = Registry.getApplicationContext().getBean("ruleMaintenanceService")
def ruleService = Registry.getApplicationContext().getBean("ruleService")
def rules = ruleService.getAllRules()
def res = maintenanceService.compileAndPublishRules(rules,"promotions-module",true)
}
activateAllPromotions()
您可以使用 maintenanceService#archiveRule(AbstractRuleModel) 取消发布
关于java - 通过 Hybris 中的 cronjob 发布或取消部署促销,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52246425/