package com.nanri.aiimage.modules.ziniao.service;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
@Slf4j
public class ZiniaoShopIndexRefreshService {

    private final ZiniaoShopIndexService ziniaoShopIndexService;

    @Scheduled(cron = "${aiimage.ziniao.shop-index-refresh-cron:0 */10 * * * *}")
    public void refreshShopIndex() {
        try {
            ziniaoShopIndexService.refreshShopIndex();
        } catch (Exception ex) {
            log.warn("[ziniao-index] refresh failed: {}", ex.getMessage());
        }
    }
}
