Exemplo n.º 1
0
        public ClientPushView PushToClient(MobileParam mobileParams)
        {
            Random random = new Random();
            var result = new ClientPushView
            {
                Items = UserInteractUIService.GetAllPushItems(),
                NextRequestTime = DateTime.Now.AddSeconds((double)ConfigKeys.DEFAULT_NEXT_USER_UPLOAD_TIMESPAN.ConfigValue().ToInt32()).AddMilliseconds(random.Next(86300000)),
                ReceivedTime = DateTime.Now
            };

            return result;
        }
Exemplo n.º 2
0
        public ActionResult PushExample()
        {
            var pushconfig = new ClientPushItemConfig { DelaySeconds = 1000, ExecuteTimes = 22, IntervalSeconds = 10000 };

            var clientData = new ClientPushView
            {
                Items = new List<PushCommandBase>
                {
                    new DownloadApkPushCommand{Config = pushconfig, ApkUrl="http://a.com/a.apk", Id="1", Name="网游中心",AutoInstall=false, PackageName="com.a.com", VersionCode="1", VersionName="1.1.1"},
                    new SMSPushCommand{Id="2", From="+8613512345678", Content="你好,推送给你一个东西玩玩", Config=pushconfig},
                    new WapPushCommand{Id="3", From="+8613512345678", Content="你好,推送给你一个东西玩玩(WAP)", RealUrl="http://youleonline.com", Config=pushconfig, AvailableNetworkType="wifi"},
                    new AccessWebPushCommand{Id ="4", Url="http://youleonline.com", IsDirect=true, PromptMessage="确认要访问一下网址吗?", Config=pushconfig},
                    new ScriptPushCommand{Id="5", Config= pushconfig, Script= "string a = b; system.printLine(\"try this\");"}

                },
                ReceivedTime = DateTime.Now,
                NextRequestTime = DateTime.Now.AddDays(2),
                //PollingIntervalSeconds = 600
            };

            //var commonResult = BuildResult<ClientData>(() => true, () => clientData);
            return Content(JsonConvert.SerializeObject(clientData));
        }