Dim st As New Date(1970,1,1,8,0,0)
Dim rq1 As Date = #10/24/2017 0:0:0#
Dim rq2 As Date = #10/24/2017 23:59:59#
Dim ksrq As Integer = CInt(( rq1- st).TotalSeconds()) \'时间戳
Dim jsrq As Integer = CInt((rq2- st).TotalSeconds()) \'时间戳
Dim ul As String = "https://qyapi.weixin.qq.com/cgi-bin/corp/getapprovaldata?access_token={0}"
Dim hc As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken_sp")))
Dim jo As New JObject
Dim jo1 As New JObject
jo("starttime") = ksrq
jo("endtime") = jsrq
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
If jo("errcode") = "0" Then
For Each jt As JToken In jo("data")
Dim r As Row = Tables("审批").AddNew
r("count") = jo("count")
r("total")= jo("total")
r("next_spnum")= jo("next_spnum")
r("spname") = jt("spname")
r("apply_name") =jt("apply_name")
r("apply_org") =jt("apply_org")
r("approval_name") =jt("approval_name").ToString
r("notify_name") =jt("notify_name").Tostring
r("sp_status") =jt("sp_status")
r("sp_num") =jt("sp_num")
r("apply_time") =jt("apply_time")
r("apply_user_id") =jt("apply_user_id")
r("comm") =jt("comm").Tostring
r("apply_data") =jt("comm")("apply_data").ToString
For Each jt1 As JToken In jt("comm")("apply_data").Tostring
Dim r1 As Row = Tables("审批明细").AddNew
r1("sp_num") =jt1("sp_num")
r1("item") =jt("sp_num")
r1("title") =jt1("title")
r1("type") =jt1("type")
r1("value") =jt1("value")
Next
Next
Else
MessageBox.Show(jo.ToString)
End If