|
@@ -53,17 +53,24 @@ class Dingtalk extends Base
|
|
|
public function user_list(){
|
|
|
$dept_id = input('dept_id');
|
|
|
$resp = DingtalkService::user_list($dept_id);
|
|
|
- p($resp);exit;
|
|
|
- $data = [];
|
|
|
- foreach ($resp as $value){
|
|
|
- $data[] = [
|
|
|
- 'dept_id'=>$value->dept_id,
|
|
|
- 'name'=>$value->name,
|
|
|
- 'parent_id'=>$value->parent_id,
|
|
|
- ];
|
|
|
- }
|
|
|
- if($data){
|
|
|
- Department::insertAll($data);
|
|
|
+ if($resp->has_more){
|
|
|
+ $data = [];
|
|
|
+ foreach ($resp->list as $value){
|
|
|
+ $data[] = [
|
|
|
+ 'userid'=>$value->userid,
|
|
|
+ 'unionid'=>$value->unionid,
|
|
|
+ 'name'=>$value->name,
|
|
|
+ 'avatar'=>$value->avatar,
|
|
|
+ 'mobile'=>isset($value->mobile)? $value->mobile :'',
|
|
|
+ 'email'=>isset($value->email)? $value->email :'',
|
|
|
+ 'title'=>$value->title,
|
|
|
+ 'manager_userid'=>isset($value->manager_userid)? $value->manager_userid :'',
|
|
|
+ 'department'=>implode(',',$value->dept_id_list),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($data){
|
|
|
+ User::insertAll($data);
|
|
|
+ }
|
|
|
}
|
|
|
$this->success('获取部门用户详情',$resp);
|
|
|
}
|