/** * 判断小区园丁是否是有效的小区园丁 * * @param int $communityId * @return bool */ public static function checkCommunityGardenerValidate($communityId) { $communityGardenerState = static::getCommunityGardenerState($communityId); if (empty($communityGardenerState)) { return false; } $gardenerId = $communityGardenerState['gardenerId']; if ($gardenerId == 0) { return false; } $brokerApplyHistory = Model_Community_GardenerApply::getBrokerLastApprovalApply($gardenerId, $communityId); if (empty($brokerApplyHistory)) { return false; } $lastValidateGardenerDate = date('Ymd', strtotime('-30 day')); $applyApprovalDate = date('Ymd', $brokerApplyHistory['updateTime']); return $lastValidateGardenerDate < $applyApprovalDate; }
/** * 获取经纪人最后审核通过记录 * * @param int $brokerId * @param int $communityId * @return array */ public static function getBrokerLastApprovalApply($brokerId, $communityId) { try { return Model_Community_GardenerApply::data_access()->filter('brokerId', $brokerId)->filter('commId', $communityId)->filter('state', self::APPLY_STATUS_APPROVAL)->sort('applyId', 'desc')->get_row(); } catch (Exception $e) { return array(); } }