Dim st As New Date(1970,1,1,8,0,0)
Dim t1 As Integer = CInt((Date.Today.AddDays(-100) - st).TotalSeconds()) '时间戳开始时间
Dim t2 As Integer = CInt((Date.Now - st).TotalSeconds()) '时间戳结束时间
Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/corp/getapprovaldata?access_token={0}"
Dim hc As new HttpClient(Cexp(ur,Functions.Execute("GetQYAccessToken2"))) '企业号应用
Dim jo As New JObject
jo("starttime") = t1
jo("endtime") = t2
hc.Content = jo.Tostring()
jo = JObject.Parse(hc.GetData)
Dim json As String = jo("data").ToString()
Dim ja As JArray = Jarray.Parse(json)
For i As Integer = 0 To ja.Count - 1
If ja(i)("spname").ToString() = " 香烟领用" Then
Dim spbh As String = ja(i)("sp_num").ToString() '判断是否存在相同的审批编号行
Dim dr As DataRow = DataTables("微信审批表香烟").Find("审批编号 = '" & spbh & "'")
If dr Is Nothing Then '如果不存在想同审批编号
Dim r As Row =Tables("微信审批表香烟").AddNew()
r("单据类型") = ja(i)("spname").ToString() '审批名称(请假,香烟,自定义审批名称)
r("审批编号") = ja(i)("sp_num").ToString() '审批单号
r("申请部门") = ja(i)("apply_org").ToString() '申请人部门
r("申请人") = ja(i)("apply_name").ToString() '申请人姓名
r("审批状态") = ja(i)("sp_status").ToString() '审批状态:1审批中;2 已通过;3已驳回;4已取消;6通过后撤销;10已支付
r("审批人") = ja(i)("approval_name").ToString().Replace("""","").Replace("[","").Replace("]","").Replace(vblf,"") '审批人姓名
r("提交时间") = ja(i)("apply_time").ToString() '审批单提交时间
' r("附件") = ja(i)("mediaids").ToString() '审批的附件media_id,可使用media/get获取附件
r("comm") = ja(i)("comm")("apply_data").ToString() '获取详细信息
r("userid") = ja(i)("apply_user_id").ToString() '审批单提交者的userid
r("附件") = """[" & r("comm").Replace("""","'") & "]""" '替换双引号为单引号,并加入"[]"
r("次数") = "1"
Dim json1 As String = r("附件")
For Each ep As JToken In JArray.Parse(json1)
r("用途") = ep("item-1494250993171")("value").ToString()
r("香烟类别") = ep("item-1529756528001")("value").ToString().Replace("[","").Replace("]","")
r("数量") = ep("item-1494251019660")("value").ToString()
Next
Dim csr As String
csr = ja(i)("notify_name").ToString().Replace(vblf,"")
If len(csr) = 2 Then
r("抄送人") = ""
Else
Dim s As String
s = ""
For Each v As JToken In JArray.Parse(csr)
s = s & "," & v.ToString
Next
r("抄送人") = s.TrimStart(",")
End If
End If
End If
Next
错误提示:
.NET Framework 版本:2.0.50727.8793
Foxtable 版本:2018.8.30.1
错误所在事件:窗口,QQ信息,香烟领用,Click
详细错误信息:
Error reading JArray from JsonReader. Current JsonReader item is not an array: String. Path '', line 1, position 562.
加上红色的代码,就会出现上面的错误,请大神帮忙修改