/// <summary> /// 批量保存缴费通知数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult BatchSavePayNotice(IList<PayNoticeEntity> list) { ExecResult result = new ExecResult(); if (list != null && list.Count > 0) { HttpClientHelper clientHelper = new HttpClientHelper(); result = clientHelper.Post<ExecResult, IList<PayNoticeEntity>>(GetAPIUrl(APIConstant.PAYNOTICE_BATCHSAVE), list); if (result.result == EnumJsonResult.success.ToString()) { int index = 0; string returnData = string.Empty; foreach (var model in list) { SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageRecodeEntity logModel = new MessageRecodeEntity(); logModel.MsgType = 1; logModel.JournalID = model.JournalID; logModel.SendUser = model.SendUser; logModel.MsgTitle = model.Title; logModel.MsgContent = model.Body; logModel.CID = model.CID; if (model.PayType == 1) logModel.SendType = -3; else if (model.PayType == 2) logModel.SendType = -4; IList<Int64> userList = new List<Int64>() { model.AuthorID }; var emailResult = service.SendEmailOrSms(userList, logModel); index++; returnData = emailResult.msg; if (model.IsSms && !string.IsNullOrWhiteSpace(model.SmsContent)) { logModel.MsgType = 2; logModel.MsgContent = model.SmsContent; var smsResult = service.SendEmailOrSms(userList, logModel); result.msg += smsResult.msg; } } result.msg += returnData + "共计通知 " + index + " 人"; } } return result; }
/// <summary> /// 投稿 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveContributionInfo(ContributionInfoEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, ContributionInfoEntity>(GetAPIUrl(APIConstant.CONTRIBUTIONINFO_SAVE), model); if (result.result.Equals(EnumJsonResult.success.ToString()) && model.CID == 0 && model.Status != -1)//新投稿,不是草稿 { #region 投稿回执 Action action = () => { try { SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageTemplateQuery queryTemp = new MessageTemplateQuery(); queryTemp.JournalID = model.JournalID; queryTemp.TCategory = -5;//回执 var tempList = service.GetMessageTempList(queryTemp).ToList(); if (tempList == null) return; var EmailModel = tempList.Find(p => p.TType == 1); var SmsModel = tempList.Find(p => p.TType == 2); if (EmailModel == null && SmsModel == null) return; MessageRecodeEntity LogModel = new MessageRecodeEntity(); LogModel.JournalID = model.JournalID; LogModel.SendType = -5; LogModel.SendUser = model.AuthorID; IDictionary<string, string> dict = service.GetEmailVariable(); var user = new AuthorFacadeAPIService().GetAuthorInfo(new AuthorInfoQuery() { JournalID = model.JournalID, AuthorID = model.AuthorID }); dict["${接收人}$"] = user.RealName; dict["${邮箱}$"] = user.LoginName; dict["${手机}$"] = user.Mobile; dict["${稿件编号}$"] = result.resultStr; dict["${稿件标题}$"] = model.Title; dict["$稿件主键$"] = result.resultID.ToString(); ExecResult execResult = new ExecResult(); if (EmailModel != null) { LogModel.MsgType = 1; execResult = service.SendEmailOrSms(new Dictionary<Int64, IDictionary<string, string>>() { { model.AuthorID, dict } }, LogModel); } if (SmsModel != null) { LogModel.MsgType = 2; execResult = service.SendEmailOrSms(new Dictionary<Int64, IDictionary<string, string>>() { { model.AuthorID, dict } }, LogModel); } if (!execResult.result.Equals(EnumJsonResult.success.ToString())) throw new Exception(execResult.msg); } catch (Exception ex) { LogProvider.Instance.Error("发送投稿回执失败,稿件编码【" + result.resultStr + "】:" + ex.ToString()); } }; action.BeginInvoke(null, null); #endregion } return result; }
/// <summary> /// 保存缴费通知数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SavePayNotice(PayNoticeEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, PayNoticeEntity>(GetAPIUrl(APIConstant.PAYNOTICE_SAVE), model); if (result.result == EnumJsonResult.success.ToString()) { SiteConfigFacadeAPIService service = new SiteConfigFacadeAPIService(); MessageRecodeEntity logModel = new MessageRecodeEntity(); logModel.MsgType = 1; logModel.JournalID = model.JournalID; logModel.SendUser = model.SendUser; logModel.MsgTitle = model.Title; logModel.MsgContent = model.Body; logModel.CID = model.CID; if (model.PayType == 1) logModel.SendType = -3; else if (model.PayType == 2) logModel.SendType = -4; IList<Int64> userList = new List<Int64>() { model.AuthorID }; var emailResult = service.SendEmailOrSms(userList, logModel); result.msg += emailResult.msg; if (model.IsSms && !string.IsNullOrWhiteSpace(model.SmsContent)) { logModel.MsgType = 2; logModel.MsgContent = model.SmsContent; var smsResult = service.SendEmailOrSms(userList, logModel); result.msg += smsResult.msg; } } return result; }