/// <summary> /// 互联登陆结果. /// </summary> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult OAuthReturn(string type) { if (Request.QueryString["code"] != null) { string code = Request.QueryString["code"]; bool accredit; switch (type) { case "sina": var sina = new Sina(); accredit = sina.Authorize(code); if (accredit) { this.SaveUserInfo(sina.openID, sina.nickName); } else { return this.View("Index"); } break; case "qq": var qq = new QQ(); accredit = qq.Authorize(code); if (accredit) { this.SaveUserInfo(qq.openID, qq.nickName); } else { return this.View("Index"); } break; case "renren": var rr = new RenRen(); accredit = rr.Authorize(code); if (accredit) { // 保存登录信息 this.SaveUserInfo(rr.openID, rr.nickName); } else { return this.View("Index"); } break; case "163": var wy = new Wangyi(); accredit = wy.Authorize(code); if (accredit) { // 保存登录信息 this.SaveUserInfo(wy.openID, wy.nickName); } else { return this.View("Index"); } break; case "kaixin": var kx = new KaiXin(); accredit = kx.Authorize(code); if (accredit) { // 保存登录信息 this.SaveUserInfo(kx.openID, kx.nickName); } else { return this.View("Index"); } break; case "sohu": var sh = new Sohu(); accredit = sh.Authorize(code); if (accredit) { // 保存登录信息 this.SaveUserInfo(sh.openID, sh.nickName); } else { return this.View("Index"); } break; case "douban": var douban = new DouBan(); accredit = douban.Authorize(code); if (accredit) { // 保存登录信息 this.SaveUserInfo(douban.openID, douban.nickName); } else { return this.View("Index"); } break; case "taobao": var taobao = new TaoBao(); accredit = taobao.Authorize(code); if (accredit) { // 保存登录信息 this.SaveUserInfo(taobao.openID, taobao.nickName); } else { return this.View("Index"); } break; } } return this.RedirectToAction("Index", "Home"); }