This commit is contained in:
mkm 2024-01-12 14:18:56 +08:00
parent d1dbca47b9
commit ccd05b1aaf

View File

@ -30,18 +30,22 @@ class Member extends CommonModel
$configModel = new SystemConfig();
$config = $configModel->info();
if ($config['single_mode'] && $config['single_org_code']) {
$list = MemberAccount::where(['member_code' => $member['code'], 'organization_code' => $config['single_org_code']])->where('authorize','<>','')->order('id asc')->select()->toArray();
$list = MemberAccount::where(['member_code' => $member['code'], 'organization_code' => $config['single_org_code']])->order('id asc')->select()->toArray();
if (!$list) {
MemberAccount::inviteMember($member['code'], $config['single_org_code']);
$list = MemberAccount::where(['member_code' => $member['code'], 'organization_code' => $config['single_org_code']])->where('authorize','<>','')->order('id asc')->select()->toArray();
$list = MemberAccount::where(['member_code' => $member['code'], 'organization_code' => $config['single_org_code']])->order('id asc')->select()->toArray();
}
} else {
$list = MemberAccount::where(['member_code' => $member['code']])->where('authorize','<>','')->order('id asc')->select()->toArray();
$list = MemberAccount::where(['member_code' => $member['code']])->order('id asc')->select()->toArray();
}
$organizationList = self::getOrgList($member['code'], true);
$authorize=0;
if ($list) {
foreach ($list as &$item) {
if($item['authorize']>0){
$authorize=$item['authorize'];
}
$departments = [];
$departmentCodes = $item['department_code'];
if ($departmentCodes) {
@ -56,7 +60,7 @@ class Member extends CommonModel
}
$member['account_id'] = $list[0]['id'];
$member['is_owner'] = $list[0]['is_owner'];
$member['authorize'] = $list[0]['authorize'];
$member['authorize'] = $authorize;
$member['position'] = $list[0]['position'];
$member['department'] = $list[0]['department'];
$member['organization_code'] = $list[0]['organization_code'];