<?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($A0M_7 = 'home') { goto zBFbf; zBFbf: $Y9WQp = ModelUtil::model('partner')->where(array('position' => $A0M_7, 'enable' => true))->orderBy('sort', 'asc')->get()->toArray(); goto VEuag; VEuag: foreach ($Y9WQp as $D5qRP => $qGgGl) { if (!empty($qGgGl['logo'])) { $Y9WQp[$D5qRP]['logo'] = AssetsUtil::fixFull($qGgGl['logo']); } } goto Xn370; Xn370: return $Y9WQp; goto zk0cD; zk0cD: } public static function listByPositionWithCache($A0M_7 = 'home', $W7jBq = 60) { return Cache::remember(self::CACHE_KEY_PREFIX . $A0M_7, $W7jBq, function () use($A0M_7) { return self::listByPosition($A0M_7); }); } public static function clearCache() { foreach (PartnerPosition::getList() as $D5qRP => $FtPNG) { Cache::forget(self::CACHE_KEY_PREFIX . $D5qRP); } } }