|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
+use app\common\model\Department;
|
|
|
use app\common\model\User;
|
|
|
use app\common\service\DingtalkService;
|
|
|
use hg\apidoc\annotation as Apidoc;
|
|
@@ -17,12 +18,17 @@ class Dingtalk extends Base
|
|
|
public function department_listsub(){
|
|
|
$parent_id = input('parent_id');
|
|
|
$resp = DingtalkService::department_listsub($parent_id);
|
|
|
- if($resp->errcode == 0 && $resp->errmsg == 'ok'){
|
|
|
- $result = $resp->result;
|
|
|
- p($result);exit;
|
|
|
+ foreach ($resp as $value){
|
|
|
+ $data[] = [
|
|
|
+ 'dept_id'=>$value->dept_id,
|
|
|
+ 'name'=>$value->name,
|
|
|
+ 'parent_id'=>$value->parent_id,
|
|
|
+ ];
|
|
|
}
|
|
|
- $this->error($resp->errcode.$resp->errmsg);
|
|
|
-
|
|
|
+ if($data){
|
|
|
+ Department::insertAll($data);
|
|
|
+ }
|
|
|
+ $this->success('获取部门列表',$resp);
|
|
|
}
|
|
|
|
|
|
/**
|