public void T1()
        {
            var record = new WinXinUserInfoPartRecord
            {
                UserId = 5,
                openid = "openid",
                nickname = "nickname",
                sex = "sex",
                province = "province",
                city = "city",
                country = "country",
                headimgurl = "headimgurl",
                privilege = "privilege",

            };
            _winXinUserInfoPartRecordRepository.Create(record);
            Console.ForegroundColor = ConsoleColor.Green;
            Context.Output.WriteLine("插入成功.");
        }
        public QuickLogOnResponse Auth(WorkContext wc, string code, string returnUrl)
        {
            string error = null;
            if (string.IsNullOrEmpty(code))
            {
                error = "无效的code";
            }
            else
            {
                var token = GetAccessToken(wc, code);
                if (!string.IsNullOrEmpty(token.access_token))
                {
                    var request = new QuickLogOnRequest
                    {
                        UserName = token.openid,
                        RememberMe = false,
                        ReturnUrl = returnUrl
                    };
                    var lowerEmail = request.Email == null ? "" : request.Email.ToLowerInvariant();
                    return _quickLogOnService.LogOn(request, () =>
                    {
                        UserPart user = _membershipService.CreateUser(new CreateUserParams(request.UserName, Guid.NewGuid().ToString(), lowerEmail, null, null, true)) as UserPart;

                        var model = GetUserInfo(token.access_token, token.openid);

                        var record = new WinXinUserInfoPartRecord
                        {
                            UserId = user.Id,
                            openid = model.openid,
                            nickname = model.nickname,
                            sex = model.sex,
                            province = model.province,
                            city = model.city,
                            country = model.country,
                            headimgurl = model.headimgurl,
                            privilege = string.Join(",", model.privilege),

                        };
                        _winXinUserInfoPartRecordRepository.Create(record);

                        return user;
                    });
                }
                else
                {
                    error = string.Format("[{0}]{1}", token.errcode, token.errmsg);
                }
            }
            return new QuickLogOnResponse { Error = T("微信登录失败: {0}", error), ReturnUrl = returnUrl };
        }