package com.jxy.system.api.factory;

import com.jxy.common.core.Result.R;
import com.jxy.system.api.RemoteFileService;
import com.jxy.system.api.RemoteMailService;
import com.jxy.system.api.entity.EmailEntity;
import com.jxy.system.api.entity.GetEmailCodeEntity;
import com.jxy.system.api.entity.SysFile;
import com.jxy.system.api.entity.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件服务降级处理
 *
 * @author jxy
 */
@Component
public class RemoteMailFallbackFactory implements FallbackFactory<RemoteMailService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMailFallbackFactory.class);

    @Override
    public RemoteMailService create(Throwable cause)
    {
        return new RemoteMailService() {
            @Override
            public R<?>
            sendAddCreditEmailCode(GetEmailCodeEntity entity) {
                return R.fail("提现邮箱验证发送失败:" + cause.getMessage());
            }

            @Override
            public R<?> sendTextMail(@RequestBody EmailEntity entity){
                return R.fail("邮箱发送失败:" + cause.getMessage());
            }

        };
    }
}
