예제 #1
0
        public weixin(int _DT_id, Lebi_Site CurrentSite = null)
        {
            DT_id = _DT_id;
            BaseConfig_DT dtbcf = null;

            if (DT_id > 0)
            {
                dtbcf = ShopCache.GetBaseConfig_DT(DT_id);
                if (dtbcf != null)
                {
                    appid          = dtbcf.platform_weixin_id;
                    appkey         = dtbcf.platform_weixin_secret;
                    number         = dtbcf.platform_weixin_number;
                    platform_image = dtbcf.platform_weixin_image;
                }
            }
            if (DT_id == 0 || dtbcf == null)
            {
                if (CurrentSite != null)
                {
                    if (CurrentSite.platform_weixin_id != "" && CurrentSite.platform_weixin_secret != "")
                    {
                        appid  = CurrentSite.platform_weixin_id;
                        appkey = CurrentSite.platform_weixin_secret;
                        number = CurrentSite.platform_weixin_number;
                    }
                    if (appid == "")
                    {
                        appid = ShopCache.GetBaseConfig().platform_weixin_id;
                    }
                    if (appkey == "")
                    {
                        appkey = ShopCache.GetBaseConfig().platform_weixin_secret;
                    }
                    if (number == "")
                    {
                        number = ShopCache.GetBaseConfig().platform_weixin_number;
                    }
                    platform_image = ShopCache.GetBaseConfig().platform_weixin_image;
                }
                else
                {
                    BaseConfig bcf = ShopCache.GetBaseConfig();
                    appid          = bcf.platform_weixin_id;
                    appkey         = bcf.platform_weixin_secret;
                    number         = bcf.platform_weixin_number;
                    platform_image = bcf.platform_weixin_image;
                }
            }
            Model.weixin.token t = GetToken();
            Token = t.access_token;

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            url      = "https://api.weixin.qq.com/";
            reurnurl = ShopCache.GetBaseConfig().HTTPServer + "://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_weixin.aspx";
        }
예제 #2
0
 public Facebook(int DT_id = 0)
 {
     url = "https://graph.facebook.com/";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_facebook_id;
         appkey         = bcf.platform_facebook_secret;
         platform_image = bcf.platform_facebook_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_facebook_id;
         appkey         = bcf.platform_facebook_secret;
         platform_image = bcf.platform_facebook_image;
     }
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_facebook.aspx";
 }
예제 #3
0
파일: Weibo.cs 프로젝트: yzbjack/LebiShop
 public Weibo(int _DT_id = 0)
 {
     DT_id = _DT_id;
     url   = "https://api.weibo.com/";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_weibo_id;
         appkey         = bcf.platform_weibo_key;
         platform_image = bcf.platform_weibo_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_weibo_id;
         appkey         = bcf.platform_weibo_key;
         platform_image = bcf.platform_weibo_image;
     }
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_weibo.aspx";
 }
예제 #4
0
 public Twitter(int _DT_id = 0)
 {
     DT_id = _DT_id;
     url   = "https://api.twitter.com/";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_twitter_key;
         appkey         = bcf.platform_twitter_secret;
         platform_image = bcf.platform_twitter_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_twitter_key;
         appkey         = bcf.platform_twitter_secret;
         platform_image = bcf.platform_twitter_image;
     }
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + ":8001" + site.WebPath + "/platform/login_twitter.aspx";
     //reurnurl = "http://demo.lebi.cn" + site.WebPath + "/platform/login.aspx";
     reurnurl = System.Web.HttpUtility.UrlEncode(reurnurl);
 }
예제 #5
0
파일: Taobao.cs 프로젝트: zwkjgs/LebiShop
 public Taobao(int _DT_id = 0)
 {
     DT_id  = _DT_id;
     url    = "https://oauth.taobao.com/";
     apiurl = "https://eco.taobao.com/router/rest";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_taobao_key;
         appkey         = bcf.platform_taobao_secret;
         platform_image = bcf.platform_taobao_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_taobao_key;
         appkey         = bcf.platform_taobao_secret;
         platform_image = bcf.platform_taobao_image;
     }
     appid  = Shop.Bussiness.ShopCache.GetBaseConfig().platform_taobao_key;
     appkey = Shop.Bussiness.ShopCache.GetBaseConfig().platform_taobao_secret;
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_taobao.aspx";
 }
예제 #6
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            SystemLog.Add("api_weixin");
            if (!Check())
            {
                return;
            }
            try
            {
                //微信推送消息处理
                Shop.Platform.Model.weixin.wxmessage wx     = Shop.Platform.weixin.Instance.GetWxMessage();
                string    platform_weixin_subscribe_automsg = "";
                string    parentuserid = wx.EventKey.Replace("qrscene_", "");
                Lebi_User parentuser   = B_Lebi_User.GetModel("id=" + parentuserid + "");
                if (parentuser == null)
                {
                    parentuser = new Lebi_User();
                }
                int DT_id = ShopPage.GetDT();
                if (DT_id == 0)
                {
                    BaseConfig bcf = ShopCache.GetBaseConfig();
                    platform_weixin_subscribe_automsg = bcf.platform_weixin_subscribe_automsg;
                    if (parentuser != null)
                    {
                        DT_id = parentuser.DT_id;
                    }
                }
                else
                {
                    BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
                    platform_weixin_subscribe_automsg = bcf.platform_weixin_subscribe_automsg;
                }
                string res = "";
                if (!string.IsNullOrEmpty(wx.EventName) && wx.EventName.Trim() == "subscribe")//未关注情况下扫码的事件推送
                {
                    string content = "";
                    if (!wx.EventKey.Contains("qrscene_"))
                    {
                        content = platform_weixin_subscribe_automsg;
                        res     = Shop.Platform.weixin.Instance.sendTextMessage(wx, content);
                    }
                    else
                    {
                        //content = "二维码参数:\n" + wx.EventKey.Replace("qrscene_", "");
                        //res = Shop.Platform.weixin.Instance.sendTextMessage(wx, content);
                        content = platform_weixin_subscribe_automsg;
                        res     = Shop.Platform.weixin.Instance.sendTextMessage(wx, content);

                        parentuserid = wx.EventKey.Replace("qrscene_", "");
                        Lebi_User user = Shop.Platform.weixin.Instance.GetUserByopenid(wx.FromUserName, DT_id);
                        if (parentuser != null)
                        {
                            if (parentuser.id != user.id && user.User_id_parent == 0)
                            {
                                //生成上下级关系
                                user = B_Lebi_User.GetModel(user.id);
                                user.User_id_parent = parentuser.id;
                                user.DT_id          = DT_id;
                                B_Lebi_User.Update(user);
                            }
                        }
                    }
                    Shop.Platform.weixin.GetInstance(DT_id, null).GetUserByopenid(wx.FromUserName, DT_id);
                }
                else if (!string.IsNullOrEmpty(wx.EventName) && wx.EventName.ToLower() == "scan")//已经关注情况下扫码的事件推送
                {
                    Lebi_User user = Shop.Platform.weixin.Instance.GetUserByopenid(wx.FromUserName);
                    if (parentuser != null)
                    {
                        if (parentuser.id != user.id && user.User_id_parent == 0)
                        {
                            //生成上下级关系
                            user = B_Lebi_User.GetModel(user.id);
                            user.User_id_parent = parentuser.id;
                            user.DT_id          = DT_id;
                            B_Lebi_User.Update(user);
                        }
                    }

                    //string str = "二维码参数:\n" + wx.EventKey;
                    //res = Shop.Platform.weixin.Instance.sendTextMessage(wx, str);
                }
                else if (!string.IsNullOrEmpty(wx.EventName) && wx.EventName.Trim() == "CLICK")
                {
                    if (wx.EventKey == "HELLO")
                    {
                        res = Shop.Platform.weixin.Instance.sendTextMessage(wx, "你好,欢迎使用公共微信平台!");
                    }
                }
                else
                {
                    if (wx.MsgType == "text" && wx.Content == "你好")
                    {
                        res = Shop.Platform.weixin.Instance.sendTextMessage(wx, "你好,欢迎使用公共微信平台!");
                    }
                    //else if (wx.MsgType == "voice")
                    //{
                    //    res = Shop.Platform.weixin.Instance.sendTextMessage(wx, wx.Recognition);
                    //}
                    else
                    {
                        res = Shop.Platform.weixin.Instance.sendTextMessage(wx, "你好,未能识别消息!");
                    }
                }

                Response.Write(res);
            }
            catch
            {
            }
        }