コード例 #1
0
        public ActionResult GetSerStatus()
        {
            Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_QUERY_SERVERSTATUS, new byte[0] {
            }));

            switch ((CenterCmd)tbind.header.CommandID)
            {
            case CenterCmd.CS_QUERY_SERVERSTATUS:
            {
                Service_Query_ServerStatus_S ServiceQueryServerStatusS = Service_Query_ServerStatus_S.ParseFrom(tbind.body.ToBytes());

                return(Json(new
                    {
                        result = !ServiceQueryServerStatusS.Close
                    }, JsonRequestBehavior.AllowGet));
            }

            case CenterCmd.CS_CONNECT_ERROR:

                break;
            }


            return(Json(new
            {
                result = false
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult GetStrongPushAD(Dictionary <string, string> queryvalues)
        {
            int Platform = queryvalues.ContainsKey("Platform") ? Convert.ToInt32(queryvalues["Platform"]) : 1; //设备
            int Channels = queryvalues.ContainsKey("Channels") ? Convert.ToInt32(queryvalues["Channels"]) : 0; //设备

            LoginRegisterDataView model = new LoginRegisterDataView();

            model.Channels = Channels;
            model.Platform = Platform;
            bool Mark  = false;
            Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_QUERY_SERVERSTATUS, new byte[0] {
            }));

            switch ((CenterCmd)tbind.header.CommandID)
            {
            case CenterCmd.CS_QUERY_SERVERSTATUS:
            {
                Service_Query_ServerStatus_S ServiceQueryServerStatusS = Service_Query_ServerStatus_S.ParseFrom(tbind.body.ToBytes());

                if (ServiceQueryServerStatusS.Close == true)
                {
                    Mark = true;
                }
            }
            break;

            case CenterCmd.CS_CONNECT_ERROR:
                Mark = true;
                break;
            }


            if (Mark == true)
            {
                StrongPushAD enti = StrongPushADBLL.GetStrongPushAD(model);
                if (enti == null)
                {
                    model.Url  = "";
                    model.Type = -1;

                    return(Json(new
                    {
                        ret = 0,
                        Url = "",
                        Type = -1,
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        ret = 1,
                        Url = enti.Url,
                        Type = enti.Type,
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new
                {
                    ret = 0,
                    Url = "",
                    Type = -1,
                }, JsonRequestBehavior.AllowGet));
            }
        }