|
@@ -74,6 +74,27 @@ class Login extends Base
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //获取部门详情
|
|
|
+ public function get_department_detail(){
|
|
|
+ $c = $this->get_obj()['obj'];
|
|
|
+ $req = new \OapiV2DepartmentListsubRequest;
|
|
|
+ $req->setDeptId("891114410");
|
|
|
+ $resp = $c->execute($req, $this->get_obj()['access_token'], "https://oapi.dingtalk.com/topapi/v2/department/get");
|
|
|
+ if(isset($resp->result) && $resp->result){
|
|
|
+ var_dump($resp->result);exit();
|
|
|
+ foreach ($resp->result as $value){
|
|
|
+ $id = Db::name('department')->where('dept_id',$value->dept_id)->value('id');
|
|
|
+ if(empty($id)){
|
|
|
+ $data = array(
|
|
|
+ 'dept_id' => $value->dept_id,
|
|
|
+ 'name' => $value->name,
|
|
|
+ 'parent_id' => $value->parent_id,
|
|
|
+ );
|
|
|
+ Db::name('department')->insert($data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//获取部门用户详情
|
|
|
public function get_user_list(){
|
|
|
$c = $this->get_obj()['obj'];
|