package com.liquidnet.service.kylin.service.impl;

import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.service.IFeishuBotService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class FeishuBotServiceImpl implements IFeishuBotService {


    @Override
    public void sendTextMessage(String text) {
        HashMap<String, Object> textMap = new HashMap<>();
        textMap.put("text", text);

        Map<String, Object> bodyMap = new HashMap<>();
        bodyMap.put("msg_type", "text");
        bodyMap.put("content", textMap);

        HttpUtil.postJson("https://open.feishu.cn/open-apis/bot/v2/hook/6315d096-5947-4bbb-9c34-90808dd91555",
                JsonUtils.toJson(bodyMap));
    }
}
