怎么可能未声明?
Dim url As String = e.Request.URL.ToString
MsgBox(url)
第一步
第二步 http://www.abc.com/indexhtm?tjr=xxxx
第三步 openid 和 username 提取出来了
第四步 手机端显示的 系统繁忙稍后访问本系统
没有进入系统
[此贴子已经被作者于2024/6/17 17:34:46编辑过]
系统繁忙是因为后台弹出许多msgbox,测试的时候如果msgbox关闭的慢,会导致前端超时。把前面所有MsgBox取消掉,只保留MsgBox(url),看弹出什么内容?
老师我刚才测试下,三种办法都没有保存数据,不知道为啥 If e.GetValues.ContainsKey("tjr") Then
.AddHiddenValue(e.GetValues("tjr"), "客户来源_KHID")
.AddHiddenValue("客户来源_KHID",e.GetValues("tjr"),)
dr1("客户来源_KHID") = e.GetValues("tjr")
End If
这样看看分别弹出什么
If e.GetValues.ContainsKey("code") Then '如果是通过授权链接跳转而来,就从链接重提取code来获取openid
MsgBox(e.Request.URL.ToString)
Dim ul As String = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code"
……
……
Else
UserName = e.Cookies("username") '从cookie获取用户名和openid
OpenID = e.Cookies("openid")
Dim dr As DataRow = DataTables("客户").SQLFind("openid ='" & Openid & "'") '根据openid找出对应的行
If dr Is Nothing OrElse UserName = "" OrElse OpenId = "" Then '空
Dim url As String = e.Request.URL.ToString
Dim ul As String = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx................&redirect_uri=" & UrlEncode(url) & "&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"
MsgBox(ul)
……
能进系统里额,保存dr行了,我把这个的 dr.Save 放在外面了,但是就是不保存 tjr=xxxx的值
If e.GetValues.ContainsKey("tjr") Then
dr("客户来源_KHID") = e.GetValues("tjr")
' dr.Save
End If
dr.Save