<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Partner\Util; use Illuminate\Support\Facades\Cache; use ModStart\Core\Assets\AssetsUtil; use ModStart\Core\Dao\ModelUtil; use Module\Partner\Type\PartnerPosition; class PartnerUtil { const CACHE_KEY_PREFIX = 'partner:'; public static function listByPosition($FcLCS = 'home') { goto zF7lZ; EZO6C: return $sX2oK; goto v2VX0; zF7lZ: $sX2oK = ModelUtil::model('partner')->where(array('position' => $FcLCS, 'enable' => true))->orderBy('sort', 'asc')->get()->toArray(); goto EwGHs; EwGHs: foreach ($sX2oK as $kEhTf => $y2Ltn) { if (!empty($y2Ltn['logo'])) { $sX2oK[$kEhTf]['logo'] = AssetsUtil::fixFull($y2Ltn['logo']); } } goto EZO6C; v2VX0: } public static function listByPositionWithCache($FcLCS = 'home', $K9IuV = 60) { return Cache::remember(self::CACHE_KEY_PREFIX . $FcLCS, $K9IuV, function () use($FcLCS) { return self::listByPosition($FcLCS); }); } public static function clearCache() { foreach (PartnerPosition::getList() as $kEhTf => $plloB) { Cache::forget(self::CACHE_KEY_PREFIX . $kEhTf); } } }