Web/app/tencent/oauth.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using Newtonsoft.Json;
using OAuth.Tencent;
using Common;
namespace Web.App.Tencent
{
    public partial class oauth : Web.UI.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //CheckOAuthState("tencent");
            //if (!site.AllowReg || site.CheckReg)
            //{
            //    FinalMessage("对不起,本站不支持第三方登录!", site.Dir, 0);
            //    Response.End();
            //}
            string _operType =Request.Params["type"].ToString();
            switch (_operType)
            {
                case "login"://登陆
                    string strXmlFile = HttpContext.Current.Server.MapPath("~/XmlConfig/oauth_tencent.config");
                    DBUtility.XmlControl XmlTool = new DBUtility.XmlControl(strXmlFile);
                    string appid = XmlTool.GetText("Root/AppId");
                    string appkey = XmlTool.GetText("Root/AppKey");
                    XmlTool.Dispose();
                    string callBackUrl = SiteConfig.WebUrl + "app/tencent/RegNor_Third.aspx";
                    Utility.Login(appid, appkey, callBackUrl,SiteConfig.WebUrl + "app/tencent/oauth.aspx?type=loginsuccess",SiteConfig.WebUrl + "app/tencent/oauth.aspx?type=loginfail");
                    break;
                case "loginsuccess"://成功
                    string _Access_Token = Utility.OpenId;
                    if (_Access_Token != "")
                    {
                        string result = Utility.GetUserInfo(DataFormatEnum.Json);
                        Dictionary<string, object> newobj = (Dictionary<string, object>)fastJSON.JSON.Instance.ToObject(result);
                        string _UserName = (string)newobj["nickname"];
                        string _Birthday = "1980-01-01";
                        string _Email = "";
                        Utils.SetObj("OAuth_Info", "{\"code\":\"tencent\",\"token\":\"" + _Access_Token + "\",\"username\":\"" + _UserName + "\",\"email\":\"" + _Email + "\",\"birthday\":\"" + _Birthday + "\"}");
                        Response.Redirect(SiteConfig.WebUrl + "app/tencent/RegNor_Third.aspx");
                    }
                    break;
                case "loginfail"://失败
                    string _html2 = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
<html xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <title></title>
</head>
<body>
error_code=" + Request["error_code"] + @"
</body>
</html>";
                    Response.Write(_html2);
                    break;
                default://腾讯调转
后面还有 14 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。