package com.yuchen.saas.flow.api.feign;

import com.yuchen.saas.flow.api.dto.sms.req.SmsTempReqDTO;
import com.yuchen.saas.flow.api.dto.sms.resp.SmsResultRespDTO;
import com.yuchen.saas.flow.api.utils.FlowFeignFallbackUtils;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @author zhouhanwei
 * @create 2024/3/14 17:42
 */
@Component
public class SendSmsFeignFallback implements FallbackFactory<SendSmsFeign> {
    @Override
    public SendSmsFeign create(Throwable throwable) {
        return new SendSmsFeign() {
            @Override
            public R<SmsResultRespDTO> sendSms(SmsTempReqDTO reqDTO) {
                return FlowFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
