Beispiel #1
0
        static void Main()
        {
            var _json = new DingTalkService("dinglfmorrawr77sau47", "KPiUN-KQyXODKlZN6r9Xfg7XZUnRH1wszJ-i80ouf8xWwizMqurwuikBTG27mQb9").SendText("01523069397077", "测试001");

            Console.ReadKey();
            //TaskManageErrorSendTask task = new TaskManageErrorSendTask();
            //task.SystemRuntimeInfo = new XXF.BaseService.TaskManager.SystemRuntime.TaskSystemRuntimeInfo() { TaskConnectString = "Server=10.10.10.35;Database=dyd_bs_task;UID=TxoooNewDataBaseDesignUser;Password=Tx)))NewSJCoolSJPassWORderAdmin;" };

            //task.TestRun();
        }
Beispiel #2
0
        private void SendEmail(List <tb_senderror_model> errors, string email)
        {
            StringBuilder sb = new StringBuilder();

            if (errors != null)
            {
                foreach (var e in errors)
                {
                    sb.AppendLine($"【错误id】{e.error_model.id}【任务id】{e.error_model.taskid}【创建时间】{e.error_model.errorcreatetime}【集群id】{e.error_model.nodeid}<br/>");
                }
            }
            string content = sb.ToString();

            if (string.IsNullOrEmpty(content))
            {
                return;
            }
            content += "\r\n详情请查看错误信息表!";
            try
            {
                var _json = new DingTalkService(this.AppConfig["appKey"], this.AppConfig["appsecret"]).SendText(email, content);
                if (Convert.ToInt32(_json["errcode"].ToString()) != 0)
                {
                    OpenOperator.Error($"发送错误钉钉消息失败{_json.ToString()}", null);
                }
            }
            catch (Exception exp)
            {
                OpenOperator.Error("发送错误钉钉消息失败", exp);
            }

            //EmailHelper emailhelper = new EmailHelper();
            //emailhelper.mailFrom = this.AppConfig["sendmailname"];
            //emailhelper.mailPwd = this.AppConfig["password"];
            //emailhelper.mailSubject = "任务调度平台之错误日报" + DateTime.Now.ToString("yyyyMMddHHmmss")+"【系统邮件】";
            //emailhelper.mailBody = content;
            //emailhelper.isbodyHtml = true;    //是否是HTML
            //emailhelper.host = this.AppConfig["sendmailhost"];//如果是QQ邮箱则:smtp:qq.com,依次类推
            //emailhelper.mailToArray = new string[] { email };//接收者邮件集合
            //emailhelper.mailCcArray = new string[] { };//抄送者邮件集合
            //try
            //{
            //    emailhelper.Send();
            //}
            //catch (Exception exp)
            //{
            //    OpenOperator.Error("发送错误邮件错误", exp);
            //}
        }