예제 #1
0
        /// <summary>
        /// 设备注册命令请求执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            Device device = cmdData.ProtoBufDeserialize <Device>();

            if (Compiled.Debug)
            {
                device.Debug("=== Support.RegisterDevice 上行数据===");
            }

            UserDevice userDevice = new UserDevice
            {
                IMEI        = device.IMEI,
                IMSI        = device.IMSI,
                Platform    = (int)device.Platform,
                OS          = device.OS,
                MSID        = context.Msid,
                ChannelCode = context.ReqChannel,
                Code        = device.Model,
                Token       = string.Empty,
                CreateDate  = DateTime.Now
            };

            SupportBiz.RegisterDevice(userDevice);
            context.Flush(BitConverter.GetBytes(userDevice.DeviceId).Reverse());
        }
예제 #2
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            StringSingle cmdStr = cmdData.ProtoBufDeserialize <StringSingle>();

            if (Compiled.Debug)
            {
                cmdStr.Debug("=== Support.CheckVersion 上行数据===");
            }

            string         currentVer  = cmdStr.Data;
            AppVersionInfo nextVersion = SupportBiz.GetNextVersion(context.ReqChannel, currentVer);

            if (null == nextVersion)
            {
                context.Flush();
            }
            else
            {
                context.Flush <AppVersion>(nextVersion.ToAppVersion());
            }
        }
예제 #3
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            var          interestTypes = SupportBiz.GetInterestTypes();
            var          interestWords = SupportBiz.GetInterestWords();
            InterestList interestList  = new InterestList
            {
                DataList = interestTypes.Select(t => new ParentSubListKv
                {
                    ParentData = new KvPair {
                        Key = t.Id.ToString(), Value = t.Name
                    },
                    SubList = interestWords.Where(w => w.TypeId == t.Id).Select(w => new KvPair {
                        Key = w.Id.ToString(), Value = w.Word
                    }).ToList()
                }).ToList()
            };

            context.Flush <InterestList>(interestList);
        }
예제 #4
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            StringSingle cmdStr = cmdData.ProtoBufDeserialize <StringSingle>();

            if (Compiled.Debug)
            {
                cmdStr.Debug("=== Support.SetDeviceToken 上行数据===");
            }

            context.Flush();

            UserDevice userDevice = new UserDevice {
                DeviceId = context.DeviceId, Token = cmdStr.Data
            };

            SupportBiz.SetDeviceToken(userDevice);
        }