Foxtable(狐表)用户栏目专家坐堂 → [求助]y移动开发求助


  共有2180人关注过本帖树形打印复制链接

主题:[求助]y移动开发求助

帅哥哟,离线,有人找我吗?
18523982317
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:857 积分:6156 威望:0 精华:0 注册:2015/12/24 13:02:00
[求助]y移动开发求助  发帖心情 Post By:2017/6/16 22:53:00 [显示全部帖子]

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


为什么企业号创建用户和修改用户什么的 全都失败,我用代码直接单个执行,又成功,求解?

 回到顶部
帅哥哟,离线,有人找我吗?
18523982317
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:857 积分:6156 威望:0 精华:0 注册:2015/12/24 13:02:00
  发帖心情 Post By:2017/6/16 23:15:00 [显示全部帖子]

都提示43002   需要post方式
[此贴子已经被作者于2017/6/16 23:18:26编辑过]

 回到顶部