Foxtable(狐表)用户栏目专家坐堂 → httprequest事件中,屏蔽代码可以弹开网页,if怎么写?


  共有3229人关注过本帖树形打印复制链接

主题:httprequest事件中,屏蔽代码可以弹开网页,if怎么写?

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110587 积分:562831 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/3/16 8:17:00 [显示全部帖子]

接收到的是微信消息,又怎么会弹出网页?

 

HttpServer有对3楼第一张图中的url的网页进行处理吗,例如下面这种

 

case "CCintroduction.htm"

 

检查数据库中配置的回调url,不能有CCintroduction.htm

 

红框代码的意思是,如果微信服务不为空,说明就是微信消息,就不会执行下面的代码了。微信消息回调和公众号菜单中的url是二回事来的,只要他们的地址不一致,示例是不会有问题的


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110587 积分:562831 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/3/16 8:40:00 [显示全部帖子]

使用下面代码,跟踪一下点击view菜单后服务端项目里的日志

 

 

try
   
   
    Select Case e.host
        Case "192.168.1.153","127.0.0.1","ycyysf.viphk.ngrok.org"
            Dim dr As DataRow
            Dim url As String
            Dim wechatserv As WeChat.WeChatPublicNo
            If e.Path > "" Then
                url = "http://" & e.host & "/" & e.Path.replace("\","/").replace("'","''").replace("""","""""") & "/"
                Functions.Execute("LogText","url=" & url)
                wechatserv = Functions.Execute("WeChat_GetServerByUrl",url) '查询是否有此地址的微信公众号
            End If
           
           
            Dim xo As XObject = XObject.Parse(e.PlainText)
            ' msgbox(xo("MsgType"))
            msgbox(e.PlainText)
            msgbox(xo("MsgType"))
            If (wechatserv  IsNot Nothing)   Then
                wechatserv.ProcessMessage(e,"WeChat_ProcessRequestMsg") '处理消息并获取返回值
                Functions.Execute("LogText","已回复")
            Else
                '通用事件头
                '如果网页路径定义了中间目录,如"ordertest/logon.htm" ,则下面的fl实际就是"d:\web\ordertest\weui\weui.me.js"
                '因此你需要把WeUI框架三个文件复制到"d:\web\ordertest\weui"目录下
                Dim fl As String = "d:\web\" & e.path
                If filesys.FileExists(fl)
                    Dim idx As Integer = fl.LastIndexOf(".")
                    Dim ext As String  = fl.SubString(idx)
                    Select Case ext
                        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
                            e.WriteFile(fl)
                            Return '这里必须返回
                    End Select
                End If
               
                Select Case e.Path
                    Case "ApplyService.htm"
                        Dim wb As New WeUI
                        wb.AddPageTitle("","pageheader","服务申请","请选择下面的对应的服务按钮")
                        With wb.AddGrid("","g1")
                            .Add("c1","软件需求登记", "./images/button.png","DemandRegist.htm")    '没有问题
                            .Add("c2","Cell", "./images/cell.png", "http://www.foxtable.com")
                            .Add("c3","Toast", "./images/toast.png", "http://www.foxtable.com")
                            .Add("c4","Dialog", "./images/dialog.png", "http://www.foxtable.com")
                            .Add("c5","Progress", "./images/progress.png", "http://www.foxtable.com")
                            .Add("c6","Msg", "./images/msg.png", "http://www.foxtable.com")
                            .Add("c7","Article", "./images/article.png", "http://www.foxtable.com")
                            .Add("c8","ActionSheet", "./images/actionSheet.png", "http://www.foxtable.com")
                            .Add("c9","Icons", "./images/icons.png", "http://www.foxtable.com")
                            .Add("c10","Panel", "./images/panel.png", "http://www.foxtable.com")
                            .Add("c11","Tab", "./images/tab.png", "http://www.foxtable.com")
                            .Add("c12","SearchBar", "./images/search.png", "http://www.foxtable.com")
                        End With
                        e.WriteString(wb.Build)
                       
                       
                       
                       
                    Case "list.htm"
                        Functions.Execute("List",e)
                    Case "addnew.htm"
                        Functions.Execute("AddNew",e)
                    Case "edit.htm"
                        Functions.Execute("Edit",e)
                    Case "delete.htm"
                        Functions.Execute("Delete",e)
                    Case "SatisSurvey.htm"
                        Functions.Execute("SatisSurvey",e)
                    Case "CCintroduction.htm"
                        Functions.Execute("CCintroduction",e)
                    Case "order1.htm"
                        Functions.Execute("JTweb",e)
                        .AddInput("sl","数量","number")
                       
                       
                       
                       
                       
                       
                    Case "gettoken" '做为AccessToken中控服务
                        Dim atoken As WeChat.AccessToken = WeChat.WeChatAccessTokenController.GetServiceAccessToken(e.PlainText)
                        e.WriteString(atoken.ToJson()) '返回access_token的JSON数据
                    Case "scanlogon" '做为AccessToken中控服务
                        Functions.Execute("Http_ScanLogon" ,e)
                    Case Else
                        If e.Path.StartsWith("ordertest\") Then '公众号订单测试地址前缀都统一使用这个
                            Functions.Execute("Order_HttpRequest",e)
                        ElseIf e.Path.StartsWith("review\") Then '企业号订单审核地址前缀都统一使用这个
                            Functions.Execute("Order_HttpReview",e)
                        End If
                End Select      'e.path 的配对
            End If
    End Select     'e.host的配对
    '记录接收的消息,方便分析
    Dim str As new StringBuilder
    str.AppendLine("host=" & e.host)
    str.AppendLine("path=" & e.Path)
    str.AppendLine("HttpMethod=" & e.Request.HttpMethod)
    str.AppendLine("poststring=" & e.PlainText)
    'str.AppendLine("ip=" & e.Request.RemoteEndPoint().Address.ToString())
    For Each key As String In e.Values.Keys
        str.AppendLine(key & "=" & e.Values(key))
    Next
    Functions.Execute("logText",str.ToString)
catch ex As Exception
    Functions.Execute("LogText",ex)
    e.WriteString("")
End Try


 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110587 积分:562831 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/3/16 8:42:00 [显示全部帖子]

另外贴出函数Functions.Execute("CCintroduction",e)的代码看看

 回到顶部