/// <summary>
        /// 单线程处理接受消息
        /// </summary>
        public static void DealWithReceiveMessage(string msg, Socket client)
        {
            int index = msg.IndexOf(",");
            var type  = Convert.ToInt32(new string(msg.Take(index).ToArray()));

            msg   = new string(msg.Skip(index + 1).ToArray());
            index = msg.IndexOf(",");
            var qq      = new string(msg.Take(index).ToArray());
            var context = new string(msg.Skip(index + 1).ToArray());
            BackgroundService service = new BackgroundService();

            switch (type)
            {
            case (int)(MessageTypeEnum.Cookies):
                // cookie
                // TODO:这里获取好友列表(完成)
                QqSocketClientDictionary[qq] = client;
                var m = Regex.Match(context, @"skey=(?<skey>[0-9a-zA-Z]*);");
                if (m.Success)
                {
                    string sKey = m.Groups["skey"].Value;
                    long   g_tk = GetG_tk(sKey);
                    string url  =
                        string.Format("http://m.qzone.com/friend/mfriend_list?g_tk={0}&res_uin={1}&res_type=normal&format=json&count_per_page=10&page_index=0&page_type=0&mayknowuin=&qqmailstat=", g_tk, qq);
                    Dictionary <string, string> headers = new Dictionary <string, string>();
                    headers.Add("Cookie", context);
                    string content = HttpClient.GetHttpResponse(url, headers);
                    var    result  = JsonConvert.DeserializeObject <dynamic>(content);
                    if (result.code == -3000)
                    {
                        Logger.Error(result.message);
                    }
                    else
                    {
                        HashSet <FriendViewModel> set = new HashSet <FriendViewModel>();
                        var items_list = result.data.list;
                        foreach (var item in items_list)
                        {
                            set.Add(new FriendViewModel()
                            {
                                Owner = qq,
                                Qq    = item.uin,
                                Nick  = item.nick
                            });
                        }

                        foreach (var viewModel in set)
                        {
                            service.AddQQFriends(viewModel);
                        }
                    }
                }
                break;

            case (int)(MessageTypeEnum.CommonMsg):
                // 消息
                MessageInViewModel model = JsonConvert.DeserializeObject <MessageInViewModel>(context);
                // TODO:消息过滤(完成)
                // [CQ:image,file=1F782FD4E9960B8DC370C995A7C7463D.png]"
                var matches = Regex.Matches(model.Msg, @"\[CQ:image,file=(?<filename>[0-9a-zA-Z]*\.\w*)\]");
                foreach (Match match in matches)
                {
                    var    value    = match.Groups["filename"].Value;
                    var    filename = Path.Combine(Global.AirPath, "data/image", value + ".cqimg");
                    string url      = "";
                    foreach (var line in File.ReadAllLines(filename))
                    {
                        if (line.StartsWith("url="))
                        {
                            url = new string(line.Skip(4).ToArray());
                            break;
                        }
                    }

                    model.Msg = model.Msg.Replace(value, url);
                }
                service.SaveRecevicedMessage(model.FromQQ, qq, qq, model.SubType, model.Msg, model.GroupNum);
                break;
            }
        }