コード例 #1
0
ファイル: AliPayFuwuApi.cs プロジェクト: llenroc/kangaroo
        public void ProcessRequest(System.Web.HttpContext context)
        {
            this.siteSettings = SettingsManager.GetMasterSettings(true);
            this.appid        = this.siteSettings.AlipayAppid;
            AliOHHelper.log(context.Request.Form.ToString());
            if (AlipayFuwuConfig.appId.Length < 15 && !AlipayFuwuConfig.CommSetConfig(this.appid, context.Server.MapPath("~/"), "GBK"))
            {
                context.Response.Write(AlipayFuwuConfig.errstr);
                return;
            }
            if ("alipay.service.check".Equals(AliOHHelper.getRequestString("service", context)))
            {
                AliOHHelper.verifygw(context);
                return;
            }
            if ("alipay.mobile.public.message.notify".Equals(AliOHHelper.getRequestString("service", context)))
            {
                string requestString = AliOHHelper.getRequestString("biz_content", context);
                string xmlNode       = AliOHHelper.getXmlNode(requestString, "EventType");
                string xmlNode2      = AliOHHelper.getXmlNode(requestString, "FromUserId");
                this.UserInfo = AliOHHelper.getXmlNode(requestString, "UserInfo");
                string xmlNode3 = AliOHHelper.getXmlNode(requestString, "ActionParam");
                AliOHHelper.getXmlNode(requestString, "AgreementId");
                AliOHHelper.getXmlNode(requestString, "AccountNo");
                AliOHHelper.getXmlNode(requestString, "AppId");
                AliOHHelper.getXmlNode(requestString, "CreateTime");
                string xmlNode4 = AliOHHelper.getXmlNode(requestString, "MsgType");
                string xmlNode5 = AliOHHelper.getXmlNode(requestString, "Content");
                string a;
                if ((a = xmlNode4) != null)
                {
                    if (!(a == "event"))
                    {
                        if (!(a == "text"))
                        {
                            if (!(a == "image"))
                            {
                                goto IL_22F;
                            }
                            goto IL_1E3;
                        }
                    }
                    else
                    {
                        try
                        {
                            this.replyAction(xmlNode2, xmlNode, xmlNode5, xmlNode3);
                            goto IL_22F;
                        }
                        catch (System.Exception ex)
                        {
                            AliOHHelper.log(ex.Message.ToString());
                            goto IL_22F;
                        }
                    }
                    try
                    {
                        if (!string.IsNullOrEmpty(xmlNode2))
                        {
                            WeiXinHelper.UpdateRencentAliOpenID(xmlNode2);
                        }
                    }
                    catch (System.Exception ex2)
                    {
                        AliOHHelper.log(ex2.Message.ToString());
                    }
                    try
                    {
                        this.replyAction(xmlNode2, "", xmlNode5, xmlNode3);
                        goto IL_22F;
                    }
                    catch (System.Exception ex3)
                    {
                        AliOHHelper.log(ex3.Message.ToString());
                        goto IL_22F;
                    }
IL_1E3:
                    Articles articles = new Articles
                    {
                        toUserId = xmlNode2,
                        msgType  = "text",
                        text     = new MessageText
                        {
                            content = "服务窗暂时不接收图片消息"
                        }
                    };
                    AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
                }
IL_22F:
                AliOHHelper.verifyRequestFromAliPay(context, xmlNode2, this.appid);
            }
        }
コード例 #2
0
ファイル: AliPayFuwuApi.cs プロジェクト: 123456-cq/xkq34_src
        public void ProcessRequest(HttpContext context)
        {
            Articles articles2;

            this.siteSettings = SettingsManager.GetMasterSettings(true);
            this.appid        = this.siteSettings.AlipayAppid;
            AliOHHelper.log(context.Request.Form.ToString());
            if ((AlipayFuwuConfig.appId.Length < 15) && !AlipayFuwuConfig.CommSetConfig(this.appid, context.Server.MapPath("~/"), "GBK"))
            {
                context.Response.Write(AlipayFuwuConfig.errstr);
                return;
            }
            if ("alipay.service.check".Equals(AliOHHelper.getRequestString("service", context)))
            {
                AliOHHelper.verifygw(context);
                return;
            }
            if (!"alipay.mobile.public.message.notify".Equals(AliOHHelper.getRequestString("service", context)))
            {
                return;
            }
            string xml       = AliOHHelper.getRequestString("biz_content", context);
            string eventType = AliOHHelper.getXmlNode(xml, "EventType");
            string str3      = AliOHHelper.getXmlNode(xml, "FromUserId");

            this.UserInfo = AliOHHelper.getXmlNode(xml, "UserInfo");
            string actionParam = AliOHHelper.getXmlNode(xml, "ActionParam");

            AliOHHelper.getXmlNode(xml, "AgreementId");
            AliOHHelper.getXmlNode(xml, "AccountNo");
            AliOHHelper.getXmlNode(xml, "AppId");
            AliOHHelper.getXmlNode(xml, "CreateTime");
            string str5        = AliOHHelper.getXmlNode(xml, "MsgType");
            string textContent = AliOHHelper.getXmlNode(xml, "Content");
            string str7        = str5;

            if (str7 != null)
            {
                if (!(str7 == "event"))
                {
                    if (str7 == "text")
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(str3))
                            {
                                WeiXinHelper.UpdateRencentAliOpenID(str3);
                            }
                        }
                        catch (Exception exception2)
                        {
                            AliOHHelper.log(exception2.Message.ToString());
                        }
                        try
                        {
                            this.replyAction(str3, "", textContent, actionParam);
                            goto Label_022F;
                        }
                        catch (Exception exception3)
                        {
                            AliOHHelper.log(exception3.Message.ToString());
                            goto Label_022F;
                        }
                        goto Label_01E3;
                    }
                    if (str7 == "image")
                    {
                        goto Label_01E3;
                    }
                }
                else
                {
                    try
                    {
                        this.replyAction(str3, eventType, textContent, actionParam);
                    }
                    catch (Exception exception)
                    {
                        AliOHHelper.log(exception.Message.ToString());
                    }
                }
            }
            goto Label_022F;
Label_01E3:
            articles2          = new Articles();
            articles2.toUserId = str3;
            articles2.msgType  = "text";
            MessageText text = new MessageText
            {
                content = "服务窗暂时不接收图片消息"
            };

            articles2.text = text;
            Articles articles = articles2;

            AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
Label_022F:
            AliOHHelper.verifyRequestFromAliPay(context, str3, this.appid);
        }