//-------- protected void QQ() { //?Type=QQ&#access_token=FB82968B4FC03BCB39FB917375D9BB51&expires_in=7776000 thirdMod = thirdBll.SelModelByName("QQ"); PlatConfig.QQKey = thirdMod.ID;//底层是使用QQKey,将其传入 QQ_Div.Visible = true; Script_Lit.Text = "<script src=\"http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js\" data-appid=\"" + thirdMod.ID + "\" data-callback=\"true\" charset=\"utf-8\"></script>"; function.Script(this, "QQBind();"); }
protected void Page_Load(object sender, EventArgs e) { //string appid = "wx64dcf57278caa037"; //string redirect_uri = "http://www.zljdsc.com/test/WxLogin.aspx"; //string secret = "71c21ab790c34c05e1290a26ff025c70"; M_Third_Info wxInfo = thirdBll.SelModelByName("wechat"); string state = ""; if (string.IsNullOrEmpty(Request.QueryString["code"]))//微信登录操作 { state = function.GetRandomString(8).ToLower(); Session.Add("wx_state", state); string url = "https://open.weixin.qq.com/connect/qrconnect?appid=" + wxInfo.ID + "&redirect_uri=" + HttpUtility.UrlEncode(wxInfo.CallBackUrl) + "&response_type=code&scope=snsapi_login&state=" + state + "#wechat_redirect"; Response.Redirect(url); } else//登录返回操作 { //检测state参数是否匹配 if (Session["wx_state"] == null || !Session["wx_state"].Equals(Request.QueryString["state"])) { function.WriteErrMsg("参数错误!"); } Session["wx_state"] = null; string url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + wxInfo.ID + "&secret=" + wxInfo.Secret + "&code=" + Request.QueryString["code"] + "&grant_type=authorization_code"; JObject wxinfo = GetWxInfo(url); Appinfo infomod = AppBll.SelModelByOpenID(wxinfo["openid"].ToString(), "wechat"); if (infomod == null)//新用户注册 { infomod = GetNewUser(wxinfo); } M_UserInfo mu = buser.SelReturnModel(infomod.UserID); buser.SetLoginState(mu); Response.Redirect("/User"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //int uid = Convert.ToInt32(Request.QueryString["state"]); M_UserInfo mu = buser.GetLogin();//注意域名不要子域名跳过来 M_User_Token tokenMod = tokenbll.SelModelByUid(mu.UserID); if (tokenMod == null) { tokenMod = new M_User_Token(); } switch (Request.QueryString["s"]) { case "qq": //使用JS SDK break; default: //Sina string code = Request.QueryString["code"]; if (!string.IsNullOrEmpty(code)) { M_Third_Info appmod = thirdBll.SelModelByName("Sina"); SinaHelper sinaBll = new SinaHelper(null); tokenMod.uid = mu.UserID; tokenMod.SinaToken = sinaBll.GetTokenByCode(code); tokenbll.InsertORUpdate(tokenMod); } Response.Redirect("/Plat/UpCenter.aspx?Set=1"); break; } } }
protected void bindVibo_B_Click(object sender, EventArgs e) { M_Third_Info appmod = thirdBll.SelModelByName("Sina"); M_User_Token tokenMod = tokenbll.SelModelByUid(buser.GetLogin().UserID); if (tokenMod == null) { tokenMod = new M_User_Token(); } SinaHelper sinaBll = new SinaHelper(tokenMod.SinaToken); Response.Redirect(sinaBll.GetAuthUrl()); }
//QQ APPID=Key,APPKey=Secret //Key:一串数字,Secret:一串字母 //所有的存值都为 key和secret protected void Page_Load(object sender, EventArgs e) { B_Admin.IsSuperManage(); if (!IsPostBack) { XmlDocument Xml = thirdBll.GetXmlDoc(); //-------新浪 { M_Third_Info model = thirdBll.SelModelByName("Sina"); if (model != null) { ASina.Value = PlatConfig.SinaKey; SSina.Value = PlatConfig.SinaSecret; SSinaURL.Value = PlatConfig.SinaCallBack; Sina_Enable_Chk.Checked = model.Enabled; } } //-------QQ { M_Third_Info model = thirdBll.SelModelByName("QQ"); if (model != null) { QQ_Login_APPID_T.Value = model.Key; QQ_Login_Key_T.Value = model.Secret; QQ_Login_CallBack_T.Value = model.CallBackUrl; QQ_Enable_Chk.Checked = model.Enabled; } } //-------微信 { M_Third_Info model = thirdBll.SelModelByName("wechat"); if (model != null) { WeChat_APPID_T.Text = model.Key; WeChat_Secret_T.Text = model.Secret; WeChat_URL_T.Text = model.CallBackUrl; Wechat_Enable_Chk.Checked = model.Enabled; } } //-------百度 { M_Third_Info model = thirdBll.SelModelByName("Baidu"); if (model != null) { ABaidu.Value = model.Key; SBaidu.Value = model.Secret; UBaidu.Value = model.CallBackUrl; Baidu_Enable_Chk.Checked = model.Enabled; } } //-------开心 //{ // M_Third_Info model = thirdBll.SelModelByName("Kaixin"); // if (model != null) // { // AKaixin.Value = model.Key; // SKaixin.Value = model.Secret; // SKaixiuUrl.Value = model.CallBackUrl; // } //} //-------搜狐畅言 //XApp = Xml.SelectSingleNode("SuppliersList/SohuChat"); //chat_AppIDT.Value = XApp.Attributes["Key"].Value; //chat_AppKeyT.Value = XApp.Attributes["Secret"].Value; //CkSohuChat.Checked = XApp.Attributes["Enable"].Value == "1" ? true : false; //-------百度翻译 { M_Third_Info model = thirdBll.SelModelByName("BaiduTrans"); if (model != null) { Baidu_Translate_Key_T.Text = model.Key; Baidu_Translate_Secret_T.Text = model.Secret; } } //-------飞印打印机 { M_Third_Info model = thirdBll.SelModelByName("printer"); if (model != null) { Printer_Key_T.Text = model.Key; //商户号 Printer_Secret_T.Text = model.Secret; //Secret } } //-------飞印打印机 //XApp = Xml.SelectSingleNode("SuppliersList/BaiduTrans"); //BaiduKey_T.Text = XApp.Attributes["Key"].Value; //BaiduAppID_T.Text = XApp.Attributes["AppID"].Value; //Sina_Blog_Key_T.Text = PlatConfig.SinaKey; //Sina_Blog_Secret_T.Text = PlatConfig.SinaSecret; //Sina_Blog_CallBack_T.Text = PlatConfig.SinaCallBack; QQ_Blog_Key_T.Text = PlatConfig.QQKey; QQ_Blog_CallBack_T.Text = PlatConfig.QQCallBack; Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>" + Resources.L.工作台 + "</a></li><li><a href='" + CustomerPageAction.customPath2 + "user/UserManage.aspx'>" + Resources.L.用户管理 + "</a></li><li><a href='" + CustomerPageAction.customPath2 + "user/UserManage.aspx'>" + Resources.L.会员管理 + "</a></li><li>" + Resources.L.APP社会化登录 + "</li>" + Call.GetHelp(39)); } }