Static Createtime As Date
Static AccessToken As String
Dim appid As String = "ddOa20201127"
Dim appSecret As String = "nCluLHTEdpxz"
Dim tp As TimeSpan = Date.Now - createtime
Dim url As String = "http://www.jqkywy.com/pws/api/v1/getAccessToken.do?appid={0}&appSecret={1}"
If tp.TotalSeconds > 3600 Then
Dim hc As New HttpClient(Cexp(url,appid,appSecret))
Dim ret As String = hc.GetData()
'Output.show(ret)
If ret = "" Then
hc.GetData()
End If
CreateTime = Date.now()
Dim jo As Jobject = Jobject.Parse(ret)
' If jo("errcode") Is Nothing Then
AccessToken = jo("data")
' Else
'MessageBox.show("获取access_token失败,原因:" & vbcrlf & jo("errmsg").Tostring)
' End If
'Output.show(AccessToken)
End If
Dim url1 As String = "http://www.jqkywy.com/pws/api/v1/saveUser"
Dim addnews As New HttpClient(CExp(url1))
addnews.C
'addnews.Method = "Post"
Dim postjosn As New JObject
postjosn("name") = "lee"
postjosn("mobile") = "18639325188"
postjosn("departmentId") = "SHF35HYWYFWZX-ZXB"
postjosn("dutyIds") = "MG{KYWY}"
postjosn("sex") = "1"
postjosn("state") = "1"
postjosn("accessToken") = AccessToken
'Output.show(accessToken)
addnews.Content = postjosn.Tostring()
Output.show(postjosn.Tostring())
postjosn = JObject.Parse(addnews.GetData())
Output.show(postjosn.Tostring())
MessageBox.Show(addnews.GetData())