luodangjia
2024-12-16 a8d2cb07f6440dc54dc4005b0b06d5a47cb1517d
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/TaskUtil.java
@@ -1,9 +1,12 @@
package com.ruoyi.account.util;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.VipSettingService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
@@ -11,6 +14,13 @@
 */
@Component
public class TaskUtil {
    @Resource
    private AppUserService appUserService;
    @Resource
    private VipSettingService vipSettingService;
    /**
@@ -18,14 +28,24 @@
     */
    @Scheduled(fixedRate = 1000 * 60)
    public void sendVipCoupon(){
        //解绑推广人
        appUserService.unbindThePromoter();
    }
    @Scheduled(fixedRate = 1000 * 60)
    public void changeVipId(){
    /**
     * 每天的凌晨执行的任务
     */
    @Scheduled(cron = "0 0 0 * * *")
    public void taskDay(){
        try {
            vipSettingService.downUsers();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}