以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]y移动开发求助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=102307) |
-- 作者:18523982317 -- 发布时间:2017/6/16 22:53:00 -- [求助]y移动开发求助 DataTables("下载users").DataRows.Clear Dim r As Row Dim dr As DataRow Dim ul As String ul = "https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token={0}&department_id=1&fetch_child=1&status=0" Dim hc As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken"))) Dim jo As JObject = JObject.Parse(hc.GetData()) If jo("errcode") = "0" Then Dim nms() As String = {"userid","name","position","mobile"} \'"" For Each jt As JToken In jo("userlist") dr = DataTables("下载Users").AddNew() For Each nm As String In nms dr(nm) = jt(nm) Next If dr("department") IsNot Nothing dr("department") = CompressJson(jt("department")).Trim("[","]") End If Next DataTables("下载Users").Save() Else End If \'DataTables("临时员工资料").LoadFilter = "" \'DataTables("临时员工资料").Load For Each r In Tables("下载users").Rows dr = DataTables("临时员工资料").Find("工号 = \'" & r("userid") & "\'") If dr.IsNull("手机号码") = False Then If dr("手机号码") <> r("mobile") Then msgbox(dr("姓名0")) ul = "https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token={0}" Dim hc1 As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken"))) Dim jo1 As New JObject jo1("userid") = CStr(r("userid")) jo1("mobile") = CStr(dr("手机号码")) hc.Content = jo.ToString jo1 = JObject.Parse(hc1.GetData) If jo1("errcode") = "0" Then Else End If End If End If If dr("是否离职") = 1 Then ul = "https://qyapi.weixin.qq.com/cgi-bin/user/delete?access_token={0}&userid={1}" Dim hc2 As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken"),dr("工号"))) Dim jo2 As JObject = JObject.Parse(hc2.GetData) If jo2("errcode") = "0" Then Else End If End If Next For Each r In Tables("临时员工资料").Rows If r("是否离职") = 0 Then dr = DataTables("下载users").Find("userid = \'" & r("工号") & "\'") If dr Is Nothing Then ul = "https://qyapi.weixin.qq.com/cgi-bin/user/create?access_token={0}" Dim hc3 As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken"))) Dim jo3 As New JObject jo3("userid") = CStr(r("工号")) jo3("name") = CStr(r("姓名0")) Dim dr1 As DataRow = DataTables("Departments").Find("[name] = \'" & r("部门") & "\'") If dr1 IsNot Nothing jo3("department") = CStr(dr1("id")) \'部门ID为3和9 Else jo3("department") = "1" End If jo3("mobile")= CStr(r("手机号码")) jo3("gender") = "1" hc.Content = Jo.ToString jo3 = JObject.Parse(hc3.GetData) If jo3("errcode") = "0" Then Else MessageBox.Show(jo3.ToString) End If End If End If Next 为什么企业号创建用户和修改用户什么的 全都失败,我用代码直接单个执行,又成功,求解?
|
-- 作者:有点蓝 -- 发布时间:2017/6/16 22:57:00 -- 失败返回什么错误码和错误提示? MessageBox.Show(jo1.ToString) MessageBox.Show(jo2.ToString) MessageBox.Show(jo3.ToString)
|
-- 作者:18523982317 -- 发布时间:2017/6/16 23:15:00 -- 都提示43002 需要post方式 [此贴子已经被作者于2017/6/16 23:18:26编辑过]
|
-- 作者:有点蓝 -- 发布时间:2017/6/17 8:43:00 -- ..... ul = "https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token={0}" Dim hc1 As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken"))) Dim jo1 As New JObject jo1("userid") = CStr(r("userid")) jo1("mobile") = CStr(dr("手机号码")) hc1.Content = jo.ToString jo1 = JObject.Parse(hc1.GetData) ..... jo3("mobile")= CStr(r("手机号码")) jo3("gender") = "1" hc3.Content = Jo.ToString jo3 = JObject.Parse(hc3.GetData) If jo3("errcode") = "0" Then |