Hidistro.UI.SaleSystem.CodeBehind/VReGetWeiXinUserInfos.cs

(开头部分) 5KB

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

namespace Hidistro.UI.SaleSystem.CodeBehind
{
    using Hidistro.Core;
    using Hidistro.Core.Entities;
    using Hidistro.Entities.Members;
    using Hidistro.SaleSystem.Vshop;
    using Hidistro.UI.Common.Controls;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    using System;
    using System.IO;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.UI;

    [ParseChildren(true)]
    public class VReGetWeiXinUserInfos : VshopTemplatedWebControl
    {
        protected override void AttachChildControls()
        {
            string userAgent = this.Page.Request.UserAgent;
            string str2 = Globals.RequestQueryStr("returnUrl");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            try
            {
                if ((currentMember != null) && (currentMember.Status == 1))
                {
                    if (userAgent.ToLower().Contains("micromessenger"))
                    {
                        if (masterSettings.IsValidationService)
                        {
                            string str3 = this.Page.Request.QueryString["code"];
                            if (!string.IsNullOrEmpty(str3))
                            {
                                string responseResult = this.GetResponseResult("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + masterSettings.WeixinAppId + "&secret=" + masterSettings.WeixinAppSecret + "&code=" + str3 + "&grant_type=authorization_code");
                                if (responseResult.Contains("access_token"))
                                {
                                    JObject obj2 = JsonConvert.DeserializeObject(responseResult) as JObject;
                                    string str5 = this.GetResponseResult("https://api.weixin.qq.com/sns/userinfo?access_token=" + obj2["access_token"].ToString() + "&openid=" + obj2["openid"].ToString() + "&lang=zh_CN");
                                    if (str5.Contains("nickname"))
                                    {
                                        JObject obj3 = JsonConvert.DeserializeObject(str5) as JObject;
                                        MemberProcessor.ReSetUserHead(currentMember.UserId.ToString(), Globals.UrlDecode(obj3["nickname"].ToString()), obj3["headimgurl"].ToString(), obj3["openid"].ToString());
                                        if (string.IsNullOrEmpty(str2))
                                        {
                                            this.Page.Response.Redirect(str2);
                                        }
                                        else
                                        {
                                            this.Page.Response.Redirect("MemberCenter.aspx");
                                        }
                                    }
                                    else
                                    {
                                        this.Page.Response.Write("获取微信用户信息失败");
                                    }
                                }
                                else
后面还有 60 行代码,购买后查看完整代码

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

AI 解读 AI

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

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