public void PushMessage(LoggingSessionInfo loggingSessionInfo, dynamic paramter) { DynamicInterfaceBLL dynamicInterfaceBLL = new DynamicInterfaceBLL(loggingSessionInfo); var eventList = dynamicInterfaceBLL.getEventList(new ReqData <getActivityListEntity>() { common = new ReqCommonData() { customerId = loggingSessionInfo.ClientID }, special = new getActivityListEntity() { type = "new", page = 1, pageSize = 5 } }); if (eventList.ItemList != null && eventList.ItemList.Length > 0) { int channelID = 0; string message = ""; PrepareMessage(loggingSessionInfo, paramter, out channelID, out message); if (channelID > 0 && !string.IsNullOrEmpty(message)) { string method = "Process"; //Android消息推送 // string url = "http://121.199.42.125:9000/PushService.svc"; string url = System.Configuration.ConfigurationManager.AppSettings["pushMessageUrl"]; //string url = "http://localhost:1475/PushService.svc"; //3488619 为中欧校友汇在百度推送中的ID message += "#http://url.cn/TzrnuO"; //短链接 //http://dev.o2omarketing.cn:9004/HtmlApps/html/public/xiehuibao/activity.html?customerId=75a232c2cf064b45b1b6393823d2431e&type=new"; PushRequest pRequest2 = RequestBuilder.CreateAndroidUnicastMessageRequest(1, channelID, "", "3488619", message, PushTypes.Broadcast); var json = "{\"pRequest\":" + pRequest2.ToJSON() + "}"; var response2 = PushIOSMessage.SendHttpRequest(url, method, json); } } else { SendMarketingMessageBLL.log.WriteEntry("无新活动", System.Diagnostics.EventLogEntryType.Information); } }
public void PushMessage(string memberID, string messageContent) { PushAndroidBasicBLL pushBll = new PushAndroidBasicBLL(loggingSessionInfo); var userBasic = pushBll.GetByID(memberID); if (userBasic != null) { if (!string.IsNullOrEmpty(userBasic.UserIDBaiDu) && !string.IsNullOrEmpty(userBasic.ChannelIDBaiDu)) { string method = "Process"; //Android消息推送 //string url = "http://121.199.42.125:9000/PushService.svc"; string url = System.Configuration.ConfigurationManager.AppSettings["pushMessageUrl"]; int channelId = 1; if (!string.IsNullOrEmpty(userBasic.Channel)) { channelId = Convert.ToInt32(userBasic.Channel); } PushRequest pRequest2 = RequestBuilder.CreateAndroidUnicastNotificationRequest(2, channelId, userBasic.UserIDBaiDu, userBasic.ChannelIDBaiDu, "消息", messageContent); var json = "{\"pRequest\":" + pRequest2.ToJSON() + "}"; var response2 = PushIOSMessage.SendHttpRequest(url, method, json); var msg = "会员ID:" + memberID + " DeviceToken:" + userBasic.DeviceToken; Loggers.DEFAULT.Debug(new DebugLogInfo { Message = msg + " 消息发送Android结果: " + response2 }); } else { Loggers.Debug(new DebugLogInfo() { Message = string.Format("PushMessage: {0}", "VipID:" + memberID + "没有保存百度推送消息参数") }); } } }