package com.gic.haoban.manage.service.util;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.commons.util.DingtalkMessageUtil;

public class DingUtils {

    private static boolean isDev = false;
    static {
        Config config = ConfigService.getConfig("COMMON.gic-properties");
        String env = config.getProperty("environment.value", "");
        isDev = !"prod".equals(env);
    }

    public static void send(String msg, String dingUrl, boolean skipDev) {
        try {
            if (skipDev && isDev) {
                return;
            }
            if (isDev) {
                msg = "【dev】" + msg;
            }
            DingtalkMessageUtil.sendAlertMessage(msg, dingUrl);
        } catch (Exception e) {

        }
    }

}
