/// <summary> /// 指定别名广播 /// </summary> /// <param name="title">标题</param> /// <param name="content">内容</param> /// <param name="json">推送内容</param> /// <param name="aliases">别名集合</param> /// <returns></returns> public static string JPushAliases(string title, string content, Dictionary <string, object> json, ArrayList aliases) { JPushClient jpushClient = new JPushClient(AppKey, Master_Secret); PushPayload payload = new PushPayload(); payload.Platform = "all"; Dictionary <string, ArrayList> audis = new Dictionary <string, ArrayList>(); audis.Add("alias", aliases); payload.Audience = audis; Notification noti = new Notification(); noti.Alert = title; noti.Android = new Android() { Title = title, Alert = content, Extras = json }; noti.IOS = new IOS() { Alert = content, Category = title, Extras = json }; payload.Notification = noti; Jiguang.JPush.Model.HttpResponse response = jpushClient.SendPush(payload); return(response.Content); }
/// <summary> /// 别名消息 /// </summary> /// <param name="title">消息标题</param> /// <param name="content">消息内容</param> /// <param name="json">json数据</param> /// <param name="aliases">别名集合</param> /// <returns></returns> public static string JPushMessageAliases(string title, string content, Dictionary <string, object> json, ArrayList aliases) { JPushClient jpushClient = new JPushClient(AppKey, Master_Secret); PushPayload payload = new PushPayload(); payload.Platform = "all"; Dictionary <string, ArrayList> aliasSet = new Dictionary <string, ArrayList>(); aliasSet.Add("alias", aliases); payload.Audience = aliasSet; Message msg = new Message(); msg.ContentType = "text"; msg.Title = title; msg.Content = content; msg.Extras = json; payload.Message = msg; Jiguang.JPush.Model.HttpResponse response = jpushClient.SendPush(payload); return(response.Content); }