package com.ms.biz.spi.timer;

import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.biz.common.R;
import com.ms.biz.common.Ret;
import com.ms.biz.common.TimerBaseService;
import com.ms.api.dto.ItemDTO;
import com.ms.biz.task.RefreshTokenTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@ExtensionService("RefreshTokenTimer")
@Slf4j
public class RefreshTokenTimerService extends TimerBaseService implements ExtensionServiceHandler<ItemDTO, Ret> {
    @Autowired
    RefreshTokenTaskService refreshTokenTaskService;

    @Override
    public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
        refreshTokenTaskService.runTask();
        return R.ok(Ret.success());
    }
}
