/// <summary> /// 执行更新操作 /// </summary> /// <param name="doc"></param> /// <returns></returns> public InvokeResult Update(BsonDocument doc) { var storageData = new StorageData() { Name = tableName, Document = doc, Type = StorageType.Update, Query = Query.EQ(keyFieldName, doc.Text(keyFieldName)) }; //调用基类的_commonDbChangeHelper进行保存 // var result = CommonDbChangeHelper.CommonSubmitChange(storageData); if (CommonDbChangeHelper.NeedQueue) { var result = NetQHelper.Broadcast <string>(doc.ToJson()); return(new InvokeResult() { Status = Status.Successful }); } else { var result = CommonDbChangeHelper.CommonSubmitChange(storageData); return(new InvokeResult() { Status = Status.Successful }); } }
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); }
/// <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); }