Exemple #1
0
        public InvokeResult CreateLog(BackgroundJobLog jobLog)
        {
            //记录日志到统一日志平台
            logger.Info(jobLog.runLog.Replace("\\", ""));
            var bsonDoc = new BsonDocument
            {
                { "jobId", jobLog.jobId },
                { "jobType", jobLog.jobType },
                { "name", jobLog.name },
                { "runLog", jobLog.runLog },
                { "executionTime", jobLog.executionTime },
                { "executionDuration", jobLog.executionDuration },
                { "customerCode", jobLog.customerCode }
            };

            var result = CommonDbChangeHelper.SubmitChange(new StorageData()
            {
                Document = LogDataMessagePack(bsonDoc),
                Name     = tableName,
                Type     = StorageType.Insert
            });


            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 处理站点健康检查信息,一般为需要发送邮件的内容,后续定期从数据库中读取数据进行邮件发送
        /// </summary>
        /// <param name="jobLog"></param>
        /// <returns></returns>
        public InvokeResult ProcessPushMessageInfo(PushMessageInfo messageInfo)
        {
            var result = new InvokeResult()
            {
                Status = Status.Successful
            };

            if (!string.IsNullOrEmpty(messageInfo.errorMessage))
            {
                //messageInfo.errorMessage = HttpUtility.UrlEncode(messageInfo.errorMessage);
                //messageInfo.content = HttpUtility.UrlDecode(messageInfo.content);
                if (!string.IsNullOrEmpty(messageInfo.errorMessage))
                {
                    var bsonDoc = new BsonDocument
                    {
                        { "title", messageInfo.content },
                        { "content", messageInfo.errorMessage },
                        { "arrivedUserIds", messageInfo.approvalUserId },
                        { "sendUserId", messageInfo.approvalUserId },
                        { "sendType", "0" },
                        { "registerDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") },
                        { "sendDate", DateTime.Now.AddMinutes(5).ToString("yyyy-MM-dd HH:mm:ss") },
                        { "isMessagePack", 1 },//加密模式
                    };
                    result = CommonDbChangeHelper.SubmitChange(new StorageData()
                    {
                        Document = bsonDoc,
                        Name     = "SystemMessagePushQueue",
                        Type     = StorageType.Insert
                    });
                }
            }


            return(result);
        }