|
@@ -115,14 +115,12 @@ class DingtalkService
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
// 更新部门
|
|
|
- if ($save_department_data) {
|
|
|
- foreach ($department_list as $val) {
|
|
|
- if (array_key_exists($val['dept_id'], $department_data_key)) {
|
|
|
- $department_data_info = $department_data_key[$val['dept_id']];
|
|
|
- $val->save($department_data_info);
|
|
|
- } else {
|
|
|
- $del_department_data[] = $val['id'];
|
|
|
- }
|
|
|
+ foreach ($department_list as $val) {
|
|
|
+ if (array_key_exists($val['dept_id'], $department_data_key)) {
|
|
|
+ $department_data_info = $department_data_key[$val['dept_id']];
|
|
|
+ $val->save($department_data_info);
|
|
|
+ } else {
|
|
|
+ $del_department_data[] = $val['id'];
|
|
|
}
|
|
|
}
|
|
|
if ($add_department_data) {
|
|
@@ -150,19 +148,17 @@ class DingtalkService
|
|
|
$add_user_data[] = $data;
|
|
|
}
|
|
|
}
|
|
|
- if ($save_user_data) {
|
|
|
- foreach ($user_list as $val) {
|
|
|
- if (array_key_exists($val['userid'], $user_data_key)) {
|
|
|
- $user_data_info = $user_data_key[$val['userid']];
|
|
|
- $data = [
|
|
|
- 'userid' => $user_data_info['userid'],
|
|
|
- 'unionid' => $user_data_info['unionid'],
|
|
|
- 'department' => implode(',', $user_data_info['dept_id_list']),
|
|
|
- ];
|
|
|
- $val->save($data);
|
|
|
- } else {
|
|
|
- $del_user_data[] = $val['id'];
|
|
|
- }
|
|
|
+ foreach ($user_list as $val) {
|
|
|
+ if (array_key_exists($val['userid'], $user_data_key)) {
|
|
|
+ $user_data_info = $user_data_key[$val['userid']];
|
|
|
+ $data = [
|
|
|
+ 'userid' => $user_data_info['userid'],
|
|
|
+ 'unionid' => $user_data_info['unionid'],
|
|
|
+ 'department' => implode(',', $user_data_info['dept_id_list']),
|
|
|
+ ];
|
|
|
+ $val->save($data);
|
|
|
+ } else {
|
|
|
+ $del_user_data[] = $val['id'];
|
|
|
}
|
|
|
}
|
|
|
if ($add_user_data) {
|