/** * @return bool|null|string * @throws YoloException * @throws YoloParamException */ public static function getUserStatus() { $wid = self::getWid(); if ($wid <= 0) { return false; } if (self::permissionHas('user_status')) { return intval(self::permissionGet('user_status')); } $memberInfo = UserApi::singleton()->getMemberInfo($wid); if (isset($memberInfo)) { self::permissionSet('company_wid', $memberInfo->company_wid, null, false); if ($wid == $memberInfo->company_wid) { // Activated HR BlueV self::permissionSet('user_status', intval(self::ACTIVE | self::HR | self::BLUE_V)); return self::ACTIVE | self::HR | self::BLUE_V; // BlueV } else { self::permissionSet('user_status', intval(self::ACTIVE | self::HR)); return self::ACTIVE | self::HR; // Common Hr } } else { $companyInfo = null; try { $companyInfo = UserApi::singleton()->getCompanyInfo($wid); } catch (YoloPlatformException $e) { } if ($companyInfo == null || !is_a($companyInfo, 'CompanyObject')) { self::permissionSet('user_status', intval(0)); return 0; // Inactivated Common User } else { if ($wid == $companyInfo->wid) { if ($companyInfo->status != -1) { throw new YoloException('未知错误'); } self::permissionSet('user_status', intval(self::HR | self::BLUE_V)); return self::HR | self::BLUE_V; // Inactivated BlueV } } } return false; }