Exemplo n.º 1
0
        public ResResultModel SendPush(PushFmModel model)
        {
            try
            {
                JPushHelper     jpush          = new JPushHelper();
                JPushOptionInfo pushOptionInfo = null;
                if (!string.IsNullOrWhiteSpace(model.Alias))
                {
                    pushOptionInfo = new JPushOptionInfo {
                        Title = model.Title, Content = model.Content, Alias = model.Alias, PushPayloadType = EnumPushPayloadType.Alias
                    }
                }
                ;
                else
                {
                    pushOptionInfo = new JPushOptionInfo {
                        Title = model.Title, Content = model.Content, PushPayloadType = EnumPushPayloadType.All
                    }
                };
                var isOk = jpush.SendPush(pushOptionInfo);
                if (!isOk)
                {
                    return(ResResult.Response(false, MC.M_Save_Error, ""));
                }

                return(ResResult.Response(true, "", ""));
            }
            catch (Exception ex)
            {
                return(ResResult.Response(false, ex.Message, ""));
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //MobileClient client = new MobileClient();
            //var s = client.GetHelloWord();
            //var s = client.ValidateUser("admin", "ccecc123");

            //极光推送
            JPushHelper jpush          = new JPushHelper();
            var         pushOptionInfo = new JPushOptionInfo {
                Title = "任务通知1", Content = "您好,任务通知1,请按时完成!", Alias = "01010101", PushPayloadType = EnumPushPayloadType.Alias
            };
            var isOk = jpush.SendPush(pushOptionInfo);
        }