123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace common\util;
- use common\models\BaseUser;
- use common\models\LwtCompanyInfoBase;
- class Role
- {
- /**
- * 判断是否是客户
- * @param BaseUser $userInfo
- * @return bool
- */
- public static function isCommonUser(BaseUser $userInfo)
- {
- $result = false;
- if ($userInfo->category == 1) {
- $result = true;
- }
- return $result;
- }
- public static function getCommonUserCompanyScanId(BaseUser $userInfo)
- {
- $LwtCompanyInfo = LwtCompanyInfoBase::findOne(["company_name" => $userInfo->company]);
- if ($LwtCompanyInfo) {
- $scan_id = $LwtCompanyInfo->scan_id;
- } else {
- $scan_id = $userInfo->login_name;
- }
- return $scan_id;
- }
- public static function ifCommonUserAddScanId(BaseUser $userInfo)
- {
- $addParams = [];
- if (self::isCommonUser($userInfo)) {
- $addParams["scan_id"] = $userInfo->CompanyScanId;
- }
- return $addParams;
- }
- }
|