<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Assets\Driver; use ModStart\Core\Assets\AssetsPath; use Illuminate\Support\Facades\Cache; class CdnAssetsPath implements AssetsPath { const CACHE_PREFIX = 'modstart:asset-file:'; public function getPathWithHash($yHf3t) { goto ZWXM2; TEkui: if (file_exists($yHf3t)) { goto SXvhC; EXaBY: Cache::put($AeeYP, $a3qUm, 0); goto cJWlp; SXvhC: $a3qUm = '' . crc32(md5_file($yHf3t)); goto EXaBY; cJWlp: return $yHf3t . '?' . $a3qUm; goto PnaeI; PnaeI: } goto E1JfO; k2W9y: if (null !== $a3qUm) { return $yHf3t . '?' . $a3qUm; } goto TEkui; dZV4N: return $yHf3t; goto w__St; ZWXM2: $a3qUm = Cache::get($AeeYP = self::CACHE_PREFIX . $yHf3t, null); goto k2W9y; E1JfO: Cache::put($AeeYP, '', 0); goto dZV4N; w__St: } public function getCDN($yHf3t) { goto lLTTO; lLTTO: $MI_Uu = config('modstart.asset.cdn_array', array('/')); goto D5Lo1; D5Lo1: $j6H3J = abs(crc32($yHf3t) % count($MI_Uu)); goto E_YvZ; E_YvZ: return $MI_Uu[$j6H3J]; goto RegbI; RegbI: } }