……
If tp.TotalSeconds > 3600 Then
Dim url As String = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={0}&corpsecret={1}"
Dim hc As New HttpClient(CExp(url, CorpID, Secret))
Dim ret As String = hc.GetData(true)
If ret = "" orelse not(ret like "{*") Then '如果失败,再尝试一次
hc.GetData(true)
End If
If ret = "" orelse not(ret like "{*") then
msgbox("c错误" & ret)
else
CreateTime = Date.Now()
Dim jo As JObject = JObject.Parse(ret)
If jo("access_token") IsNot Nothing Then
AccessTocken = jo("access_token")
Else
MessageBox.show("获取access_token失败,原因:" & vbcrlf & jo.ToString)
End If
endif
End If
……