Example #1
0
        public byte[] HandlerClientData(byte[] buff)
        {
            NetStructure.ClientResp outInfo = this.DecodeData(buff);

            using (ServiceStack.Redis.IRedisClient client = GlobalVariable.RedisClient)
            {
                string strUserKey = client.Get <string>(GlobalVariable.PRE_INFO_TYPE_DISCARD + outInfo.MachineId.ToString());
                client.Set <int>(GlobalVariable.PRE_RESP_DOWN_INFO + strUserKey, (int)outInfo.RespResult);
            }
            return(null);
        }
Example #2
0
        /// <summary>
        /// 客户端返回结果解码
        /// </summary>
        /// <param name="buff"></param>
        private NetStructure.ClientResp DecodeData(byte[] buff)
        {
            NetStructure.ClientResp info = new NetStructure.ClientResp();
            byte[] tempData = buff;
            info.MachineId = ConvertHelper.BytesToInt16(tempData, true);

            switch (tempData[2])
            {
            case 1: info.RespResult = enumErrorCode.DeviceRespFailInfo; break;

            case 2: info.RespResult = enumErrorCode.DeviceScheduleWorking; break;

            default: info.RespResult = enumErrorCode.HandlerSuccess; break;
            }
            return(info);
        }