package cn.axzo.msg.center.api.fallback;

import cn.axzo.msg.center.api.MessagePushApi;
import cn.axzo.msg.center.api.request.MsgBody4Guest;
import cn.azxo.framework.common.model.CommonResponse;
import cn.hutool.json.JSONUtil;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author jiachao
 * @date 2021/5/24
 */
@Slf4j
@Component
public class MessagePushApiFallback implements MessagePushApi {

  @Setter
  private Throwable throwable;

  @Override
  public CommonResponse<Void> sendPushMessage(MsgBody4Guest msgBody) {
    log.info("发送推送失败，接口异常:msgBody={}", JSONUtil.toJsonStr(msgBody));
    return CommonResponse.fail("发送推送失败，接口异常");
  }
}
