zdzs函数内容:
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.Request.Headers("User-Agent").ToLower.Contains("micromessenger") Then
Dim openid As String
Dim dropenid As DataRow
openid = Functions.Execute("getopenid", e) '提取用户openid
If openid <> "" Then '假如提取到openid
' messagebox.Show("1")
dropenid = DataTables("登录用户").sqlfind("openid='" & openid & "'") '在登录用户表中查找此openid
End If
' messagebox.Show("2")
If dropenid IsNot Nothing Then '如果找到了用户的openid
' messagebox.Show("3")
wb.AppendCookie("用户姓名", dropenid("用户姓名")) '将用户名信息写入cookie
wb.AppendCookie("用户密码", dropenid("用户密码"))
End If
ElseIf e.Cookies.ContainsKey("用户姓名") And e.Cookies.ContainsKey("用户密码") Then
Dim dr As DataRow = DataTables("登录用户").sqlfind("用户姓名='" & e.Cookies("用户姓名") & "'")
If dr Is Nothing OrElse dr("用户密码") <> e.Cookies("用户密码") Then '''如果无此用户,或密码不正确.
wb.InsertHTML("<meta http-equiv='Refresh' c>")
e.WriteString(wb.Build)
Return""
End If
Else
wb.InsertHTML("<meta http-equiv='Refresh' c>")
e.WriteString(wb.Build)
Return""
End If
If e.GetValues.ContainsKey("name") Then
zdzs页面内容......
end if
现在通过http://cbjg.740700.xyz/zdzs.htm?name=1557 这个网址调用这个页面,在pc浏览器可以直接打开对应的zdzs页面内容,但是在微信浏览器中则自动跳转到了http://cbjg.740700.xyz/default.htm页面了
请问哪里出错了?
If dr2("openid") <> "" Then '推送公众号
Dim url As String = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}"
Dim hc As New HttpClient(CExp(url, Functions.Execute("GetAccessToken")))
Dim jo As New JObject
Dim ja As New JArray
jo("touser") = CStr(dr2("openid"))
jo("template_id") = "k16d8RCZCzoR4" '模板ID
jo("url") = "cbjg.740700.xyz/zdzs.htm?name=" & CStr(dr("_Identify")) '打开折叠信息页面,传递主键
jo("data") = New JObject()
网址链接是通过这个微信公众号的地址推送的
调试
zdzs函数:
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
msgbox(e.Request.Headers("User-Agent"))
If e.Request.Headers("User-Agent").ToLower.Contains("micromessenger") Then
Dim openid As String
Dim dropenid As DataRow
openid = Functions.Execute("getopenid", e) '提取用户openid
msgbox("openid=" & openid)
If openid <> "" Then '假如提取到openid
' messagebox.Show("1")
dropenid = DataTables("登录用户").sqlfind("openid='" & openid & "'") '在登录用户表中查找此openid
End If
' messagebox.Show("2")
msgbox("dropenid=" & (dropenid IsNot Nothing))
If dropenid IsNot Nothing Then '如果找到了用户的openid
' messagebox.Show("3")
wb.AppendCookie("用户姓名", dropenid("用户姓名")) '将用户名信息写入cookie
wb.AppendCookie("用户密码", dropenid("用户密码"))
wb.AppendCookie("用户类别", dropenid("用户类别"))
wb.AppendCookie("用户单位", dropenid("用户单位"))
wb.AppendCookie("用户账号", dropenid("用户账号"))
wb.AppendCookie("用户级别", dropenid("用户级别"))
wb.AppendCookie("手机号", dropenid("手机号"))
wb.AppendCookie("邮箱地址", dropenid("邮箱地址"))
End If
ElseIf e.Cookies.ContainsKey("用户姓名") And e.Cookies.ContainsKey("用户密码") Then
msgbox("用户姓名")
Dim dr As DataRow = DataTables("登录用户").sqlfind("用户姓名='" & e.Cookies("用户姓名") & "'")
If dr Is Nothing OrElse dr("用户密码") <> e.Cookies("用户密码") Then '''如果无此用户,或密码不正确.
wb.InsertHTML("<meta http-equiv='Refresh' c>")
e.WriteString(wb.Build)
Return""
End If
Else
msgbox("logon.htm")
wb.InsertHTML("<meta http-equiv='Refresh' c>")
e.WriteString(wb.Build)
Return""
End If
msgbox("name=" & e.GetValues.ContainsKey("name") )
图片添加不上来了,我手敲吧,第一个是浏览器信息,第二个是openid=,第三个是dropenid=false,后边就没有了。这么看openid没有获取到啊
学会发图:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=78
openid=后面没有东西就是没有获取到