package com.xueyi.nlt.api.nlt.feign.factory;

import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.nlt.api.nlt.domain.vo.DmLandingLlmVo;
import com.xueyi.nlt.api.nlt.feign.RemoteLandingLlmService;
import com.xueyi.nlt.api.nlt.feign.RemoteQAService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 会议室服务 降级处理
 *
 * @author xueyi
 */
@Slf4j
@Component
public class RemoteLandingLlmFallbackFactory implements FallbackFactory<RemoteLandingLlmService> {

    @Override
    public RemoteLandingLlmService create(Throwable throwable) {
        log.error("短信服务调用失败:{}", throwable.getMessage());
        return new RemoteLandingLlmService() {
            @Override
            public JSONObject query(DmLandingLlmVo vo) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("status","fail");
                jsonObject.put("data","");
                return jsonObject;
            }

            @Override
            public JSONObject query(JSONObject jsonObject) {
                JSONObject jResult = new JSONObject();
                jResult.put("status","fail2");
                jResult.put("data","");
                return jResult;
            }
        };
    }
}