/// <summary> /// 获取移动端推送Model /// </summary> /// <param name="batchId"></param> /// <returns></returns> public static MobMessageRequest GetAppBatch(string batchId) { List <MessageDetail> appBatch = MessageSysBLL.GetBatchForSend(batchId, 3); MobMessageRequest appModel = new MobMessageRequest(); string accidList = ""; if (appBatch != null && appBatch.Count > 0) { appModel.msgContent = appBatch[0].Content; appModel.msgTitle = appBatch[0].Title; appModel.ContentType = appBatch[0].ContentType; appModel.ContentUrl = appBatch[0].ContentUrl; } else { return(null); } foreach (var item in appBatch) { accidList += item.AccId.ToString() + ","; } accidList = accidList.Substring(0, accidList.LastIndexOf(',')); appModel.accIdList = accidList; return(appModel); }
/// <summary> /// 发送移动端消息方法 /// </summary> /// <param name="batchId"></param> /// <returns></returns> public static string SendingAppNotify(string batchId, int operId, string operName) { Dictionary <string, string> formData = new Dictionary <string, string>(); MobMessageRequest request = GetAppBatch(batchId); request.operatorId = operId; request.operatorName = operName; //string requestJson = CommonLib.Helper.JsonSerializeObject(GetEmailBatch(batchId)); int count = GetBatchCount(batchId, 3); Dictionary <string, string> parameters = CreateHeader(); //formData["requestJson"] = requestJson; formData["accIdList"] = request.accIdList; formData["msgTitle"] = request.msgTitle; formData["msgContent"] = request.msgContent; formData["operatorId"] = request.operatorId.ToString(); formData["operatorName"] = request.operatorName; formData["contentType"] = request.ContentType; formData["contentUrl"] = request.ContentUrl; string postStr = CommonLib.Helper.SendHttpPost(mobUrl, formData, parameters); Logger.Info(postStr); try { ResponseModel resModel = CommonLib.Helper.JsonDeserializeObject <ResponseModel>(postStr); if (resModel.Status == 0) { UpdateAllowCount(batchId, 3, count, resModel.Data.ToString()); } return(resModel.Status.ToString()); } catch (Exception ex) { Logger.Error("转换接口返回数据出错~", ex); return("1"); } }