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