以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  获取二维码,错误41001是什么原因?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=124485)

--  作者:xluoping
--  发布时间:2018/9/7 10:01:00
--  获取二维码,错误41001是什么原因?
消息加解密设置的是  安全模式


请帮助


Dim e As RequestEventArgs = args(0)  \'网页函数开始
Dim dr1 As DataRow = DataTables("单位").Find("_Identify = " & e.Postvalues("id"))
If dr1 Is Nothing Then
    Functions.Execute("error",e)
    Return ""
End If
Dim url As String = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}"
Dim hc As New HttpClient(CExp(url,Functions.Execute("GetAccessToken")))
Dim jo As New JObject
jo("expire_seconds") = 86400 \'有效时间,单位为秒
jo("action_name") = "QR_SCENE" \'类型为临时二维码
jo("action_info") = New JObject
jo("action_info")("scene") = New JObject
jo("action_info")("scene")("scene_id") = 112 \'指定此二维码的场景ID
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
If jo("errcode") Is Nothing Then
    Dim dr As DataRow = DataTables("QRCode").Find("descripttion = \'加入" & dr1("单位") & "申请\'")
    If dr Is Nothing Then
        dr = DataTables("QRCode").AddNew()
    End If
    dr("Ticket") = jo("ticket")
    dr("ExpireDate") = Date.Now .AddSeconds(jo("expire_seconds"))
    dr("Descripttion") = "加入" & dr1("单位") & "申请"
    dr.Save()
    \'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" & jo("ticket")
Else
    MessageBox.Show(jo("errcode"))
End If
Dim wb As New weui \'微信框架
wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'直接跳转到首页
e.WriteString(wb.Build) \'生成网页

--  作者:有点蓝
--  发布时间:2018/9/7 10:24:00
--  

缺少access_token.

碰到这种错误,请检查自己的appid和appsecret